query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
sequence
label_sequence
sequence
Unused import
rcbops/glance-buildpackage/glance/tests/unit/test_db.py
[ { "content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2010-2011 OpenStack, LLC\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport datetime\n\nfrom glance.common import context\nfrom glance.common import exception\nfrom glance.common import utils\nfrom glance.registry import context as rcontext\nfrom glance.registry.db import api as db_api\nfrom glance.registry.db import models as db_models\nfrom glance.tests.unit import base\nfrom glance.tests import utils as test_utils\n\n\n_gen_uuid = utils.generate_uuid\n\nUUID1 = _gen_uuid()\nUUID2 = _gen_uuid()\n\n\nCONF = {'sql_connection': 'sqlite://',\n 'verbose': False,\n 'debug': False}\n\nFIXTURES = [\n {'id': UUID1,\n 'name': 'fake image #1',\n 'status': 'active',\n 'disk_format': 'ami',\n 'container_format': 'ami',\n 'is_public': False,\n 'created_at': datetime.datetime.utcnow(),\n 'updated_at': datetime.datetime.utcnow(),\n 'deleted_at': None,\n 'deleted': False,\n 'checksum': None,\n 'min_disk': 0,\n 'min_ram': 0,\n 'size': 13,\n 'location': \"swift://user:passwd@acct/container/obj.tar.0\",\n 'properties': {'type': 'kernel'}},\n {'id': UUID2,\n 'name': 'fake image #2',\n 'status': 'active',\n 'disk_format': 'vhd',\n 'container_format': 'ovf',\n 'is_public': True,\n 'created_at': datetime.datetime.utcnow(),\n 'updated_at': datetime.datetime.utcnow(),\n 'deleted_at': None,\n 'deleted': False,\n 'checksum': None,\n 'min_disk': 5,\n 'min_ram': 256,\n 'size': 19,\n 'location': \"file:///tmp/glance-tests/2\",\n 'properties': {}}]\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestRegistryDb(base.IsolatedUnitTest):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestRegistryDb", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def setUp(self):\n \"\"\"Establish a clean test environment\"\"\"\n super(TestRegistryDb, self).setUp()\n conf = test_utils.TestConfigOpts(CONF)\n self.adm_context = rcontext.RequestContext(is_admin=True)\n self.context = rcontext.RequestContext(is_admin=False)\n db_api.configure_db(conf)\n self.destroy_fixtures()\n self.create_fixtures()", "metadata": "root.TestRegistryDb.setUp", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 76 }, { "content": " def create_fixtures(self):\n for fixture in FIXTURES:\n db_api.image_create(self.adm_context, fixture)", "metadata": "root.TestRegistryDb.create_fixtures", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 86 }, { "content": " def destroy_fixtures(self):\n # Easiest to just drop the models and re-create them...\n db_models.unregister_models(db_api._ENGINE)\n db_models.register_models(db_api._ENGINE)", "metadata": "root.TestRegistryDb.destroy_fixtures", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_image_get(self):\n image = db_api.image_get(self.context, UUID1)\n self.assertEquals(image['id'], FIXTURES[0]['id'])", "metadata": "root.TestRegistryDb.test_image_get", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_image_get_disallow_deleted(self):\n db_api.image_destroy(self.adm_context, UUID1)\n self.assertRaises(exception.NotFound, db_api.image_get,\n self.context, UUID1)", "metadata": "root.TestRegistryDb.test_image_get_disallow_deleted", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 99 }, { "content": " def test_image_get_allow_deleted(self):\n db_api.image_destroy(self.adm_context, UUID1)\n image = db_api.image_get(self.adm_context, UUID1)\n self.assertEquals(image['id'], FIXTURES[0]['id'])", "metadata": "root.TestRegistryDb.test_image_get_allow_deleted", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 104 }, { "content": " def test_image_get_force_allow_deleted(self):\n db_api.image_destroy(self.adm_context, UUID1)\n image = db_api.image_get(self.context, UUID1, force_show_deleted=True)\n self.assertEquals(image['id'], FIXTURES[0]['id'])", "metadata": "root.TestRegistryDb.test_image_get_force_allow_deleted", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 109 }, { "content": " def test_image_get_all(self):\n images = db_api.image_get_all(self.context)\n self.assertEquals(len(images), 2)", "metadata": "root.TestRegistryDb.test_image_get_all", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 114 }, { "content": " def test_image_get_all_marker(self):\n images = db_api.image_get_all(self.context, marker=UUID2)\n self.assertEquals(len(images), 1)", "metadata": "root.TestRegistryDb.test_image_get_all_marker", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 118 }, { "content": " def test_image_get_all_marker_deleted(self):\n \"\"\"Cannot specify a deleted image as a marker.\"\"\"\n db_api.image_destroy(self.adm_context, UUID1)\n filters = {'deleted': False}\n self.assertRaises(exception.NotFound, db_api.image_get_all,\n self.context, marker=UUID1, filters=filters)", "metadata": "root.TestRegistryDb.test_image_get_all_marker_deleted", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 122 }, { "content": " def test_image_get_all_marker_deleted_showing_deleted_as_admin(self):\n \"\"\"Specify a deleted image as a marker if showing deleted images.\"\"\"\n db_api.image_destroy(self.adm_context, UUID1)\n images = db_api.image_get_all(self.adm_context, marker=UUID1)\n self.assertEquals(len(images), 0)", "metadata": "root.TestRegistryDb.test_image_get_all_marker_deleted_showing_deleted_as_admin", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 129 }, { "content": " def test_image_get_all_marker_deleted_showing_deleted(self):\n \"\"\"Specify a deleted image as a marker if showing deleted images.\"\"\"\n db_api.image_destroy(self.adm_context, UUID1)\n filters = {'deleted': True}\n images = db_api.image_get_all(self.context, marker=UUID1,\n filters=filters)\n self.assertEquals(len(images), 0)", "metadata": "root.TestRegistryDb.test_image_get_all_marker_deleted_showing_deleted", "header": "['class', 'TestRegistryDb', '(', 'base', '.', 'IsolatedUnitTest', ')', ':', '___EOS___']", "index": 135 } ]
[ { "span": "from glance.common import context", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", "-", "2011", " ", "Open", "Stack", ",", " ", "LLC", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "glance_", "._", "common_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glance_", "._", "common_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glance_", "._", "common_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glance_", "._", "registry_", "import_", "context_", "as_", "rcon", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glance_", "._", "registry_", "._", "db_", "import_", "api_", "as_", "db", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glance_", "._", "registry_", "._", "db_", "import_", "models_", "as_", "db", "\\u", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glance_", "._", "tests_", "._", "unit_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glance_", "._", "tests_", "import_", "utils_", "as_", "test\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "gen", "\\u", "uuid_", "=_", "utils_", "._", "generat", "e\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UU", "ID", "1_", "=_", "\\u", "gen", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UU", "ID", "2_", "=_", "\\u", "gen", "\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "=_", "{_", "'", "sql", "\\u", "connecti", "on", "'_", ":_", "'", "sql", "ite", "://'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verbo", "se", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "debug", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FIXTURE", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "id", "'_", ":_", "UU", "ID", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "fake", " ", "image", " ", "#", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "active", "'_", ",_", "\\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_", "'", "is", "\\u", "public", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "checks", "um", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "disk", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "ram", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "13_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\"", "swift", "://", "user", ":", "passw", "d", "@", "acct", "/", "container", "/", "obj", ".", "tar", ".0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "kernel", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "id", "'_", ":_", "UU", "ID", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "fake", " ", "image", " ", "#", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "active", "'_", ",_", "\\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_", "'", "is", "\\u", "public", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "checks", "um", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "disk", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "ram", "'_", ":_", "256_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "19_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\"", "file", ":///", "tmp", "/", "gla", "nce", "-", "tests", "/", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "{_", "}_", "}_", "]_", "\\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_", "Test", "Regi", "stry", "Db_", "(_", "base_", "._", "Isolat", "ed", "Unit", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Regi", "stry", "Db_", "(_", "base_", "._", "Isolat", "ed", "Unit", "Test_", ")_", ":_", "\\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 ", " _", "\"\"\"", "Esta", "blis", "h", " ", "a", " ", "clean", " ", "test", " ", "environ", "ment", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Regi", "stry", "Db_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "test\\u", "utils_", "._", "Test", "Config", "Opts_", "(_", "CONF_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "adm", "\\u", "context_", "=_", "rcon", "text_", "._", "Request", "Context_", "(_", "is", "\\u", "admin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "=_", "rcon", "text_", "._", "Request", "Context_", "(_", "is", "\\u", "admin_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "api_", "._", "configur", "e\\u", "db_", "(_", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "destroy", "\\u", "fixtures_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "fixtures_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "base_", "._", "Isolat", "ed", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "fixtures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fixture_", "in_", "FIXTURE", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "api_", "._", "image", "\\u", "create_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "fixture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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_", "destroy", "\\u", "fixtures_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Eas", "ies", "t", " ", "to", " ", "just", " ", "drop", " ", "the", " ", "model", "s", " ", "and", " ", "re", "-", "create", " ", "them", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "models_", "._", "unregister", "\\u", "models_", "(_", "db", "\\u", "api_", "._", "\\u", "ENGINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "models_", "._", "register", "\\u", "models_", "(_", "db", "\\u", "api_", "._", "\\u", "ENGINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "db", "\\u", "api_", "._", "image", "\\u", "get_", "(_", "self_", "._", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "image_", "[_", "'", "id", "'_", "]_", ",_", "FIXTURE", "S_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "disallow", "\\u", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "api_", "._", "image", "\\u", "destroy_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Not", "Found_", ",_", "db", "\\u", "api_", "._", "image", "\\u", "get_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "allow", "\\u", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "api_", "._", "image", "\\u", "destroy_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "db", "\\u", "api_", "._", "image", "\\u", "get_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "image_", "[_", "'", "id", "'_", "]_", ",_", "FIXTURE", "S_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "force", "\\u", "allow", "\\u", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "api_", "._", "image", "\\u", "destroy_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "db", "\\u", "api_", "._", "image", "\\u", "get_", "(_", "self_", "._", "context_", ",_", "UU", "ID", "1_", ",_", "force", "\\u", "show", "\\u", "deleted_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "image_", "[_", "'", "id", "'_", "]_", ",_", "FIXTURE", "S_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "images_", "=_", "db", "\\u", "api_", "._", "image", "\\u", "get", "\\u", "all_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "all", "\\u", "marker_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "images_", "=_", "db", "\\u", "api_", "._", "image", "\\u", "get", "\\u", "all_", "(_", "self_", "._", "context_", ",_", "marker_", "=_", "UU", "ID", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "all", "\\u", "marker", "\\u", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Cann", "ot", " ", "speci", "fy", " ", "a", " ", "delete", "d", " ", "image", " ", "as", " ", "a", " ", "marker", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "api_", "._", "image", "\\u", "destroy_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "{_", "'", "delete", "d", "'_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Not", "Found_", ",_", "db", "\\u", "api_", "._", "image", "\\u", "get", "\\u", "all_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", ",_", "marker_", "=_", "UU", "ID", "1_", ",_", "filters_", "=_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "all", "\\u", "marker", "\\u", "delete", "d\\u", "showin", "g", "\\u", "delete", "d\\u", "as", "\\u", "admin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Speci", "fy", " ", "a", " ", "delete", "d", " ", "image", " ", "as", " ", "a", " ", "marker", " ", "if", " ", "showin", "g", " ", "delete", "d", " ", "images", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "api_", "._", "image", "\\u", "destroy_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "db", "\\u", "api_", "._", "image", "\\u", "get", "\\u", "all_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "marker_", "=_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regi", "stry", "Db_", "(_", "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", "image", "\\u", "get", "\\u", "all", "\\u", "marker", "\\u", "delete", "d\\u", "showin", "g", "\\u", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Speci", "fy", " ", "a", " ", "delete", "d", " ", "image", " ", "as", " ", "a", " ", "marker", " ", "if", " ", "showin", "g", " ", "delete", "d", " ", "images", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "api_", "._", "image", "\\u", "destroy_", "(_", "self_", "._", "adm", "\\u", "context_", ",_", "UU", "ID", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "{_", "'", "delete", "d", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "db", "\\u", "api_", "._", "image", "\\u", "get", "\\u", "all_", "(_", "self_", "._", "context_", ",_", "marker_", "=_", "UU", "ID", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "images_", ")_", ",_", "0_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
n9code/pylease/tests/test_ctxmgmt.py
[ { "content": " def test_caution_context_manager_must_rollback_everything_if_error_occurs(self):\n rb1 = MagicMock()\n rb2 = MagicMock()\n rb3 = MagicMock()\n\n with Caution() as caution:\n caution.add_rollback(rb1)\n caution.add_rollback(rb2)\n\n raise Exception()\n\n rb1.assert_called_once_with()\n rb2.assert_called_once_with()\n ok_(not rb3.called)", "metadata": "root.ContextManagersTest.test_caution_context_manager_must_rollback_everything_if_error_occurs", "header": "['class', 'ContextManagersTest', '(', 'PyleaseTest', ')', ':', '___EOS___']", "index": 30 } ]
[ { "span": "rb3 ", "start_line": 33, "start_column": 8, "end_line": 33, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Context", "Manager", "s", "Test_", "(_", "Py", "lease", "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", "cau", "tion", "\\u", "context", "\\u", "manage", "r", "\\u", "must", "\\u", "rollback", "\\u", "every", "thing", "\\u", "if", "\\u", "error", "\\u", "occur", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rb", "1_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rb", "2_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rb", "3_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "Cau", "tion_", "(_", ")_", "as_", "cau", "tion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cau", "tion_", "._", "add", "\\u", "rollback_", "(_", "rb", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cau", "tion_", "._", "add", "\\u", "rollback_", "(_", "rb", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rb", "1_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rb", "2_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "not_", "rb", "3_", "._", "called_", ")_", "\\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, 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 ]
First parameter of a method is not named 'self'
edgewall/trac/trac/wiki/api.py
[ { "content": " def wiki_page_added(page):\n \"\"\"Called whenever a new Wiki page is added.\"\"\"", "metadata": "root.IWikiChangeListener.wiki_page_added", "header": "['class', 'IWikiChangeListener', '(', 'Interface', ')', ':', '___EOS___']", "index": 37 }, { "content": " def wiki_page_changed(page, version, t, comment, author, ipnr):\n \"\"\"Called when a page has been modified.\n\n :since 1.0.3: `ipnr` is optional and deprecated, and will\n be removed in 1.3.1\n \"\"\"", "metadata": "root.IWikiChangeListener.wiki_page_changed", "header": "['class', 'IWikiChangeListener', '(', 'Interface', ')', ':', '___EOS___']", "index": 40 }, { "content": " def wiki_page_deleted(page):\n \"\"\"Called when a page has been deleted.\"\"\"", "metadata": "root.IWikiChangeListener.wiki_page_deleted", "header": "['class', 'IWikiChangeListener', '(', 'Interface', ')', ':', '___EOS___']", "index": 47 }, { "content": " def wiki_page_version_deleted(page):\n \"\"\"Called when a version of a page has been deleted.\"\"\"", "metadata": "root.IWikiChangeListener.wiki_page_version_deleted", "header": "['class', 'IWikiChangeListener', '(', 'Interface', ')', ':', '___EOS___']", "index": 50 }, { "content": " def wiki_page_renamed(page, old_name):\n \"\"\"Called when a page has been renamed.\"\"\"", "metadata": "root.IWikiChangeListener.wiki_page_renamed", "header": "['class', 'IWikiChangeListener', '(', 'Interface', ')', ':', '___EOS___']", "index": 53 }, { "content": " def wiki_page_comment_modified(page, old_comment):\n \"\"\"Called when a page comment has been modified.\"\"\"", "metadata": "root.IWikiChangeListener.wiki_page_comment_modified", "header": "['class', 'IWikiChangeListener', '(', 'Interface', ')', ':', '___EOS___']", "index": 56 }, { "content": " def prepare_wiki_page(req, page, fields):\n \"\"\"Validate a wiki page before rendering it.\n\n :param page: is the `WikiPage` being viewed.\n\n :param fields: is a dictionary which contains the wiki `text`\n of the page, initially identical to `page.text` but it can\n eventually be transformed in place before being used as\n input to the formatter.\n \"\"\"", "metadata": "root.IWikiPageManipulator.prepare_wiki_page", "header": "['class', 'IWikiPageManipulator', '(', 'Interface', ')', ':', '___EOS___']", "index": 68 }, { "content": " def validate_wiki_page(req, page):\n \"\"\"Validate a wiki page after it's been populated from user input.\n\n :param page: is the `WikiPage` being edited.\n\n :return: a list of `(field, message)` tuples, one for each\n problem detected. `field` can be `None` to indicate an\n overall problem with the page. Therefore, a return value of\n `[]` means everything is OK.\n \"\"\"", "metadata": "root.IWikiPageManipulator.validate_wiki_page", "header": "['class', 'IWikiPageManipulator', '(', 'Interface', ')', ':', '___EOS___']", "index": 79 }, { "content": " def get_macros():\n \"\"\"Return an iterable that provides the names of the provided macros.\n \"\"\"", "metadata": "root.IWikiMacroProvider.get_macros", "header": "['class', 'IWikiMacroProvider', '(', 'Interface', ')', ':', '___EOS___']", "index": 98 }, { "content": " def get_macro_description(name):\n \"\"\"Return a tuple of a domain name to translate and plain text\n description of the macro or only the description with the specified\n name.\n\n .. versionchanged :: 1.0\n `get_macro_description` can return a domain to translate the\n description.\n \"\"\"", "metadata": "root.IWikiMacroProvider.get_macro_description", "header": "['class', 'IWikiMacroProvider', '(', 'Interface', ')', ':', '___EOS___']", "index": 102 }, { "content": " def is_inline(content):\n \"\"\"Return `True` if the content generated is an inline XHTML element.\n\n .. versionadded :: 1.0\n \"\"\"", "metadata": "root.IWikiMacroProvider.is_inline", "header": "['class', 'IWikiMacroProvider', '(', 'Interface', ')', ':', '___EOS___']", "index": 112 }, { "content": " def expand_macro(formatter, name, content, args=None):\n \"\"\"Called by the formatter when rendering the parsed wiki text.\n\n .. versionadded:: 0.11\n\n .. versionchanged:: 0.12\n added the `args` parameter\n\n :param formatter: the wiki `Formatter` currently processing\n the wiki markup\n\n :param name: is the name by which the macro has been called;\n remember that via `get_macros`, multiple names could be\n associated to this macros. Note that the macro names are\n case sensitive.\n\n :param content: is the content of the macro call. When called\n using macro syntax (`[[Macro(content)]]`), this is the\n string contained between parentheses, usually containing\n macro arguments. When called using wiki processor syntax\n (`{{{!#Macro ...}}}`), it is the content of the processor\n block, that is, the text starting on the line following the\n macro name.\n\n :param args: will be a dictionary containing the named\n parameters passed when using the Wiki processor syntax.\n\n The named parameters can be specified when calling the macro\n using the wiki processor syntax::\n\n {{{#!Macro arg1=value1 arg2=\"value 2\"`\n ... some content ...\n }}}\n\n In this example, `args` will be\n `{'arg1': 'value1', 'arg2': 'value 2'}`\n and `content` will be `\"... some content ...\"`.\n\n If no named parameters are given like in::\n\n {{{#!Macro\n ...\n }}}\n\n then `args` will be `{}`. That makes it possible to\n differentiate the above situation from a call\n made using the macro syntax::\n\n [[Macro(arg1=value1, arg2=\"value 2\", ... some content...)]]\n\n in which case `args` will always be `None`. Here `content`\n will be the\n `\"arg1=value1, arg2=\"value 2\", ... some content...\"` string.\n If like in this example, `content` is expected to contain\n some arguments and named parameters, one can use the\n `parse_args` function to conveniently extract them.\n \"\"\"", "metadata": "root.IWikiMacroProvider.expand_macro", "header": "['class', 'IWikiMacroProvider', '(', 'Interface', ')', ':', '___EOS___']", "index": 118 }, { "content": " def get_wiki_syntax():\n \"\"\"Return an iterable that provides additional wiki syntax.\n\n Additional wiki syntax correspond to a pair of `(regexp, cb)`,\n the `regexp` for the additional syntax and the callback `cb`\n which will be called if there's a match. That function is of\n the form `cb(formatter, ns, match)`.\n \"\"\"", "metadata": "root.IWikiSyntaxProvider.get_wiki_syntax", "header": "['class', 'IWikiSyntaxProvider', '(', 'Interface', ')', ':', '___EOS___']", "index": 180 }, { "content": " def get_link_resolvers():\n \"\"\"Return an iterable over `(namespace, formatter)` tuples.\n\n Each formatter should be a function of the form::\n\n def format(formatter, ns, target, label, fullmatch=None):\n pass\n\n and should return some HTML fragment. The `label` is already\n HTML escaped, whereas the `target` is not. The `fullmatch`\n argument is optional, and is bound to the regexp match object\n for the link.\n \"\"\"", "metadata": "root.IWikiSyntaxProvider.get_link_resolvers", "header": "['class', 'IWikiSyntaxProvider', '(', 'Interface', ')', ':', '___EOS___']", "index": 189 } ]
[ { "span": "def wiki_page_added(page):", "start_line": 37, "start_column": 4, "end_line": 37, "end_column": 30 }, { "span": "def wiki_page_changed(page, version, t, comment, author, ipnr):", "start_line": 40, "start_column": 4, "end_line": 40, "end_column": 67 }, { "span": "def wiki_page_deleted(page):", "start_line": 47, "start_column": 4, "end_line": 47, "end_column": 32 }, { "span": "def wiki_page_version_deleted(page):", "start_line": 50, "start_column": 4, "end_line": 50, "end_column": 40 }, { "span": "def wiki_page_renamed(page, old_name):", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 42 }, { "span": "def wiki_page_comment_modified(page, old_comment):", "start_line": 56, "start_column": 4, "end_line": 56, "end_column": 54 }, { "span": "def prepare_wiki_page(req, page, fields):", "start_line": 68, "start_column": 4, "end_line": 68, "end_column": 45 }, { "span": "def validate_wiki_page(req, page):", "start_line": 79, "start_column": 4, "end_line": 79, "end_column": 38 }, { "span": "def get_macros():", "start_line": 98, "start_column": 4, "end_line": 98, "end_column": 21 }, { "span": "def get_macro_description(name):", "start_line": 102, "start_column": 4, "end_line": 102, "end_column": 36 }, { "span": "def is_inline(content):", "start_line": 112, "start_column": 4, "end_line": 112, "end_column": 27 }, { "span": "def expand_macro(formatter, name, content, args=None):", "start_line": 118, "start_column": 4, "end_line": 118, "end_column": 58 }, { "span": "def get_wiki_syntax():", "start_line": 180, "start_column": 4, "end_line": 180, "end_column": 26 }, { "span": "def get_link_resolvers():", "start_line": 189, "start_column": 4, "end_line": 189, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "IW", "iki", "Change", "Listener_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "wiki", "\\u", "page", "\\u", "added_", "(_", "page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "neve", "r", " ", "a", " ", "new", " ", "Wiki", " ", "page", " ", "is", " ", "adde", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Change", "Listener_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wiki", "\\u", "page", "\\u", "changed_", "(_", "page_", ",_", "version_", ",_", "t_", ",_", "comment_", ",_", "author_", ",_", "ip", "nr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "a", " ", "page", " ", "has", " ", "bee", "n", " ", "modifi", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "sinc", "e", " ", "1.0", ".3", ":", " ", "`", "ip", "nr", "`", " ", "is", " ", "option", "al", " ", "and", " ", "depre", "cated", ",", " ", "and", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "remove", "d", " ", "in", " ", "1.3", ".1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Change", "Listener_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wiki", "\\u", "page", "\\u", "deleted_", "(_", "page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "a", " ", "page", " ", "has", " ", "bee", "n", " ", "delete", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Change", "Listener_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wiki", "\\u", "page", "\\u", "version", "\\u", "deleted_", "(_", "page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "a", " ", "version", " ", "of", " ", "a", " ", "page", " ", "has", " ", "bee", "n", " ", "delete", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Change", "Listener_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wiki", "\\u", "page", "\\u", "renamed", "_", "(_", "page_", ",_", "old", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "a", " ", "page", " ", "has", " ", "bee", "n", " ", "renamed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Change", "Listener_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wiki", "\\u", "page", "\\u", "comment", "\\u", "modified_", "(_", "page_", ",_", "old", "\\u", "comment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "a", " ", "page", " ", "comment", " ", "has", " ", "bee", "n", " ", "modifi", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Page", "Manipulat", "or_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "wiki", "\\u", "page_", "(_", "req_", ",_", "page_", ",_", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", " ", "a", " ", "wiki", " ", "page", " ", "bef", "ore", " ", "render", "ing", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "page", ":", " ", "is", " ", "the", " ", "`", "Wiki", "Page", "`", " ", "bei", "ng", " ", "viewed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "fields", ":", " ", "is", " ", "a", " ", "dictionar", "y", " ", "whi", "ch", " ", "contain", "s", " ", "the", " ", "wiki", " ", "`", "text", "`", "\\", "10", ";", " ", " ", "of", " ", "the", " ", "page", ",", " ", "initially", " ", "identi", "cal", " ", "to", " ", "`", "page", ".", "text", "`", " ", "but", " ", "it", " ", "can", "\\", "10", ";", " ", " ", "eventual", "ly", " ", "be", " ", "transforme", "d", " ", "in", " ", "place", " ", "bef", "ore", " ", "bei", "ng", " ", "used", " ", "as", "\\", "10", ";", " ", " ", "input", " ", "to", " ", "the", " ", "formatter", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Page", "Manipulat", "or_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "wiki", "\\u", "page_", "(_", "req_", ",_", "page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", " ", "a", " ", "wiki", " ", "page", " ", "after", " ", "it", "'", "s", " ", "bee", "n", " ", "populate", "d", " ", "from", " ", "user", " ", "input", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "page", ":", " ", "is", " ", "the", " ", "`", "Wiki", "Page", "`", " ", "bei", "ng", " ", "edited", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "a", " ", "list", " ", "of", " ", "`", "(", "field", ",", " ", "message", ")`", " ", "tuple", "s", ",", " ", "one", " ", "for", " ", "each", "\\", "10", ";", " ", " ", "problem", " ", "detect", "ed", ".", " ", "`", "field", "`", " ", "can", " ", "be", " ", "`", "Non", "e", "`", " ", "to", " ", "indicat", "e", " ", "an", "\\", "10", ";", " ", " ", "over", "all", " ", "problem", " ", "with", " ", "the", " ", "page", ".", " ", "There", "fore", ",", " ", "a", " ", "return", " ", "value", " ", "of", "\\", "10", ";", " ", " ", "`", "[]", "`", " ", "means", " ", "every", "thing", " ", "is", " ", "OK", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Macro", "Provider_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "macros_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "an", " ", "iterable", " ", "tha", "t", " ", "provide", "s", " ", "the", " ", "names", " ", "of", " ", "the", " ", "provided", " ", "macro", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Macro", "Provider_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "macro", "\\u", "description_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "tuple", " ", "of", " ", "a", " ", "domain", " ", "name", " ", "to", " ", "translat", "e", " ", "and", " ", "plain", " ", "text", "\\", "10", ";", " ", " ", " ", " ", "description", " ", "of", " ", "the", " ", "macro", " ", "or", " ", "only", " ", "the", " ", "description", " ", "with", " ", "the", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "change", "d", " ", "::", " ", "1.0", "\\", "10", ";", " ", " ", " ", "`", "get", "\\u", "macro", "\\u", "description", "`", " ", "can", " ", "return", " ", "a", " ", "domain", " ", "to", " ", "translat", "e", " ", "the", "\\", "10", ";", " ", " ", " ", "description", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Macro", "Provider_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "inline_", "(_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "`", "Tru", "e", "`", " ", "if", " ", "the", " ", "content", " ", "generat", "ed", " ", "is", " ", "an", " ", "inline", " ", "XH", "TML", " ", "element", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", " ", "::", " ", "1.0", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Macro", "Provider_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expand", "\\u", "macro_", "(_", "formatter_", ",_", "name_", ",_", "content_", ",_", "args_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "by", " ", "the", " ", "formatter", " ", "whe", "n", " ", "render", "ing", " ", "the", " ", "parsed", " ", "wiki", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "0.11", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "change", "d", "::", " ", "0.12", "\\", "10", ";", " ", " ", " ", "adde", "d", " ", "the", " ", "`", "args", "`", " ", "parameter", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "formatter", ":", " ", "the", " ", "wiki", " ", "`", "Formatt", "er", "`", " ", "currentl", "y", " ", "process", "ing", "\\", "10", ";", " ", " ", "the", " ", "wiki", " ", "markup", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "name", ":", " ", "is", " ", "the", " ", "name", " ", "by", " ", "whi", "ch", " ", "the", " ", "macro", " ", "has", " ", "bee", "n", " ", "call", "ed", ";", "\\", "10", ";", " ", " ", "remember", " ", "tha", "t", " ", "via", " ", "`", "get", "\\u", "macro", "s", "`", ",", " ", "multiple", " ", "names", " ", "coul", "d", " ", "be", "\\", "10", ";", " ", " ", "associate", "d", " ", "to", " ", "this", " ", "macro", "s", ".", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "macro", " ", "names", " ", "are", "\\", "10", ";", " ", " ", "case", " ", "sensi", "tiv", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "content", ":", " ", "is", " ", "the", " ", "content", " ", "of", " ", "the", " ", "macro", " ", "call", ".", " ", "Whe", "n", " ", "call", "ed", "\\", "10", ";", " ", " ", "usi", "ng", " ", "macro", " ", "synta", "x", " ", "(", "`", "[[", "Macro", "(", "content", ")]", "]`", "),", " ", "this", " ", "is", " ", "the", "\\", "10", ";", " ", " ", "string", " ", "contain", "ed", " ", "bet", "ween", " ", "parenthes", "es", ",", " ", "usual", "ly", " ", "contain", "ing", "\\", "10", ";", " ", " ", "macro", " ", "argu", "ment", "s", ".", " ", "Whe", "n", " ", "call", "ed", " ", "usi", "ng", " ", "wiki", " ", "process", "or", " ", "synta", "x", "\\", "10", ";", " ", " ", "(", "`", "{{", "{", "!#", "Macro", " ", "...", "}}}", "`)", ",", " ", "it", " ", "is", " ", "the", " ", "content", " ", "of", " ", "the", " ", "process", "or", "\\", "10", ";", " ", " ", "block", ",", " ", "tha", "t", " ", "is", ",", " ", "the", " ", "text", " ", "startin", "g", " ", "on", " ", "the", " ", "line", " ", "follow", "ing", " ", "the", "\\", "10", ";", " ", " ", "macro", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "will", " ", "be", " ", "a", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "named", "\\", "10", ";", " ", " ", "parameter", "s", " ", "pass", "ed", " ", "whe", "n", " ", "usi", "ng", " ", "the", " ", "Wiki", " ", "process", "or", " ", "synta", "x", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "named", " ", "parameter", "s", " ", "can", " ", "be", " ", "specified", " ", "whe", "n", " ", "calling", " ", "the", " ", "macro", "\\", "10", ";", " ", " ", "usi", "ng", " ", "the", " ", "wiki", " ", "process", "or", " ", "synta", "x", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{{", "{", "#!", "Macro", " ", "arg", "1", "=", "value", "1", " ", "arg", "2", "=\"", "value", " ", "2", "\"`", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "some", " ", "content", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "}}}", "\\", "10", ";", "\\", "10", ";", " ", " ", "In", " ", "this", " ", "example", ",", " ", "`", "args", "`", " ", "will", " ", "be", "\\", "10", ";", " ", " ", "`", "{", "'", "arg", "1", "':", " ", "'", "value", "1", "',", " ", "'", "arg", "2", "':", " ", "'", "value", " ", "2", "'}", "`", "\\", "10", ";", " ", " ", "and", " ", "`", "content", "`", " ", "will", " ", "be", " ", "`", "\"...", " ", "some", " ", "content", " ", "...\"", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "no", " ", "named", " ", "parameter", "s", " ", "are", " ", "give", "n", " ", "like", " ", "in", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "{{", "{", "#!", "Macro", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "}}}", "\\", "10", ";", "\\", "10", ";", " ", " ", "then", " ", "`", "args", "`", " ", "will", " ", "be", " ", "`{}`", ".", " ", "Tha", "t", " ", "make", "s", " ", "it", " ", "possib", "le", " ", "to", "\\", "10", ";", " ", " ", "different", "iate", " ", "the", " ", "above", " ", "situation", " ", "from", " ", "a", " ", "call", "\\", "10", ";", " ", " ", "made", " ", "usi", "ng", " ", "the", " ", "macro", " ", "synta", "x", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "[[", "Macro", "(", "arg", "1", "=", "value", "1", ",", " ", "arg", "2", "=\"", "value", " ", "2", "\",", " ", "...", " ", "some", " ", "content", "...)", "]]", "\\", "10", ";", "\\", "10", ";", " ", " ", "in", " ", "whi", "ch", " ", "case", " ", "`", "args", "`", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "`", "Non", "e", "`.", " ", " ", "Her", "e", " ", "`", "content", "`", "\\", "10", ";", " ", " ", "will", " ", "be", " ", "the", "\\", "10", ";", " ", " ", "`", "\"", "arg", "1", "=", "value", "1", ",", " ", "arg", "2", "=\"", "value", " ", "2", "\",", " ", "...", " ", "some", " ", "content", "...\"", "`", " ", "string", ".", "\\", "10", ";", " ", " ", "If", " ", "like", " ", "in", " ", "this", " ", "example", ",", " ", "`", "content", "`", " ", "is", " ", "expected", " ", "to", " ", "contain", "\\", "10", ";", " ", " ", "some", " ", "argu", "ment", "s", " ", "and", " ", "named", " ", "parameter", "s", ",", " ", "one", " ", "can", " ", "use", " ", "the", "\\", "10", ";", " ", " ", "`", "parse", "\\u", "args", "`", " ", "function", " ", "to", " ", "convenien", "tl", "y", " ", "extract", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Syntax", "Provider_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "wiki", "\\u", "syntax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "an", " ", "iterable", " ", "tha", "t", " ", "provide", "s", " ", "addition", "al", " ", "wiki", " ", "synta", "x", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Addition", "al", " ", "wiki", " ", "synta", "x", " ", "correspond", " ", "to", " ", "a", " ", "pair", " ", "of", " ", "`", "(", "regexp", ",", " ", "cb", ")`", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "`", "regexp", "`", " ", "for", " ", "the", " ", "addition", "al", " ", "synta", "x", " ", "and", " ", "the", " ", "callback", " ", "`", "cb", "`", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "will", " ", "be", " ", "call", "ed", " ", "if", " ", "there", "'", "s", " ", "a", " ", "match", ".", " ", " ", "Tha", "t", " ", "function", " ", "is", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "form", " ", "`", "cb", "(", "formatter", ",", " ", "ns", ",", " ", "match", ")`", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IW", "iki", "Syntax", "Provider_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "link", "\\u", "resolver", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "an", " ", "iterable", " ", "over", " ", "`", "(", "namespace", ",", " ", "formatter", ")`", " ", "tuple", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "formatter", " ", "shou", "ld", " ", "be", " ", "a", " ", "function", " ", "of", " ", "the", " ", "form", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "def", " ", "format", "(", "formatter", ",", " ", "ns", ",", " ", "target", ",", " ", "label", ",", " ", "full", "match", "=", "Non", "e", "):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "pass", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "shou", "ld", " ", "return", " ", "some", " ", "HTM", "L", " ", "fragment", ".", " ", "The", " ", "`", "label", "`", " ", "is", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "HTM", "L", " ", "escaped", ",", " ", "where", "as", " ", "the", " ", "`", "target", "`", " ", "is", " ", "not", ".", " ", "The", " ", "`", "full", "match", "`", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", " ", "is", " ", "option", "al", ",", " ", "and", " ", "is", " ", "bound", " ", "to", " ", "the", " ", "regexp", " ", "match", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "the", " ", "link", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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3\n 2 > 3\n 2 == 3\n 2 > 3\n 2 < 3", "metadata": "root.CompareIntegers.test", "header": "['class', 'CompareIntegers', '(', 'Test', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test(self):\n\n for i in xrange(self.rounds):\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31\n\n 2.1 < 3.31\n 2.1 > 3.31\n 2.1 == 3.31\n 2.1 > 3.31\n 2.1 < 3.31", "metadata": "root.CompareFloats.test", "header": "['class', 'CompareFloats', '(', 'Test', ')', ':', '___EOS___']", "index": 223 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1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4\n\n 2.1 < 4\n 2.1 > 4\n 2.1 == 4\n 2.1 > 4\n 2.1 < 4", "metadata": "root.CompareFloatsIntegers.test", "header": "['class', 'CompareFloatsIntegers', '(', 'Test', ')', ':', '___EOS___']", "index": 419 }, { "content": " def test(self):\n\n for i in xrange(self.rounds):\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L\n\n 1234567890L < 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L == 3456789012345L\n 1234567890L > 3456789012345L\n 1234567890L < 3456789012345L", "metadata": "root.CompareLongs.test", "header": "['class', 'CompareLongs', '(', 'Test', ')', ':', '___EOS___']", "index": 615 } ]
[ { "span": "2 < 3", "start_line": 31, "start_column": 12, "end_line": 31, "end_column": 17 }, { "span": "2 > 3", "start_line": 32, "start_column": 12, "end_line": 32, "end_column": 17 }, { "span": "2 == 3", "start_line": 33, "start_column": 12, "end_line": 33, "end_column": 18 }, { "span": "2 > 3", "start_line": 34, "start_column": 12, "end_line": 34, "end_column": 17 }, { "span": "2 < 3", "start_line": 35, "start_column": 12, "end_line": 35, "end_column": 17 }, { "span": "2 < 3", "start_line": 37, "start_column": 12, "end_line": 37, "end_column": 17 }, { "span": "2 > 3", "start_line": 38, "start_column": 12, "end_line": 38, "end_column": 17 }, { "span": "2 == 3", "start_line": 39, "start_column": 12, "end_line": 39, "end_column": 18 }, { "span": "2 > 3", "start_line": 40, "start_column": 12, "end_line": 40, "end_column": 17 }, { "span": "2 < 3", "start_line": 41, "start_column": 12, "end_line": 41, "end_column": 17 }, { "span": "2 < 3", "start_line": 43, "start_column": 12, "end_line": 43, "end_column": 17 }, { "span": "2 > 3", "start_line": 44, "start_column": 12, "end_line": 44, "end_column": 17 }, { "span": "2 == 3", "start_line": 45, "start_column": 12, "end_line": 45, "end_column": 18 }, { "span": "2 > 3", "start_line": 46, "start_column": 12, "end_line": 46, "end_column": 17 }, { "span": "2 < 3", "start_line": 47, "start_column": 12, "end_line": 47, "end_column": 17 }, { "span": "2 < 3", "start_line": 49, "start_column": 12, "end_line": 49, "end_column": 17 }, { "span": "2 > 3", "start_line": 50, "start_column": 12, "end_line": 50, "end_column": 17 }, { "span": "2 == 3", "start_line": 51, "start_column": 12, "end_line": 51, "end_column": 18 }, { "span": "2 > 3", "start_line": 52, "start_column": 12, "end_line": 52, "end_column": 17 }, { "span": "2 < 3", "start_line": 53, "start_column": 12, "end_line": 53, "end_column": 17 }, { "span": "2 < 3", "start_line": 55, "start_column": 12, "end_line": 55, "end_column": 17 }, { "span": "2 > 3", "start_line": 56, "start_column": 12, "end_line": 56, "end_column": 17 }, { "span": "2 == 3", "start_line": 57, "start_column": 12, "end_line": 57, "end_column": 18 }, { "span": "2 > 3", "start_line": 58, "start_column": 12, "end_line": 58, "end_column": 17 }, { "span": "2 < 3", "start_line": 59, "start_column": 12, "end_line": 59, "end_column": 17 }, { "span": "2 < 3", "start_line": 61, "start_column": 12, "end_line": 61, "end_column": 17 }, { "span": "2 > 3", "start_line": 62, "start_column": 12, "end_line": 62, "end_column": 17 }, { "span": "2 == 3", "start_line": 63, "start_column": 12, "end_line": 63, "end_column": 18 }, { "span": "2 > 3", "start_line": 64, "start_column": 12, "end_line": 64, "end_column": 17 }, { "span": "2 < 3", "start_line": 65, "start_column": 12, "end_line": 65, "end_column": 17 }, { "span": "2 < 3", "start_line": 67, "start_column": 12, "end_line": 67, "end_column": 17 }, { "span": "2 > 3", "start_line": 68, "start_column": 12, "end_line": 68, "end_column": 17 }, { "span": "2 == 3", "start_line": 69, "start_column": 12, "end_line": 69, "end_column": 18 }, { "span": "2 > 3", "start_line": 70, "start_column": 12, "end_line": 70, "end_column": 17 }, { "span": "2 < 3", "start_line": 71, "start_column": 12, "end_line": 71, "end_column": 17 }, { "span": "2 < 3", "start_line": 73, "start_column": 12, "end_line": 73, "end_column": 17 }, { "span": "2 > 3", "start_line": 74, "start_column": 12, "end_line": 74, "end_column": 17 }, { "span": "2 == 3", "start_line": 75, "start_column": 12, "end_line": 75, "end_column": 18 }, { "span": "2 > 3", "start_line": 76, "start_column": 12, "end_line": 76, "end_column": 17 }, { "span": "2 < 3", "start_line": 77, "start_column": 12, "end_line": 77, "end_column": 17 }, { "span": "2 < 3", "start_line": 79, "start_column": 12, "end_line": 79, "end_column": 17 }, { "span": "2 > 3", "start_line": 80, "start_column": 12, "end_line": 80, "end_column": 17 }, { "span": "2 == 3", "start_line": 81, "start_column": 12, "end_line": 81, "end_column": 18 }, { "span": "2 > 3", "start_line": 82, "start_column": 12, "end_line": 82, "end_column": 17 }, { "span": "2 < 3", "start_line": 83, "start_column": 12, "end_line": 83, "end_column": 17 }, { "span": "2 < 3", "start_line": 85, "start_column": 12, "end_line": 85, "end_column": 17 }, { "span": "2 > 3", "start_line": 86, "start_column": 12, "end_line": 86, "end_column": 17 }, { "span": "2 == 3", "start_line": 87, "start_column": 12, "end_line": 87, "end_column": 18 }, { "span": "2 > 3", "start_line": 88, "start_column": 12, "end_line": 88, "end_column": 17 }, { "span": "2 < 3", "start_line": 89, "start_column": 12, "end_line": 89, "end_column": 17 }, { "span": "2 < 3", "start_line": 91, "start_column": 12, "end_line": 91, "end_column": 17 }, { "span": "2 > 3", "start_line": 92, "start_column": 12, "end_line": 92, "end_column": 17 }, { "span": "2 == 3", "start_line": 93, "start_column": 12, "end_line": 93, "end_column": 18 }, { "span": "2 > 3", "start_line": 94, "start_column": 12, "end_line": 94, "end_column": 17 }, { "span": "2 < 3", "start_line": 95, "start_column": 12, "end_line": 95, "end_column": 17 }, { "span": "2 < 3", "start_line": 97, "start_column": 12, "end_line": 97, "end_column": 17 }, { "span": "2 > 3", "start_line": 98, "start_column": 12, "end_line": 98, "end_column": 17 }, { "span": "2 == 3", "start_line": 99, "start_column": 12, "end_line": 99, "end_column": 18 }, { "span": "2 > 3", "start_line": 100, "start_column": 12, "end_line": 100, "end_column": 17 }, { "span": "2 < 3", "start_line": 101, "start_column": 12, "end_line": 101, "end_column": 17 }, { "span": "2 < 3", "start_line": 103, "start_column": 12, "end_line": 103, "end_column": 17 }, { "span": "2 > 3", "start_line": 104, "start_column": 12, "end_line": 104, "end_column": 17 }, { "span": "2 == 3", "start_line": 105, "start_column": 12, "end_line": 105, "end_column": 18 }, { "span": "2 > 3", "start_line": 106, "start_column": 12, "end_line": 106, "end_column": 17 }, { "span": "2 < 3", "start_line": 107, "start_column": 12, "end_line": 107, "end_column": 17 }, { "span": "2 < 3", "start_line": 109, "start_column": 12, "end_line": 109, "end_column": 17 }, { "span": "2 > 3", "start_line": 110, "start_column": 12, "end_line": 110, "end_column": 17 }, { "span": "2 == 3", "start_line": 111, "start_column": 12, "end_line": 111, "end_column": 18 }, { "span": "2 > 3", "start_line": 112, "start_column": 12, "end_line": 112, "end_column": 17 }, { "span": "2 < 3", "start_line": 113, "start_column": 12, "end_line": 113, "end_column": 17 }, { "span": "2 < 3", "start_line": 115, "start_column": 12, "end_line": 115, "end_column": 17 }, { "span": "2 > 3", "start_line": 116, "start_column": 12, "end_line": 116, "end_column": 17 }, { "span": "2 == 3", "start_line": 117, "start_column": 12, "end_line": 117, "end_column": 18 }, { "span": "2 > 3", "start_line": 118, "start_column": 12, "end_line": 118, "end_column": 17 }, { "span": "2 < 3", "start_line": 119, "start_column": 12, "end_line": 119, "end_column": 17 }, { "span": "2 < 3", "start_line": 121, "start_column": 12, "end_line": 121, "end_column": 17 }, { "span": "2 > 3", "start_line": 122, "start_column": 12, "end_line": 122, "end_column": 17 }, { "span": "2 == 3", "start_line": 123, "start_column": 12, "end_line": 123, "end_column": 18 }, { "span": "2 > 3", "start_line": 124, "start_column": 12, "end_line": 124, "end_column": 17 }, { "span": "2 < 3", "start_line": 125, "start_column": 12, "end_line": 125, "end_column": 17 }, { "span": "2 < 3", "start_line": 127, "start_column": 12, "end_line": 127, "end_column": 17 }, { "span": "2 > 3", "start_line": 128, "start_column": 12, "end_line": 128, "end_column": 17 }, { "span": "2 == 3", "start_line": 129, "start_column": 12, "end_line": 129, "end_column": 18 }, { "span": "2 > 3", "start_line": 130, "start_column": 12, "end_line": 130, "end_column": 17 }, { "span": "2 < 3", "start_line": 131, "start_column": 12, "end_line": 131, "end_column": 17 }, { "span": "2 < 3", "start_line": 133, "start_column": 12, "end_line": 133, "end_column": 17 }, { "span": "2 > 3", "start_line": 134, "start_column": 12, "end_line": 134, "end_column": 17 }, { "span": "2 == 3", "start_line": 135, "start_column": 12, "end_line": 135, "end_column": 18 }, { "span": "2 > 3", "start_line": 136, "start_column": 12, "end_line": 136, "end_column": 17 }, { "span": "2 < 3", "start_line": 137, "start_column": 12, "end_line": 137, "end_column": 17 }, { "span": "2 < 3", "start_line": 139, "start_column": 12, "end_line": 139, "end_column": 17 }, { "span": "2 > 3", "start_line": 140, "start_column": 12, "end_line": 140, "end_column": 17 }, { "span": "2 == 3", "start_line": 141, "start_column": 12, "end_line": 141, "end_column": 18 }, { "span": "2 > 3", "start_line": 142, "start_column": 12, "end_line": 142, "end_column": 17 }, { "span": "2 < 3", "start_line": 143, "start_column": 12, "end_line": 143, "end_column": 17 }, { "span": "2 < 3", "start_line": 145, "start_column": 12, "end_line": 145, "end_column": 17 }, { "span": "2 > 3", "start_line": 146, "start_column": 12, "end_line": 146, "end_column": 17 }, { "span": "2 == 3", "start_line": 147, "start_column": 12, "end_line": 147, "end_column": 18 }, { "span": "2 > 3", "start_line": 148, "start_column": 12, "end_line": 148, "end_column": 17 }, { "span": "2 < 3", "start_line": 149, "start_column": 12, "end_line": 149, "end_column": 17 }, { "span": "2 < 3", "start_line": 151, "start_column": 12, "end_line": 151, "end_column": 17 }, { "span": "2 > 3", "start_line": 152, "start_column": 12, "end_line": 152, "end_column": 17 }, { "span": "2 == 3", "start_line": 153, "start_column": 12, "end_line": 153, "end_column": 18 }, { "span": "2 > 3", "start_line": 154, "start_column": 12, "end_line": 154, "end_column": 17 }, { "span": "2 < 3", "start_line": 155, "start_column": 12, "end_line": 155, "end_column": 17 }, { "span": "2 < 3", "start_line": 157, "start_column": 12, "end_line": 157, "end_column": 17 }, { "span": "2 > 3", "start_line": 158, "start_column": 12, "end_line": 158, "end_column": 17 }, { "span": "2 == 3", "start_line": 159, "start_column": 12, "end_line": 159, "end_column": 18 }, { "span": "2 > 3", "start_line": 160, "start_column": 12, "end_line": 160, "end_column": 17 }, { "span": "2 < 3", "start_line": 161, "start_column": 12, "end_line": 161, "end_column": 17 }, { "span": "2 < 3", "start_line": 163, "start_column": 12, "end_line": 163, "end_column": 17 }, { "span": "2 > 3", "start_line": 164, "start_column": 12, "end_line": 164, "end_column": 17 }, { "span": "2 == 3", "start_line": 165, "start_column": 12, "end_line": 165, "end_column": 18 }, { "span": "2 > 3", "start_line": 166, "start_column": 12, "end_line": 166, "end_column": 17 }, { "span": "2 < 3", "start_line": 167, "start_column": 12, "end_line": 167, "end_column": 17 }, { "span": "2 < 3", "start_line": 169, "start_column": 12, "end_line": 169, "end_column": 17 }, { "span": "2 > 3", "start_line": 170, "start_column": 12, "end_line": 170, "end_column": 17 }, { "span": "2 == 3", "start_line": 171, "start_column": 12, "end_line": 171, "end_column": 18 }, { "span": "2 > 3", "start_line": 172, "start_column": 12, "end_line": 172, "end_column": 17 }, { "span": "2 < 3", "start_line": 173, "start_column": 12, "end_line": 173, "end_column": 17 }, { "span": "2 < 3", "start_line": 175, "start_column": 12, "end_line": 175, "end_column": 17 }, { "span": "2 > 3", "start_line": 176, "start_column": 12, "end_line": 176, "end_column": 17 }, { "span": "2 == 3", "start_line": 177, "start_column": 12, "end_line": 177, "end_column": 18 }, { "span": "2 > 3", "start_line": 178, "start_column": 12, "end_line": 178, "end_column": 17 }, { "span": "2 < 3", "start_line": 179, "start_column": 12, "end_line": 179, "end_column": 17 }, { "span": "2 < 3", "start_line": 181, "start_column": 12, "end_line": 181, "end_column": 17 }, { "span": "2 > 3", "start_line": 182, "start_column": 12, "end_line": 182, "end_column": 17 }, { "span": "2 == 3", "start_line": 183, "start_column": 12, "end_line": 183, "end_column": 18 }, { "span": "2 > 3", "start_line": 184, "start_column": 12, "end_line": 184, "end_column": 17 }, { "span": "2 < 3", "start_line": 185, "start_column": 12, "end_line": 185, "end_column": 17 }, { "span": "2 < 3", "start_line": 187, "start_column": 12, "end_line": 187, "end_column": 17 }, { "span": "2 > 3", "start_line": 188, "start_column": 12, "end_line": 188, "end_column": 17 }, { "span": "2 == 3", "start_line": 189, "start_column": 12, "end_line": 189, "end_column": 18 }, { "span": "2 > 3", "start_line": 190, "start_column": 12, "end_line": 190, "end_column": 17 }, { "span": "2 < 3", "start_line": 191, "start_column": 12, "end_line": 191, "end_column": 17 }, { "span": "2 < 3", "start_line": 193, "start_column": 12, "end_line": 193, "end_column": 17 }, { "span": "2 > 3", "start_line": 194, "start_column": 12, "end_line": 194, "end_column": 17 }, { "span": "2 == 3", "start_line": 195, "start_column": 12, "end_line": 195, "end_column": 18 }, { "span": "2 > 3", "start_line": 196, "start_column": 12, "end_line": 196, "end_column": 17 }, { "span": "2 < 3", "start_line": 197, "start_column": 12, "end_line": 197, "end_column": 17 }, { "span": "2 < 3", "start_line": 199, "start_column": 12, "end_line": 199, "end_column": 17 }, { "span": "2 > 3", "start_line": 200, "start_column": 12, "end_line": 200, "end_column": 17 }, { "span": "2 == 3", "start_line": 201, "start_column": 12, "end_line": 201, "end_column": 18 }, { "span": "2 > 3", "start_line": 202, "start_column": 12, "end_line": 202, "end_column": 17 }, { "span": "2 < 3", "start_line": 203, "start_column": 12, "end_line": 203, "end_column": 17 }, { "span": "2 < 3", "start_line": 205, "start_column": 12, "end_line": 205, "end_column": 17 }, { "span": "2 > 3", "start_line": 206, "start_column": 12, "end_line": 206, "end_column": 17 }, { "span": "2 == 3", "start_line": 207, "start_column": 12, "end_line": 207, "end_column": 18 }, { "span": "2 > 3", "start_line": 208, "start_column": 12, "end_line": 208, "end_column": 17 }, { "span": "2 < 3", "start_line": 209, "start_column": 12, "end_line": 209, "end_column": 17 }, { "span": "2.1 < 3.31", "start_line": 227, "start_column": 12, "end_line": 227, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 228, "start_column": 12, "end_line": 228, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 229, "start_column": 12, "end_line": 229, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 230, "start_column": 12, "end_line": 230, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 231, "start_column": 12, "end_line": 231, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 233, "start_column": 12, "end_line": 233, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 234, "start_column": 12, "end_line": 234, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 235, "start_column": 12, "end_line": 235, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 236, "start_column": 12, "end_line": 236, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 237, "start_column": 12, "end_line": 237, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 239, "start_column": 12, "end_line": 239, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 240, "start_column": 12, "end_line": 240, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 241, "start_column": 12, "end_line": 241, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 242, "start_column": 12, "end_line": 242, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 243, "start_column": 12, "end_line": 243, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 245, "start_column": 12, "end_line": 245, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 246, "start_column": 12, "end_line": 246, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 247, "start_column": 12, "end_line": 247, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 248, "start_column": 12, "end_line": 248, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 249, "start_column": 12, "end_line": 249, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 251, "start_column": 12, "end_line": 251, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 252, "start_column": 12, "end_line": 252, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 253, "start_column": 12, "end_line": 253, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 254, "start_column": 12, "end_line": 254, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 255, "start_column": 12, "end_line": 255, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 257, "start_column": 12, "end_line": 257, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 258, "start_column": 12, "end_line": 258, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 259, "start_column": 12, "end_line": 259, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 260, "start_column": 12, "end_line": 260, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 261, "start_column": 12, "end_line": 261, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 263, "start_column": 12, "end_line": 263, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 264, "start_column": 12, "end_line": 264, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 265, "start_column": 12, "end_line": 265, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 266, "start_column": 12, "end_line": 266, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 267, "start_column": 12, "end_line": 267, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 269, "start_column": 12, "end_line": 269, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 270, "start_column": 12, "end_line": 270, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 271, "start_column": 12, "end_line": 271, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 272, "start_column": 12, "end_line": 272, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 273, "start_column": 12, "end_line": 273, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 275, "start_column": 12, "end_line": 275, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 276, "start_column": 12, "end_line": 276, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 277, "start_column": 12, "end_line": 277, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 278, "start_column": 12, "end_line": 278, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 279, "start_column": 12, "end_line": 279, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 281, "start_column": 12, "end_line": 281, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 282, "start_column": 12, "end_line": 282, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 283, "start_column": 12, "end_line": 283, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 284, "start_column": 12, "end_line": 284, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 285, "start_column": 12, "end_line": 285, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 287, "start_column": 12, "end_line": 287, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 288, "start_column": 12, "end_line": 288, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 289, "start_column": 12, "end_line": 289, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 290, "start_column": 12, "end_line": 290, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 291, "start_column": 12, "end_line": 291, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 293, "start_column": 12, "end_line": 293, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 294, "start_column": 12, "end_line": 294, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 295, "start_column": 12, "end_line": 295, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 296, "start_column": 12, "end_line": 296, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 297, "start_column": 12, "end_line": 297, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 299, "start_column": 12, "end_line": 299, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 300, "start_column": 12, "end_line": 300, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 301, "start_column": 12, "end_line": 301, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 302, "start_column": 12, "end_line": 302, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 303, "start_column": 12, "end_line": 303, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 305, "start_column": 12, "end_line": 305, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 306, "start_column": 12, "end_line": 306, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 307, "start_column": 12, "end_line": 307, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 308, "start_column": 12, "end_line": 308, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 309, "start_column": 12, "end_line": 309, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 311, "start_column": 12, "end_line": 311, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 312, "start_column": 12, "end_line": 312, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 313, "start_column": 12, "end_line": 313, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 314, "start_column": 12, "end_line": 314, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 315, "start_column": 12, "end_line": 315, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 317, "start_column": 12, "end_line": 317, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 318, "start_column": 12, "end_line": 318, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 319, "start_column": 12, "end_line": 319, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 320, "start_column": 12, "end_line": 320, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 321, "start_column": 12, "end_line": 321, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 323, "start_column": 12, "end_line": 323, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 324, "start_column": 12, "end_line": 324, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 325, "start_column": 12, "end_line": 325, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 326, "start_column": 12, "end_line": 326, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 327, "start_column": 12, "end_line": 327, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 329, "start_column": 12, "end_line": 329, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 330, "start_column": 12, "end_line": 330, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 331, "start_column": 12, "end_line": 331, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 332, "start_column": 12, "end_line": 332, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 333, "start_column": 12, "end_line": 333, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 335, "start_column": 12, "end_line": 335, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 336, "start_column": 12, "end_line": 336, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 337, "start_column": 12, "end_line": 337, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 338, "start_column": 12, "end_line": 338, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 339, "start_column": 12, "end_line": 339, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 341, "start_column": 12, "end_line": 341, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 342, "start_column": 12, "end_line": 342, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 343, "start_column": 12, "end_line": 343, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 344, "start_column": 12, "end_line": 344, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 345, "start_column": 12, "end_line": 345, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 347, "start_column": 12, "end_line": 347, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 348, "start_column": 12, "end_line": 348, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 349, "start_column": 12, "end_line": 349, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 350, "start_column": 12, "end_line": 350, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 351, "start_column": 12, "end_line": 351, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 353, "start_column": 12, "end_line": 353, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 354, "start_column": 12, "end_line": 354, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 355, "start_column": 12, "end_line": 355, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 356, "start_column": 12, "end_line": 356, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 357, "start_column": 12, "end_line": 357, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 359, "start_column": 12, "end_line": 359, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 360, "start_column": 12, "end_line": 360, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 361, "start_column": 12, "end_line": 361, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 362, "start_column": 12, "end_line": 362, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 363, "start_column": 12, "end_line": 363, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 365, "start_column": 12, "end_line": 365, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 366, "start_column": 12, "end_line": 366, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 367, "start_column": 12, "end_line": 367, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 368, "start_column": 12, "end_line": 368, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 369, "start_column": 12, "end_line": 369, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 371, "start_column": 12, "end_line": 371, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 372, "start_column": 12, "end_line": 372, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 373, "start_column": 12, "end_line": 373, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 374, "start_column": 12, "end_line": 374, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 375, "start_column": 12, "end_line": 375, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 377, "start_column": 12, "end_line": 377, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 378, "start_column": 12, "end_line": 378, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 379, "start_column": 12, "end_line": 379, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 380, "start_column": 12, "end_line": 380, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 381, "start_column": 12, "end_line": 381, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 383, "start_column": 12, "end_line": 383, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 384, "start_column": 12, "end_line": 384, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 385, "start_column": 12, "end_line": 385, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 386, "start_column": 12, "end_line": 386, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 387, "start_column": 12, "end_line": 387, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 389, "start_column": 12, "end_line": 389, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 390, "start_column": 12, "end_line": 390, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 391, "start_column": 12, "end_line": 391, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 392, "start_column": 12, "end_line": 392, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 393, "start_column": 12, "end_line": 393, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 395, "start_column": 12, "end_line": 395, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 396, "start_column": 12, "end_line": 396, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 397, "start_column": 12, "end_line": 397, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 398, "start_column": 12, "end_line": 398, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 399, "start_column": 12, "end_line": 399, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 401, "start_column": 12, "end_line": 401, "end_column": 22 }, { "span": "2.1 > 3.31", "start_line": 402, "start_column": 12, "end_line": 402, "end_column": 22 }, { "span": "2.1 == 3.31", "start_line": 403, "start_column": 12, "end_line": 403, "end_column": 23 }, { "span": "2.1 > 3.31", "start_line": 404, "start_column": 12, "end_line": 404, "end_column": 22 }, { "span": "2.1 < 3.31", "start_line": 405, "start_column": 12, "end_line": 405, "end_column": 22 }, { "span": "2.1 < 4", "start_line": 423, "start_column": 12, "end_line": 423, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 424, "start_column": 12, "end_line": 424, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 425, "start_column": 12, "end_line": 425, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 426, "start_column": 12, "end_line": 426, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 427, "start_column": 12, "end_line": 427, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 429, "start_column": 12, "end_line": 429, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 430, "start_column": 12, "end_line": 430, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 431, "start_column": 12, "end_line": 431, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 432, "start_column": 12, "end_line": 432, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 433, "start_column": 12, "end_line": 433, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 435, "start_column": 12, "end_line": 435, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 436, "start_column": 12, "end_line": 436, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 437, "start_column": 12, "end_line": 437, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 438, "start_column": 12, "end_line": 438, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 439, "start_column": 12, "end_line": 439, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 441, "start_column": 12, "end_line": 441, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 442, "start_column": 12, "end_line": 442, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 443, "start_column": 12, "end_line": 443, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 444, "start_column": 12, "end_line": 444, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 445, "start_column": 12, "end_line": 445, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 447, "start_column": 12, "end_line": 447, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 448, "start_column": 12, "end_line": 448, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 449, "start_column": 12, "end_line": 449, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 450, "start_column": 12, "end_line": 450, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 451, "start_column": 12, "end_line": 451, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 453, "start_column": 12, "end_line": 453, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 454, "start_column": 12, "end_line": 454, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 455, "start_column": 12, "end_line": 455, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 456, "start_column": 12, "end_line": 456, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 457, "start_column": 12, "end_line": 457, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 459, "start_column": 12, "end_line": 459, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 460, "start_column": 12, "end_line": 460, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 461, "start_column": 12, "end_line": 461, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 462, "start_column": 12, "end_line": 462, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 463, "start_column": 12, "end_line": 463, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 465, "start_column": 12, "end_line": 465, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 466, "start_column": 12, "end_line": 466, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 467, "start_column": 12, "end_line": 467, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 468, "start_column": 12, "end_line": 468, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 469, "start_column": 12, "end_line": 469, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 471, "start_column": 12, "end_line": 471, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 472, "start_column": 12, "end_line": 472, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 473, "start_column": 12, "end_line": 473, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 474, "start_column": 12, "end_line": 474, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 475, "start_column": 12, "end_line": 475, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 477, "start_column": 12, "end_line": 477, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 478, "start_column": 12, "end_line": 478, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 479, "start_column": 12, "end_line": 479, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 480, "start_column": 12, "end_line": 480, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 481, "start_column": 12, "end_line": 481, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 483, "start_column": 12, "end_line": 483, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 484, "start_column": 12, "end_line": 484, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 485, "start_column": 12, "end_line": 485, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 486, "start_column": 12, "end_line": 486, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 487, "start_column": 12, "end_line": 487, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 489, "start_column": 12, "end_line": 489, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 490, "start_column": 12, "end_line": 490, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 491, "start_column": 12, "end_line": 491, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 492, "start_column": 12, "end_line": 492, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 493, "start_column": 12, "end_line": 493, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 495, "start_column": 12, "end_line": 495, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 496, "start_column": 12, "end_line": 496, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 497, "start_column": 12, "end_line": 497, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 498, "start_column": 12, "end_line": 498, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 499, "start_column": 12, "end_line": 499, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 501, "start_column": 12, "end_line": 501, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 502, "start_column": 12, "end_line": 502, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 503, "start_column": 12, "end_line": 503, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 504, "start_column": 12, "end_line": 504, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 505, "start_column": 12, "end_line": 505, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 507, "start_column": 12, "end_line": 507, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 508, "start_column": 12, "end_line": 508, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 509, "start_column": 12, "end_line": 509, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 510, "start_column": 12, "end_line": 510, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 511, "start_column": 12, "end_line": 511, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 513, "start_column": 12, "end_line": 513, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 514, "start_column": 12, "end_line": 514, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 515, "start_column": 12, "end_line": 515, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 516, "start_column": 12, "end_line": 516, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 517, "start_column": 12, "end_line": 517, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 519, "start_column": 12, "end_line": 519, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 520, "start_column": 12, "end_line": 520, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 521, "start_column": 12, "end_line": 521, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 522, "start_column": 12, "end_line": 522, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 523, "start_column": 12, "end_line": 523, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 525, "start_column": 12, "end_line": 525, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 526, "start_column": 12, "end_line": 526, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 527, "start_column": 12, "end_line": 527, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 528, "start_column": 12, "end_line": 528, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 529, "start_column": 12, "end_line": 529, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 531, "start_column": 12, "end_line": 531, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 532, "start_column": 12, "end_line": 532, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 533, "start_column": 12, "end_line": 533, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 534, "start_column": 12, "end_line": 534, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 535, "start_column": 12, "end_line": 535, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 537, "start_column": 12, "end_line": 537, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 538, "start_column": 12, "end_line": 538, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 539, "start_column": 12, "end_line": 539, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 540, "start_column": 12, "end_line": 540, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 541, "start_column": 12, "end_line": 541, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 543, "start_column": 12, "end_line": 543, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 544, "start_column": 12, "end_line": 544, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 545, "start_column": 12, "end_line": 545, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 546, "start_column": 12, "end_line": 546, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 547, "start_column": 12, "end_line": 547, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 549, "start_column": 12, "end_line": 549, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 550, "start_column": 12, "end_line": 550, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 551, "start_column": 12, "end_line": 551, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 552, "start_column": 12, "end_line": 552, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 553, "start_column": 12, "end_line": 553, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 555, "start_column": 12, "end_line": 555, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 556, "start_column": 12, "end_line": 556, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 557, "start_column": 12, "end_line": 557, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 558, "start_column": 12, "end_line": 558, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 559, "start_column": 12, "end_line": 559, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 561, "start_column": 12, "end_line": 561, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 562, "start_column": 12, "end_line": 562, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 563, "start_column": 12, "end_line": 563, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 564, "start_column": 12, "end_line": 564, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 565, "start_column": 12, "end_line": 565, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 567, "start_column": 12, "end_line": 567, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 568, "start_column": 12, "end_line": 568, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 569, "start_column": 12, "end_line": 569, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 570, "start_column": 12, "end_line": 570, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 571, "start_column": 12, "end_line": 571, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 573, "start_column": 12, "end_line": 573, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 574, "start_column": 12, "end_line": 574, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 575, "start_column": 12, "end_line": 575, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 576, "start_column": 12, "end_line": 576, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 577, "start_column": 12, "end_line": 577, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 579, "start_column": 12, "end_line": 579, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 580, "start_column": 12, "end_line": 580, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 581, "start_column": 12, "end_line": 581, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 582, "start_column": 12, "end_line": 582, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 583, "start_column": 12, "end_line": 583, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 585, "start_column": 12, "end_line": 585, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 586, "start_column": 12, "end_line": 586, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 587, "start_column": 12, "end_line": 587, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 588, "start_column": 12, "end_line": 588, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 589, "start_column": 12, "end_line": 589, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 591, "start_column": 12, "end_line": 591, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 592, "start_column": 12, "end_line": 592, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 593, "start_column": 12, "end_line": 593, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 594, "start_column": 12, "end_line": 594, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 595, "start_column": 12, "end_line": 595, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 597, "start_column": 12, "end_line": 597, "end_column": 19 }, { "span": "2.1 > 4", "start_line": 598, "start_column": 12, "end_line": 598, "end_column": 19 }, { "span": "2.1 == 4", "start_line": 599, "start_column": 12, "end_line": 599, "end_column": 20 }, { "span": "2.1 > 4", "start_line": 600, "start_column": 12, "end_line": 600, "end_column": 19 }, { "span": "2.1 < 4", "start_line": 601, "start_column": 12, "end_line": 601, "end_column": 19 }, { "span": "1234567890L < 3456789012345L", "start_line": 619, "start_column": 12, "end_line": 619, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 620, "start_column": 12, "end_line": 620, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 621, "start_column": 12, "end_line": 621, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 622, "start_column": 12, "end_line": 622, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 623, "start_column": 12, "end_line": 623, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 625, "start_column": 12, "end_line": 625, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 626, "start_column": 12, "end_line": 626, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 627, "start_column": 12, "end_line": 627, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 628, "start_column": 12, "end_line": 628, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 629, "start_column": 12, "end_line": 629, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 631, "start_column": 12, "end_line": 631, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 632, "start_column": 12, "end_line": 632, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 633, "start_column": 12, "end_line": 633, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 634, "start_column": 12, "end_line": 634, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 635, "start_column": 12, "end_line": 635, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 637, "start_column": 12, "end_line": 637, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 638, "start_column": 12, "end_line": 638, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 639, "start_column": 12, "end_line": 639, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 640, "start_column": 12, "end_line": 640, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 641, "start_column": 12, "end_line": 641, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 643, "start_column": 12, "end_line": 643, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 644, "start_column": 12, "end_line": 644, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 645, "start_column": 12, "end_line": 645, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 646, "start_column": 12, "end_line": 646, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 647, "start_column": 12, "end_line": 647, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 649, "start_column": 12, "end_line": 649, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 650, "start_column": 12, "end_line": 650, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 651, "start_column": 12, "end_line": 651, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 652, "start_column": 12, "end_line": 652, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 653, "start_column": 12, "end_line": 653, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 655, "start_column": 12, "end_line": 655, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 656, "start_column": 12, "end_line": 656, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 657, "start_column": 12, "end_line": 657, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 658, "start_column": 12, "end_line": 658, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 659, "start_column": 12, "end_line": 659, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 661, "start_column": 12, "end_line": 661, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 662, "start_column": 12, "end_line": 662, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 663, "start_column": 12, "end_line": 663, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 664, "start_column": 12, "end_line": 664, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 665, "start_column": 12, "end_line": 665, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 667, "start_column": 12, "end_line": 667, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 668, "start_column": 12, "end_line": 668, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 669, "start_column": 12, "end_line": 669, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 670, "start_column": 12, "end_line": 670, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 671, "start_column": 12, "end_line": 671, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 673, "start_column": 12, "end_line": 673, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 674, "start_column": 12, "end_line": 674, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 675, "start_column": 12, "end_line": 675, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 676, "start_column": 12, "end_line": 676, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 677, "start_column": 12, "end_line": 677, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 679, "start_column": 12, "end_line": 679, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 680, "start_column": 12, "end_line": 680, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 681, "start_column": 12, "end_line": 681, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 682, "start_column": 12, "end_line": 682, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 683, "start_column": 12, "end_line": 683, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 685, "start_column": 12, "end_line": 685, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 686, "start_column": 12, "end_line": 686, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 687, "start_column": 12, "end_line": 687, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 688, "start_column": 12, "end_line": 688, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 689, "start_column": 12, "end_line": 689, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 691, "start_column": 12, "end_line": 691, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 692, "start_column": 12, "end_line": 692, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 693, "start_column": 12, "end_line": 693, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 694, "start_column": 12, "end_line": 694, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 695, "start_column": 12, "end_line": 695, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 697, "start_column": 12, "end_line": 697, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 698, "start_column": 12, "end_line": 698, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 699, "start_column": 12, "end_line": 699, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 700, "start_column": 12, "end_line": 700, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 701, "start_column": 12, "end_line": 701, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 703, "start_column": 12, "end_line": 703, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 704, "start_column": 12, "end_line": 704, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 705, "start_column": 12, "end_line": 705, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 706, "start_column": 12, "end_line": 706, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 707, "start_column": 12, "end_line": 707, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 709, "start_column": 12, "end_line": 709, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 710, "start_column": 12, "end_line": 710, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 711, "start_column": 12, "end_line": 711, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 712, "start_column": 12, "end_line": 712, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 713, "start_column": 12, "end_line": 713, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 715, "start_column": 12, "end_line": 715, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 716, "start_column": 12, "end_line": 716, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 717, "start_column": 12, "end_line": 717, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 718, "start_column": 12, "end_line": 718, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 719, "start_column": 12, "end_line": 719, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 721, "start_column": 12, "end_line": 721, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 722, "start_column": 12, "end_line": 722, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 723, "start_column": 12, "end_line": 723, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 724, "start_column": 12, "end_line": 724, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 725, "start_column": 12, "end_line": 725, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 727, "start_column": 12, "end_line": 727, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 728, "start_column": 12, "end_line": 728, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 729, "start_column": 12, "end_line": 729, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 730, "start_column": 12, "end_line": 730, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 731, "start_column": 12, "end_line": 731, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 733, "start_column": 12, "end_line": 733, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 734, "start_column": 12, "end_line": 734, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 735, "start_column": 12, "end_line": 735, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 736, "start_column": 12, "end_line": 736, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 737, "start_column": 12, "end_line": 737, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 739, "start_column": 12, "end_line": 739, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 740, "start_column": 12, "end_line": 740, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 741, "start_column": 12, "end_line": 741, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 742, "start_column": 12, "end_line": 742, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 743, "start_column": 12, "end_line": 743, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 745, "start_column": 12, "end_line": 745, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 746, "start_column": 12, "end_line": 746, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 747, "start_column": 12, "end_line": 747, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 748, "start_column": 12, "end_line": 748, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 749, "start_column": 12, "end_line": 749, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 751, "start_column": 12, "end_line": 751, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 752, "start_column": 12, "end_line": 752, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 753, "start_column": 12, "end_line": 753, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 754, "start_column": 12, "end_line": 754, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 755, "start_column": 12, "end_line": 755, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 757, "start_column": 12, "end_line": 757, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 758, "start_column": 12, "end_line": 758, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 759, "start_column": 12, "end_line": 759, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 760, "start_column": 12, "end_line": 760, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 761, "start_column": 12, "end_line": 761, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 763, "start_column": 12, "end_line": 763, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 764, "start_column": 12, "end_line": 764, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 765, "start_column": 12, "end_line": 765, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 766, "start_column": 12, "end_line": 766, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 767, "start_column": 12, "end_line": 767, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 769, "start_column": 12, "end_line": 769, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 770, "start_column": 12, "end_line": 770, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 771, "start_column": 12, "end_line": 771, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 772, "start_column": 12, "end_line": 772, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 773, "start_column": 12, "end_line": 773, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 775, "start_column": 12, "end_line": 775, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 776, "start_column": 12, "end_line": 776, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 777, "start_column": 12, "end_line": 777, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 778, "start_column": 12, "end_line": 778, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 779, "start_column": 12, "end_line": 779, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 781, "start_column": 12, "end_line": 781, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 782, "start_column": 12, "end_line": 782, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 783, "start_column": 12, "end_line": 783, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 784, "start_column": 12, "end_line": 784, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 785, "start_column": 12, "end_line": 785, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 787, "start_column": 12, "end_line": 787, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 788, "start_column": 12, "end_line": 788, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 789, "start_column": 12, "end_line": 789, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 790, "start_column": 12, "end_line": 790, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 791, "start_column": 12, "end_line": 791, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 793, "start_column": 12, "end_line": 793, "end_column": 40 }, { "span": "1234567890L > 3456789012345L", "start_line": 794, "start_column": 12, "end_line": 794, "end_column": 40 }, { "span": "1234567890L == 3456789012345L", "start_line": 795, "start_column": 12, "end_line": 795, "end_column": 41 }, { "span": "1234567890L > 3456789012345L", "start_line": 796, "start_column": 12, "end_line": 796, "end_column": 40 }, { "span": "1234567890L < 3456789012345L", "start_line": 797, "start_column": 12, "end_line": 797, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Compare", "Integer", "s_", "(_", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "rounds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", ">_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2_", "<_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compare", "Float", "s_", "(_", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "rounds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "3.3", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compare", "Float", "s", "Integer", "s_", "(_", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "rounds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", ">_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "2.1_", "<_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compare", "Long", "s_", "(_", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "rounds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "==_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", ">_", "3456", "7890", "12345_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "12345678", "90_", "L_", "<_", "3456", "7890", "12345_", "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, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 1, 2, 0, 1,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2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2 ]
Except block handles 'BaseException'
XiaoMi/minos/supervisor/supervisor/supervisorctl.py
[ { "content": " def do_tail(self, arg):\n if not self.ctl.upcheck():\n return\n \n args = arg.strip().split()\n\n if len(args) < 1:\n self.ctl.output('Error: too few arguments')\n self.help_tail()\n return\n\n elif len(args) > 3:\n self.ctl.output('Error: too many arguments')\n self.help_tail()\n return\n\n modifier = None\n\n if args[0].startswith('-'):\n modifier = args.pop(0)\n\n if len(args) == 1:\n name = args[-1]\n channel = 'stdout'\n else:\n if args:\n name = args[0]\n channel = args[-1].lower()\n if channel not in ('stderr', 'stdout'):\n self.ctl.output('Error: bad channel %r' % channel)\n return\n else:\n self.ctl.output('Error: tail requires process name')\n return\n\n bytes = 1600\n\n if modifier is not None:\n what = modifier[1:]\n if what == 'f':\n bytes = None\n else:\n try:\n bytes = int(what)\n except:\n self.ctl.output('Error: bad argument %s' % modifier)\n return\n\n supervisor = self.ctl.get_supervisor()\n\n if bytes is None:\n return self._tailf('/logtail/%s/%s' % (name, channel))\n\n else:\n try:\n if channel is 'stdout':\n output = supervisor.readProcessStdoutLog(name,\n -bytes, 0)\n else: # if channel is 'stderr'\n output = supervisor.readProcessStderrLog(name,\n -bytes, 0)\n except xmlrpclib.Fault, e:\n template = '%s: ERROR (%s)'\n if e.faultCode == xmlrpc.Faults.NO_FILE:\n self.ctl.output(template % (name, 'no log file'))\n elif e.faultCode == xmlrpc.Faults.FAILED:\n self.ctl.output(template % (name,\n 'unknown error reading log'))\n elif e.faultCode == xmlrpc.Faults.BAD_NAME:\n self.ctl.output(template % (name,\n 'no such process name'))\n else:\n self.ctl.output(output)", "metadata": "root.DefaultControllerPlugin.do_tail", "header": "['class', 'DefaultControllerPlugin', '(', 'ControllerPluginBase', ')', ':', '___EOS___']", "index": 404 }, { "content": " def do_maintail(self, arg):\n if not self.ctl.upcheck():\n return\n \n args = arg.strip().split()\n\n if len(args) > 1:\n self.ctl.output('Error: too many arguments')\n self.help_maintail()\n return\n\n elif len(args) == 1:\n if args[0].startswith('-'):\n what = args[0][1:]\n if what == 'f':\n path = '/mainlogtail'\n return self._tailf(path)\n try:\n what = int(what)\n except:\n self.ctl.output('Error: bad argument %s' % args[0])\n return\n else:\n bytes = what\n else:\n self.ctl.output('Error: bad argument %s' % args[0])\n return\n \n else:\n bytes = 1600\n\n supervisor = self.ctl.get_supervisor()\n\n try:\n output = supervisor.readLog(-bytes, 0)\n except xmlrpclib.Fault, e:\n template = '%s: ERROR (%s)'\n if e.faultCode == xmlrpc.Faults.NO_FILE:\n self.ctl.output(template % ('supervisord', 'no log file'))\n elif e.faultCode == xmlrpc.Faults.FAILED:\n self.ctl.output(template % ('supervisord',\n 'unknown error reading log'))\n else:\n self.ctl.output(output)", "metadata": "root.DefaultControllerPlugin.do_maintail", "header": "['class', 'DefaultControllerPlugin', '(', 'ControllerPluginBase', ')', ':', '___EOS___']", "index": 488 } ]
[ { "span": "except:", "start_line": 448, "start_column": 16, "end_line": 448, "end_column": 23 }, { "span": "except:", "start_line": 507, "start_column": 16, "end_line": 507, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Default", "Controlle", "r", "Plugin_", "(_", "Controlle", "r", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "tail_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "ctl_", "._", "upc", "heck_", "(_", ")_", ":_", "\\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_", "args_", "=_", "arg_", "._", "strip_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "too", " ", "few", " ", "argu", "ment", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "help", "\\u", "tail_", "(_", ")_", "\\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_", "elif_", "len_", "(_", "args_", ")_", ">_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "too", " ", "many", " ", "argu", "ment", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "help", "\\u", "tail_", "(_", ")_", "\\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_", "modifier_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifier_", "=_", "args_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "args_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "=_", "'", "stdout", "'_", "\\u\\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_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "=_", "args_", "[_", "-_", "1_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "channel_", "not_", "in_", "(_", "'", "std", "err", "'_", ",_", "'", "stdout", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "bad", " ", "channel", " ", "%", "r", "'_", "%_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\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_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "tail", " ", "require", "s", " ", "process", " ", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bytes_", "=_", "1600", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "modifier_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "what_", "=_", "modifier_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "what_", "==_", "'", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bytes_", "=_", "int_", "(_", "what_", ")_", "\\u\\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_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "bad", " ", "argu", "ment", " ", "%", "s", "'_", "%_", "modifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "supervisor", "_", "=_", "self_", "._", "ctl_", "._", "get", "\\u", "supervisor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bytes_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "tail", "f_", "(_", "'/", "logt", "ail", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "name_", ",_", "channel_", ")_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "channel_", "is_", "'", "stdout", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "=_", "supervisor", "_", "._", "read", "Process", "Stdout", "Log_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "bytes_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "if", " ", "channel", " ", "is", " ", "'", "std", "err", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "=_", "supervisor", "_", "._", "read", "Process", "Std", "err", "Log_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "bytes_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "xmlrpclib_", "._", "Fault_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "'%", "s", ":", " ", "ERROR", " ", "(%", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "NO", "\\u", "FILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ctl_", "._", "output_", "(_", "template_", "%_", "(_", "name_", ",_", "'", "no", " ", "log", " ", "file", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "FAILED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ctl_", "._", "output_", "(_", "template_", "%_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unknown", " ", "error", " ", "readi", "ng", " ", "log", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "BAD", "\\u", "NAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ctl_", "._", "output_", "(_", "template_", "%_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "no", " ", "suc", "h", " ", "process", " ", "name", "'_", ")_", ")_", "\\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_", "._", "ctl_", "._", "output_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Default", "Controlle", "r", "Plugin_", "(_", "Controlle", "r", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "maint", "ail", "_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "ctl_", "._", "upc", "heck_", "(_", ")_", ":_", "\\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_", "args_", "=_", "arg_", "._", "strip_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "too", " ", "many", " ", "argu", "ment", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "help", "\\u", "maint", "ail", "_", "(_", ")_", "\\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_", "elif_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "what_", "=_", "args_", "[_", "0_", "]_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "what_", "==_", "'", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path_", "=_", "'/", "mainl", "og", "tail", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "tail", "f_", "(_", "path_", ")_", "\\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 ", " ", "_", "what_", "=_", "int_", "(_", "what_", ")_", "\\u\\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_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "bad", " ", "argu", "ment", " ", "%", "s", "'_", "%_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bytes_", "=_", "what_", "\\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_", "._", "ctl_", "._", "output_", "(_", "'", "Error", ":", " ", "bad", " ", "argu", "ment", " ", "%", "s", "'_", "%_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes_", "=_", "1600", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "supervisor", "_", "=_", "self_", "._", "ctl_", "._", "get", "\\u", "supervisor", "_", "(_", ")_", "\\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 ", " _", "output_", "=_", "supervisor", "_", "._", "read", "Log_", "(_", "-_", "bytes_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "xmlrpclib_", "._", "Fault_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "'%", "s", ":", " ", "ERROR", " ", "(%", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "NO", "\\u", "FILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "template_", "%_", "(_", "'", "supervisor", "d", "'_", ",_", "'", "no", " ", "log", " ", "file", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "FAILED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "template_", "%_", "(_", "'", "supervisor", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unknown", " ", "error", " ", "readi", "ng", " ", "log", "'_", ")_", ")_", "\\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_", "._", "ctl_", "._", "output_", "(_", "output_", ")_", "\\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, 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 'book':\n try:\n md = metadata[doc]\n return md['title'][0]\n except:\n return doc\n elif context_type == 'page':\n context_md = ctx_md['page']\n where = np.squeeze(np.where(np.in1d(context_md['page_label'], [doc])))\n page_no = context_md['file'][where]\n page_no = page_no.split('/')[-1]\n page_no = page_no.replace('.txt','')\n page_no = int(page_no)\n\n book_label = context_md['book_label'][where]\n md = metadata[book_label]\n try:\n xml = parse_marc(md['fullrecord'].encode('utf8'))\n vol = get_volume_from_marc(xml[0])\n return \"p%s of %s of %s\" % (page_no, vol, md['title'][0])\n except:\n pass\n try:\n return \"p%s of %s\" % (page_no, md['title'][0])\n except:\n return doc", "metadata": "root.label", "header": "['module', '___EOS___']", "index": 39 } ]
[ { "span": "except:", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 15 }, { "span": "except:", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 15 }, { "span": "except:", "start_line": 64, "start_column": 8, "end_line": 64, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "label_", "(_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "context", "\\u", "type_", "==_", "'", "book", "'_", ":_", "\\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 ", " _", "md_", "=_", "metadata_", "[_", "doc_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "md_", "[_", "'", "title", "'_", "]_", "[_", "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 ", " _", "return_", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "context", "\\u", "type_", "==_", "'", "page", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "\\u", "md_", "=_", "ctx", "\\u", "md_", "[_", "'", "page", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "where_", "=_", "np_", "._", "squeeze_", "(_", "np_", "._", "where_", "(_", "np_", "._", "in1", "d_", "(_", "context", "\\u", "md_", "[_", "'", "page", "\\u", "label", "'_", "]_", ",_", "[_", "doc_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "no_", "=_", "context", "\\u", "md_", "[_", "'", "file", "'_", "]_", "[_", "where_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "no_", "=_", "page", "\\u", "no_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "no_", "=_", "page", "\\u", "no_", "._", "replace_", "(_", "'.", "txt", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "no_", "=_", "int_", "(_", "page", "\\u", "no_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "book", "\\u", "label_", "=_", "context", "\\u", "md_", "[_", "'", "book", "\\u", "label", "'_", "]_", "[_", "where_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "metadata_", "[_", "book", "\\u", "label_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml_", "=_", "parse", "\\u", "marc", "_", "(_", "md_", "[_", "'", "full", "record", "'_", "]_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol_", "=_", "get", "\\u", "volume", "\\u", "from", "\\u", "marc", "_", "(_", "xml_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "p", "%", "s", " ", "of", " ", "%", "s", " ", "of", " ", "%", "s", "\"_", "%_", "(_", "page", "\\u", "no_", ",_", "vol_", ",_", "md_", "[_", "'", "title", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "p", "%", "s", " ", "of", " ", "%", "s", "\"_", "%_", "(_", "page", "\\u", "no_", ",_", "md_", "[_", "'", "title", "'_", "]_", "[_", "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 ", " _", "return_", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
denizalti/concoord/concoord/replica.py
[ { "content": " def send_replybatch_to_client(self, givenresult, command):\n if self.debug: self.logger.write(\"State\", \"Sending REPLY to CLIENT\")\n clientreply = create_message(MSG_CLIENTREPLY, self.me,\n {FLD_REPLY: givenresult,\n FLD_REPLYCODE: CR_BATCH,\n FLD_INRESPONSETO: command.clientcommandnumber})\n clientconn = self.connectionpool.get_connection_by_peer(command.client)\n if clientconn == None or clientconn.thesocket == None:\n if self.debug: self.logger.write(\"State\", \"Client connection does not exist.\")\n return\n clientconn.send(clientreply)", "metadata": "root.Replica.send_replybatch_to_client", "header": "['class', 'Replica', '(', 'Node', ')', ':', '___EOS___']", "index": 318 }, { "content": " def send_reply_to_client(self, clientreplycode, givenresult, command):\n if self.debug: self.logger.write(\"State\", \"Sending REPLY to CLIENT\")\n clientreply = create_message(MSG_CLIENTREPLY, self.me,\n {FLD_REPLY: givenresult,\n FLD_REPLYCODE: clientreplycode,\n FLD_INRESPONSETO: command.clientcommandnumber})\n if self.debug: self.logger.write(\"State\", \"Clientreply: %s\" % str(clientreply))\n clientconn = self.connectionpool.get_connection_by_peer(command.client)\n if clientconn == None or clientconn.thesocket == None:\n if self.debug: self.logger.write(\"State\", \"Client connection does not exist.\")\n return\n clientconn.send(clientreply)", "metadata": "root.Replica.send_reply_to_client", "header": "['class', 'Replica', '(', 'Node', ')', ':', '___EOS___']", "index": 330 } ]
[ { "span": "clientconn == None ", "start_line": 325, "start_column": 11, "end_line": 325, "end_column": 29 }, { "span": "clientconn.thesocket == None:", "start_line": 325, "start_column": 33, "end_line": 325, "end_column": 61 }, { "span": "clientconn == None ", "start_line": 338, "start_column": 11, "end_line": 338, "end_column": 29 }, { "span": "clientconn.thesocket == None:", "start_line": 338, "start_column": 33, "end_line": 338, "end_column": 61 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Replica", "_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "repl", "yb", "atch", "\\u", "to", "\\u", "client_", "(_", "self_", ",_", "give", "nre", "sult_", ",_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "debug_", ":_", "self_", "._", "logger_", "._", "write_", "(_", "\"", "State", "\"_", ",_", "\"", "Sen", "ding", " ", "REPLY", " ", "to", " ", "CLIENT", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "reply_", "=_", "create", "\\u", "message_", "(_", "MS", "G", "\\u", "CLIENT", "REPLY_", ",_", "self_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "FL", "D", "\\u", "REPLY_", ":_", "give", "nre", "sult_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FL", "D", "\\u", "REPLY", "CODE_", ":_", "CR", "\\u", "BATCH", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FL", "D", "\\u", "IN", "RESPONSE", "TO_", ":_", "command_", "._", "client", "command", "number_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "conn_", "=_", "self_", "._", "connecti", "onp", "ool_", "._", "get", "\\u", "connecti", "on", "\\u", "by", "\\u", "peer_", "(_", "command_", "._", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "client", "conn_", "==_", "None_", "or_", "client", "conn_", "._", "thes", "ocket", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "debug_", ":_", "self_", "._", "logger_", "._", "write_", "(_", "\"", "State", "\"_", ",_", "\"", "Client", " ", "connecti", "on", " ", "doe", "s", " ", "not", " ", "exist", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client", "conn_", "._", "send_", "(_", "client", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Replica", "_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "repl", "y", "\\u", "to", "\\u", "client_", "(_", "self_", ",_", "client", "repl", "yco", "de_", ",_", "give", "nre", "sult_", ",_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "debug_", ":_", "self_", "._", "logger_", "._", "write_", "(_", "\"", "State", "\"_", ",_", "\"", "Sen", "ding", " ", "REPLY", " ", "to", " ", "CLIENT", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "reply_", "=_", "create", "\\u", "message_", "(_", "MS", "G", "\\u", "CLIENT", "REPLY_", ",_", "self_", "._", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "FL", "D", "\\u", "REPLY_", ":_", "give", "nre", "sult_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FL", "D", "\\u", "REPLY", "CODE_", ":_", "client", "repl", "yco", "de_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FL", "D", "\\u", "IN", "RESPONSE", "TO_", ":_", "command_", "._", "client", "command", "number_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "logger_", "._", "write_", "(_", "\"", "State", "\"_", ",_", "\"", "Client", "repl", "y", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "client", "reply_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "conn_", "=_", "self_", "._", "connecti", "onp", "ool_", "._", "get", "\\u", "connecti", "on", "\\u", "by", "\\u", "peer_", "(_", "command_", "._", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "client", "conn_", "==_", "None_", "or_", "client", "conn_", "._", "thes", "ocket", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "debug_", ":_", "self_", "._", "logger_", "._", "write_", "(_", "\"", "State", "\"_", ",_", "\"", "Client", " ", "connecti", "on", " ", "doe", "s", " ", "not", " ", "exist", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client", "conn_", "._", "send_", "(_", "client", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Imprecise assert
divio/django-cms/cms/tests/test_publisher.py
[ { "content": " def test_publish_works_with_descendants(self):\n \"\"\"\n For help understanding what this tests for, see:\n http://articles.sitepoint.com/print/hierarchical-data-database\n\n Creates this published structure:\n home\n / \\\n item1 item2\n / \\\n subitem1 subitem2\n \"\"\"\n home_page = create_page(\"home\", \"nav_playground.html\", \"en\",\n published=True, in_navigation=False)\n\n create_page(\"item1\", \"nav_playground.html\", \"en\", parent=home_page,\n published=True)\n item2 = create_page(\"item2\", \"nav_playground.html\", \"en\", parent=home_page,\n published=True)\n\n create_page(\"subitem1\", \"nav_playground.html\", \"en\", parent=item2,\n published=True)\n create_page(\"subitem2\", \"nav_playground.html\", \"en\", parent=item2,\n published=True)\n item2 = item2.reload()\n not_drafts = list(Page.objects.filter(publisher_is_draft=False).order_by('path'))\n drafts = list(Page.objects.filter(publisher_is_draft=True).order_by('path'))\n\n self.assertEqual(len(not_drafts), 5)\n self.assertEqual(len(drafts), 5)\n\n for idx, draft in enumerate(drafts):\n public = not_drafts[idx]\n # Check that a node doesn't become a root node magically\n self.assertEqual(bool(public.parent_id), bool(draft.parent_id))\n if public.parent:\n self.assertEqual(public.path[0:4], public.parent.path[0:4])\n self.assertTrue(public.parent in public.get_ancestors())\n self.assertTrue(public in public.parent.get_descendants())\n self.assertTrue(public in public.parent.get_children())\n if draft.parent:\n # Same principle for the draft tree\n self.assertEqual(draft.path[0:4], draft.parent.path[0:4])\n self.assertTrue(draft.parent in draft.get_ancestors())\n self.assertTrue(draft in draft.parent.get_descendants())\n self.assertTrue(draft in draft.parent.get_children())\n\n # Now call publish again. The structure should not change.\n item2.publish('en')\n\n not_drafts = list(Page.objects.filter(publisher_is_draft=False).order_by('path'))\n drafts = list(Page.objects.filter(publisher_is_draft=True).order_by('path'))\n\n self.assertEqual(len(not_drafts), 5)\n self.assertEqual(len(drafts), 5)\n\n for idx, draft in enumerate(drafts):\n public = not_drafts[idx]\n # Check that a node doesn't become a root node magically\n self.assertEqual(bool(public.parent_id), bool(draft.parent_id))\n self.assertEqual(public.numchild, draft.numchild)\n if public.parent:\n self.assertEqual(public.path[0:4], public.parent.path[0:4])\n self.assertTrue(public.parent in public.get_ancestors())\n self.assertTrue(public in public.parent.get_descendants())\n self.assertTrue(public in public.parent.get_children())\n if draft.parent:\n self.assertEqual(draft.path[0:4], draft.parent.path[0:4])\n self.assertTrue(draft.parent in draft.get_ancestors())\n self.assertTrue(draft in draft.parent.get_descendants())\n self.assertTrue(draft in draft.parent.get_children())", "metadata": "root.PublishingTests.test_publish_works_with_descendants", "header": "['class', 'PublishingTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 930 } ]
[ { "span": "self.assertTrue(public.parent in public.get_ancestors())", "start_line": 967, "start_column": 16, "end_line": 967, "end_column": 72 }, { "span": "self.assertTrue(public in public.parent.get_descendants())", "start_line": 968, "start_column": 16, "end_line": 968, "end_column": 74 }, { "span": "self.assertTrue(public in public.parent.get_children())", "start_line": 969, "start_column": 16, "end_line": 969, "end_column": 71 }, { "span": "self.assertTrue(draft.parent in draft.get_ancestors())", "start_line": 973, "start_column": 16, "end_line": 973, "end_column": 70 }, { "span": "self.assertTrue(draft in draft.parent.get_descendants())", "start_line": 974, "start_column": 16, "end_line": 974, "end_column": 72 }, { "span": "self.assertTrue(draft in draft.parent.get_children())", "start_line": 975, "start_column": 16, "end_line": 975, "end_column": 69 }, { "span": "self.assertTrue(public.parent in public.get_ancestors())", "start_line": 993, "start_column": 16, "end_line": 993, "end_column": 72 }, { "span": "self.assertTrue(public in public.parent.get_descendants())", "start_line": 994, "start_column": 16, "end_line": 994, "end_column": 74 }, { "span": "self.assertTrue(public in public.parent.get_children())", "start_line": 995, "start_column": 16, "end_line": 995, "end_column": 71 }, { "span": "self.assertTrue(draft.parent in draft.get_ancestors())", "start_line": 998, "start_column": 16, "end_line": 998, "end_column": 70 }, { "span": "self.assertTrue(draft in draft.parent.get_descendants())", "start_line": 999, "start_column": 16, "end_line": 999, "end_column": 72 }, { "span": "self.assertTrue(draft in draft.parent.get_children())", "start_line": 1000, "start_column": 16, "end_line": 1000, "end_column": 69 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Publish", "ing", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "publi", "sh", "\\u", "works", "\\u", "with", "\\u", "descendants", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "help", " ", "underst", "and", "ing", " ", "what", " ", "this", " ", "tests", " ", "for", ",", " ", "see", ":", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "article", "s", ".", "site", "point", ".", "com", "/", "print", "/", "hierarchical", "-", "data", "-", "databa", "se", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "this", " ", "publi", "shed", " ", "structure", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "home", "\\", "10", ";", " ", " ", " ", " ", "/", " ", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", "item", "1", " ", " ", " ", "item", "2", "\\", "10", ";", " ", " ", " ", " ", "/", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "subi", "tem", "1", " ", "subi", "tem", "2", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "\\u", "page_", "=_", "create", "\\u", "page_", "(_", "\"", "home", "\"_", ",_", "\"", "nav", "\\u", "play", "ground", ".", "html", "\"_", ",_", "\"", "en", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "published_", "=_", "True_", ",_", "in", "\\u", "navigation", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "page_", "(_", "\"", "item", "1", "\"_", ",_", "\"", "nav", "\\u", "play", "ground", ".", "html", "\"_", ",_", "\"", "en", "\"_", ",_", "parent_", "=_", "home", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "published_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item2_", "=_", "create", "\\u", "page_", "(_", "\"", "item", "2", "\"_", ",_", "\"", "nav", "\\u", "play", "ground", ".", "html", "\"_", ",_", "\"", "en", "\"_", ",_", "parent_", "=_", "home", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "published_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "page_", "(_", "\"", "subi", "tem", "1", "\"_", ",_", "\"", "nav", "\\u", "play", "ground", ".", "html", "\"_", ",_", "\"", "en", "\"_", ",_", "parent_", "=_", "item2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "published_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "page_", "(_", "\"", "subi", "tem", "2", "\"_", ",_", "\"", "nav", "\\u", "play", "ground", ".", "html", "\"_", ",_", "\"", "en", "\"_", ",_", "parent_", "=_", "item2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "published_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item2_", "=_", "item2_", "._", "reload_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "\\u", "draft", "s_", "=_", "list_", "(_", "Page_", "._", "objects_", "._", "filter_", "(_", "publi", "sher", "\\u", "is", "\\u", "draft_", "=_", "False_", ")_", "._", "order", "\\u", "by_", "(_", "'", "path", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "draft", "s_", "=_", "list_", "(_", "Page_", "._", "objects_", "._", "filter_", "(_", "publi", "sher", "\\u", "is", "\\u", "draft_", "=_", "True_", ")_", "._", "order", "\\u", "by_", "(_", "'", "path", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "not", "\\u", "draft", "s_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "draft", "s_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", ",_", "draft_", "in_", "enumerate_", "(_", "draft", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "public_", "=_", "not", "\\u", "draft", "s_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "a", " ", "node", " ", "doe", "sn", "'", "t", " ", "bec", "ome", " ", "a", " ", "root", " ", "node", " ", "magic", "ally", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bool_", "(_", "public_", "._", "parent", "\\u", "id_", ")_", ",_", "bool_", "(_", "draft_", "._", "parent", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "public_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "public_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ",_", "public_", "._", "parent_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "public_", "._", "parent_", "in_", "public_", "._", "get", "\\u", "ancestors_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "public_", "in_", "public_", "._", "parent_", "._", "get", "\\u", "descendants", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "public_", "in_", "public_", "._", "parent_", "._", "get", "\\u", "children_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "draft_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sam", "e", " ", "princ", "ipl", "e", " ", "for", " ", "the", " ", "draft", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "draft_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ",_", "draft_", "._", "parent_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "draft_", "._", "parent_", "in_", "draft_", "._", "get", "\\u", "ancestors_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "draft_", "in_", "draft_", "._", "parent_", "._", "get", "\\u", "descendants", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "draft_", "in_", "draft_", "._", "parent_", "._", "get", "\\u", "children_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "call", " ", "publi", "sh", " ", "again", ".", " ", "The", " ", "structure", " ", "shou", "ld", " ", "not", " ", "change", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "item2_", "._", "publish_", "(_", "'", "en", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "not", "\\u", "draft", "s_", "=_", "list_", "(_", "Page_", "._", "objects_", "._", "filter_", "(_", "publi", "sher", "\\u", "is", "\\u", "draft_", "=_", "False_", ")_", "._", "order", "\\u", "by_", "(_", "'", "path", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "draft", "s_", "=_", "list_", "(_", "Page_", "._", "objects_", "._", "filter_", "(_", "publi", "sher", "\\u", "is", "\\u", "draft_", "=_", "True_", ")_", "._", "order", "\\u", "by_", "(_", "'", "path", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "not", "\\u", "draft", "s_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "draft", "s_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", ",_", "draft_", "in_", "enumerate_", "(_", "draft", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "public_", "=_", "not", "\\u", "draft", "s_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "a", " ", "node", " ", "doe", "sn", "'", "t", " ", "bec", "ome", " ", "a", " ", "root", " ", "node", " ", "magic", "ally", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bool_", "(_", "public_", "._", "parent", "\\u", "id_", ")_", ",_", "bool_", "(_", "draft_", "._", "parent", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "public_", "._", "numc", "hild", "_", ",_", "draft_", "._", "numc", "hild", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "public_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "public_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ",_", "public_", "._", "parent_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "public_", "._", "parent_", "in_", "public_", "._", "get", "\\u", "ancestors_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "public_", "in_", "public_", "._", "parent_", "._", "get", "\\u", "descendants", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "public_", "in_", "public_", "._", "parent_", "._", "get", "\\u", "children_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "draft_", "._", "parent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "draft_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ",_", "draft_", "._", "parent_", "._", "path_", "[_", "0_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "draft_", "._", "parent_", "in_", "draft_", "._", "get", "\\u", "ancestors_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "draft_", "in_", "draft_", "._", "parent_", "._", "get", "\\u", "descendants", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "draft_", "in_", "draft_", "._", "parent_", "._", "get", "\\u", "children_", "(_", ")_", ")_" ]
[ 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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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Unused import
bayespy/bayespy/bayespy/inference/vmp/nodes/tests/test_multinomial.py
[ { "content": "################################################################################\n# Copyright (C) 2014 Jaakko Luttinen\n#\n# This file is licensed under the MIT License.\n################################################################################\n\n\n\"\"\"\nUnit tests for `multinomial` module.\n\"\"\"\n\nimport numpy as np\nimport scipy\n\nfrom bayespy.nodes import (Multinomial,\n Dirichlet,\n Mixture)\n\nfrom bayespy.utils import random\n\nfrom bayespy.utils.misc import TestCase\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestMultinomial(TestCase):\n \"\"\"\n Unit tests for Multinomial node\n \"\"\"\n\n \n\n \n\n\n\n ", "metadata": "root.TestMultinomial", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def test_init(self):\n \"\"\"\n Test the creation of multinomial nodes.\n \"\"\"\n\n # Some simple initializations\n X = Multinomial(10, [0.1, 0.3, 0.6])\n X = Multinomial(10, Dirichlet([5,4,3]))\n\n # Check that plates are correct\n X = Multinomial(10, [0.1, 0.3, 0.6], plates=(3,4))\n self.assertEqual(X.plates,\n (3,4))\n X = Multinomial(10, 0.25*np.ones((2,3,4)))\n self.assertEqual(X.plates,\n (2,3))\n n = 10 * np.ones((3,4), dtype=np.int)\n X = Multinomial(n, [0.1, 0.3, 0.6])\n self.assertEqual(X.plates,\n (3,4))\n X = Multinomial(n, Dirichlet([2,1,9], plates=(3,4)))\n self.assertEqual(X.plates,\n (3,4))\n \n\n # Probabilities not a vector\n self.assertRaises(ValueError,\n Multinomial,\n 10,\n 0.5)\n\n # Invalid probability\n self.assertRaises(ValueError,\n Multinomial,\n 10,\n [-0.5, 1.5])\n self.assertRaises(ValueError,\n Multinomial,\n 10,\n [0.5, 1.5])\n\n # Invalid number of trials\n self.assertRaises(ValueError,\n Multinomial,\n -1,\n [0.5, 0.5])\n self.assertRaises(ValueError,\n Multinomial,\n 8.5,\n [0.5, 0.5])\n\n # Inconsistent plates\n self.assertRaises(ValueError,\n Multinomial,\n 10,\n 0.25*np.ones((2,4)),\n plates=(3,))\n\n # Explicit plates too small\n self.assertRaises(ValueError,\n Multinomial,\n 10,\n 0.25*np.ones((2,4)),\n plates=(1,))\n\n pass", "metadata": "root.TestMultinomial.test_init", "header": "['class', 'TestMultinomial', '(', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_moments(self):\n \"\"\"\n Test the moments of multinomial nodes.\n \"\"\"\n\n # Simple test\n X = Multinomial(1, [0.7,0.2,0.1])\n u = X._message_to_child()\n self.assertEqual(len(u), 1)\n self.assertAllClose(u[0],\n [0.7,0.2,0.1])\n\n # Test n\n X = Multinomial(10, [0.7,0.2,0.1])\n u = X._message_to_child()\n self.assertAllClose(u[0],\n [7,2,1])\n\n # Test plates in p\n n = np.random.randint(1, 10)\n p = np.random.dirichlet([1,1], size=3)\n X = Multinomial(n, p)\n u = X._message_to_child()\n self.assertAllClose(u[0],\n p*n)\n \n # Test plates in n\n n = np.random.randint(1, 10, size=(3,))\n p = np.random.dirichlet([1,1,1,1])\n X = Multinomial(n, p)\n u = X._message_to_child()\n self.assertAllClose(u[0],\n p*n[:,None])\n\n # Test plates in p and n\n n = np.random.randint(1, 10, size=(4,1))\n p = np.random.dirichlet([1,1], size=3)\n X = Multinomial(n, p)\n u = X._message_to_child()\n self.assertAllClose(u[0],\n p*n[...,None])\n\n # Test with Dirichlet prior\n P = Dirichlet([7, 3])\n logp = P._message_to_child()[0]\n p0 = np.exp(logp[0]) / (np.exp(logp[0]) + np.exp(logp[1]))\n p1 = np.exp(logp[1]) / (np.exp(logp[0]) + np.exp(logp[1]))\n X = Multinomial(1, P)\n u = X._message_to_child()\n p = np.array([p0, p1])\n self.assertAllClose(u[0],\n p)\n\n # Test with broadcasted plates\n P = Dirichlet([7, 3], plates=(10,))\n X = Multinomial(5, P)\n u = X._message_to_child()\n self.assertAllClose(u[0] * np.ones(X.get_shape(0)),\n 5*p*np.ones((10,1)))\n\n pass", "metadata": "root.TestMultinomial.test_moments", "header": "['class', 'TestMultinomial', '(', 'TestCase', ')', ':', '___EOS___']", "index": 97 }, { "content": " def test_lower_bound(self):\n \"\"\"\n Test lower bound for multinomial node.\n \"\"\"\n\n # Test for a bug found in multinomial\n X = Multinomial(10, [0.3, 0.5, 0.2])\n l = X.lower_bound_contribution()\n self.assertAllClose(l, 0.0)\n \n pass", "metadata": "root.TestMultinomial.test_lower_bound", "header": "['class', 'TestMultinomial', '(', 'TestCase', ')', ':', '___EOS___']", "index": 160 }, { "content": " def test_mixture(self):\n \"\"\"\n Test multinomial mixture\n \"\"\"\n\n p0 = [0.1, 0.5, 0.2, 0.2]\n p1 = [0.5, 0.1, 0.1, 0.3]\n p2 = [0.3, 0.2, 0.1, 0.4]\n X = Mixture(2, Multinomial, 10, [p0, p1, p2])\n u = X._message_to_child()\n self.assertAllClose(u[0],\n 10*np.array(p2))\n\n pass", "metadata": "root.TestMultinomial.test_mixture", "header": "['class', 'TestMultinomial', '(', 'TestCase', ')', ':', '___EOS___']", "index": 173 } ]
[ { "span": "import scipy", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 12 }, { "span": "from bayespy.utils import random", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2014", " ", "Ja", "ak", "ko", " ", "Lu", "tti", "nen", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "license", "d", " ", "under", " ", "the", " ", "MIT", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Unit", " ", "tests", " ", "for", " ", "`", "multin", "omial", "`", " ", "module", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bayes", "py_", "._", "nodes_", "import_", "(_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dir", "ich", "let_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mix", "ture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bayes", "py_", "._", "utils_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bayes", "py_", "._", "utils_", "._", "misc_", "import_", "Test", "Case_", "\\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_", "Test", "Multi", "nomi", "al_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Unit", " ", "tests", " ", "for", " ", "Multi", "nomi", "al", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "nomi", "al_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "creati", "on", " ", "of", " ", "multin", "omial", " ", "nodes", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", " ", "simple", " ", "initialization", "s_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "10_", ",_", "[_", "0.1_", ",_", "0.3_", ",_", "0.6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "10_", ",_", "Dir", "ich", "let_", "(_", "[_", "5_", ",_", "4_", ",_", "3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "plates", " ", "are", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "10_", ",_", "[_", "0.1_", ",_", "0.3_", ",_", "0.6_", "]_", ",_", "plates", "_", "=_", "(_", "3_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "X_", "._", "plates", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "10_", ",_", "0.25_", "*_", "np_", "._", "ones_", "(_", "(_", "2_", ",_", "3_", ",_", "4_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "X_", "._", "plates", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "10_", "*_", "np_", "._", "ones_", "(_", "(_", "3_", ",_", "4_", ")_", ",_", "dtype_", "=_", "np_", "._", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "n_", ",_", "[_", "0.1_", ",_", "0.3_", ",_", "0.6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "X_", "._", "plates", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "n_", ",_", "Dir", "ich", "let_", "(_", "[_", "2_", ",_", "1_", ",_", "9_", "]_", ",_", "plates", "_", "=_", "(_", "3_", ",_", "4_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "X_", "._", "plates", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Probabili", "ties", " ", "not", " ", "a", " ", "vector_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "probability_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "0.5_", ",_", "1.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.5_", ",_", "1.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "number", " ", "of", " ", "trials_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.5_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "8.5", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.5_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inco", "nsis", "tent", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.25_", "*_", "np_", "._", "ones_", "(_", "(_", "2_", ",_", "4_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "3_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exp", "licit", " ", "plates", " ", "too", " ", "small_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "nomi", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.25_", "*_", "np_", "._", "ones_", "(_", "(_", "2_", ",_", "4_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plates", "_", "=_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "nomi", "al_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "moments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "moments", " ", "of", " ", "multin", "omial", " ", "nodes", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "1_", ",_", "[_", "0.7_", ",_", "0.2_", ",_", "0.1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "u_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.7_", ",_", "0.2_", ",_", "0.1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "10_", ",_", "[_", "0.7_", ",_", "0.2_", ",_", "0.1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "7_", ",_", "2_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "plates", " ", "in", " ", "p_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "np_", "._", "random_", "._", "randint_", "(_", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "np_", "._", "random_", "._", "diri", "chl", "et_", "(_", "[_", "1_", ",_", "1_", "]_", ",_", "size_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "n_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "*_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "plates", " ", "in", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "np_", "._", "random_", "._", "randint_", "(_", "1_", ",_", "10_", ",_", "size_", "=_", "(_", "3_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "np_", "._", "random_", "._", "diri", "chl", "et_", "(_", "[_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "n_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "*_", "n_", "[_", ":_", ",_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "plates", " ", "in", " ", "p", " ", "and", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "np_", "._", "random_", "._", "randint_", "(_", "1_", ",_", "10_", ",_", "size_", "=_", "(_", "4_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "np_", "._", "random_", "._", "diri", "chl", "et_", "(_", "[_", "1_", ",_", "1_", "]_", ",_", "size_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "n_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "*_", "n_", "[_", "..._", ",_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "Dir", "ich", "let", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "=_", "Dir", "ich", "let_", "(_", "[_", "7_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logp", "_", "=_", "P_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p0_", "=_", "np_", "._", "exp_", "(_", "logp", "_", "[_", "0_", "]_", ")_", "/_", "(_", "np_", "._", "exp_", "(_", "logp", "_", "[_", "0_", "]_", ")_", "+_", "np_", "._", "exp_", "(_", "logp", "_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "np_", "._", "exp_", "(_", "logp", "_", "[_", "1_", "]_", ")_", "/_", "(_", "np_", "._", "exp_", "(_", "logp", "_", "[_", "0_", "]_", ")_", "+_", "np_", "._", "exp_", "(_", "logp", "_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "1_", ",_", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "np_", "._", "array_", "(_", "[_", "p0_", ",_", "p1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "broadcast", "ed", " ", "plates", "_", "\\u\\u\\uNL\\u\\u\\u_", "P_", "=_", "Dir", "ich", "let_", "(_", "[_", "7_", ",_", "3_", "]_", ",_", "plates", "_", "=_", "(_", "10_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "5_", ",_", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", "*_", "np_", "._", "ones_", "(_", "X_", "._", "get", "\\u", "shape_", "(_", "0_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", "*_", "p_", "*_", "np_", "._", "ones_", "(_", "(_", "10_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "nomi", "al_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lower", "\\u", "bound_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "lower", " ", "bound", " ", "for", " ", "multin", "omial", " ", "node", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "for", " ", "a", " ", "bug", " ", "found", " ", "in", " ", "multin", "omial", "_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "Multi", "nomi", "al_", "(_", "10_", ",_", "[_", "0.3_", ",_", "0.5_", ",_", "0.2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "X_", "._", "lower", "\\u", "bound", "\\u", "contribution", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "l_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Multi", "nomi", "al_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mixture", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "multin", "omial", " ", "mixture", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p0_", "=_", "[_", "0.1_", ",_", "0.5_", ",_", "0.2_", ",_", "0.2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "[_", "0.5_", ",_", "0.1_", ",_", "0.1_", ",_", "0.3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "[_", "0.3_", ",_", "0.2_", ",_", "0.1_", ",_", "0.4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "Mix", "ture_", "(_", "2_", ",_", "Multi", "nomi", "al_", ",_", "10_", ",_", "[_", "p0_", ",_", "p1_", ",_", "p2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "X_", "._", "\\u", "message", "\\u", "to", "\\u", "child_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "All", "Close_", "(_", "u_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "10_", "*_", "np_", "._", "array_", "(_", "p2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kaleidos/django-sampledatahelper/tests/tests.py
[ { "content": " def test_int(self):\n self.assertEqual(self.sd.int(min_value=5, max_value=5), 5)\n\n self.assertTrue(self.sd.int(min_value=1000000000) >= 1000000000)\n self.assertTrue(self.sd.int(max_value=3) <= 3)\n\n self.assertTrue(isinstance(self.sd.int(), int))\n\n val = self.sd.int(5, 10)\n self.assertTrue(val <= 10)\n self.assertTrue(val >= 5)\n\n with self.assertRaises(ParameterError):\n self.sd.int(10, 5)", "metadata": "root.TestNumberHelpers.test_int", "header": "['class', 'TestNumberHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_number(self):\n self.assertTrue(len(str(self.sd.number(5))) <= 5)\n\n with self.assertRaises(ParameterError):\n self.sd.number(0)\n\n with self.assertRaises(ParameterError):\n self.sd.number(-1)", "metadata": "root.TestNumberHelpers.test_number", "header": "['class', 'TestNumberHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_float(self):\n value = self.sd.float(1, 5)\n self.assertTrue(isinstance(value, float))\n self.assertTrue(value >= 1)\n self.assertTrue(value <= 5)\n\n self.assertEqual(self.sd.float(0, 0), 0)\n self.assertEqual(self.sd.float(5, 5), 5)\n self.assertEqual(self.sd.float(-5, -5), -5)\n\n with self.assertRaises(ParameterError):\n self.sd.float(10, 5)", "metadata": "root.TestNumberHelpers.test_float", "header": "['class', 'TestNumberHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_char(self):\n value = self.sd.char()\n self.assertTrue(isinstance(value, six.string_types))\n self.assertTrue(value in string.ascii_letters)", "metadata": "root.TestTextHelpers.test_char", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": " def test_chars(self):\n value = self.sd.chars()\n self.assertTrue(isinstance(value, six.string_types))\n self.assertTrue(len(value) >= 1)\n self.assertTrue(len(value) <= 5)\n\n value = self.sd.chars(5, 5)\n self.assertTrue(len(value) == 5)\n\n self.assertEqual(self.sd.chars(0, 0), '')\n\n with self.assertRaises(ParameterError):\n value = self.sd.chars(10, 5)", "metadata": "root.TestTextHelpers.test_chars", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_words(self):\n value = self.sd.words()\n self.assertTrue(isinstance(value, six.string_types))\n self.assertTrue(len(value.split(' ')) >= 1)\n self.assertTrue(len(value.split(' ')) <= 5)\n\n value = self.sd.words(5, 5)\n self.assertTrue(len(value.split(' ')) == 5)\n\n self.assertEqual(self.sd.words(0, 0), '')\n\n with self.assertRaises(ParameterError):\n value = self.sd.words(10, 5)", "metadata": "root.TestTextHelpers.test_words", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 116 }, { "content": " def test_sentence(self):\n for x in range(1, 10):\n value = self.sd.sentence()\n self.assertTrue(isinstance(value, six.string_types))\n self.assertTrue(len(value) <= 255)", "metadata": "root.TestTextHelpers.test_sentence", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def test_short_sentence(self):\n for x in range(1, 10):\n value = self.sd.short_sentence()\n self.assertTrue(isinstance(value, six.string_types))\n self.assertTrue(len(value) <= 100)", "metadata": "root.TestTextHelpers.test_short_sentence", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 144 }, { "content": " def test_long_sentence(self):\n for x in range(1, 10):\n value = self.sd.long_sentence()\n self.assertTrue(isinstance(value, six.string_types))\n self.assertTrue(len(value) >= 150)", "metadata": "root.TestTextHelpers.test_long_sentence", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_paragraphs(self):\n for x in range(1, 10):\n value = self.sd.paragraphs()\n self.assertTrue(isinstance(value, six.string_types))\n\n self.assertTrue(len(value.split('\\n\\n')) >= 1)\n self.assertTrue(len(value.split('\\n\\n')) <= 5)\n\n with self.assertRaises(ParameterError):\n value = self.sd.paragraphs(5, 1)", "metadata": "root.TestTextHelpers.test_paragraphs", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 160 }, { "content": " def test_tags(self):\n value = self.sd.tags()\n self.assertTrue(isinstance(value, six.string_types))\n\n value = self.sd.tags(5, 5)\n self.assertEqual(len(value.split(',')), 5)\n\n value = self.sd.tags(5, 5, ['a', 'b', 'c'])\n self.assertTrue(value.split(',')[0] in ['a', 'b', 'c'])\n\n with self.assertRaises(ParameterError):\n value = self.sd.tags(10, 5)", "metadata": "root.TestTextHelpers.test_tags", "header": "['class', 'TestTextHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 182 }, { "content": " def test_date_between(self):\n value = self.sd.date_between(\n datetime.date(year=2000, month=1, day=1),\n datetime.date(year=2001, month=1, day=1),\n )\n self.assertTrue(isinstance(value, datetime.date))\n self.assertTrue(value > datetime.date(year=2000, month=1, day=1))\n self.assertTrue(value < datetime.date(year=2001, month=1, day=1))\n\n with self.assertRaises(ParameterError):\n self.sd.date_between(\n datetime.date(year=2001, month=1, day=1),\n datetime.date(year=2000, month=1, day=1),\n )", "metadata": "root.TestTimeHelpers.test_date_between", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 201 }, { "content": " def test_future_date(self):\n value = self.sd.future_date()\n self.assertTrue(isinstance(value, datetime.date))\n\n self.assertTrue(value >= datetime.date.today())\n self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=365)))\n\n value = self.sd.future_date(0, 10)\n self.assertTrue(value >= datetime.date.today())\n self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=10)))\n\n with self.assertRaises(ParameterError):\n self.sd.future_date(100, 0)\n\n with self.assertRaises(ParameterError):\n self.sd.future_date(-10, 10)", "metadata": "root.TestTimeHelpers.test_future_date", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 216 }, { "content": " def test_past_date(self):\n value = self.sd.past_date()\n self.assertTrue(isinstance(value, datetime.date))\n\n self.assertTrue(value <= datetime.date.today())\n self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=365)))\n\n value = self.sd.past_date(0, 10)\n self.assertTrue(value <= datetime.date.today())\n self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=10)))\n\n with self.assertRaises(ParameterError):\n self.sd.past_date(100, 0)\n\n with self.assertRaises(ParameterError):\n self.sd.past_date(-10, 10)", "metadata": "root.TestTimeHelpers.test_past_date", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 233 }, { "content": " def test_datetime_between(self):\n value = self.sd.datetime_between(\n datetime.datetime(year=2000, month=1, day=1),\n datetime.datetime(year=2001, month=1, day=1),\n )\n self.assertTrue(isinstance(value, datetime.datetime))\n self.assertTrue(value > datetime.datetime(year=2000, month=1, day=1))\n self.assertTrue(value < datetime.datetime(year=2001, month=1, day=1))\n\n with self.assertRaises(ParameterError):\n self.sd.datetime_between(\n datetime.datetime(year=2001, month=1, day=1),\n datetime.datetime(year=2000, month=1, day=1),\n )", "metadata": "root.TestTimeHelpers.test_datetime_between", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 250 }, { "content": " def test_future_datetime(self):\n now = datetime.datetime.utcnow().replace(tzinfo=utc)\n value = self.sd.future_datetime()\n self.assertTrue(isinstance(value, datetime.datetime))\n\n self.assertTrue(value >= now)\n self.assertTrue(value <= (now + datetime.timedelta(minutes=1440)))\n\n now = datetime.datetime.utcnow().replace(tzinfo=utc)\n value = self.sd.future_datetime(1, 10)\n self.assertTrue(value >= now)\n self.assertTrue(value <= (now + datetime.timedelta(minutes=10)))\n\n with self.assertRaises(ParameterError):\n self.sd.future_datetime(100, 0)\n\n with self.assertRaises(ParameterError):\n self.sd.future_datetime(-10, 10)", "metadata": "root.TestTimeHelpers.test_future_datetime", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 265 }, { "content": " def test_past_datetime(self):\n value = self.sd.past_datetime()\n self.assertTrue(isinstance(value, datetime.datetime))\n\n self.assertTrue(value <= datetime.datetime.utcnow().replace(tzinfo=utc))\n self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=1440)))\n\n value = self.sd.past_datetime(0, 10)\n self.assertTrue(value <= datetime.datetime.utcnow().replace(tzinfo=utc))\n self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=10)))\n\n with self.assertRaises(ParameterError):\n self.sd.past_datetime(100, 0)\n\n with self.assertRaises(ParameterError):\n self.sd.past_datetime(-10, 10)", "metadata": "root.TestTimeHelpers.test_past_datetime", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 284 }, { "content": " def test_date(self):\n value = self.sd.date()\n self.assertTrue(isinstance(value, datetime.date))\n\n self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=365)))\n self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=365)))\n\n value = self.sd.date(-10, 10)\n self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=10)))\n self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=10)))\n\n with self.assertRaises(ParameterError):\n self.sd.date(100, 0)", "metadata": "root.TestTimeHelpers.test_date", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 301 }, { "content": " def test_datetime(self):\n value = self.sd.datetime()\n self.assertTrue(isinstance(value, datetime.datetime))\n\n self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=1440)))\n self.assertTrue(value <= (datetime.datetime.utcnow().replace(tzinfo=utc) + datetime.timedelta(minutes=1440)))\n\n value = self.sd.datetime(-10, 10)\n self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=10)))\n self.assertTrue(value <= (datetime.datetime.utcnow().replace(tzinfo=utc) + datetime.timedelta(minutes=10)))\n\n with self.assertRaises(ParameterError):\n self.sd.datetime(100, 0)", "metadata": "root.TestTimeHelpers.test_datetime", "header": "['class', 'TestTimeHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 315 }, { "content": " def test_state_code(self):\n value = self.sd.state_code('es')\n self.assertTrue(value in ['01', '02', '03', '04', '05', '06', '07',\n '08', '09', '10', '11', '12', '13', '14',\n '15', '16', '17', '18', '19', '20', '21',\n '22', '23', '24', '25', '26', '27', '28',\n '29', '30', '31', '32', '33', '34', '35',\n '36', '37', '38', '39', '40', '41', '42',\n '43', '44', '45', '46', '47', '48', '49',\n '50', '51', '52', 'AD', ])\n\n value = self.sd.state_code('us')\n self.assertTrue(value in ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT',\n 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN',\n 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA',\n 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV',\n 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH',\n 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN',\n 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI',\n 'WY', 'AS', 'DC', 'FM', 'GU', 'MH', 'MP',\n 'PW', 'PR', 'VI', ])\n\n with self.assertRaises(ParameterError):\n self.sd.state_code('invalid-code')", "metadata": "root.TestLocalizedHelpers.test_state_code", "header": "['class', 'TestLocalizedHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 339 }, { "content": " def test_phone(self):\n value = self.sd.phone(locale='es')\n self.assertTrue(isinstance(value, six.string_types))\n self.assertEqual(len(value), 9)\n self.assertTrue(value[0] in ['6', '9'])\n\n value = self.sd.phone(locale='es', country_code=True)\n self.assertTrue(isinstance(value, six.string_types))\n self.assertEqual(len(value), 13)\n self.assertTrue(value[0:5] in ['+34 6', '+34 9'])\n\n with self.assertRaises(ParameterError):\n value = self.sd.phone(locale=\"not-valid-locale\")", "metadata": "root.TestLocalizedHelpers.test_phone", "header": "['class', 'TestLocalizedHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 465 }, { "content": " def test_id_card(self):\n value = self.sd.id_card(locale='es')\n self.assertTrue(isinstance(value, six.string_types))\n self.assertEqual(len(value), 9)\n self.assertTrue(value[8] in \"TRWAGMYFPDXBNJZSQVHLCKET\")\n\n with self.assertRaises(ParameterError):\n value = self.sd.id_card(locale=\"not-valid-locale\")", "metadata": "root.TestLocalizedHelpers.test_id_card", "header": "['class', 'TestLocalizedHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 487 }, { "content": " def test_hex_chars(self):\n value = self.sd.hex_chars()\n self.assertTrue(isinstance(value, six.string_types))\n self.assertTrue(len(value) >= 1)\n self.assertTrue(len(value) <= 5)\n\n value = self.sd.hex_chars(5, 5)\n self.assertTrue(len(value) == 5)\n\n self.assertEqual(self.sd.hex_chars(0, 0), '')\n\n with self.assertRaises(ParameterError):\n value = self.sd.hex_chars(10, 5)", "metadata": "root.TestOtherHelpers.test_hex_chars", "header": "['class', 'TestOtherHelpers', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 585 } ]
[ { "span": "self.assertTrue(self.sd.int(min_value=1000000000) >= 1000000000)", "start_line": 34, "start_column": 8, "end_line": 34, "end_column": 72 }, { "span": "self.assertTrue(self.sd.int(max_value=3) <= 3)", "start_line": 35, "start_column": 8, "end_line": 35, "end_column": 54 }, { "span": "self.assertTrue(val <= 10)", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 34 }, { "span": "self.assertTrue(val >= 5)", "start_line": 41, "start_column": 8, "end_line": 41, "end_column": 33 }, { "span": "self.assertTrue(len(str(self.sd.number(5))) <= 5)", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 57 }, { "span": "self.assertTrue(value >= 1)", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 35 }, { "span": "self.assertTrue(value <= 5)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 35 }, { "span": "self.assertTrue(value in string.ascii_letters)", "start_line": 96, "start_column": 8, "end_line": 96, "end_column": 54 }, { "span": "self.assertTrue(len(value) >= 1)", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 40 }, { "span": "self.assertTrue(len(value) <= 5)", "start_line": 102, "start_column": 8, "end_line": 102, "end_column": 40 }, { "span": "self.assertTrue(len(value) == 5)", "start_line": 105, "start_column": 8, "end_line": 105, "end_column": 40 }, { "span": "self.assertTrue(len(value.split(' ')) >= 1)", "start_line": 119, "start_column": 8, "end_line": 119, "end_column": 51 }, { "span": "self.assertTrue(len(value.split(' ')) <= 5)", "start_line": 120, "start_column": 8, "end_line": 120, "end_column": 51 }, { "span": "self.assertTrue(len(value.split(' ')) == 5)", "start_line": 123, "start_column": 8, "end_line": 123, "end_column": 51 }, { "span": "self.assertTrue(len(value) <= 255)", "start_line": 142, "start_column": 12, "end_line": 142, "end_column": 46 }, { "span": "self.assertTrue(len(value) <= 100)", "start_line": 148, "start_column": 12, "end_line": 148, "end_column": 46 }, { "span": "self.assertTrue(len(value) >= 150)", "start_line": 154, "start_column": 12, "end_line": 154, "end_column": 46 }, { "span": "self.assertTrue(len(value.split('\\n\\n')) >= 1)", "start_line": 165, "start_column": 12, "end_line": 165, "end_column": 58 }, { "span": "self.assertTrue(len(value.split('\\n\\n')) <= 5)", "start_line": 166, "start_column": 12, "end_line": 166, "end_column": 58 }, { "span": "self.assertTrue(value.split(',')[0] in ['a', 'b', 'c'])", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 63 }, { "span": "self.assertTrue(value > datetime.date(year=2000, month=1, day=1))", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 73 }, { "span": "self.assertTrue(value < datetime.date(year=2001, month=1, day=1))", "start_line": 208, "start_column": 8, "end_line": 208, "end_column": 73 }, { "span": "self.assertTrue(value >= datetime.date.today())", "start_line": 220, "start_column": 8, "end_line": 220, "end_column": 55 }, { "span": "self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=365)))", "start_line": 221, "start_column": 8, "end_line": 221, "end_column": 88 }, { "span": "self.assertTrue(value >= datetime.date.today())", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 55 }, { "span": "self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=10)))", "start_line": 225, "start_column": 8, "end_line": 225, "end_column": 87 }, { "span": "self.assertTrue(value <= datetime.date.today())", "start_line": 237, "start_column": 8, "end_line": 237, "end_column": 55 }, { "span": "self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=365)))", "start_line": 238, "start_column": 8, "end_line": 238, "end_column": 88 }, { "span": "self.assertTrue(value <= datetime.date.today())", "start_line": 241, "start_column": 8, "end_line": 241, "end_column": 55 }, { "span": "self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=10)))", "start_line": 242, "start_column": 8, "end_line": 242, "end_column": 87 }, { "span": "self.assertTrue(value > datetime.datetime(year=2000, month=1, day=1))", "start_line": 256, "start_column": 8, "end_line": 256, "end_column": 77 }, { "span": "self.assertTrue(value < datetime.datetime(year=2001, month=1, day=1))", "start_line": 257, "start_column": 8, "end_line": 257, "end_column": 77 }, { "span": "self.assertTrue(value >= now)", "start_line": 270, "start_column": 8, "end_line": 270, "end_column": 37 }, { "span": "self.assertTrue(value <= (now + datetime.timedelta(minutes=1440)))", "start_line": 271, "start_column": 8, "end_line": 271, "end_column": 74 }, { "span": "self.assertTrue(value >= now)", "start_line": 275, "start_column": 8, "end_line": 275, "end_column": 37 }, { "span": "self.assertTrue(value <= (now + datetime.timedelta(minutes=10)))", "start_line": 276, "start_column": 8, "end_line": 276, "end_column": 72 }, { "span": "self.assertTrue(value <= datetime.datetime.utcnow().replace(tzinfo=utc))", "start_line": 288, "start_column": 8, "end_line": 288, "end_column": 80 }, { "span": "self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=1440)))", "start_line": 289, "start_column": 8, "end_line": 289, "end_column": 117 }, { "span": "self.assertTrue(value <= datetime.datetime.utcnow().replace(tzinfo=utc))", "start_line": 292, "start_column": 8, "end_line": 292, "end_column": 80 }, { "span": "self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=10)))", "start_line": 293, "start_column": 8, "end_line": 293, "end_column": 115 }, { "span": "self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=365)))", "start_line": 305, "start_column": 8, "end_line": 305, "end_column": 88 }, { "span": "self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=365)))", "start_line": 306, "start_column": 8, "end_line": 306, "end_column": 88 }, { "span": "self.assertTrue(value >= (datetime.date.today() - datetime.timedelta(days=10)))", "start_line": 309, "start_column": 8, "end_line": 309, "end_column": 87 }, { "span": "self.assertTrue(value <= (datetime.date.today() + datetime.timedelta(days=10)))", "start_line": 310, "start_column": 8, "end_line": 310, "end_column": 87 }, { "span": "self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=1440)))", "start_line": 319, "start_column": 8, "end_line": 319, "end_column": 117 }, { "span": "self.assertTrue(value <= (datetime.datetime.utcnow().replace(tzinfo=utc) + datetime.timedelta(minutes=1440)))", "start_line": 320, "start_column": 8, "end_line": 320, "end_column": 117 }, { "span": "self.assertTrue(value >= (datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=10)))", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 115 }, { "span": "self.assertTrue(value <= (datetime.datetime.utcnow().replace(tzinfo=utc) + datetime.timedelta(minutes=10)))", "start_line": 324, "start_column": 8, "end_line": 324, "end_column": 115 }, { "span": "self.assertTrue(value in ['01', '02', '03', '04', '05', '06', '07',\n '08', '09', '10', '11', '12', '13', '14',\n '15', '16', '17', '18', '19', '20', '21',\n '22', '23', '24', '25', '26', '27', '28',\n '29', '30', '31', '32', '33', '34', '35',\n '36', '37', '38', '39', '40', '41', '42',\n '43', '44', '45', '46', '47', '48', '49',\n '50', '51', '52', 'AD', ])", "start_line": 341, "start_column": 8, "end_line": 348, "end_column": 60 }, { "span": "self.assertTrue(value in ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT',\n 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN',\n 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA',\n 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV',\n 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH',\n 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN',\n 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI',\n 'WY', 'AS', 'DC', 'FM', 'GU', 'MH', 'MP',\n 'PW', 'PR', 'VI', ])", "start_line": 351, "start_column": 8, "end_line": 359, "end_column": 54 }, { "span": "self.assertTrue(value[0] in ['6', '9'])", "start_line": 469, "start_column": 8, "end_line": 469, "end_column": 47 }, { "span": "self.assertTrue(value[0:5] in ['+34 6', '+34 9'])", "start_line": 474, "start_column": 8, "end_line": 474, "end_column": 57 }, { "span": "self.assertTrue(value[8] in \"TRWAGMYFPDXBNJZSQVHLCKET\")", "start_line": 491, "start_column": 8, "end_line": 491, "end_column": 63 }, { "span": "self.assertTrue(len(value) >= 1)", "start_line": 588, "start_column": 8, "end_line": 588, "end_column": 40 }, { "span": "self.assertTrue(len(value) <= 5)", "start_line": 589, "start_column": 8, "end_line": 589, "end_column": 40 }, { "span": "self.assertTrue(len(value) == 5)", "start_line": 592, "start_column": 8, "end_line": 592, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Number", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "int_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sd_", "._", "int_", "(_", "min", "\\u", "value_", "=_", "5_", ",_", "max", "\\u", "value_", "=_", "5_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "sd_", "._", "int_", "(_", "min", "\\u", "value_", "=_", "1000000000", "_", ")_", ">=_", "1000000000", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "sd_", "._", "int_", "(_", "max", "\\u", "value_", "=_", "3_", ")_", "<=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "self_", "._", "sd_", "._", "int_", "(_", ")_", ",_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "self_", "._", "sd_", "._", "int_", "(_", "5_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "val_", "<=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "val_", ">=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "int_", "(_", "10_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Number", "Helpers_", "(_", "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", "number_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "len_", "(_", "str_", "(_", "self_", "._", "sd_", "._", "number_", "(_", "5_", ")_", ")_", ")_", "<=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "number_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "number_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Number", "Helpers_", "(_", "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", "float_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "float_", "(_", "1_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "float_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sd_", "._", "float_", "(_", "0_", ",_", "0_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sd_", "._", "float_", "(_", "5_", ",_", "5_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sd_", "._", "float_", "(_", "-_", "5_", ",_", "-_", "5_", ")_", ",_", "-_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "float_", "(_", "10_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "char_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "char_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "in_", "string_", "._", "ascii", "\\u", "letters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "chars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "chars_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", ">=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", "<=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "chars_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sd_", "._", "chars_", "(_", "0_", ",_", "0_", ")_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "chars_", "(_", "10_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "words_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "words_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", ">=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", "<=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "words_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", "._", "split_", "(_", "'", " ", "'_", ")_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sd_", "._", "words_", "(_", "0_", ",_", "0_", ")_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "words_", "(_", "10_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "sentence_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "1_", ",_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "sentence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", "<=_", "255_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "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", "short", "\\u", "sentence_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "1_", ",_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "short", "\\u", "sentence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", "<=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "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", "long", "\\u", "sentence_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "1_", ",_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "long", "\\u", "sentence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", ">=_", "150_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "paragraphs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "1_", ",_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "paragraphs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", "._", "split_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", ")_", ">=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", "._", "split_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", ")_", "<=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "paragraphs_", "(_", "5_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Text", "Helpers_", "(_", "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", "tags_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "tags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "tags_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "value_", "._", "split_", "(_", "','_", ")_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "tags_", "(_", "5_", ",_", "5_", ",_", "[_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "c", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "._", "split_", "(_", "','_", ")_", "[_", "0_", "]_", "in_", "[_", "'", "a", "'_", ",_", "'", "b", "'_", ",_", "'", "c", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "tags_", "(_", "10_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "date", "\\u", "between_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "date", "\\u", "between_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "date_", "(_", "year_", "=_", "2000_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "date_", "(_", "year_", "=_", "2001_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">_", "datetime_", "._", "date_", "(_", "year_", "=_", "2000_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<_", "datetime_", "._", "date_", "(_", "year_", "=_", "2001_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "date", "\\u", "between_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "date_", "(_", "year_", "=_", "2001_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "date_", "(_", "year_", "=_", "2000_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "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", "future", "\\u", "date_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "future", "\\u", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "365_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "future", "\\u", "date_", "(_", "0_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "future", "\\u", "date_", "(_", "100_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "future", "\\u", "date_", "(_", "-_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "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", "past", "\\u", "date_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "past", "\\u", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "365_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "past", "\\u", "date_", "(_", "0_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "past", "\\u", "date_", "(_", "100_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "past", "\\u", "date_", "(_", "-_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "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", "datetime", "\\u", "between_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "datetime", "\\u", "between_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "datetime_", "(_", "year_", "=_", "2000_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "datetime_", "(_", "year_", "=_", "2001_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">_", "datetime_", "._", "datetime_", "(_", "year_", "=_", "2000_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<_", "datetime_", "._", "datetime_", "(_", "year_", "=_", "2001_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "datetime", "\\u", "between_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "datetime_", "(_", "year_", "=_", "2001_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "datetime_", "(_", "year_", "=_", "2000_", ",_", "month_", "=_", "1_", ",_", "day_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "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", "future", "\\u", "datetime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "future", "\\u", "datetime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "now_", "+_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "1440", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "future", "\\u", "datetime_", "(_", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "now_", "+_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "future", "\\u", "datetime_", "(_", "100_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "future", "\\u", "datetime_", "(_", "-_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "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", "past", "\\u", "datetime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "past", "\\u", "datetime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "1440", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "past", "\\u", "datetime_", "(_", "0_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "past", "\\u", "datetime_", "(_", "100_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "past", "\\u", "datetime_", "(_", "-_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "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", "date_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "365_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "365_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "date_", "(_", "-_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "date_", "(_", "100_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Time", "Helpers_", "(_", "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", "datetime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "datetime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "1440", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "1440", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "datetime_", "(_", "-_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", ">=_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "<=_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "utc_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "10_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "datetime_", "(_", "100_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Locali", "zed", "Helpers_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "state", "\\u", "code_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "state", "\\u", "code_", "(_", "'", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "in_", "[_", "'", "01", "'_", ",_", "'", "02", "'_", ",_", "'", "03", "'_", ",_", "'", "04", "'_", ",_", "'", "05", "'_", ",_", "'", "0", "6", "'_", ",_", "'", "0", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "0", "8", "'_", ",_", "'", "09", "'_", ",_", "'", "10", "'_", ",_", "'", "11", "'_", ",_", "'", "1", "2", "'_", ",_", "'", "13", "'_", ",_", "'", "14", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "15", "'_", ",_", "'", "16", "'_", ",_", "'", "1", "7", "'_", ",_", "'", "1", "8", "'_", ",_", "'", "1", "9", "'_", ",_", "'", "20", "'_", ",_", "'", "21", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "2", "2", "'_", ",_", "'", "23", "'_", ",_", "'", "24", "'_", ",_", "'", "25", "'_", ",_", "'", "2", "6", "'_", ",_", "'", "2", "7", "'_", ",_", "'", "2", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "2", "9", "'_", ",_", "'", "30", "'_", ",_", "'", "3", "1", "'_", ",_", "'", "32", "'_", ",_", "'", "3", "3", "'_", ",_", "'", "3", "4", "'_", ",_", "'", "3", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "3", "6", "'_", ",_", "'", "3", "7", "'_", ",_", "'", "3", "8", "'_", ",_", "'", "3", "9", "'_", ",_", "'", "40", "'_", ",_", "'", "4", "1", "'_", ",_", "'", "4", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "4", "3", "'_", ",_", "'", "4", "4", "'_", ",_", "'", "4", "5", "'_", ",_", "'", "4", "6", "'_", ",_", "'", "4", "7", "'_", ",_", "'", "4", "8", "'_", ",_", "'", "4", "9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "50", "'_", ",_", "'", "5", "1", "'_", ",_", "'", "5", "2", "'_", ",_", "'", "AD", "'_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "state", "\\u", "code_", "(_", "'", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "in_", "[_", "'", "AL", "'_", ",_", "'", "AK", "'_", ",_", "'", "AZ", "'_", ",_", "'", "AR", "'_", ",_", "'", "CA", "'_", ",_", "'", "CO", "'_", ",_", "'", "CT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DE", "'_", ",_", "'", "FL", "'_", ",_", "'", "GA", "'_", ",_", "'", "HI", "'_", ",_", "'", "ID", "'_", ",_", "'", "IL", "'_", ",_", "'", "IN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IA", "'_", ",_", "'", "KS", "'_", ",_", "'", "KY", "'_", ",_", "'", "LA", "'_", ",_", "'", "ME", "'_", ",_", "'", "MD", "'_", ",_", "'", "MA", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MI", "'_", ",_", "'", "MN", "'_", ",_", "'", "MS", "'_", ",_", "'", "MO", "'_", ",_", "'", "MT", "'_", ",_", "'", "NE", "'_", ",_", "'", "NV", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NH", "'_", ",_", "'", "NJ", "'_", ",_", "'", "NM", "'_", ",_", "'", "NY", "'_", ",_", "'", "NC", "'_", ",_", "'", "ND", "'_", ",_", "'", "OH", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "OK", "'_", ",_", "'", "OR", "'_", ",_", "'", "PA", "'_", ",_", "'", "RI", "'_", ",_", "'", "SC", "'_", ",_", "'", "SD", "'_", ",_", "'", "TN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TX", "'_", ",_", "'", "UT", "'_", ",_", "'", "VT", "'_", ",_", "'", "VA", "'_", ",_", "'", "WA", "'_", ",_", "'", "WV", "'_", ",_", "'", "WI", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "WY", "'_", ",_", "'", "AS", "'_", ",_", "'", "DC", "'_", ",_", "'", "FM", "'_", ",_", "'", "GU", "'_", ",_", "'", "MH", "'_", ",_", "'", "MP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PW", "'_", ",_", "'", "PR", "'_", ",_", "'", "VI", "'_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sd_", "._", "state", "\\u", "code_", "(_", "'", "invalid", "-", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Locali", "zed", "Helpers_", "(_", "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", "phone_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "phone_", "(_", "locale_", "=_", "'", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "value_", ")_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "[_", "0_", "]_", "in_", "[_", "'", "6", "'_", ",_", "'", "9", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "phone_", "(_", "locale_", "=_", "'", "es", "'_", ",_", "countr", "y", "\\u", "code_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "value_", ")_", ",_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "[_", "0_", ":_", "5_", "]_", "in_", "[_", "'+", "3", "4", " ", "6", "'_", ",_", "'+", "3", "4", " ", "9", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "phone_", "(_", "locale_", "=_", "\"", "not", "-", "valid", "-", "locale", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Locali", "zed", "Helpers_", "(_", "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", "id", "\\u", "card_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "id", "\\u", "card_", "(_", "locale_", "=_", "'", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "value_", ")_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "value_", "[_", "8_", "]_", "in_", "\"", "TR", "WA", "GM", "YF", "PD", "XB", "NJ", "ZS", "QV", "HL", "CK", "ET", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "id", "\\u", "card_", "(_", "locale_", "=_", "\"", "not", "-", "valid", "-", "locale", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ot", "her", "Helpers_", "(_", "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", "hex", "\\u", "chars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "hex", "\\u", "chars_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", ">=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", "<=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "._", "sd_", "._", "hex", "\\u", "chars_", "(_", "5_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "value_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "sd_", "._", "hex", "\\u", "chars_", "(_", "0_", ",_", "0_", ")_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Parameter", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "sd_", "._", "hex", "\\u", "chars_", "(_", "10_", ",_", "5_", ")_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 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 ]
Unused local variable
saltstack/salt/salt/modules/lxc.py
[ { "content": "def _network_conf(conf_tuples=None, **kwargs):\n '''\n Network configuration defaults\n\n network_profile\n as for containers, we can either call this function\n either with a network_profile dict or network profile name\n in the kwargs\n nic_opts\n overrides or extra nics in the form {nic_name: {set: tings}\n\n '''\n nic = kwargs.get('network_profile', None)\n ret = []\n nic_opts = kwargs.get('nic_opts', {})\n if nic_opts is None:\n # coming from elsewhere\n nic_opts = {}\n if not conf_tuples:\n conf_tuples = []\n old = _get_veths(conf_tuples)\n if not old:\n old = {}\n\n # if we have a profile name, get the profile and load the network settings\n # this will obviously by default look for a profile called \"eth0\"\n # or by what is defined in nic_opts\n # and complete each nic settings by sane defaults\n if nic and isinstance(nic, (six.string_types, dict)):\n nicp = get_network_profile(nic)\n else:\n nicp = {}\n if DEFAULT_NIC not in nicp:\n nicp[DEFAULT_NIC] = {}\n\n kwargs = copy.deepcopy(kwargs)\n gateway = kwargs.pop('gateway', None)\n bridge = kwargs.get('bridge', None)\n if nic_opts:\n for dev, args in six.iteritems(nic_opts):\n ethx = nicp.setdefault(dev, {})\n try:\n ethx = salt.utils.dictupdate.update(ethx, args)\n except AttributeError:\n raise SaltInvocationError('Invalid nic_opts configuration')\n ifs = [a for a in nicp]\n ifs += [a for a in old if a not in nicp]\n ifs.sort()\n gateway_set = False\n for dev in ifs:\n args = nicp.get(dev, {})\n opts = nic_opts.get(dev, {}) if nic_opts else {}\n old_if = old.get(dev, {})\n disable = opts.get('disable', args.get('disable', False))\n if disable:\n continue\n mac = opts.get('mac',\n opts.get('hwaddr',\n args.get('mac',\n args.get('hwaddr', ''))))\n type_ = opts.get('type', args.get('type', ''))\n flags = opts.get('flags', args.get('flags', ''))\n link = opts.get('link', args.get('link', ''))\n ipv4 = opts.get('ipv4', args.get('ipv4', ''))\n ipv6 = opts.get('ipv6', args.get('ipv6', ''))\n infos = salt.utils.odict.OrderedDict([\n ('lxc.network.type', {\n 'test': not type_,\n 'value': type_,\n 'old': old_if.get('lxc.network.type'),\n 'default': 'veth'}),\n ('lxc.network.name', {\n 'test': False,\n 'value': dev,\n 'old': dev,\n 'default': dev}),\n ('lxc.network.flags', {\n 'test': not flags,\n 'value': flags,\n 'old': old_if.get('lxc.network.flags'),\n 'default': 'up'}),\n ('lxc.network.link', {\n 'test': not link,\n 'value': link,\n 'old': old_if.get('lxc.network.link'),\n 'default': search_lxc_bridge()}),\n ('lxc.network.hwaddr', {\n 'test': not mac,\n 'value': mac,\n 'old': old_if.get('lxc.network.hwaddr'),\n 'default': salt.utils.gen_mac()}),\n ('lxc.network.ipv4', {\n 'test': not ipv4,\n 'value': ipv4,\n 'old': old_if.get('lxc.network.ipv4', ''),\n 'default': None}),\n ('lxc.network.ipv6', {\n 'test': not ipv6,\n 'value': ipv6,\n 'old': old_if.get('lxc.network.ipv6', ''),\n 'default': None})])\n # for each parameter, if not explicitly set, the\n # config value present in the LXC configuration should\n # take precedence over the profile configuration\n for info in list(infos.keys()):\n bundle = infos[info]\n if bundle['test']:\n if bundle['old']:\n bundle['value'] = bundle['old']\n elif bundle['default']:\n bundle['value'] = bundle['default']\n for info, data in six.iteritems(infos):\n if data['value']:\n ret.append({info: data['value']})\n for key, val in six.iteritems(args):\n if key == 'link' and bridge:\n val = bridge\n val = opts.get(key, val)\n if key in [\n 'type', 'flags', 'name',\n 'gateway', 'mac', 'link', 'ipv4', 'ipv6'\n ]:\n continue\n ret.append({'lxc.network.{0}'.format(key): val})\n # gateway (in automode) must be appended following network conf !\n if not gateway:\n gateway = args.get('gateway', None)\n if gateway is not None and not gateway_set:\n ret.append({'lxc.network.ipv4.gateway': gateway})\n # only one network gateway ;)\n gateway_set = True\n # normally, this won't happen\n # set the gateway if specified even if we did\n # not managed the network underlying\n if gateway is not None and not gateway_set:\n ret.append({'lxc.network.ipv4.gateway': gateway})\n # only one network gateway ;)\n gateway_set = True\n\n new = _get_veths(ret)\n # verify that we did not loose the mac settings\n for iface in [a for a in new]:\n ndata = new[iface]\n nmac = ndata.get('lxc.network.hwaddr', '')\n ntype = ndata.get('lxc.network.type', '')\n omac, otype = '', ''\n if iface in old:\n odata = old[iface]\n omac = odata.get('lxc.network.hwaddr', '')\n otype = odata.get('lxc.network.type', '')\n # default for network type is setted here\n # attention not to change the network type\n # without a good and explicit reason to.\n if otype and not ntype:\n ntype = otype\n if not ntype:\n ntype = 'veth'\n new[iface]['lxc.network.type'] = ntype\n if omac and not nmac:\n new[iface]['lxc.network.hwaddr'] = omac\n\n ret = []\n for val in six.itervalues(new):\n for row in val:\n ret.append(salt.utils.odict.OrderedDict([(row, val[row])]))\n # on old versions of lxc, still support the gateway auto mode\n # if we didnt explicitly say no to\n # (lxc.network.ipv4.gateway: auto)\n if (\n distutils.version.LooseVersion(version()) <= '1.0.7' and\n True not in ['lxc.network.ipv4.gateway' in a for a in ret] and\n True in ['lxc.network.ipv4' in a for a in ret]\n ):\n ret.append({'lxc.network.ipv4.gateway': 'auto'})\n return ret", "metadata": "root._network_conf", "header": "['module', '___EOS___']", "index": 701 }, { "content": "def init(name,\n config=None,\n cpuset=None,\n cpushare=None,\n memory=None,\n profile=None,\n network_profile=None,\n nic=_marker,\n nic_opts=None,\n cpu=None,\n autostart=True,\n password=None,\n password_encrypted=None,\n users=None,\n dnsservers=None,\n searchdomains=None,\n bridge=None,\n gateway=None,\n pub_key=None,\n priv_key=None,\n force_install=False,\n unconditional_install=False,\n bootstrap_delay=None,\n bootstrap_args=None,\n bootstrap_shell=None,\n bootstrap_url=None,\n **kwargs):\n '''\n Initialize a new container.\n\n This is a partial idempotent function as if it is already provisioned, we\n will reset a bit the lxc configuration file but much of the hard work will\n be escaped as markers will prevent re-execution of harmful tasks.\n\n name\n Name of the container\n\n image\n A tar archive to use as the rootfs for the container. Conflicts with\n the ``template`` argument.\n\n cpus\n Select a random number of cpu cores and assign it to the cpuset, if the\n cpuset option is set then this option will be ignored\n\n cpuset\n Explicitly define the cpus this container will be bound to\n\n cpushare\n cgroups cpu shares\n\n autostart\n autostart container on reboot\n\n memory\n cgroups memory limit, in MB\n\n .. versionchanged:: 2015.5.0\n If no value is passed, no limit is set. In earlier Salt versions,\n not passing this value causes a 1024MB memory limit to be set, and\n it was necessary to pass ``memory=0`` to set no limit.\n\n gateway\n the ipv4 gateway to use\n the default does nothing more than lxcutils does\n\n bridge\n the bridge to use\n the default does nothing more than lxcutils does\n\n network_profile\n Network profile to use for the container\n\n .. versionadded:: 2015.5.0\n\n nic\n .. deprecated:: 2015.5.0\n Use ``network_profile`` instead\n\n nic_opts\n Extra options for network interfaces, will override\n\n ``{\"eth0\": {\"hwaddr\": \"aa:bb:cc:dd:ee:ff\", \"ipv4\": \"10.1.1.1\", \"ipv6\": \"2001:db8::ff00:42:8329\"}}``\n\n or\n\n ``{\"eth0\": {\"hwaddr\": \"aa:bb:cc:dd:ee:ff\", \"ipv4\": \"10.1.1.1/24\", \"ipv6\": \"2001:db8::ff00:42:8329\"}}``\n\n users\n Users for which the password defined in the ``password`` param should\n be set. Can be passed as a comma separated list or a python list.\n Defaults to just the ``root`` user.\n\n password\n Set the initial password for the users defined in the ``users``\n parameter\n\n password_encrypted : False\n Set to ``True`` to denote a password hash instead of a plaintext\n password\n\n .. versionadded:: 2015.5.0\n\n profile\n A LXC profile (defined in config or pillar).\n This can be either a real profile mapping or a string\n to retrieve it in configuration\n\n start\n Start the newly-created container\n\n dnsservers\n list of dns servers to set in the container, default [] (no setting)\n\n seed\n Seed the container with the minion config. Default: ``True``\n\n install\n If salt-minion is not already installed, install it. Default: ``True``\n\n config\n Optional config parameters. By default, the id is set to\n the name of the container.\n\n master\n salt master (default to minion's master)\n\n master_port\n salt master port (default to minion's master port)\n\n pub_key\n Explicit public key to preseed the minion with (optional).\n This can be either a filepath or a string representing the key\n\n priv_key\n Explicit private key to preseed the minion with (optional).\n This can be either a filepath or a string representing the key\n\n approve_key\n If explicit preseeding is not used;\n Attempt to request key approval from the master. Default: ``True``\n\n path\n path to the container parent directory\n default: /var/lib/lxc (system)\n\n .. versionadded:: 2015.8.0\n\n clone\n .. deprecated:: 2015.5.0\n Use ``clone_from`` instead\n\n clone_from\n Original from which to use a clone operation to create the container.\n Default: ``None``\n\n bootstrap_delay\n Delay in seconds between end of container creation and bootstrapping.\n Useful when waiting for container to obtain a DHCP lease.\n\n .. versionadded:: 2015.5.0\n\n bootstrap_url\n See lxc.bootstrap\n\n bootstrap_shell\n See lxc.bootstrap\n\n bootstrap_args\n See lxc.bootstrap\n\n force_install\n Force installation even if salt-minion is detected,\n this is the way to run vendor bootstrap scripts even\n if a salt minion is already present in the container\n\n unconditional_install\n Run the script even if the container seems seeded\n\n CLI Example:\n\n .. code-block:: bash\n\n salt 'minion' lxc.init name [cpuset=cgroups_cpuset] \\\\\n [cpushare=cgroups_cpushare] [memory=cgroups_memory] \\\\\n [nic=nic_profile] [profile=lxc_profile] \\\\\n [nic_opts=nic_opts] [start=(True|False)] \\\\\n [seed=(True|False)] [install=(True|False)] \\\\\n [config=minion_config] [approve_key=(True|False) \\\\\n [clone_from=original] [autostart=True] \\\\\n [priv_key=/path_or_content] [pub_key=/path_or_content] \\\\\n [bridge=lxcbr0] [gateway=10.0.3.1] \\\\\n [dnsservers[dns1,dns2]] \\\\\n [users=[foo]] [password='secret'] \\\\\n [password_encrypted=(True|False)]\n\n '''\n ret = {'name': name,\n 'changes': {}}\n\n profile = get_container_profile(copy.deepcopy(profile))\n if bool(nic) and nic is not _marker:\n salt.utils.warn_until(\n 'Carbon',\n 'The \\'nic\\' argument to \\'lxc.init\\' has been deprecated, '\n 'please use \\'network_profile\\' instead.'\n )\n network_profile = nic\n if not network_profile:\n network_profile = profile.get('network_profile')\n if not network_profile:\n network_profile = DEFAULT_NIC\n\n try:\n kwargs['clone_from'] = kwargs.pop('clone')\n except KeyError:\n pass\n else:\n salt.utils.warn_until(\n 'Carbon',\n 'The \\'clone\\' argument to \\'lxc.init\\' has been deprecated, '\n 'please use \\'clone_from\\' instead.'\n )\n\n # Changes is a pointer to changes_dict['init']. This method is used so that\n # we can have a list of changes as they are made, providing an ordered list\n # of things that were changed.\n changes_dict = {'init': []}\n changes = changes_dict.get('init')\n\n if users is None:\n users = []\n dusers = ['root']\n for user in dusers:\n if user not in users:\n users.append(user)\n\n kw_overrides = copy.deepcopy(kwargs)\n\n def select(key, default=None):\n kw_overrides_match = kw_overrides.pop(key, _marker)\n profile_match = profile.pop(key, default)\n # let kwarg overrides be the preferred choice\n if kw_overrides_match is _marker:\n return profile_match\n return kw_overrides_match\n\n path = select('path')\n bpath = get_root_path(path)\n state_pre = state(name, path=path)\n tvg = select('vgname')\n vgname = tvg if tvg else __salt__['config.get']('lxc.vgname')\n start_ = select('start', True)\n autostart = select('autostart', autostart)\n seed = select('seed', True)\n install = select('install', True)\n seed_cmd = select('seed_cmd')\n salt_config = _get_salt_config(config, **kwargs)\n approve_key = select('approve_key', True)\n clone_from = select('clone_from')\n if password and password_encrypted is None:\n salt.utils.warn_until(\n 'Carbon',\n 'Starting with the Carbon release, passwords passed to the '\n '\\'lxc.init\\' function will be assumed to be hashed, unless '\n 'password_encrypted=False. Please keep this in mind.'\n )\n password_encrypted = False\n\n # If using a volume group then set up to make snapshot cow clones\n if vgname and not clone_from:\n try:\n kwargs['vgname'] = vgname\n clone_from = _get_base(profile=profile, **kwargs)\n except (SaltInvocationError, CommandExecutionError) as exc:\n ret['comment'] = exc.strerror\n if changes:\n ret['changes'] = changes_dict\n return ret\n if not kwargs.get('snapshot') is False:\n kwargs['snapshot'] = True\n does_exist = exists(name, path=path)\n to_reboot = False\n remove_seed_marker = False\n if does_exist:\n pass\n elif clone_from:\n remove_seed_marker = True\n try:\n clone(name, clone_from, profile=profile, **kwargs)\n changes.append({'create': 'Container cloned'})\n except (SaltInvocationError, CommandExecutionError) as exc:\n if 'already exists' in exc.strerror:\n changes.append({'create': 'Container already exists'})\n else:\n ret['result'] = False\n ret['comment'] = exc.strerror\n if changes:\n ret['changes'] = changes_dict\n return ret\n cfg = _LXCConfig(name=name, network_profile=network_profile,\n nic_opts=nic_opts, bridge=bridge, path=path,\n gateway=gateway, autostart=autostart,\n cpuset=cpuset, cpushare=cpushare, memory=memory)\n old_chunks = read_conf(cfg.path, out_format='commented')\n cfg.write()\n chunks = read_conf(cfg.path, out_format='commented')\n if old_chunks != chunks:\n to_reboot = True\n else:\n remove_seed_marker = True\n cfg = _LXCConfig(network_profile=network_profile,\n nic_opts=nic_opts, cpuset=cpuset, path=path,\n bridge=bridge, gateway=gateway,\n autostart=autostart,\n cpushare=cpushare, memory=memory)\n with cfg.tempfile() as cfile:\n try:\n create(name, config=cfile.name, profile=profile, **kwargs)\n changes.append({'create': 'Container created'})\n except (SaltInvocationError, CommandExecutionError) as exc:\n if 'already exists' in exc.strerror:\n changes.append({'create': 'Container already exists'})\n else:\n ret['comment'] = exc.strerror\n if changes:\n ret['changes'] = changes_dict\n return ret\n cpath = os.path.join(bpath, name, 'config')\n old_chunks = []\n if os.path.exists(cpath):\n old_chunks = read_conf(cpath, out_format='commented')\n new_cfg = _config_list(conf_tuples=old_chunks,\n cpu=cpu,\n network_profile=network_profile,\n nic_opts=nic_opts, bridge=bridge,\n cpuset=cpuset, cpushare=cpushare,\n memory=memory)\n if new_cfg:\n edit_conf(cpath, out_format='commented', lxc_config=new_cfg)\n chunks = read_conf(cpath, out_format='commented')\n if old_chunks != chunks:\n to_reboot = True\n\n # last time to be sure any of our property is correctly applied\n cfg = _LXCConfig(name=name, network_profile=network_profile,\n nic_opts=nic_opts, bridge=bridge, path=path,\n gateway=gateway, autostart=autostart,\n cpuset=cpuset, cpushare=cpushare, memory=memory)\n old_chunks = []\n if os.path.exists(cfg.path):\n old_chunks = read_conf(cfg.path, out_format='commented')\n cfg.write()\n chunks = read_conf(cfg.path, out_format='commented')\n if old_chunks != chunks:\n changes.append({'config': 'Container configuration updated'})\n to_reboot = True\n\n if to_reboot:\n try:\n stop(name, path=path)\n except (SaltInvocationError, CommandExecutionError) as exc:\n ret['comment'] = 'Unable to stop container: {0}'.format(exc)\n if changes:\n ret['changes'] = changes_dict\n return ret\n if not does_exist or (does_exist and state(name, path=path) != 'running'):\n try:\n start(name, path=path)\n except (SaltInvocationError, CommandExecutionError) as exc:\n ret['comment'] = 'Unable to stop container: {0}'.format(exc)\n if changes:\n ret['changes'] = changes_dict\n return ret\n\n if remove_seed_marker:\n run(name,\n 'rm -f \\'{0}\\''.format(SEED_MARKER),\n path=path,\n chroot_fallback=False,\n python_shell=False)\n\n # set the default user/password, only the first time\n if ret.get('result', True) and password:\n gid = '/.lxc.initial_pass'\n gids = [gid,\n '/lxc.initial_pass',\n '/.lxc.{0}.initial_pass'.format(name)]\n if not any(retcode(name,\n 'test -e \"{0}\"'.format(x),\n chroot_fallback=True,\n path=path,\n ignore_retcode=True) == 0\n for x in gids):\n # think to touch the default user generated by default templates\n # which has a really unsecure passwords...\n # root is defined as a member earlier in the code\n for default_user in ['ubuntu']:\n if (\n default_user not in users and\n retcode(name,\n 'id {0}'.format(default_user),\n python_shell=False,\n path=path,\n chroot_fallback=True,\n ignore_retcode=True) == 0\n ):\n users.append(default_user)\n for user in users:\n try:\n cret = set_password(name,\n users=[user],\n path=path,\n password=password,\n encrypted=password_encrypted)\n except (SaltInvocationError, CommandExecutionError) as exc:\n msg = '{0}: Failed to set password'.format(\n user) + exc.strerror\n # only hardfail in unrecoverable situation:\n # root cannot be setted up\n if user == 'root':\n ret['comment'] = msg\n ret['result'] = False\n else:\n log.debug(msg)\n if ret.get('result', True):\n changes.append({'password': 'Password(s) updated'})\n if retcode(name,\n ('sh -c \\'touch \"{0}\"; test -e \"{0}\"\\''\n .format(gid)),\n path=path,\n chroot_fallback=True,\n ignore_retcode=True) != 0:\n ret['comment'] = 'Failed to set password marker'\n changes[-1]['password'] += '. ' + ret['comment'] + '.'\n ret['result'] = False\n\n # set dns servers if any, only the first time\n if ret.get('result', True) and dnsservers:\n # retro compatibility, test also old markers\n gid = '/.lxc.initial_dns'\n gids = [gid,\n '/lxc.initial_dns',\n '/lxc.{0}.initial_dns'.format(name)]\n if not any(retcode(name,\n 'test -e \"{0}\"'.format(x),\n chroot_fallback=True,\n path=path,\n ignore_retcode=True) == 0\n for x in gids):\n try:\n set_dns(name,\n path=path,\n dnsservers=dnsservers,\n searchdomains=searchdomains)\n except (SaltInvocationError, CommandExecutionError) as exc:\n ret['comment'] = 'Failed to set DNS: ' + exc.strerror\n ret['result'] = False\n else:\n changes.append({'dns': 'DNS updated'})\n if retcode(name,\n ('sh -c \\'touch \"{0}\"; test -e \"{0}\"\\''\n .format(gid)),\n chroot_fallback=True,\n path=path,\n ignore_retcode=True) != 0:\n ret['comment'] = 'Failed to set DNS marker'\n changes[-1]['dns'] += '. ' + ret['comment'] + '.'\n ret['result'] = False\n\n # retro compatibility, test also old markers\n if remove_seed_marker:\n run(name,\n 'rm -f \\'{0}\\''.format(SEED_MARKER),\n path=path,\n python_shell=False)\n gid = '/.lxc.initial_seed'\n gids = [gid, '/lxc.initial_seed']\n if (\n any(retcode(name,\n 'test -e {0}'.format(x),\n path=path,\n chroot_fallback=True,\n ignore_retcode=True) == 0\n for x in gids) or not ret.get('result', True)\n ):\n pass\n elif seed or seed_cmd:\n if seed:\n try:\n result = bootstrap(\n name, config=salt_config, path=path,\n approve_key=approve_key,\n pub_key=pub_key, priv_key=priv_key,\n install=install,\n force_install=force_install,\n unconditional_install=unconditional_install,\n bootstrap_delay=bootstrap_delay,\n bootstrap_url=bootstrap_url,\n bootstrap_shell=bootstrap_shell,\n bootstrap_args=bootstrap_args)\n except (SaltInvocationError, CommandExecutionError) as exc:\n ret['comment'] = 'Bootstrap failed: ' + exc.strerror\n ret['result'] = False\n else:\n if not result:\n ret['comment'] = ('Bootstrap failed, see minion log for '\n 'more information')\n ret['result'] = False\n else:\n changes.append(\n {'bootstrap': 'Container successfully bootstrapped'}\n )\n elif seed_cmd:\n try:\n result = __salt__[seed_cmd](info(name, path=path)['rootfs'],\n name,\n salt_config)\n except (SaltInvocationError, CommandExecutionError) as exc:\n ret['comment'] = ('Bootstrap via seed_cmd \\'{0}\\' failed: {1}'\n .format(seed_cmd, exc.strerror))\n ret['result'] = False\n else:\n if not result:\n ret['comment'] = ('Bootstrap via seed_cmd \\'{0}\\' failed, '\n 'see minion log for more information '\n .format(seed_cmd))\n ret['result'] = False\n else:\n changes.append(\n {'bootstrap': 'Container successfully bootstrapped '\n 'using seed_cmd \\'{0}\\''\n .format(seed_cmd)}\n )\n\n if ret.get('result', True) and not start_:\n try:\n stop(name, path=path)\n except (SaltInvocationError, CommandExecutionError) as exc:\n ret['comment'] = 'Unable to stop container: {0}'.format(exc)\n ret['result'] = False\n\n state_post = state(name, path=path)\n if state_pre != state_post:\n changes.append({'state': {'old': state_pre, 'new': state_post}})\n\n if ret.get('result', True):\n ret['comment'] = ('Container \\'{0}\\' successfully initialized'\n .format(name))\n ret['result'] = True\n if changes:\n ret['changes'] = changes_dict\n return ret", "metadata": "root.init", "header": "['module', '___EOS___']", "index": 1125 }, { "content": "def wait_started(name, path=None, timeout=300):\n '''\n Check that the system has fully inited\n\n This is actually very important for systemD based containers\n\n see https://github.com/saltstack/salt/issues/23847\n\n path\n path to the container parent\n default: /var/lib/lxc (system default)\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt myminion lxc.wait_started ubuntu\n\n '''\n if not exists(name, path=path):\n raise CommandExecutionError(\n 'Container {0} does does exists'.format(name))\n if not state(name, path=path) == 'running':\n raise CommandExecutionError(\n 'Container {0} is not running'.format(name))\n ret = False\n if running_systemd(name, path=path):\n test_started = test_sd_started_state\n logger = log.error\n else:\n test_started = test_bare_started_state\n logger = log.debug\n now = time.time()\n expire = now + timeout\n now = time.time()\n started = test_started(name, path=path)\n while time.time() < expire and not started:\n time.sleep(0.3)\n started = test_started(name, path=path)\n if started is None:\n logger(\n 'Assuming {0} is started, although we failed to detect that'\n ' is fully started correctly'.format(name))\n ret = True\n else:\n ret = started\n return ret", "metadata": "root.wait_started", "header": "['module', '___EOS___']", "index": 3326 }, { "content": "def bootstrap(name,\n config=None,\n approve_key=True,\n install=True,\n pub_key=None,\n priv_key=None,\n bootstrap_url=None,\n force_install=False,\n unconditional_install=False,\n path=None,\n bootstrap_delay=None,\n bootstrap_args=None,\n bootstrap_shell=None):\n '''\n Install and configure salt in a container.\n\n config\n Minion configuration options. By default, the ``master`` option is set\n to the target host's master.\n\n approve_key\n Request a pre-approval of the generated minion key. Requires\n that the salt-master be configured to either auto-accept all keys or\n expect a signing request from the target host. Default: ``True``\n\n path\n path to the container parent\n default: /var/lib/lxc (system default)\n\n .. versionadded:: 2015.8.0\n\n pub_key\n Explicit public key to pressed the minion with (optional).\n This can be either a filepath or a string representing the key\n\n priv_key\n Explicit private key to pressed the minion with (optional).\n This can be either a filepath or a string representing the key\n\n bootstrap_delay\n Delay in seconds between end of container creation and bootstrapping.\n Useful when waiting for container to obtain a DHCP lease.\n\n .. versionadded:: 2015.5.0\n\n bootstrap_url\n url, content or filepath to the salt bootstrap script\n\n bootstrap_args\n salt bootstrap script arguments\n\n bootstrap_shell\n shell to execute the script into\n\n install\n Whether to attempt a full installation of salt-minion if needed.\n\n force_install\n Force installation even if salt-minion is detected,\n this is the way to run vendor bootstrap scripts even\n if a salt minion is already present in the container\n\n unconditional_install\n Run the script even if the container seems seeded\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt 'minion' lxc.bootstrap container_name [config=config_data] \\\\\n [approve_key=(True|False)] [install=(True|False)]\n\n '''\n wait_started(name, path=path)\n if bootstrap_delay is not None:\n try:\n log.info('LXC {0}: bootstrap_delay: {1}'.format(\n name, bootstrap_delay))\n time.sleep(bootstrap_delay)\n except TypeError:\n # Bad input, but assume since a value was passed that\n # a delay was desired, and sleep for 5 seconds\n time.sleep(5)\n\n c_info = info(name, path=path)\n if not c_info:\n return None\n\n # default set here as we cannot set them\n # in def as it can come from a chain of procedures.\n if bootstrap_args:\n # custom bootstrap args can be totally customized, and user could\n # have inserted the placeholder for the config directory.\n # For example, some salt bootstrap script do not use at all -c\n if '{0}' not in bootstrap_args:\n bootstrap_args += ' -c {0}'\n else:\n bootstrap_args = '-c {0}'\n if not bootstrap_shell:\n bootstrap_shell = 'sh'\n\n orig_state = _ensure_running(name, path=path)\n if not orig_state:\n return orig_state\n if not force_install:\n needs_install = _needs_install(name, path=path)\n else:\n needs_install = True\n seeded = retcode(name,\n 'test -e \\'{0}\\''.format(SEED_MARKER),\n path=path,\n chroot_fallback=True,\n ignore_retcode=True) == 0\n tmp = tempfile.mkdtemp()\n if seeded and not unconditional_install:\n ret = True\n else:\n ret = False\n cfg_files = __salt__['seed.mkconfig'](\n config, tmp=tmp, id_=name, approve_key=approve_key,\n pub_key=pub_key, priv_key=priv_key)\n if needs_install or force_install or unconditional_install:\n if install:\n rstr = __salt__['test.rand_str']()\n configdir = '/var/tmp/.c_{0}'.format(rstr)\n\n cmd = 'install -m 0700 -d {0}'.format(configdir)\n if run(name, cmd, python_shell=False):\n log.error('tmpdir {0} creation failed ({1}'\n .format(configdir, cmd))\n return False\n\n bs_ = __salt__['config.gather_bootstrap_script'](\n bootstrap=bootstrap_url)\n script = '/sbin/{0}_bootstrap.sh'.format(rstr)\n copy_to(name, bs_, script, path=path)\n result = run_all(name,\n 'sh -c \"chmod +x {0}\"'.format(script),\n python_shell=True)\n\n copy_to(name, cfg_files['config'],\n os.path.join(configdir, 'minion'),\n path=path)\n copy_to(name, cfg_files['privkey'],\n os.path.join(configdir, 'minion.pem'),\n path=path)\n copy_to(name, cfg_files['pubkey'],\n os.path.join(configdir, 'minion.pub'),\n path=path)\n bootstrap_args = bootstrap_args.format(configdir)\n cmd = ('{0} {2} {1}'\n .format(bootstrap_shell,\n bootstrap_args.replace(\"'\", \"''\"),\n script))\n # log ASAP the forged bootstrap command which can be wrapped\n # out of the output in case of unexpected problem\n log.info('Running {0} in LXC container \\'{1}\\''\n .format(cmd, name))\n ret = retcode(name, cmd, output_loglevel='info',\n path=path, use_vt=True) == 0\n\n run_all(name,\n 'sh -c \\'if [ -f \"{0}\" ];then rm -f \"{0}\";fi\\''\n ''.format(script),\n ignore_retcode=True,\n python_shell=True)\n else:\n ret = False\n else:\n minion_config = salt.config.minion_config(cfg_files['config'])\n pki_dir = minion_config['pki_dir']\n copy_to(name,\n cfg_files['config'],\n '/etc/salt/minion',\n path=path)\n copy_to(name,\n cfg_files['privkey'],\n os.path.join(pki_dir, 'minion.pem'),\n path=path)\n copy_to(name,\n cfg_files['pubkey'],\n os.path.join(pki_dir, 'minion.pub'),\n path=path)\n run(name,\n 'salt-call --local service.enable salt-minion',\n path=path,\n python_shell=False)\n ret = True\n shutil.rmtree(tmp)\n if orig_state == 'stopped':\n stop(name, path=path)\n elif orig_state == 'frozen':\n freeze(name, path=path)\n # mark seeded upon successful install\n if ret:\n run(name,\n 'touch \\'{0}\\''.format(SEED_MARKER),\n path=path,\n python_shell=False)\n return ret", "metadata": "root.bootstrap", "header": "['module', '___EOS___']", "index": 3398 } ]
[ { "span": "gateway_set ", "start_line": 838, "start_column": 8, "end_line": 838, "end_column": 19 }, { "span": "cret ", "start_line": 1535, "start_column": 20, "end_line": 1535, "end_column": 24 }, { "span": "now ", "start_line": 3362, "start_column": 4, "end_line": 3362, "end_column": 7 }, { "span": "result ", "start_line": 3534, "start_column": 16, "end_line": 3534, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "network", "\\u", "conf_", "(_", "conf", "\\u", "tuples_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Network", " ", "configura", "tion", " ", "default", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "network", "\\u", "profile", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "for", " ", "container", "s", ",", " ", "we", " ", "can", " ", "eit", "her", " ", "call", " ", "this", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "eit", "her", " ", "with", " ", "a", " ", "network", "\\u", "profile", " ", "dict", " ", "or", " ", "network", " ", "profile", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "kwarg", "s", "\\", "10", ";", " ", " ", " ", " ", "nic", "\\u", "opts", "\\", "10", ";", " ", " ", " ", " ", "override", "s", " ", "or", " ", "extra", " ", "nic", "s", " ", "in", " ", "the", " ", "form", " ", "{", "nic", "\\u", "name", ":", " ", "{", "set", ":", " ", "ting", "s", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nic_", "=_", "kwargs_", "._", "get_", "(_", "'", "network", "\\u", "profile", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nic", "\\u", "opts_", "=_", "kwargs_", "._", "get_", "(_", "'", "nic", "\\u", "opts", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nic", "\\u", "opts_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "comi", "ng", " ", "from", " ", "else", "where_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nic", "\\u", "opts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "conf", "\\u", "tuples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf", "\\u", "tuples_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old_", "=_", "\\u", "get", "\\u", "vet", "hs_", "(_", "conf", "\\u", "tuples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "old_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "have", " ", "a", " ", "profile", " ", "name", ",", " ", "get", " ", "the", " ", "profile", " ", "and", " ", "load", " ", "the", " ", "network", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "will", " ", "ob", "vio", "usl", "y", " ", "by", " ", "default", " ", " ", "look", " ", "for", " ", "a", " ", "profile", " ", "call", "ed", " ", "\"", "eth", "0", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "by", " ", "what", " ", "is", " ", "defin", "ed", " ", "in", " ", "nic", "\\u", "opts_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "complete", " ", "each", " ", "nic", " ", "settings", " ", "by", " ", "sane", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nic_", "and_", "isinstance_", "(_", "nic_", ",_", "(_", "six_", "._", "string", "\\u", "types_", ",_", "dict_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nic", "p_", "=_", "get", "\\u", "network", "\\u", "profile_", "(_", "nic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nic", "p_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DEF", "AUL", "T", "\\u", "NIC", "_", "not_", "in_", "nic", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nic", "p_", "[_", "DEF", "AUL", "T", "\\u", "NIC", "_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "copy_", "._", "deepcopy_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gateway_", "=_", "kwargs_", "._", "pop_", "(_", "'", "gateway", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bridge_", "=_", "kwargs_", "._", "get_", "(_", "'", "bridge", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nic", "\\u", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dev_", ",_", "args_", "in_", "six_", "._", "iteritems_", "(_", "nic", "\\u", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eth", "x_", "=_", "nic", "p_", "._", "setdefault_", "(_", "dev_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eth", "x_", "=_", "salt_", "._", "utils_", "._", "dict", "update_", "._", "update_", "(_", "eth", "x_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sal", "t", "Invoca", "tion", "Error_", "(_", "'", "Inva", "lid", " ", "nic", "\\u", "opts", " ", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ifs", "_", "=_", "[_", "a_", "for_", "a_", "in_", "nic", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifs", "_", "+=_", "[_", "a_", "for_", "a_", "in_", "old_", "if_", "a_", "not_", "in_", "nic", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifs", "_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gateway", "\\u", "set_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dev_", "in_", "ifs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "nic", "p_", "._", "get_", "(_", "dev_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "nic", "\\u", "opts_", "._", "get_", "(_", "dev_", ",_", "{_", "}_", ")_", "if_", "nic", "\\u", "opts_", "else_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "if_", "=_", "old_", "._", "get_", "(_", "dev_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disable_", "=_", "opts_", "._", "get_", "(_", "'", "disable", "'_", ",_", "args_", "._", "get_", "(_", "'", "disable", "'_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "disable_", ":_", "\\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_", "mac_", "=_", "opts_", "._", "get_", "(_", "'", "mac", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "._", "get_", "(_", "'", "hwa", "ddr", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "get_", "(_", "'", "mac", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "get_", "(_", "'", "hwa", "ddr", "'_", ",_", "''_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type\\u_", "=_", "opts_", "._", "get_", "(_", "'", "type", "'_", ",_", "args_", "._", "get_", "(_", "'", "type", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "opts_", "._", "get_", "(_", "'", "flags", "'_", ",_", "args_", "._", "get_", "(_", "'", "flags", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "opts_", "._", "get_", "(_", "'", "link", "'_", ",_", "args_", "._", "get_", "(_", "'", "link", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipv4_", "=_", "opts_", "._", "get_", "(_", "'", "ipv", "4", "'_", ",_", "args_", "._", "get_", "(_", "'", "ipv", "4", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipv6_", "=_", "opts_", "._", "get_", "(_", "'", "ipv", "6", "'_", ",_", "args_", "._", "get_", "(_", "'", "ipv", "6", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "infos_", "=_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lxc", ".", "network", ".", "type", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "not_", "type\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "type\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "'_", ":_", "old", "\\u", "if_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "type", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "'", "vet", "h", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lxc", ".", "network", ".", "name", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "dev_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "'_", ":_", "dev_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "dev_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lxc", ".", "network", ".", "flags", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "not_", "flags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "flags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "'_", ":_", "old", "\\u", "if_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "flags", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "'", "up", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lxc", ".", "network", ".", "link", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "not_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "'_", ":_", "old", "\\u", "if_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "link", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "search", "\\u", "lxc", "\\u", "bridge_", "(_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lxc", ".", "network", ".", "hwa", "ddr", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "not_", "mac_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "mac_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "'_", ":_", "old", "\\u", "if_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "hwa", "ddr", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "salt_", "._", "utils_", "._", "gen", "\\u", "mac_", "(_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lxc", ".", "network", ".", "ipv", "4", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "not_", "ipv4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "ipv4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "'_", ":_", "old", "\\u", "if_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "ipv", "4", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "None_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "lxc", ".", "network", ".", "ipv", "6", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "not_", "ipv6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "ipv6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "'_", ":_", "old", "\\u", "if_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "ipv", "6", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "None_", "}_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "parameter", ",", " ", "if", " ", "not", " ", "explicit", "ly", " ", "set", ",", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "config", " ", "value", " ", "presen", "t", " ", "in", " ", "the", " ", "LX", "C", " ", "configura", "tion", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", " ", "preceden", "ce", " ", "over", " ", "the", " ", "profile", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "info_", "in_", "list_", "(_", "infos_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bundle_", "=_", "infos_", "[_", "info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bundle_", "[_", "'", "test", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bundle_", "[_", "'", "old", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bundle_", "[_", "'", "value", "'_", "]_", "=_", "bundle_", "[_", "'", "old", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "bundle_", "[_", "'", "default", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bundle_", "[_", "'", "value", "'_", "]_", "=_", "bundle_", "[_", "'", "default", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "info_", ",_", "data_", "in_", "six_", "._", "iteritems_", "(_", "infos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "[_", "'", "value", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "._", "append_", "(_", "{_", "info_", ":_", "data_", "[_", "'", "value", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "six_", "._", "iteritems_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "==_", "'", "link", "'_", "and_", "bridge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "bridge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "opts_", "._", "get_", "(_", "key_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ",_", "'", "flags", "'_", ",_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gateway", "'_", ",_", "'", "mac", "'_", ",_", "'", "link", "'_", ",_", "'", "ipv", "4", "'_", ",_", "'", "ipv", "6", "'_", "\\u\\u\\uNL\\u\\u\\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_", "ret_", "._", "append_", "(_", "{_", "'", "lxc", ".", "network", ".", "{", "0", "}'_", "._", "format_", "(_", "key_", ")_", ":_", "val_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gateway", " ", "(", "in", " ", "autom", "ode", ")", " ", "must", " ", "be", " ", "append", "ed", " ", "follow", "ing", " ", "network", " ", "conf", " ", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "gateway_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gateway_", "=_", "args_", "._", "get_", "(_", "'", "gateway", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gateway_", "is_", "not_", "None_", "and_", "not_", "gateway", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "._", "append_", "(_", "{_", "'", "lxc", ".", "network", ".", "ipv", "4", ".", "gateway", "'_", ":_", "gateway_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "one", " ", "network", " ", "gateway", " ", ";)", "_", "\\u\\u\\uNL\\u\\u\\u_", "gateway", "\\u", "set_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "normal", "ly", ",", " ", "this", " ", "won", "'", "t", " ", "happ", "en_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "gateway", " ", "if", " ", "specified", " ", "even", " ", "if", " ", "we", " ", "did_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "manage", "d", " ", "the", " ", "network", " ", "underl", "ying", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gateway_", "is_", "not_", "None_", "and_", "not_", "gateway", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "._", "append_", "(_", "{_", "'", "lxc", ".", "network", ".", "ipv", "4", ".", "gateway", "'_", ":_", "gateway_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "one", " ", "network", " ", "gateway", " ", ";)", "_", "\\u\\u\\uNL\\u\\u\\u_", "gateway", "\\u", "set_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new_", "=_", "\\u", "get", "\\u", "vet", "hs_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", " ", "tha", "t", " ", "we", " ", "did", " ", "not", " ", "loose", " ", "the", " ", "mac", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "iface_", "in_", "[_", "a_", "for_", "a_", "in_", "new_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ndata", "_", "=_", "new_", "[_", "iface_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nma", "c_", "=_", "ndata", "_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "hwa", "ddr", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ntype", "_", "=_", "ndata", "_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "type", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "c_", ",_", "otype", "_", "=_", "''_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "iface_", "in_", "old_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "odata", "_", "=_", "old_", "[_", "iface_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oma", "c_", "=_", "odata", "_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "hwa", "ddr", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "otype", "_", "=_", "odata", "_", "._", "get_", "(_", "'", "lxc", ".", "network", ".", "type", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default", " ", "for", " ", "network", " ", "type", " ", "is", " ", "sette", "d", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "atten", "tion", " ", "not", " ", "to", " ", "change", " ", "the", " ", "network", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "a", " ", "good", " ", "and", " ", "explicit", " ", "reason", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "otype", "_", "and_", "not_", "ntype", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ntype", "_", "=_", "otype", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ntype", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ntype", "_", "=_", "'", "vet", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new_", "[_", "iface_", "]_", "[_", "'", "lxc", ".", "network", ".", "type", "'_", "]_", "=_", "ntype", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "oma", "c_", "and_", "not_", "nma", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new_", "[_", "iface_", "]_", "[_", "'", "lxc", ".", "network", ".", "hwa", "ddr", "'_", "]_", "=_", "oma", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "six_", "._", "itervalues_", "(_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "._", "append_", "(_", "salt_", "._", "utils_", "._", "odict_", "._", "Order", "ed", "Dict_", "(_", "[_", "(_", "row_", ",_", "val_", "[_", "row_", "]_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "on", " ", "old", " ", "version", "s", " ", "of", " ", "lxc", ",", " ", "still", " ", "support", " ", "the", " ", "gateway", " ", "auto", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "did", "nt", " ", "explicit", "ly", " ", "say", " ", "no", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "lxc", ".", "network", ".", "ipv", "4", ".", "gateway", ":", " ", "auto", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "distutils_", "._", "version_", "._", "Lo", "ose", "Version_", "(_", "version_", "(_", ")_", ")_", "<=_", "'", "1.0", ".7", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "True_", "not_", "in_", "[_", "'", "lxc", ".", "network", ".", "ipv", "4", ".", "gateway", "'_", "in_", "a_", "for_", "a_", "in_", "ret_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "True_", "in_", "[_", "'", "lxc", ".", "network", ".", "ipv", "4", "'_", "in_", "a_", "for_", "a_", "in_", "ret_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "._", "append_", "(_", "{_", "'", "lxc", ".", "network", ".", "ipv", "4", ".", "gateway", "'_", ":_", "'", "auto", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpus", "et_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpus", "hare", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "profile_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "profile_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nic_", "=_", "\\u", "marker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nic", "\\u", "opts_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpu_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autostart", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password", "\\u", "encrypted_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "users_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dns", "servers_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "domains_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bridge_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "\\u", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "priv", "\\u", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "install_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uncon", "dition", "al", "\\u", "install_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "delay_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "args_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "shell_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "url_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "a", " ", "new", " ", "container", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "partial", " ", "idempotent", " ", "function", " ", "as", " ", "if", " ", "it", " ", "is", " ", "alr", "ead", "y", " ", "provisioned", ",", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "reset", " ", "a", " ", "bit", " ", "the", " ", "lxc", " ", "configura", "tion", " ", "file", " ", "but", " ", "muc", "h", " ", "of", " ", "the", " ", "hard", " ", "work", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "escaped", " ", "as", " ", "marker", "s", " ", "will", " ", "prevent", " ", "re", "-", "executi", "on", " ", "of", " ", "harm", "ful", " ", "task", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", "of", " ", "the", " ", "container", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "image", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "tar", " ", "archive", " ", "to", " ", "use", " ", "as", " ", "the", " ", "rootfs", " ", "for", " ", "the", " ", "container", ".", " ", "Confl", "icts", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "``", "template", "``", " ", "argu", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "cpus", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "a", " ", "random", " ", "number", " ", "of", " ", "cpu", " ", "cores", " ", "and", " ", "assign", " ", "it", " ", "to", " ", "the", " ", "cpus", "et", ",", " ", "if", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "cpus", "et", " ", "option", " ", "is", " ", "set", " ", "then", " ", "this", " ", "option", " ", "will", " ", "be", " ", "ignore", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "cpus", "et", "\\", "10", ";", " ", " ", " ", " ", "Exp", "licit", "ly", " ", "defin", "e", " ", "the", " ", "cpus", " ", "this", " ", "container", " ", "will", " ", "be", " ", "bound", " ", "to", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "cpus", "hare", "\\", "10", ";", " ", " ", " ", " ", "cgroup", "s", " ", "cpu", " ", "share", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "autostart", "\\", "10", ";", " ", " ", " ", " ", "autostart", " ", "container", " ", "on", " ", "rebo", "ot", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "memory", "\\", "10", ";", " ", " ", " ", " ", "cgroup", "s", " ", "memory", " ", "limit", ",", " ", "in", " ", "MB", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "change", "d", "::", " ", "201", "5.5", ".0", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "value", " ", "is", " ", "pass", "ed", ",", " ", "no", " ", "limit", " ", "is", " ", "set", ".", " ", "In", " ", "ear", "lie", "r", " ", "Sal", "t", " ", "version", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "passi", "ng", " ", "this", " ", "value", " ", "caus", "es", " ", "a", " ", "1024", "MB", " ", "memory", " ", "limit", " ", "to", " ", "be", " ", "set", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "was", " ", "necessar", "y", " ", "to", " ", "pass", " ", "``", "memory", "=", "0", "``", " ", "to", " ", "set", " ", "no", " ", "limit", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "gateway", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "ipv", "4", " ", "gateway", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "default", " ", "doe", "s", " ", "not", "hing", " ", "more", " ", "than", " ", "lxc", "util", "s", " ", "doe", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "bridge", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "bridge", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "default", " ", "doe", "s", " ", "not", "hing", " ", "more", " ", "than", " ", "lxc", "util", "s", " ", "doe", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "network", "\\u", "profile", "\\", "10", ";", " ", " ", " ", " ", "Network", " ", "profile", " ", "to", " ", "use", " ", "for", " ", "the", " ", "container", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.5", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "nic", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "depre", "cated", "::", " ", "201", "5.5", ".0", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "``", "network", "\\u", "profile", "``", " ", "inst", "ead", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "nic", "\\u", "opts", "\\", "10", ";", " ", " ", " ", " ", "Extra", " ", "options", " ", "for", " ", "network", " ", "interface", "s", ",", " ", "will", " ", "override", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "{", "\"", "eth", "0", "\":", " ", "{", "\"", "hwa", "ddr", "\":", " ", "\"", "aa", ":", "bb", ":", "cc", ":", "dd", ":", "ee", ":", "ff", "\",", " ", "\"", "ipv", "4", "\":", " ", "\"", "10.1", ".1", ".1", "\",", " ", "\"", "ipv", "6", "\":", " ", "\"", "200", "1", ":", "db", "8", "::", "ff", "00", ":", "4", "2", ":", "832", "9", "\"}}", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "{", "\"", "eth", "0", "\":", " ", "{", "\"", "hwa", "ddr", "\":", " ", "\"", "aa", ":", "bb", ":", "cc", ":", "dd", ":", "ee", ":", "ff", "\",", " ", "\"", "ipv", "4", "\":", " ", "\"", "10.1", ".1", ".1", "/", "24", "\",", " ", "\"", "ipv", "6", "\":", " ", "\"", "200", "1", ":", "db", "8", "::", "ff", "00", ":", "4", "2", ":", "832", "9", "\"}}", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "users", "\\", "10", ";", " ", " ", " ", " ", "User", "s", " ", "for", " ", "whi", "ch", " ", "the", " ", "password", " ", "defin", "ed", " ", "in", " ", "the", " ", "``", "password", "``", " ", "param", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "set", ".", " ", "Can", " ", "be", " ", "pass", "ed", " ", "as", " ", "a", " ", "comma", " ", "separate", "d", " ", "list", " ", "or", " ", "a", " ", "python", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "just", " ", "the", " ", "``", "root", "``", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "password", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "initial", " ", "password", " ", "for", " ", "the", " ", "users", " ", "defin", "ed", " ", "in", " ", "the", " ", "``", "users", "``", "\\", "10", ";", " ", " ", " ", " ", "parameter", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "password", "\\u", "encrypt", "ed", " ", ":", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "to", " ", "``", "Tru", "e", "``", " ", "to", " ", "denote", " ", "a", " ", "password", " ", "hash", " ", "inst", "ead", " ", "of", " ", "a", " ", "plain", "text", "\\", "10", ";", " ", " ", " ", " ", "password", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.5", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "profile", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "LX", "C", " ", "profile", " ", "(", "defin", "ed", " ", "in", " ", "config", " ", "or", " ", "pillar", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "real", " ", "profile", " ", "mapping", " ", "or", " ", "a", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "retrieve", " ", "it", " ", "in", " ", "configura", "tion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "start", "\\", "10", ";", " ", " ", " ", " ", "Start", " ", "the", " ", "newl", "y", "-", "created", " ", "container", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dns", "server", "s", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "dns", " ", "server", "s", " ", "to", " ", "set", " ", "in", " ", "the", " ", "container", ",", " ", "default", " ", "[]", " ", "(", "no", " ", "setti", "ng", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "seed", "\\", "10", ";", " ", " ", " ", " ", "See", "d", " ", "the", " ", "container", " ", "with", " ", "the", " ", "minion", " ", "config", ".", " ", "Default", ":", " ", "``", "Tru", "e", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "install", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "salt", "-", "minion", " ", "is", " ", "not", " ", "alr", "ead", "y", " ", "install", "ed", ",", " ", "install", " ", "it", ".", " ", "Default", ":", " ", "``", "Tru", "e", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "config", "\\", "10", ";", " ", " ", " ", " ", "Optio", "nal", " ", "config", " ", "parameter", "s", ".", " ", "By", " ", "default", ",", " ", "the", " ", "id", " ", "is", " ", "set", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "name", " ", "of", " ", "the", " ", "container", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "master", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "master", " ", "(", "default", " ", "to", " ", "minion", "'", "s", " ", "master", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "master", "\\u", "port", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "master", " ", "port", " ", "(", "default", " ", "to", " ", "minion", "'", "s", " ", "master", " ", "port", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pub", "\\u", "key", "\\", "10", ";", " ", " ", " ", " ", "Exp", "licit", " ", "public", " ", "key", " ", "to", " ", "prese", "ed", " ", "the", " ", "minion", " ", "with", " ", "(", "option", "al", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "filepath", " ", "or", " ", "a", " ", "string", " ", "represent", "ing", " ", "the", " ", "key", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "priv", "\\u", "key", "\\", "10", ";", " ", " ", " ", " ", "Exp", "licit", " ", "private", " ", "key", " ", "to", " ", "prese", "ed", " ", "the", " ", "minion", " ", "with", " ", "(", "option", "al", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "filepath", " ", "or", " ", "a", " ", "string", " ", "represent", "ing", " ", "the", " ", "key", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "approve", "\\u", "key", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "explicit", " ", "prese", "eding", " ", "is", " ", "not", " ", "used", ";", "\\", "10", ";", " ", " ", " ", " ", "Atte", "mpt", " ", "to", " ", "request", " ", "key", " ", "approval", " ", "from", " ", "the", " ", "master", ".", " ", "Default", ":", " ", "``", "Tru", "e", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "path", " ", "to", " ", "the", " ", "container", " ", "parent", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "/", "var", "/", "lib", "/", "lxc", " ", "(", "system", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.8", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "clone", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "depre", "cated", "::", " ", "201", "5.5", ".0", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "``", "clone", "\\u", "from", "``", " ", "inst", "ead", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "clone", "\\u", "from", "\\", "10", ";", " ", " ", " ", " ", "Origina", "l", " ", "from", " ", "whi", "ch", " ", "to", " ", "use", " ", "a", " ", "clone", " ", "operati", "on", " ", "to", " ", "create", " ", "the", " ", "container", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", ":", " ", "``", "Non", "e", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "dela", "y", "\\", "10", ";", " ", " ", " ", " ", "Delay", " ", "in", " ", "second", "s", " ", "bet", "ween", " ", "end", " ", "of", " ", "container", " ", "creati", "on", " ", "and", " ", "bootstrapp", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "efu", "l", " ", "whe", "n", " ", "wait", "ing", " ", "for", " ", "container", " ", "to", " ", "obtain", " ", "a", " ", "DHC", "P", " ", "lease", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.5", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "url", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "lxc", ".", "boots", "trap", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "shell", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "lxc", ".", "boots", "trap", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "args", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "lxc", ".", "boots", "trap", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "force", "\\u", "install", "\\", "10", ";", " ", " ", " ", " ", "Force", " ", "installation", " ", "even", " ", "if", " ", "salt", "-", "minion", " ", "is", " ", "detect", "ed", ",", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "is", " ", "the", " ", "way", " ", "to", " ", "run", " ", "vendor", " ", "boots", "trap", " ", "scripts", " ", "even", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "a", " ", "salt", " ", "minion", " ", "is", " ", "alr", "ead", "y", " ", "presen", "t", " ", "in", " ", "the", " ", "container", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "uncon", "dition", "al", "\\u", "install", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "the", " ", "script", " ", "even", " ", "if", " ", "the", " ", "container", " ", "see", "ms", " ", "seede", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'", "minion", "'", " ", "lxc", ".", "init", " ", "name", " ", "[", "cpus", "et", "=", "cgroup", "s", "\\u", "cpus", "et", "]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "cpus", "hare", "=", "cgroup", "s", "\\u", "cpus", "hare", "]", " ", "[", "memory", "=", "cgroup", "s", "\\u", "memory", "]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "nic", "=", "nic", "\\u", "profile", "]", " ", "[", "profile", "=", "lxc", "\\u", "profile", "]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "nic", "\\u", "opts", "=", "nic", "\\u", "opts", "]", " ", "[", "start", "=(", "Tru", "e", "|", "Fal", "se", ")]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "seed", "=(", "Tru", "e", "|", "Fal", "se", ")]", " ", "[", "install", "=(", "Tru", "e", "|", "Fal", "se", ")]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "config", "=", "minion", "\\u", "config", "]", " ", "[", "approve", "\\u", "key", "=(", "Tru", "e", "|", "Fal", "se", ")", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "clone", "\\u", "from", "=", "original", "]", " ", "[", "autostart", "=", "Tru", "e", "]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "priv", "\\u", "key", "=", "/", "path", "\\u", "or", "\\u", "content", "]", " ", "[", "pub", "\\u", "key", "=", "/", "path", "\\u", "or", "\\u", "content", "]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "bridge", "=", "lxc", "br", "0", "]", " ", "[", "gateway", "=", "10.", "0.", "3.1", "]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "dns", "server", "s", "[", "dns", "1", ",", "dns", "2", "]]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "users", "=[", "foo", "]]", " ", "[", "password", "='", "secret", "']", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "password", "\\u", "encrypt", "ed", "=(", "Tru", "e", "|", "Fal", "se", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "'", "name", "'_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "s", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "profile_", "=_", "get", "\\u", "container", "\\u", "profile_", "(_", "copy_", "._", "deepcopy_", "(_", "profile_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bool_", "(_", "nic_", ")_", "and_", "nic_", "is_", "not_", "\\u", "marker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "._", "utils_", "._", "warn", "\\u", "until_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Car", "bon", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "\\\\'", "nic", "\\\\'", " ", "argu", "ment", " ", "to", " ", "\\\\'", "lxc", ".", "init", "\\\\'", " ", "has", " ", "bee", "n", " ", "depre", "cated", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plea", "se", " ", "use", " ", "\\\\'", "network", "\\u", "profile", "\\\\'", " ", "inst", "ead", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "profile_", "=_", "nic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "network", "\\u", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "profile_", "=_", "profile_", "._", "get_", "(_", "'", "network", "\\u", "profile", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "network", "\\u", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "profile_", "=_", "DEF", "AUL", "T", "\\u", "NIC", "_", "\\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 ", " _", "kwargs_", "[_", "'", "clone", "\\u", "from", "'_", "]_", "=_", "kwargs_", "._", "pop_", "(_", "'", "clone", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "._", "utils_", "._", "warn", "\\u", "until_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Car", "bon", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "\\\\'", "clone", "\\\\'", " ", "argu", "ment", " ", "to", " ", "\\\\'", "lxc", ".", "init", "\\\\'", " ", "has", " ", "bee", "n", " ", "depre", "cated", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plea", "se", " ", "use", " ", "\\\\'", "clone", "\\u", "from", "\\\\'", " ", "inst", "ead", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", "s", " ", "is", " ", "a", " ", "point", "er", " ", "to", " ", "change", "s", "\\u", "dict", "['", "init", "']", ".", " ", "Thi", "s", " ", "method", " ", "is", " ", "used", " ", "so", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "can", " ", "have", " ", "a", " ", "list", " ", "of", " ", "change", "s", " ", "as", " ", "the", "y", " ", "are", " ", "made", ",", " ", "provi", "ding", " ", "an", " ", "order", "ed", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "thing", "s", " ", "tha", "t", " ", "wer", "e", " ", "change", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "change", "s", "\\u", "dict_", "=_", "{_", "'", "init", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changes_", "=_", "change", "s", "\\u", "dict_", "._", "get_", "(_", "'", "init", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "users_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dus", "ers_", "=_", "[_", "'", "root", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "dus", "ers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "not_", "in_", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "._", "append_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kw", "\\u", "overrides_", "=_", "copy_", "._", "deepcopy_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "select_", "(_", "key_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kw", "\\u", "override", "s", "\\u", "match_", "=_", "kw", "\\u", "overrides_", "._", "pop_", "(_", "key_", ",_", "\\u", "marker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile", "\\u", "match_", "=_", "profile_", "._", "pop_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "let", " ", "kwarg", " ", "override", "s", " ", "be", " ", "the", " ", "prefer", "red", " ", "choice_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "kw", "\\u", "override", "s", "\\u", "match_", "is_", "\\u", "marker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "profile", "\\u", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "kw", "\\u", "override", "s", "\\u", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "select_", "(_", "'", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bpa", "th_", "=_", "get", "\\u", "root", "\\u", "path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state", "\\u", "pre_", "=_", "state_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tv", "g_", "=_", "select_", "(_", "'", "vg", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vg", "name_", "=_", "tv", "g_", "if_", "tv", "g_", "else_", "\\u\\u", "salt\\u\\u_", "[_", "'", "config", ".", "get", "'_", "]_", "(_", "'", "lxc", ".", "vg", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u_", "=_", "select_", "(_", "'", "start", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "autostart", "_", "=_", "select_", "(_", "'", "autostart", "'_", ",_", "autostart", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "=_", "select_", "(_", "'", "seed", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install_", "=_", "select_", "(_", "'", "install", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed", "\\u", "cmd_", "=_", "select_", "(_", "'", "seed", "\\u", "cmd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "salt", "\\u", "config_", "=_", "\\u", "get", "\\u", "salt", "\\u", "config_", "(_", "config_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "approve", "\\u", "key_", "=_", "select_", "(_", "'", "approve", "\\u", "key", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clone", "\\u", "from_", "=_", "select_", "(_", "'", "clone", "\\u", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", "and_", "password", "\\u", "encrypted_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "._", "utils_", "._", "warn", "\\u", "until_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Car", "bon", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Start", "ing", " ", "with", " ", "the", " ", "Car", "bon", " ", "release", ",", " ", "passwords", " ", "pass", "ed", " ", "to", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\'", "lxc", ".", "init", "\\\\'", " ", "function", " ", "will", " ", "be", " ", "assume", "d", " ", "to", " ", "be", " ", "hashed", ",", " ", "unl", "ess", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "\\u", "encrypt", "ed", "=", "Fal", "se", ".", " ", "Ple", "ase", " ", "keep", " ", "this", " ", "in", " ", "mind", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "encrypted_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "usi", "ng", " ", "a", " ", "volume", " ", "group", " ", "then", " ", "set", " ", "up", " ", "to", " ", "make", " ", "snapshot", " ", "cow", " ", "clone", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "vg", "name_", "and_", "not_", "clone", "\\u", "from_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "vg", "name", "'_", "]_", "=_", "vg", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clone", "\\u", "from_", "=_", "\\u", "get", "\\u", "base_", "(_", "profile_", "=_", "profile_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "exc_", "._", "strerror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "change", "s", "'_", "]_", "=_", "change", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "kwargs_", "._", "get_", "(_", "'", "snapshot", "'_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "snapshot", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doe", "s", "\\u", "exist_", "=_", "exists_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "reboot_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remove", "\\u", "seed", "\\u", "marker_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "doe", "s", "\\u", "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_", "elif_", "clone", "\\u", "from_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "\\u", "seed", "\\u", "marker_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clone_", "(_", "name_", ",_", "clone", "\\u", "from_", ",_", "profile_", "=_", "profile_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changes_", "._", "append_", "(_", "{_", "'", "create", "'_", ":_", "'", "Containe", "r", " ", "cloned", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "alr", "ead", "y", " ", "exist", "s", "'_", "in_", "exc_", "._", "strerror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changes_", "._", "append_", "(_", "{_", "'", "create", "'_", ":_", "'", "Containe", "r", " ", "alr", "ead", "y", " ", "exist", "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 ", " _", "ret_", "[_", "'", "result", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "exc_", "._", "strerror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "'", "change", "s", "'_", "]_", "=_", "change", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "\\u", "LX", "CC", "onfig_", "(_", "name_", "=_", "name_", ",_", "network", "\\u", "profile_", "=_", "network", "\\u", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nic", "\\u", "opts_", "=_", "nic", "\\u", "opts_", ",_", "bridge_", "=_", "bridge_", ",_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "gateway_", ",_", "autostart", "_", "=_", "autostart", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpus", "et_", "=_", "cpus", "et_", ",_", "cpus", "hare", "_", "=_", "cpus", "hare", "_", ",_", "memory_", "=_", "memory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "chunks_", "=_", "read", "\\u", "conf_", "(_", "cfg_", "._", "path_", ",_", "out", "\\u", "format_", "=_", "'", "commente", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "write_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunks_", "=_", "read", "\\u", "conf_", "(_", "cfg_", "._", "path_", ",_", "out", "\\u", "format_", "=_", "'", "commente", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "chunks_", "!=_", "chunks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "reboot_", "=_", "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 ", " _", "remove", "\\u", "seed", "\\u", "marker_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "=_", "\\u", "LX", "CC", "onfig_", "(_", "network", "\\u", "profile_", "=_", "network", "\\u", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nic", "\\u", "opts_", "=_", "nic", "\\u", "opts_", ",_", "cpus", "et_", "=_", "cpus", "et_", ",_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bridge_", "=_", "bridge_", ",_", "gateway_", "=_", "gateway_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autostart", "_", "=_", "autostart", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpus", "hare", "_", "=_", "cpus", "hare", "_", ",_", "memory_", "=_", "memory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cfg_", "._", "tempfile_", "(_", ")_", "as_", "cfile_", ":_", "\\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 ", " _", "create_", "(_", "name_", ",_", "config_", "=_", "cfile_", "._", "name_", ",_", "profile_", "=_", "profile_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changes_", "._", "append_", "(_", "{_", "'", "create", "'_", ":_", "'", "Containe", "r", " ", "created", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "alr", "ead", "y", " ", "exist", "s", "'_", "in_", "exc_", "._", "strerror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "changes_", "._", "append_", "(_", "{_", "'", "create", "'_", ":_", "'", "Containe", "r", " ", "alr", "ead", "y", " ", "exist", "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 ", " ", "_", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "exc_", "._", "strerror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ret_", "[_", "'", "change", "s", "'_", "]_", "=_", "change", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cpa", "th_", "=_", "os_", "._", "path_", "._", "join_", "(_", "bpa", "th_", ",_", "name_", ",_", "'", "config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "chunks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "cpa", "th_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "chunks_", "=_", "read", "\\u", "conf_", "(_", "cpa", "th_", ",_", "out", "\\u", "format_", "=_", "'", "commente", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "cfg_", "=_", "\\u", "config", "\\u", "list_", "(_", "conf", "\\u", "tuples_", "=_", "old", "\\u", "chunks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpu_", "=_", "cpu_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "profile_", "=_", "network", "\\u", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nic", "\\u", "opts_", "=_", "nic", "\\u", "opts_", ",_", "bridge_", "=_", "bridge_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpus", "et_", "=_", "cpus", "et_", ",_", "cpus", "hare", "_", "=_", "cpus", "hare", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory_", "=_", "memory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "cfg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edit", "\\u", "conf_", "(_", "cpa", "th_", ",_", "out", "\\u", "format_", "=_", "'", "commente", "d", "'_", ",_", "lxc", "\\u", "config_", "=_", "new", "\\u", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chunks_", "=_", "read", "\\u", "conf_", "(_", "cpa", "th_", ",_", "out", "\\u", "format_", "=_", "'", "commente", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "chunks_", "!=_", "chunks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "reboot_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "last", " ", "time", " ", "to", " ", "be", " ", "sure", " ", "any", " ", "of", " ", "our", " ", "property", " ", "is", " ", "correct", "ly", " ", "applied", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "\\u", "LX", "CC", "onfig_", "(_", "name_", "=_", "name_", ",_", "network", "\\u", "profile_", "=_", "network", "\\u", "profile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nic", "\\u", "opts_", "=_", "nic", "\\u", "opts_", ",_", "bridge_", "=_", "bridge_", ",_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gateway_", "=_", "gateway_", ",_", "autostart", "_", "=_", "autostart", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpus", "et_", "=_", "cpus", "et_", ",_", "cpus", "hare", "_", "=_", "cpus", "hare", "_", ",_", "memory_", "=_", "memory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "chunks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "cfg_", "._", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "chunks_", "=_", "read", "\\u", "conf_", "(_", "cfg_", "._", "path_", ",_", "out", "\\u", "format_", "=_", "'", "commente", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "._", "write_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunks_", "=_", "read", "\\u", "conf_", "(_", "cfg_", "._", "path_", ",_", "out", "\\u", "format_", "=_", "'", "commente", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "chunks_", "!=_", "chunks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changes_", "._", "append_", "(_", "{_", "'", "config", "'_", ":_", "'", "Containe", "r", " ", "configura", "tion", " ", "update", "d", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "reboot_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "to", "\\u", "reboot_", ":_", "\\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 ", " _", "stop_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "'", "Una", "ble", " ", "to", " ", "stop", " ", "container", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "change", "s", "'_", "]_", "=_", "change", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "doe", "s", "\\u", "exist_", "or_", "(_", "doe", "s", "\\u", "exist_", "and_", "state_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "!=_", "'", "runn", "ing", "'_", ")_", ":_", "\\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 ", " _", "start_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "'", "Una", "ble", " ", "to", " ", "stop", " ", "container", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "change", "s", "'_", "]_", "=_", "change", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\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_", "remove", "\\u", "seed", "\\u", "marker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rm", " ", "-", "f", " ", "\\\\'{", "0", "}\\\\'", "'_", "._", "format_", "(_", "SEED", "\\u", "MARKER", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "shell_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "default", " ", "user", "/", "password", ",", " ", "only", " ", "the", " ", "first", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ret_", "._", "get_", "(_", "'", "result", "'_", ",_", "True_", ")_", "and_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gid_", "=_", "'/.", "lxc", ".", "initial", "\\u", "pass", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gid", "s_", "=_", "[_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "lxc", ".", "initial", "\\u", "pass", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/.", "lxc", ".", "{", "0", "}.", "initial", "\\u", "pass", "'_", "._", "format_", "(_", "name_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "any_", "(_", "retcode_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", " ", "-", "e", " ", "\"{", "0", "}\"'_", "._", "format_", "(_", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ")_", "==_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "gid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "think", " ", "to", " ", "touch", " ", "the", " ", "default", " ", "user", " ", "generat", "ed", " ", "by", " ", "default", " ", "templates_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "has", " ", "a", " ", "reall", "y", " ", "unse", "cure", " ", "passwords", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", " ", "is", " ", "defin", "ed", " ", "as", " ", "a", " ", "member", " ", "ear", "lie", "r", " ", "in", " ", "the", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "default", "\\u", "user_", "in_", "[_", "'", "ubu", "ntu", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "user_", "not_", "in_", "users_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "retcode_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", " ", "{", "0", "}'_", "._", "format_", "(_", "default", "\\u", "user_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "shell_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ")_", "==_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "users_", "._", "append_", "(_", "default", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "users_", ":_", "\\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 ", " ", "_", "cre", "t_", "=_", "set\\u", "password_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "users_", "=_", "[_", "user_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encrypted_", "=_", "password", "\\u", "encrypted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "'{", "0", "}:", " ", "Fail", "ed", " ", "to", " ", "set", " ", "password", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ")_", "+_", "exc_", "._", "strerror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "hard", "fail", " ", "in", " ", "unre", "covera", "ble", " ", "situation", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", " ", "cann", "ot", " ", "be", " ", "sette", "d", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "==_", "'", "root", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "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 ", " ", " _", "log_", "._", "debug_", "(_", "msg_", ")_", "\\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_", "ret_", "._", "get_", "(_", "'", "result", "'_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changes_", "._", "append_", "(_", "{_", "'", "password", "'_", ":_", "'", "Passw", "ord", "(", "s", ")", " ", "update", "d", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retcode_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "sh", " ", "-", "c", " ", "\\\\'", "touch", " ", "\"{", "0", "}\"", ";", " ", "test", " ", "-", "e", " ", "\"{", "0", "}\"", "\\\\''_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "gid_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "'", "Fail", "ed", " ", "to", " ", "set", " ", "password", " ", "marker", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changes_", "[_", "-_", "1_", "]_", "[_", "'", "password", "'_", "]_", "+=_", "'.", " ", "'_", "+_", "ret_", "[_", "'", "comment", "'_", "]_", "+_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "dns", " ", "server", "s", " ", "if", " ", "any", ",", " ", "only", " ", "the", " ", "first", " ", "time_", "\\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_", "ret_", "._", "get_", "(_", "'", "result", "'_", ",_", "True_", ")_", "and_", "dns", "servers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "retro", " ", "compatibility", ",", " ", "test", " ", "als", "o", " ", "old", " ", "markers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gid_", "=_", "'/.", "lxc", ".", "initial", "\\u", "dns", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gid", "s_", "=_", "[_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "lxc", ".", "initial", "\\u", "dns", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "lxc", ".", "{", "0", "}.", "initial", "\\u", "dns", "'_", "._", "format_", "(_", "name_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "any_", "(_", "retcode_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", " ", "-", "e", " ", "\"{", "0", "}\"'_", "._", "format_", "(_", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ")_", "==_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "gid", "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 ", " _", "set\\u", "dns_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dns", "servers_", "=_", "dns", "servers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "domains_", "=_", "search", "domains_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "'", "Fail", "ed", " ", "to", " ", "set", " ", "DNS", ":", " ", "'_", "+_", "exc_", "._", "strerror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "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 ", " _", "changes_", "._", "append_", "(_", "{_", "'", "dns", "'_", ":_", "'", "DNS", " ", "update", "d", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retcode_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "sh", " ", "-", "c", " ", "\\\\'", "touch", " ", "\"{", "0", "}\"", ";", " ", "test", " ", "-", "e", " ", "\"{", "0", "}\"", "\\\\''_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "gid_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "'", "Fail", "ed", " ", "to", " ", "set", " ", "DNS", " ", "marker", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changes_", "[_", "-_", "1_", "]_", "[_", "'", "dns", "'_", "]_", "+=_", "'.", " ", "'_", "+_", "ret_", "[_", "'", "comment", "'_", "]_", "+_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "retro", " ", "compatibility", ",", " ", "test", " ", "als", "o", " ", "old", " ", "markers_", "\\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_", "remove", "\\u", "seed", "\\u", "marker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rm", " ", "-", "f", " ", "\\\\'{", "0", "}\\\\'", "'_", "._", "format_", "(_", "SEED", "\\u", "MARKER", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "shell_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gid_", "=_", "'/.", "lxc", ".", "initial", "\\u", "seed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gid", "s_", "=_", "[_", "gid_", ",_", "'/", "lxc", ".", "initial", "\\u", "seed", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "any_", "(_", "retcode_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", " ", "-", "e", " ", "{", "0", "}'_", "._", "format_", "(_", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ")_", "==_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "gid", "s_", ")_", "or_", "not_", "ret_", "._", "get_", "(_", "'", "result", "'_", ",_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "seed_", "or_", "seed", "\\u", "cmd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "seed_", ":_", "\\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_", "=_", "bootstrap_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "config_", "=_", "salt", "\\u", "config_", ",_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "approve", "\\u", "key_", "=_", "approve", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "\\u", "key_", "=_", "pub", "\\u", "key_", ",_", "priv", "\\u", "key_", "=_", "priv", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install_", "=_", "install_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "install_", "=_", "force", "\\u", "install_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uncon", "dition", "al", "\\u", "install_", "=_", "uncon", "dition", "al", "\\u", "install_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "delay_", "=_", "boots", "trap", "\\u", "delay_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "url_", "=_", "boots", "trap", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "shell_", "=_", "boots", "trap", "\\u", "shell_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "args_", "=_", "boots", "trap", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "'", "Boots", "trap", " ", "fail", "ed", ":", " ", "'_", "+_", "exc_", "._", "strerror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "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 ", " _", "if_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "(_", "'", "Boots", "trap", " ", "fail", "ed", ",", " ", "see", " ", "minion", " ", "log", " ", "for", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "more", " ", "informati", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "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 ", " ", "_", "changes_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "boots", "trap", "'_", ":_", "'", "Containe", "r", " ", "success", "full", "y", " ", "bootstrapp", "ed", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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_", "seed", "\\u", "cmd_", ":_", "\\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_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "seed", "\\u", "cmd_", "]_", "(_", "info_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "[_", "'", "rootfs", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "salt", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "(_", "'", "Boots", "trap", " ", "via", " ", "seed", "\\u", "cmd", " ", "\\\\'{", "0", "}\\\\'", " ", "fail", "ed", ":", " ", "{", "1", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "seed", "\\u", "cmd_", ",_", "exc_", "._", "strerror_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "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 ", " _", "if_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "(_", "'", "Boots", "trap", " ", "via", " ", "seed", "\\u", "cmd", " ", "\\\\'{", "0", "}\\\\'", " ", "fail", "ed", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "see", " ", "minion", " ", "log", " ", "for", " ", "more", " ", "informati", "on", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "seed", "\\u", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "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 ", " ", "_", "changes_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "boots", "trap", "'_", ":_", "'", "Containe", "r", " ", "success", "full", "y", " ", "bootstrapp", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "usi", "ng", " ", "seed", "\\u", "cmd", " ", "\\\\'{", "0", "}\\\\'", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "seed", "\\u", "cmd_", ")_", "}_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ret_", "._", "get_", "(_", "'", "result", "'_", ",_", "True_", ")_", "and_", "not_", "start", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stop_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sal", "t", "Invoca", "tion", "Error_", ",_", "Command", "Execut", "ion", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "'", "Una", "ble", " ", "to", " ", "stop", " ", "container", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "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_", "state", "\\u", "post_", "=_", "state_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state", "\\u", "pre_", "!=_", "state", "\\u", "post_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changes_", "._", "append_", "(_", "{_", "'", "state", "'_", ":_", "{_", "'", "old", "'_", ":_", "state", "\\u", "pre_", ",_", "'", "new", "'_", ":_", "state", "\\u", "post_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ret_", "._", "get_", "(_", "'", "result", "'_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "comment", "'_", "]_", "=_", "(_", "'", "Containe", "r", " ", "\\\\'{", "0", "}\\\\'", " ", "success", "full", "y", " ", "initialize", "d", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "result", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "change", "s", "'_", "]_", "=_", "change", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wait", "\\u", "started_", "(_", "name_", ",_", "path_", "=_", "None_", ",_", "timeout_", "=_", "300_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "tha", "t", " ", "the", " ", "system", " ", "has", " ", "full", "y", " ", "init", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "actual", "ly", " ", "very", " ", "importa", "nt", " ", "for", " ", "system", "D", " ", "based", " ", "container", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "see", " ", "https", "://", "git", "hub", ".", "com", "/", "salt", "stack", "/", "salt", "/", "issue", "s", "/", "238", "4", "7", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "path", " ", "to", " ", "the", " ", "container", " ", "parent", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "/", "var", "/", "lib", "/", "lxc", " ", "(", "system", " ", "default", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.8", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "mym", "ini", "on", " ", "lxc", ".", "wait", "\\u", "start", "ed", " ", "ubu", "ntu", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "exists_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Execut", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Containe", "r", " ", "{", "0", "}", " ", "doe", "s", " ", "doe", "s", " ", "exist", "s", "'_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "state_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "==_", "'", "runn", "ing", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Execut", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Containe", "r", " ", "{", "0", "}", " ", "is", " ", "not", " ", "runn", "ing", "'_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "runn", "ing", "\\u", "system", "d_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "started_", "=_", "test\\u", "sd", "\\u", "start", "ed", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "log_", "._", "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 ", " _", "test\\u", "started_", "=_", "test\\u", "bare", "\\u", "start", "ed", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "log_", "._", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expire_", "=_", "now_", "+_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "started_", "=_", "test\\u", "started_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "time_", "._", "time_", "(_", ")_", "<_", "expire_", "and_", "not_", "started_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "started_", "=_", "test\\u", "started_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "started_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Assu", "ming", " ", "{", "0", "}", " ", "is", " ", "start", "ed", ",", " ", "alth", "ou", "gh", " ", "we", " ", "fail", "ed", " ", "to", " ", "detect", " ", "tha", "t", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "is", " ", "full", "y", " ", "start", "ed", " ", "correct", "ly", "'_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "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 ", " _", "ret_", "=_", "started_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bootstrap_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "approve", "\\u", "key_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "\\u", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "priv", "\\u", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "url_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "install_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uncon", "dition", "al", "\\u", "install_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "delay_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "args_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "shell_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Install", " ", "and", " ", "configur", "e", " ", "salt", " ", "in", " ", "a", " ", "container", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "config", "\\", "10", ";", " ", " ", " ", " ", "Mini", "on", " ", "configura", "tion", " ", "options", ".", " ", "By", " ", "default", ",", " ", "the", " ", "``", "master", "``", " ", "option", " ", "is", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "target", " ", "host", "'", "s", " ", "master", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "approve", "\\u", "key", "\\", "10", ";", " ", " ", " ", " ", "Request", " ", "a", " ", "pre", "-", "approval", " ", "of", " ", "the", " ", "generat", "ed", " ", "minion", " ", "key", ".", " ", "Requ", "ires", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "salt", "-", "master", " ", "be", " ", "configur", "ed", " ", "to", " ", "eit", "her", " ", "auto", "-", "accept", " ", "all", " ", "keys", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "expect", " ", "a", " ", "signin", "g", " ", "request", " ", "from", " ", "the", " ", "target", " ", "host", ".", " ", "Default", ":", " ", "``", "Tru", "e", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "path", " ", "to", " ", "the", " ", "container", " ", "parent", "\\", "10", ";", " ", " ", " ", " ", "default", ":", " ", "/", "var", "/", "lib", "/", "lxc", " ", "(", "system", " ", "default", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.8", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pub", "\\u", "key", "\\", "10", ";", " ", " ", " ", " ", "Exp", "licit", " ", "public", " ", "key", " ", "to", " ", "presse", "d", " ", "the", " ", "minion", " ", "with", " ", "(", "option", "al", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "filepath", " ", "or", " ", "a", " ", "string", " ", "represent", "ing", " ", "the", " ", "key", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "priv", "\\u", "key", "\\", "10", ";", " ", " ", " ", " ", "Exp", "licit", " ", "private", " ", "key", " ", "to", " ", "presse", "d", " ", "the", " ", "minion", " ", "with", " ", "(", "option", "al", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "filepath", " ", "or", " ", "a", " ", "string", " ", "represent", "ing", " ", "the", " ", "key", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "dela", "y", "\\", "10", ";", " ", " ", " ", " ", "Delay", " ", "in", " ", "second", "s", " ", "bet", "ween", " ", "end", " ", "of", " ", "container", " ", "creati", "on", " ", "and", " ", "bootstrapp", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "efu", "l", " ", "whe", "n", " ", "wait", "ing", " ", "for", " ", "container", " ", "to", " ", "obtain", " ", "a", " ", "DHC", "P", " ", "lease", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "201", "5.5", ".0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "url", "\\", "10", ";", " ", " ", " ", " ", "url", ",", " ", "content", " ", "or", " ", "filepath", " ", "to", " ", "the", " ", "salt", " ", "boots", "trap", " ", "script", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "args", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "boots", "trap", " ", "script", " ", "argu", "ment", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "shell", "\\", "10", ";", " ", " ", " ", " ", "shell", " ", "to", " ", "execute", " ", "the", " ", "script", " ", "int", "o", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "install", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "atte", "mpt", " ", "a", " ", "full", " ", "installation", " ", "of", " ", "salt", "-", "minion", " ", "if", " ", "need", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "force", "\\u", "install", "\\", "10", ";", " ", " ", " ", " ", "Force", " ", "installation", " ", "even", " ", "if", " ", "salt", "-", "minion", " ", "is", " ", "detect", "ed", ",", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "is", " ", "the", " ", "way", " ", "to", " ", "run", " ", "vendor", " ", "boots", "trap", " ", "scripts", " ", "even", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "a", " ", "salt", " ", "minion", " ", "is", " ", "alr", "ead", "y", " ", "presen", "t", " ", "in", " ", "the", " ", "container", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "uncon", "dition", "al", "\\u", "install", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "the", " ", "script", " ", "even", " ", "if", " ", "the", " ", "container", " ", "see", "ms", " ", "seede", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ples", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'", "minion", "'", " ", "lxc", ".", "boots", "trap", " ", "container", "\\u", "name", " ", "[", "config", "=", "config", "\\u", "data", "]", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "[", "approve", "\\u", "key", "=(", "Tru", "e", "|", "Fal", "se", ")]", " ", "[", "install", "=(", "Tru", "e", "|", "Fal", "se", ")]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wait", "\\u", "started_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "boots", "trap", "\\u", "delay_", "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 ", " _", "log_", "._", "info_", "(_", "'", "LX", "C", " ", "{", "0", "}:", " ", "boots", "trap", "\\u", "dela", "y", ":", " ", "{", "1", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "boots", "trap", "\\u", "delay_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "boots", "trap", "\\u", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ba", "d", " ", "input", ",", " ", "but", " ", "assume", " ", "sinc", "e", " ", "a", " ", "value", " ", "was", " ", "pass", "ed", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "dela", "y", " ", "was", " ", "desi", "red", ",", " ", "and", " ", "sleep", " ", "for", " ", "5", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c\\u", "info_", "=_", "info_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "c\\u", "info_", ":_", "\\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_", "#", " ", "default", " ", "set", " ", "here", " ", "as", " ", "we", " ", "cann", "ot", " ", "set", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "def", " ", "as", " ", "it", " ", "can", " ", "come", " ", "from", " ", "a", " ", "chain", " ", "of", " ", "procedure", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "boots", "trap", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "custom", " ", "boots", "trap", " ", "args", " ", "can", " ", "be", " ", "total", "ly", " ", "customize", "d", ",", " ", "and", " ", "user", " ", "coul", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "inserted", " ", "the", " ", "placehold", "er", " ", "for", " ", "the", " ", "config", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "example", ",", " ", "some", " ", "salt", " ", "boots", "trap", " ", "script", " ", "do", " ", "not", " ", "use", " ", "at", " ", "all", " ", "-", "c_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'{", "0", "}'_", "not_", "in_", "boots", "trap", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "boots", "trap", "\\u", "args_", "+=_", "'", " ", "-", "c", " ", "{", "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 ", " _", "boots", "trap", "\\u", "args_", "=_", "'-", "c", " ", "{", "0", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "boots", "trap", "\\u", "shell_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "boots", "trap", "\\u", "shell_", "=_", "'", "sh", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "state_", "=_", "\\u", "ensure", "\\u", "running_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "orig", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "orig", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "force", "\\u", "install_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "need", "s", "\\u", "install_", "=_", "\\u", "need", "s", "\\u", "install_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "need", "s", "\\u", "install_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "seede", "d_", "=_", "retcode_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", " ", "-", "e", " ", "\\\\'{", "0", "}\\\\'", "'_", "._", "format_", "(_", "SEED", "\\u", "MARKER", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chroot", "\\u", "fallback_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "seede", "d_", "and_", "not_", "uncon", "dition", "al", "\\u", "install_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "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 ", " _", "ret_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg", "\\u", "files_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "seed", ".", "mk", "config", "'_", "]_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config_", ",_", "tmp_", "=_", "tmp_", ",_", "id\\u_", "=_", "name_", ",_", "approve", "\\u", "key_", "=_", "approve", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "\\u", "key_", "=_", "pub", "\\u", "key_", ",_", "priv", "\\u", "key_", "=_", "priv", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "s", "\\u", "install_", "or_", "force", "\\u", "install_", "or_", "uncon", "dition", "al", "\\u", "install_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "install_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rstr", "_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "test", ".", "rand", "\\u", "str", "'_", "]_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configd", "ir_", "=_", "'/", "var", "/", "tmp", "/.", "c\\u", "{", "0", "}'_", "._", "format_", "(_", "rstr", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "'", "install", " ", "-", "m", " ", "0700", " ", "-", "d", " ", "{", "0", "}'_", "._", "format_", "(_", "configd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "run_", "(_", "name_", ",_", "cmd_", ",_", "python", "\\u", "shell_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "error_", "(_", "'", "tmpdir", " ", "{", "0", "}", " ", "creati", "on", " ", "fail", "ed", " ", "({", "1", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "configd", "ir_", ",_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bs", "\\u_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "config", ".", "gather", "\\u", "boots", "trap", "\\u", "script", "'_", "]_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "=_", "boots", "trap", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "=_", "'/", "sb", "in", "/{", "0", "}\\u", "boots", "trap", ".", "sh", "'_", "._", "format_", "(_", "rstr", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "to_", "(_", "name_", ",_", "bs", "\\u_", ",_", "script_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "run", "\\u", "all_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sh", " ", "-", "c", " ", "\"", "chm", "od", " ", "+", "x", " ", "{", "0", "}\"'_", "._", "format_", "(_", "script_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "copy", "\\u", "to_", "(_", "name_", ",_", "cfg", "\\u", "files_", "[_", "'", "config", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "configd", "ir_", ",_", "'", "minion", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "to_", "(_", "name_", ",_", "cfg", "\\u", "files_", "[_", "'", "priv", "key", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "configd", "ir_", ",_", "'", "minion", ".", "pe", "m", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "to_", "(_", "name_", ",_", "cfg", "\\u", "files_", "[_", "'", "pubkey", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "configd", "ir_", ",_", "'", "minion", ".", "pub", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boots", "trap", "\\u", "args_", "=_", "boots", "trap", "\\u", "args_", "._", "format_", "(_", "configd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "(_", "'{", "0", "}", " ", "{", "2", "}", " ", "{", "1", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "boots", "trap", "\\u", "shell_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "boots", "trap", "\\u", "args_", "._", "replace_", "(_", "\"'\"_", ",_", "\"''\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "script_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "log", " ", "AS", "AP", " ", "the", " ", "forge", "d", " ", "boots", "trap", " ", "command", " ", "whi", "ch", " ", "can", " ", "be", " ", "wrapped_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "out", " ", "of", " ", "the", " ", "output", " ", "in", " ", "case", " ", "of", " ", "unexpected", " ", "problem_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "'", "Run", "ning", " ", "{", "0", "}", " ", "in", " ", "LX", "C", " ", "container", " ", "\\\\'{", "1", "}\\\\'", "'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "cmd_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "retcode_", "(_", "name_", ",_", "cmd_", ",_", "output", "\\u", "loglevel_", "=_", "'", "info", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "use", "\\u", "vt_", "=_", "True_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run", "\\u", "all_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sh", " ", "-", "c", " ", "\\\\'", "if", " ", "[", " ", "-", "f", " ", "\"{", "0", "}\"", " ", "];", "then", " ", "rm", " ", "-", "f", " ", "\"{", "0", "}\"", ";", "fi", "\\\\''_", "\\u\\u\\uNL\\u\\u\\u_", "''_", "._", "format_", "(_", "script_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "retcode_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "shell_", "=_", "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 ", " _", "ret_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "minion", "\\u", "config_", "=_", "salt_", "._", "config_", "._", "minion", "\\u", "config_", "(_", "cfg", "\\u", "files_", "[_", "'", "config", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pki", "\\u", "dir_", "=_", "minion", "\\u", "config_", "[_", "'", "pki", "\\u", "dir", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "to_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cfg", "\\u", "files_", "[_", "'", "config", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "etc", "/", "salt", "/", "minion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "to_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cfg", "\\u", "files_", "[_", "'", "priv", "key", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "pki", "\\u", "dir_", ",_", "'", "minion", ".", "pe", "m", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "to_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cfg", "\\u", "files_", "[_", "'", "pubkey", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "pki", "\\u", "dir_", ",_", "'", "minion", ".", "pub", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "salt", "-", "call", " ", "--", "local", " ", "service", ".", "enable", " ", "salt", "-", "minion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "shell_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "tmp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "orig", "\\u", "state_", "==_", "'", "stopp", "ed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stop_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "orig", "\\u", "state_", "==_", "'", "frozen", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "freeze_", "(_", "name_", ",_", "path_", "=_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mark", " ", "seede", "d", " ", "upo", "n", " ", "success", "ful", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "touch", " ", "\\\\'{", "0", "}\\\\'", "'_", "._", "format_", "(_", "SEED", "\\u", "MARKER", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "shell_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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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 ]
Imprecise assert
jollychang/robotframework-appiumlibrary/tests/locators/test_elementfinder.py
[ { "content": " def test_should_have_strategies(self):\n \"\"\"Element Finder instance should contain expected strategies.\"\"\"\n self.assertTrue('android' in self.finder._strategies)\n self.assertTrue('ios' in self.finder._strategies)", "metadata": "root.ElementFinderTests.test_should_have_strategies", "header": "['class', 'ElementFinderTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 } ]
[ { "span": "self.assertTrue('android' in self.finder._strategies)", "start_line": 15, "start_column": 8, "end_line": 15, "end_column": 61 }, { "span": "self.assertTrue('ios' in self.finder._strategies)", "start_line": 16, "start_column": 8, "end_line": 16, "end_column": 57 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Element", "Fin", "der", "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", "shou", "ld", "\\u", "have", "\\u", "strategies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Element", " ", "Fin", "der", " ", "instance", " ", "shou", "ld", " ", "contain", " ", "expected", " ", "strategi", "es", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "android", "'_", "in_", "self_", "._", "finder_", "._", "\\u", "strategies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ios", "'_", "in_", "self_", "._", "finder_", "._", "\\u", "strategies_", ")_", "\\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, 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, 2 ]
Except block handles 'BaseException'
xraypy/xraylarch/plugins/epics/xrfcontrol.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\nEpics XRF Display App\n\"\"\"\n\nimport sys\nimport os\n\nimport time\nimport copy\nfrom functools import partial\n\nimport wx\nimport wx.lib.mixins.inspection\nimport wx.lib.scrolledpanel as scrolled\ntry:\n from wx._core import PyDeadObjectError\nexcept:\n PyDeadObjectError = Exception\n\nimport wx.lib.colourselect as csel\nimport numpy as np\nimport matplotlib\n\nHAS_PLOT = False\ntry:\n from wxmplot import PlotPanel\n HAS_PLOT = True\nexcept ImportError:\n HAS_PLOT = False\n\nHAS_DV = False\ntry:\n import wx.dataview as dv\n HAS_DV = True\nexcept:\n pass\n\nfrom wxutils import (SimpleText, EditableListBox, Font, FloatCtrl,\n pack, Popup, Button, get_icon, Check, MenuItem,\n Choice, FileOpen, FileSave, fix_filename, HLine,\n GridPanel, CEN, LEFT, RIGHT)\n\n\nimport larch\nfrom larch_plugins.wx import (PeriodicTablePanel, XRFDisplayFrame,\n FILE_WILDCARDS, CalibrationFrame)\n\nROI_WILDCARD = 'Data files (*.dat)|*.dat|ROI files (*.roi)|*.roi|All files (*.*)|*.*'\nlarch.use_plugin_path('epics')\ntry:\n from larch_plugins.epics import Epics_MultiXMAP, Epics_Xspress3\n from scandb import ScanDB\nexcept:\n pass\n\n\n\n\n\n\nif __name__ == \"__main__\":\n # e = EpicsXRFApp(prefix='QX4:', det_type='ME-4',\n # amp_type='xspress3', nmca=4)\n\n EpicsXRFApp().MainLoop()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def ConnectScanDB(self, **kws):\n self.scandb = ScanDB(**kws)\n # print \"Scandb \", self.scandb\n if self.scandb is not None:\n basedir = self.scandb.get_info('user_folder')\n fileroot = self.scandb.get_info('server_fileroot')\n basedir = str(basedir)\n fileroot = str(fileroot)\n if basedir.startswith(fileroot):\n basedir = basedir[len(fileroot):]\n fullpath = os.path.join(fileroot, basedir)\n fullpath = fullpath.replace('\\\\', '/').replace('//', '/')\n curdir = os.getcwd()\n try:\n os.chdir(fullpath)\n except:\n os.chdir(curdir)\n self.scandb.connect_pvs()", "metadata": "root.EpicsXRFDisplayFrame.ConnectScanDB", "header": "['class', 'EpicsXRFDisplayFrame', '(', 'XRFDisplayFrame', ')', ':', '___EOS___']", "index": 165 }, { "content": " def onCalibrateEnergy(self, event=None, **kws):\n try:\n self.win_calib.Raise()\n except:\n self.win_calib = CalibrationFrame(self, mca=self.mca,\n larch=self.larch,\n callback=self.onSetCalib)", "metadata": "root.EpicsXRFDisplayFrame.onCalibrateEnergy", "header": "['class', 'EpicsXRFDisplayFrame', '(', 'XRFDisplayFrame', ')', ':', '___EOS___']", "index": 571 } ]
[ { "span": "except:", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 7 }, { "span": "except:", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 7 }, { "span": "except:", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 7 }, { "span": "except:", "start_line": 180, "start_column": 8, "end_line": 180, "end_column": 15 }, { "span": "except:", "start_line": 574, "start_column": 8, "end_line": 574, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Epi", "cs", " ", "XR", "F", " ", "Display", " ", "App", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "wx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wx_", "._", "lib_", "._", "mixins_", "._", "inspection", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wx_", "._", "lib_", "._", "scrolled", "panel_", "as_", "scrolled", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "wx_", "._", "\\u", "core_", "import_", "Py", "Dead", "Object", "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 ", " _", "Py", "Dead", "Object", "Error_", "=_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "wx_", "._", "lib_", "._", "colour", "select_", "as_", "cse", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HAS", "\\u", "PLOT", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "wx", "mplo", "t_", "import_", "Plot", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "PLOT", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HAS", "\\u", "PLOT", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "HAS", "\\u", "DV", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "wx_", "._", "datav", "iew_", "as_", "dv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "DV", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "wx", "utils_", "import_", "(_", "Simple", "Text_", ",_", "Editable", "List", "Box_", ",_", "Font_", ",_", "Float", "Ctrl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pack_", ",_", "Popup_", ",_", "Button_", ",_", "get", "\\u", "icon_", ",_", "Check_", ",_", "Menu", "Item_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Choice_", ",_", "File", "Open_", ",_", "File", "Save_", ",_", "fix", "\\u", "filename_", ",_", "HL", "ine_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Grid", "Panel_", ",_", "CEN", "_", ",_", "LEFT_", ",_", "RIGHT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "lar", "ch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lar", "ch", "\\u", "plugins_", "._", "wx_", "import_", "(_", "Period", "ic", "Table", "Panel_", ",_", "XR", "FD", "isp", "lay", "Frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FILE", "\\u", "WIL", "DC", "ARD", "S_", ",_", "Calibrat", "ion", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ROI", "\\u", "WIL", "DC", "ARD", "_", "=_", "'", "Data", " ", "files", " ", "(*", ".", "dat", ")|", "*.", "dat", "|", "ROI", " ", "files", " ", "(*", ".", "roi", ")|", "*.", "roi", "|", "All", " ", "files", " ", "(*", ".*)", "|", "*.", "*'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lar", "ch_", "._", "use", "\\u", "plugin", "\\u", "path_", "(_", "'", "epic", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lar", "ch", "\\u", "plugins_", "._", "epic", "s_", "import_", "Epi", "cs", "\\u", "Multi", "XM", "AP_", ",_", "Epi", "cs", "\\u", "Xs", "press", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scan", "db_", "import_", "Sca", "n", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "e", " ", "=", " ", "Epi", "cs", "XR", "FA", "pp", "(", "prefix", "='", "QX", "4", ":'", ",", " ", "det", "\\u", "type", "='", "ME", "-", "4", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "amp", "\\u", "type", "='", "xsp", "ress", "3", "',", " ", "nm", "ca", "=", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Epi", "cs", "XR", "FA", "pp_", "(_", ")_", "._", "Main", "Loop_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Epi", "cs", "XR", "FD", "isp", "lay", "Frame_", "(_", "XR", "FD", "isp", "lay", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Connect", "Sca", "n", "DB_", "(_", "self_", ",_", "**_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scan", "db_", "=_", "Sca", "n", "DB_", "(_", "**_", "kws_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "Sca", "ndb", " ", "\",", " ", "self", ".", "scan", "db_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "scan", "db_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basedir_", "=_", "self_", "._", "scan", "db_", "._", "get", "\\u", "info_", "(_", "'", "user", "\\u", "folder", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filer", "oot_", "=_", "self_", "._", "scan", "db_", "._", "get", "\\u", "info_", "(_", "'", "server", "\\u", "filer", "oot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "basedir_", "=_", "str_", "(_", "basedir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filer", "oot_", "=_", "str_", "(_", "filer", "oot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "basedir_", "._", "startswith_", "(_", "filer", "oot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basedir_", "=_", "basedir_", "[_", "len_", "(_", "filer", "oot_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fullpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "filer", "oot_", ",_", "basedir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fullpath_", "=_", "fullpath_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'/'_", ")_", "._", "replace_", "(_", "'//'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curdir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "fullpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "curdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "scan", "db_", "._", "connect", "\\u", "pvs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Epi", "cs", "XR", "FD", "isp", "lay", "Frame_", "(_", "XR", "FD", "isp", "lay", "Frame_", ")_", ":_", "\\u\\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", "Calibrat", "e", "Energy_", "(_", "self_", ",_", "event_", "=_", "None_", ",_", "**_", "kws_", ")_", ":_", "\\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_", "._", "win", "\\u", "calib", "_", "._", "Raise_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "win", "\\u", "calib", "_", "=_", "Calibrat", "ion", "Frame_", "(_", "self_", ",_", "mca", "_", "=_", "self_", "._", "mca", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lar", "ch_", "=_", "self_", "._", "lar", "ch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "self_", "._", "on", "Set", "Cali", "b_", ")_", "\\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,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, 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 ]
Unused local variable
CybOXProject/python-cybox/cybox/bindings/win_registry_key_object.py
[ { "content": " def exportChildren(self, lwrite, level, namespace_='WinRegistryKeyObj:', name_='RegistryValueType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Name is not None:\n self.Name.export(lwrite, level, 'WinRegistryKeyObj:', name_='Name', pretty_print=pretty_print)\n if self.Data is not None:\n self.Data.export(lwrite, level, 'WinRegistryKeyObj:', name_='Data', pretty_print=pretty_print)\n if self.Datatype is not None:\n self.Datatype.export(lwrite, level, 'WinRegistryKeyObj:', name_='Datatype', pretty_print=pretty_print)\n if self.Byte_Runs is not None:\n self.Byte_Runs.export(lwrite, level, 'WinRegistryKeyObj:', name_='Byte_Runs', pretty_print=pretty_print)", "metadata": "root.RegistryValueType.exportChildren", "header": "['class', 'RegistryValueType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 69 }, { "content": " def exportChildren(self, lwrite, level, namespace_='WinRegistryKeyObj:', name_='RegistryValuesType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Value_ in self.Value:\n Value_.export(lwrite, level, 'WinRegistryKeyObj:', name_='Value', pretty_print=pretty_print)", "metadata": "root.RegistryValuesType.exportChildren", "header": "['class', 'RegistryValuesType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 155 }, { "content": " def exportChildren(self, lwrite, level, namespace_='WinRegistryKeyObj:', name_='RegistrySubkeysType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Subkey_ in self.Subkey:\n Subkey_.export(lwrite, level, 'WinRegistryKeyObj:', name_='Subkey', pretty_print=pretty_print)", "metadata": "root.RegistrySubkeysType.exportChildren", "header": "['class', 'RegistrySubkeysType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 223 }, { "content": " def exportChildren(self, lwrite, level, namespace_='WinRegistryKeyObj:', name_='WindowsRegistryKeyObjectType', fromsubclass_=False, pretty_print=True):\n super(WindowsRegistryKeyObjectType, self).exportChildren(lwrite, level, 'WinRegistryKeyObj:', name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Key is not None:\n self.Key.export(lwrite, level, 'WinRegistryKeyObj:', name_='Key', pretty_print=pretty_print)\n if self.Hive is not None:\n self.Hive.export(lwrite, level, 'WinRegistryKeyObj:', name_='Hive', pretty_print=pretty_print)\n if self.Number_Values is not None:\n self.Number_Values.export(lwrite, level, 'WinRegistryKeyObj:', name_='Number_Values', pretty_print=pretty_print)\n if self.Values is not None:\n self.Values.export(lwrite, level, 'WinRegistryKeyObj:', name_='Values', pretty_print=pretty_print)\n if self.Modified_Time is not None:\n self.Modified_Time.export(lwrite, level, 'WinRegistryKeyObj:', name_='Modified_Time', pretty_print=pretty_print)\n if self.Creator_Username is not None:\n self.Creator_Username.export(lwrite, level, 'WinRegistryKeyObj:', name_='Creator_Username', pretty_print=pretty_print)\n if self.Handle_List is not None:\n self.Handle_List.export(lwrite, level, 'WinRegistryKeyObj:', name_='Handle_List', pretty_print=pretty_print)\n if self.Number_Subkeys is not None:\n self.Number_Subkeys.export(lwrite, level, 'WinRegistryKeyObj:', name_='Number_Subkeys', pretty_print=pretty_print)\n if self.Subkeys is not None:\n self.Subkeys.export(lwrite, level, 'WinRegistryKeyObj:', name_='Subkeys', pretty_print=pretty_print)\n if self.Byte_Runs is not None:\n self.Byte_Runs.export(lwrite, level, 'WinRegistryKeyObj:', name_='Byte_Runs', pretty_print=pretty_print)", "metadata": "root.WindowsRegistryKeyObjectType.exportChildren", "header": "['class', 'WindowsRegistryKeyObjectType', '(', 'cybox_common', '.', 'ObjectPropertiesType', ')', ':', '___EOS___']", "index": 482 }, { "content": "def parse(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Windows_Registry_Key'\n rootClass = WindowsRegistryKeyObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=rootTag,\n# namespacedef_='',\n# pretty_print=True)\n return rootObj", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 682 }, { "content": "def parseEtree(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Windows_Registry_Key'\n rootClass = WindowsRegistryKeyObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n rootElement = rootObj.to_etree(None, name_=rootTag)\n content = etree_.tostring(rootElement, pretty_print=True,\n xml_declaration=True, encoding=\"utf-8\")\n sys.stdout.write(content)\n sys.stdout.write('\\n')\n return rootObj, rootElement", "metadata": "root.parseEtree", "header": "['module', '___EOS___']", "index": 699 }, { "content": "def parseString(inString):\n from mixbox.vendor.six import StringIO\n doc = parsexml_(StringIO(inString))\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Windows_Registry_Key'\n rootClass = WindowsRegistryKeyObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=\"Windows_Registry_Key\",\n# namespacedef_='')\n return rootObj", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 717 } ]
[ { "span": "eol_ ", "start_line": 71, "start_column": 12, "end_line": 71, "end_column": 16 }, { "span": "eol_ ", "start_line": 73, "start_column": 12, "end_line": 73, "end_column": 16 }, { "span": "eol_ ", "start_line": 157, "start_column": 12, "end_line": 157, "end_column": 16 }, { "span": "eol_ ", "start_line": 159, "start_column": 12, "end_line": 159, "end_column": 16 }, { "span": "eol_ ", "start_line": 225, "start_column": 12, "end_line": 225, "end_column": 16 }, { "span": "eol_ ", "start_line": 227, "start_column": 12, "end_line": 227, "end_column": 16 }, { "span": "eol_ ", "start_line": 485, "start_column": 12, "end_line": 485, "end_column": 16 }, { "span": "eol_ ", "start_line": 487, "start_column": 12, "end_line": 487, "end_column": 16 }, { "span": "rootTag ", "start_line": 687, "start_column": 8, "end_line": 687, "end_column": 15 }, { "span": "doc ", "start_line": 692, "start_column": 4, "end_line": 692, "end_column": 7 }, { "span": "doc ", "start_line": 709, "start_column": 4, "end_line": 709, "end_column": 7 }, { "span": "rootTag ", "start_line": 723, "start_column": 8, "end_line": 723, "end_column": 15 }, { "span": "doc ", "start_line": 728, "start_column": 4, "end_line": 728, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Regi", "stry", "Value", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Regi", "stry", "Value", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Name_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Name", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Data_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Data", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Datat", "ype_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Datat", "ype_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Datat", "ype", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Byte", "\\u", "Run", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Byte", "\\u", "Run", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Byte", "\\u", "Run", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Regi", "stry", "Value", "s", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Regi", "stry", "Value", "s", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Value", "\\u_", "in_", "self_", "._", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Value", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Value", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Regi", "stry", "Sub", "keys", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Regi", "stry", "Sub", "keys", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Sub", "key", "\\u_", "in_", "self_", "._", "Sub", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sub", "key", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Sub", "key", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Window", "s", "Regi", "stry", "Key", "Object", "Type_", "(_", "cy", "box", "\\u", "common_", "._", "Object", "Proper", "ties", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Window", "s", "Regi", "stry", "Key", "Object", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Window", "s", "Regi", "stry", "Key", "Object", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Key_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Key", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Hi", "ve_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Hi", "ve_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Hi", "ve", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Number", "\\u", "Values_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Number", "\\u", "Values_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Number", "\\u", "Value", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Values_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Values_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Value", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Modifie", "d\\u", "Time_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Modifie", "d\\u", "Time_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Modifie", "d\\u", "Time", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Creat", "or", "\\u", "Username_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Creat", "or", "\\u", "Username_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Creat", "or", "\\u", "User", "name", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Handle", "\\u", "List_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Handle", "\\u", "List_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Handle", "\\u", "List", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Number", "\\u", "Sub", "keys_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Number", "\\u", "Sub", "keys_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Number", "\\u", "Sub", "keys", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Sub", "keys_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Sub", "keys_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Sub", "keys", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Byte", "\\u", "Run", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Byte", "\\u", "Run", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Win", "Regi", "stry", "Key", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Byte", "\\u", "Run", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Window", "s", "\\u", "Regi", "stry", "\\u", "Key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Window", "s", "Regi", "stry", "Key", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=", "root", "Ta", "g", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Et", "ree_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Window", "s", "\\u", "Regi", "stry", "\\u", "Key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Window", "s", "Regi", "stry", "Key", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Element_", "=_", "root", "Obj_", "._", "to", "\\u", "etree_", "(_", "None_", ",_", "name\\u_", "=_", "root", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "etree", "\\u_", "._", "tostring_", "(_", "root", "Element_", ",_", "pretty", "\\u", "print_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "declaration_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", ",_", "root", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "String_", "(_", "in", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "mix", "box_", "._", "vendor_", "._", "six_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "parse", "xml", "\\u_", "(_", "String", "IO_", "(_", "in", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Window", "s", "\\u", "Regi", "stry", "\\u", "Key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Window", "s", "Regi", "stry", "Key", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=\"", "Window", "s", "\\u", "Regi", "stry", "\\u", "Key", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 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 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, 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 ]
Unused import
Arelle/Arelle/arelle/plugin/streamingExtensions.py
[ { "content": "'''\nStreamingExtensions is a plug-in to both GUI menu and command line/web service\nthat provides an alternative approach to big instance documents without building a DOM, to save\nmemory footprint. lxml iterparse is used to parse the big instance. ModelObjects are specialized by features\nfor efficiency and to avoid dependency on an underlying DOM.\n\n(Note that this module is based on a parser target, an alternate based on iterparse is under examples/plugin.)\n\n(c) Copyright 2013 Mark V Systems Limited, All rights reserved.\n\nCalls these plug-in classes:\n Streaming.BlockingPlugin(modelXbrl): returns name of plug in blocking streaming if it is being blocked, else None\n Streaming.Start(modelXbrl): notifies that streaming is starting for modelXbrl; simulated modelDocument is established\n Streaming.ValidateFacts(modelXbrl, modelFacts) modelFacts are available for streaming processing\n Streaming.Finish(modelXbrl): notifies that streaming is finished\n'''\n\nimport io, os, time, sys, re, gc\nfrom decimal import Decimal, InvalidOperation\nfrom lxml import etree\nfrom arelle import XbrlConst, XmlUtil, XmlValidate, ValidateXbrlDimensions\nfrom arelle.ModelDocument import ModelDocument, Type\nfrom arelle.ModelObjectFactory import parser\nfrom arelle.ModelObject import ModelObject\nfrom arelle.ModelInstanceObject import ModelFact\nfrom arelle.PluginManager import pluginClassMethods\nfrom arelle.Validate import Validate\nfrom arelle.HashUtil import md5hash, Md5Sum\n\n_streamingExtensionsCheck = True # check streaming if enabled except for CmdLine, then only when requested\n_streamingExtensionsValidate = False\n_streamingValidatePlugin = False\n \n\n\n\n\n\n\n \n \n \n \n\n'''\ndef streamingOptionsExtender(parser):\n parser.add_option(\"--check-streaming\", \n action=\"store_true\", \n dest=\"check_streaming\", \n help=_('Check streamability of instance document.\"'))\n'''\n\n\n\n'''\n Do not use _( ) in pluginInfo itself (it is applied later, after loading\n'''\n\n__pluginInfo__ = {\n 'name': 'Streaming Extensions Loader',\n 'version': '0.9',\n 'description': \"This plug-in loads big XBRL instances without building a DOM in memory. \"\n \"lxml iterparse parses XBRL directly into an object model without a DOM. \",\n 'license': 'Apache-2',\n 'author': 'Mark V Systems Limited',\n 'copyright': '(c) Copyright 2014 Mark V Systems Limited, All rights reserved.',\n # classes of mount points (required)\n # take out for now: 'CntlrCmdLine.Options': streamingOptionsExtender,\n 'CntlrCmdLine.Utility.Run': streamingExtensionsSetup,\n 'ModelDocument.PullLoader': streamingExtensionsLoader,\n 'ModelDocument.IsValidated': streamingExtensionsIsValidated,\n}\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NotInstanceDocumentException(Exception):", "metadata": "root.NotInstanceDocumentException", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def __init__(self):\n pass", "metadata": "root.NotInstanceDocumentException.__init__", "header": "['class', 'NotInstanceDocumentException', '(', 'Exception', ')', ':', '___EOS___']", "index": 34 }, { "content": "def precedingProcessingInstruction(elt, target):\n pi = elt.getprevious()\n while pi is not None:\n if isinstance(pi, etree._ProcessingInstruction) and pi.target == target:\n return pi\n pi = pi.getprevious()\n return None", "metadata": "root.precedingProcessingInstruction", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def childProcessingInstruction(elt, target, reversed=False):\n for pi in elt.iterchildren(reversed=reversed):\n if isinstance(pi, etree._ProcessingInstruction):\n if pi.target == target:\n return pi\n else:\n break\n return None", "metadata": "root.childProcessingInstruction", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def precedingComment(elt):\n c = elt.getprevious()\n comment = ''\n while c is not None:\n if isinstance(c, etree._Comment) and c.text:\n comment = c.text + '\\n' + comment\n c = c.getprevious()\n return comment or None", "metadata": "root.precedingComment", "header": "['module', '___EOS___']", "index": 54 }, { "content": "def streamingExtensionsLoader(modelXbrl, mappedUri, filepath, *args, **kwargs):\n # check if big instance and has header with an initial incomplete tree walk (just 2 elements\n if not _streamingExtensionsCheck:\n return None\n \n # track whether modelXbrl has been validated by this streaming extension\n modelXbrl._streamingExtensionValidated = False\n \n def logSyntaxErrors(parsercontext):\n for error in parsercontext.error_log:\n modelXbrl.error(\"xmlSchema:syntax\",\n _(\"%(error)s, %(fileName)s, line %(line)s, column %(column)s, %(sourceAction)s source element\"),\n modelObject=modelXbrl, fileName=os.path.basename(filepath), \n error=error.message, line=error.line, column=error.column, sourceAction=\"streaming\")\n #### note: written for iterparse of lxml prior to version 3.3, otherwise rewrite to use XmlPullParser ###\n #### note: iterparse wants a binary file, but file is text mode\n _file, = modelXbrl.fileSource.file(filepath, binary=True)\n startedAt = time.time()\n modelXbrl.profileActivity()\n ''' this seems twice as slow as iterparse\n class instInfoTarget():\n def __init__(self, element_factory=None, parser=None):\n self.newTree = True\n self.streamingAspects = None\n self.foundInstance = False\n self.creationSoftwareComment = ''\n self.currentEltTag = \"(before xbrli:xbrl)\"\n self.numRootFacts = 0\n def start(self, tag, attrib, nsmap=None):\n if self.newTree:\n if tag == \"{http://www.xbrl.org/2003/instance}xbrl\":\n self.foundInstance = True\n self.newTree = False\n else: # break \n raise NotInstanceDocumentException()\n elif not tag.startswith(\"{http://www.xbrl.org/\"):\n self.numRootFacts += 1\n if self.numRootFacts % 1000 == 0:\n modelXbrl.profileActivity(\"... streaming tree check\", minTimeToShow=20.0)\n self.currentEltTag = tag\n def end(self, tag):\n pass\n def data(self, data):\n pass\n def comment(self, text):\n if not self.foundInstance: # accumulate comments before xbrli:xbrl\n self.creationSoftwareComment += ('\\n' if self.creationSoftwareComment else '') + text\n elif not self.creationSoftwareComment:\n self.creationSoftwareComment = text # or first comment after xbrli:xbrl\n def pi(self, target, data):\n if target == \"xbrl-streamable-instance\":\n if self.currentEltTag == \"{http://www.xbrl.org/2003/instance}xbrl\":\n self.streamingAspects = dict(etree.PI(target,data).attrib.copy()) # dereference target results\n else:\n modelXbrl.error(\"streamingExtensions:headerMisplaced\",\n _(\"Header is misplaced: %(target)s, must follow xbrli:xbrl element but was found at %(element)s\"),\n modelObject=modelXbrl, target=target, element=self.currentEltTag)\n def close(self):\n if not self.creationSoftwareComment:\n self.creationSoftwareComment = None\n return True\n instInfo = instInfoTarget()\n infoParser = etree.XMLParser(recover=True, huge_tree=True, target=instInfo)\n try:\n etree.parse(_file, parser=infoParser, base_url=filepath)\n except NotInstanceDocumentException:\n pass\n '''\n foundErrors = False\n foundInstance = False\n streamingAspects = None\n creationSoftwareComment = None\n instInfoNumRootFacts = 0\n numElts = 0\n elt = None\n instInfoContext = etree.iterparse(_file, events=(\"start\",\"end\"), huge_tree=True)\n try:\n for event, elt in instInfoContext:\n if event == \"start\":\n if elt.getparent() is not None:\n if elt.getparent().tag == \"{http://www.xbrl.org/2003/instance}xbrl\":\n if not foundInstance:\n foundInstance = True\n pi = precedingProcessingInstruction(elt, \"xbrl-streamable-instance\")\n if pi is None:\n break\n else:\n streamingAspects = dict(pi.attrib.copy())\n if creationSoftwareComment is None:\n creationSoftwareComment = precedingComment(elt)\n if not elt.tag.startswith(\"{http://www.xbrl.org/\"):\n instInfoNumRootFacts += 1\n if instInfoNumRootFacts % 1000 == 0:\n modelXbrl.profileActivity(\"... streaming tree check\", minTimeToShow=20.0)\n elif not foundInstance: \n break\n elif elt.tag == \"{http://www.xbrl.org/2003/instance}xbrl\":\n creationSoftwareComment = precedingComment(elt)\n if precedingProcessingInstruction(elt, \"xbrl-streamable-instance\") is not None:\n modelXbrl.error(\"streamingExtensions:headerMisplaced\",\n _(\"Header is misplaced: %(error)s, must follow xbrli:xbrl element\"),\n modelObject=elt)\n elif event == \"end\":\n elt.clear()\n numElts += 1\n if numElts % 1000 == 0 and elt.getparent() is not None:\n while elt.getprevious() is not None and elt.getparent() is not None:\n del elt.getparent()[0]\n except etree.XMLSyntaxError as err:\n modelXbrl.error(\"xmlSchema:syntax\",\n _(\"Unrecoverable error: %(error)s\"),\n error=err)\n _file.close()\n return err\n \n _file.seek(0,io.SEEK_SET) # allow reparsing\n if not foundInstance or streamingAspects is None:\n del elt\n _file.close()\n return None\n modelXbrl.profileStat(_(\"streaming tree check\"), time.time() - startedAt)\n startedAt = time.time()\n try:\n version = Decimal(streamingAspects.get(\"version\"))\n if int(version) != 1:\n modelXbrl.error(\"streamingExtensions:unsupportedVersion\",\n _(\"Streaming version %(version)s, major version number must be 1\"),\n modelObject=elt, version=version)\n foundErrors = True\n except (InvalidOperation, OverflowError):\n modelXbrl.error(\"streamingExtensions:versionError\",\n _(\"Version %(version)s, number must be 1.n\"),\n modelObject=elt, version=streamingAspects.get(\"version\", \"(none)\"))\n foundErrors = True\n for bufAspect in (\"contextBuffer\", \"unitBuffer\", \"footnoteBuffer\"):\n try:\n bufLimit = Decimal(streamingAspects.get(bufAspect, \"INF\"))\n if bufLimit < 1 or (bufLimit.is_finite() and bufLimit % 1 != 0):\n raise InvalidOperation\n elif bufAspect == \"contextBuffer\":\n contextBufferLimit = bufLimit\n elif bufAspect == \"unitBuffer\":\n unitBufferLimit = bufLimit\n elif bufAspect == \"footnoteBuffer\":\n footnoteBufferLimit = bufLimit\n except InvalidOperation:\n modelXbrl.error(\"streamingExtensions:valueError\",\n _(\"Streaming %(attrib)s %(value)s, number must be a positive integer or INF\"),\n modelObject=elt, attrib=bufAspect, value=streamingAspects.get(bufAspect))\n foundErrors = True\n if _streamingExtensionsValidate:\n incompatibleValidations = []\n _validateDisclosureSystem = modelXbrl.modelManager.validateDisclosureSystem\n _disclosureSystem = modelXbrl.modelManager.disclosureSystem\n if _validateDisclosureSystem and _disclosureSystem.validationType == \"EFM\":\n incompatibleValidations.append(\"EFM\")\n if _validateDisclosureSystem and _disclosureSystem.validationType == \"GFM\":\n incompatibleValidations.append(\"GFM\")\n if _validateDisclosureSystem and _disclosureSystem.validationType == \"HMRC\":\n incompatibleValidations.append(\"HMRC\")\n if modelXbrl.modelManager.validateCalcLB:\n incompatibleValidations.append(\"calculation LB\")\n if incompatibleValidations:\n modelXbrl.error(\"streamingExtensions:incompatibleValidation\",\n _(\"Streaming instance validation does not support %(incompatibleValidations)s validation\"),\n modelObject=modelXbrl, incompatibleValidations=', '.join(incompatibleValidations))\n foundErrors = True\n if instInfoContext.error_log:\n foundErrors = True\n logSyntaxErrors(instInfoContext)\n del instInfoContext # dereference\n\n for pluginMethod in pluginClassMethods(\"Streaming.BlockStreaming\"):\n _blockingPluginName = pluginMethod(modelXbrl)\n if _blockingPluginName: # name of blocking plugin is returned\n modelXbrl.error(\"streamingExtensions:incompatiblePlugIn\",\n _(\"Streaming instance not supported by plugin %(blockingPlugin)s\"),\n modelObject=modelXbrl, blockingPlugin=_blockingPluginName)\n foundErrors = True\n \n if foundErrors:\n _file.close()\n return None\n\n _encoding = XmlUtil.encoding(_file.read(512))\n _file.seek(0,io.SEEK_SET) # allow reparsing\n\n if _streamingExtensionsValidate:\n validator = Validate(modelXbrl)\n instValidator = validator.instValidator\n\n contextBuffer = []\n contextsToDrop = []\n unitBuffer = []\n unitsToDrop = []\n footnoteBuffer = []\n footnoteLinksToDrop = []\n \n _streamingFactsPlugin = any(True for pluginMethod in pluginClassMethods(\"Streaming.Facts\"))\n _streamingValidateFactsPlugin = (_streamingExtensionsValidate and \n any(True for pluginMethod in pluginClassMethods(\"Streaming.ValidateFacts\")))\n\n ''' this is very much slower than iterparse\n class modelLoaderTarget():\n def __init__(self, element_factory=None, parser=None):\n self.newTree = True\n self.currentMdlObj = None\n self.beforeInstanceStream = True\n self.beforeStartStreamingPlugin = True\n self.numRootFacts = 1\n modelXbrl.makeelementParentModelObject = None\n modelXbrl.isStreamingMode = True\n self.factsCheckVersion = None\n self.factsCheckMd5s = Md5Sum()\n def start(self, tag, attrib, nsmap=None):\n modelXbrl.makeelementParentModelObject = self.currentMdlObj # pass parent to makeelement for ModelObjectFactory\n mdlObj = _parser.makeelement(tag, attrib=attrib, nsmap=nsmap)\n mdlObj.sourceline = 1\n if self.newTree:\n self.newTree = False\n self.currentMdlObj = mdlObj\n modelDocument = ModelDocument(modelXbrl, Type.INSTANCE, mappedUri, filepath, mdlObj.getroottree())\n modelXbrl.modelDocument = modelDocument # needed for incremental validation\n mdlObj.init(modelDocument)\n modelDocument.parser = _parser # needed for XmlUtil addChild's makeelement \n modelDocument.parserLookupName = _parserLookupName\n modelDocument.parserLookupClass = _parserLookupClass\n modelDocument.xmlRootElement = mdlObj\n modelDocument.schemaLocationElements.add(mdlObj)\n modelDocument.documentEncoding = _encoding\n modelDocument._creationSoftwareComment = creationSoftwareComment\n modelXbrl.info(\"streamingExtensions:streaming\",\n _(\"Stream processing this instance.\"),\n modelObject = modelDocument)\n else:\n self.currentMdlObj.append(mdlObj)\n self.currentMdlObj = mdlObj\n mdlObj._init()\n ns = mdlObj.namespaceURI\n ln = mdlObj.localName\n if (self.beforeInstanceStream and (\n (ns == XbrlConst.link and ln not in (\"schemaRef\", \"linkbaseRef\")) or\n (ns == XbrlConst.xbrli and ln in (\"context\", \"unit\")) or\n (ns not in (XbrlConst.link, XbrlConst.xbrli)))):\n self.beforeInstanceStream = False\n if _streamingExtensionsValidate:\n instValidator.validate(modelXbrl, modelXbrl.modelManager.formulaOptions.typedParameters())\n else: # need default dimensions\n ValidateXbrlDimensions.loadDimensionDefaults(modelXbrl)\n elif not self.beforeInstanceStream and self.beforeStartStreamingPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.Start\"):\n pluginMethod(modelXbrl)\n self.beforeStartStreamingPlugin = False\n return mdlObj\n def end(self, tag):\n modelDocument = modelXbrl.modelDocument\n mdlObj = self.currentMdlObj\n parentMdlObj = mdlObj.getparent()\n self.currentMdlObj = parentMdlObj\n ns = mdlObj.namespaceURI\n ln = mdlObj.localName\n if ns == XbrlConst.xbrli:\n if ln == \"context\":\n if mdlObj.get(\"sticky\"):\n del mdlObj.attrib[\"sticky\"]\n XmlValidate.validate(modelXbrl, mdlObj)\n modelDocument.contextDiscover(mdlObj)\n else:\n if _streamingExtensionsValidate and len(contextBuffer) >= contextBufferLimit:\n # drop before adding as dropped may have same id as added\n cntx = contextBuffer.pop(0)\n if _streamingValidateFactsPlugin:\n contextsToDrop.append(cntx)\n else:\n dropContext(modelXbrl, cntx)\n del parentMdlObj[parentMdlObj.index(cntx)]\n cntx = None\n #>>XmlValidate.validate(modelXbrl, mdlObj)\n #>>modelDocument.contextDiscover(mdlObj)\n if contextBufferLimit.is_finite():\n contextBuffer.append(mdlObj)\n if _streamingExtensionsValidate:\n contextsToCheck = (mdlObj,)\n instValidator.checkContexts(contextsToCheck)\n if modelXbrl.hasXDT:\n instValidator.checkContextsDimensions(contextsToCheck)\n del contextsToCheck # dereference\n elif ln == \"unit\":\n if _streamingExtensionsValidate and len(unitBuffer) >= unitBufferLimit:\n # drop before adding as dropped may have same id as added\n unit = unitBuffer.pop(0)\n if _streamingValidateFactsPlugin:\n unitsToDrop.append(unit)\n else:\n dropUnit(modelXbrl, unit)\n del parentMdlObj[parentMdlObj.index(unit)]\n unit = None \n #>>XmlValidate.validate(modelXbrl, mdlObj)\n #>>modelDocument.unitDiscover(mdlObj)\n if unitBufferLimit.is_finite():\n unitBuffer.append(mdlObj)\n if _streamingExtensionsValidate:\n instValidator.checkUnits( (mdlObj,) )\n elif ln == \"xbrl\": # end of document\n # check remaining batched facts if any\n if _streamingValidateFactsPlugin:\n # plugin attempts to process batch of all root facts not yet processed (not just current one)\n # finish any final batch of facts\n if len(modelXbrl.facts) > 0:\n factsToCheck = modelXbrl.facts.copy()\n factsHaveBeenProcessed = True\n # can block facts deletion if required data not yet available, such as numeric unit for DpmDB\n for pluginMethod in pluginClassMethods(\"Streaming.ValidateFacts\"):\n if not pluginMethod(modelXbrl, factsToCheck):\n factsHaveBeenProcessed = False\n if factsHaveBeenProcessed:\n for fact in factsToCheck:\n dropFact(modelXbrl, fact, modelXbrl.facts)\n del parentMdlObj[parentMdlObj.index(fact)]\n for cntx in contextsToDrop:\n dropContext(modelXbrl, cntx)\n del parentMdlObj[parentMdlObj.index(cntx)]\n for unit in unitsToDrop:\n dropUnit(modelXbrl, unit)\n del parentMdlObj[parentMdlObj.index(unit)]\n for footnoteLink in footnoteLinksToDrop:\n dropFootnoteLink(modelXbrl, footnoteLink)\n del parentMdlObj[parentMdlObj.index(footnoteLink)]\n fact = cntx = unit = footnoteLink = None\n del contextsToDrop[:]\n del unitsToDrop[:]\n del footnoteLinksToDrop[:]\n del factsToCheck\n # check remaining footnote refs\n for footnoteLink in footnoteBuffer:\n checkFootnoteHrefs(modelXbrl, footnoteLink)\n for pluginMethod in pluginClassMethods(\"Streaming.Finish\"):\n pluginMethod(modelXbrl)\n elif ns == XbrlConst.link:\n if ln == \"footnoteLink\":\n XmlValidate.validate(modelXbrl, mdlObj)\n footnoteLinks = (mdlObj,)\n modelDocument.linkbaseDiscover(footnoteLinks, inInstance=True)\n if footnoteBufferLimit.is_finite():\n footnoteBuffer.append(mdlObj)\n if _streamingExtensionsValidate:\n instValidator.checkLinks(footnoteLinks)\n if len(footnoteBuffer) > footnoteBufferLimit:\n # check that hrefObjects for locators were all satisfied\n # drop before addition as dropped may have same id as added\n footnoteLink = footnoteBuffer.pop(0)\n checkFootnoteHrefs(modelXbrl, footnoteLink)\n if _streamingValidateFactsPlugin:\n footnoteLinksToDrop.append(footnoteLink)\n else:\n dropFootnoteLink(modelXbrl, footnoteLink)\n del parentMdlObj[parentMdlObj.index(footnoteLink)]\n footnoteLink = None\n footnoteLinks = None\n elif ln in (\"schemaRef\", \"linkbaseRef\"):\n modelDocument.discoverHref(mdlObj)\n elif not modelXbrl.skipDTS:\n if ln in (\"roleRef\", \"arcroleRef\"):\n modelDocument.linkbaseDiscover((mdlObj,), inInstance=True)\n elif parentMdlObj.qname == XbrlConst.qnXbrliXbrl:\n self.numRootFacts += 1\n #>>XmlValidate.validate(modelXbrl, mdlObj)\n #>>modelDocument.factDiscover(mdlObj, modelXbrl.facts)\n if self.factsCheckVersion:\n self.factCheckFact(mdlObj)\n if _streamingExtensionsValidate or _streamingValidateFactsPlugin:\n factsToCheck = (mdlObj,) # validate current fact by itself\n if _streamingExtensionsValidate:\n instValidator.checkFacts(factsToCheck)\n if modelXbrl.hasXDT:\n instValidator.checkFactsDimensions(factsToCheck)\n if _streamingValidateFactsPlugin:\n # plugin attempts to process batch of all root facts not yet processed (not just current one)\n # use batches of 1000 facts\n if len(modelXbrl.facts) > 1000:\n factsToCheck = modelXbrl.facts.copy()\n factsHaveBeenProcessed = True\n # can block facts deletion if required data not yet available, such as numeric unit for DpmDB\n for pluginMethod in pluginClassMethods(\"Streaming.ValidateFacts\"):\n if not pluginMethod(modelXbrl, factsToCheck):\n factsHaveBeenProcessed = False\n if factsHaveBeenProcessed:\n for fact in factsToCheck:\n dropFact(modelXbrl, fact, modelXbrl.facts)\n del parentMdlObj[parentMdlObj.index(fact)]\n for cntx in contextsToDrop:\n dropContext(modelXbrl, cntx)\n del parentMdlObj[parentMdlObj.index(cntx)]\n for unit in unitsToDrop:\n dropUnit(modelXbrl, unit)\n del parentMdlObj[parentMdlObj.index(unit)]\n for footnoteLink in footnoteLinksToDrop:\n dropFootnoteLink(modelXbrl, footnoteLink)\n del parentMdlObj[parentMdlObj.index(footnoteLink)]\n fact = cntx = unit = footnoteLink = None\n del contextsToDrop[:]\n del unitsToDrop[:]\n del footnoteLinksToDrop[:]\n del factsToCheck # dereference fact or batch of facts\n else:\n dropFact(modelXbrl, mdlObj, modelXbrl.facts) # single fact has been processed\n del parentMdlObj[parentMdlObj.index(mdlObj)]\n if self.numRootFacts % 1000 == 0:\n pass\n #modelXbrl.profileActivity(\"... streaming fact {0} of {1} {2:.2f}%\".format(self.numRootFacts, instInfoNumRootFacts, \n # 100.0 * self.numRootFacts / instInfoNumRootFacts), \n # minTimeToShow=20.0)\n gc.collect()\n sys.stdout.write (\"\\rAt fact {} of {} mem {}\".format(self.numRootFacts, instInfoNumRootFacts, modelXbrl.modelManager.cntlr.memoryUsed))\n return mdlObj\n def data(self, data):\n self.currentMdlObj.text = data\n def comment(self, text):\n pass\n def pi(self, target, data):\n if target == \"xbrl-facts-check\":\n _match = re.search(\"([\\\\w-]+)=[\\\"']([^\\\"']+)[\\\"']\", data)\n if _match:\n _matchGroups = _match.groups()\n if len(_matchGroups) == 2:\n if _matchGroups[0] == \"version\":\n self.factsCheckVersion = _matchGroups[1]\n elif _matchGroups[0] == \"sum-of-fact-md5s\":\n try:\n expectedMd5 = Md5Sum(_matchGroups[1])\n if self.factsCheckMd5s != expectedMd5:\n modelXbrl.warning(\"streamingExtensions:xbrlFactsCheckWarning\",\n _(\"XBRL facts sum of md5s expected %(expectedMd5)s not matched to actual sum %(actualMd5Sum)s\"),\n modelObject=modelXbrl, expectedMd5=expectedMd5, actualMd5Sum=self.factsCheckMd5s)\n else:\n modelXbrl.info(\"info\",\n _(\"Successful XBRL facts sum of md5s.\"),\n modelObject=modelXbrl)\n except ValueError:\n modelXbrl.error(\"streamingExtensions:xbrlFactsCheckError\",\n _(\"Invalid sum-of-md5s %(sumOfMd5)s\"),\n modelObject=modelXbrl, sumOfMd5=_matchGroups[1])\n def close(self):\n del modelXbrl.makeelementParentModelObject\n return None\n \n def factCheckFact(self, fact):\n self.factsCheckMd5s += fact.md5sum\n for _tupleFact in fact.modelTupleFacts:\n self.factCheckFact(_tupleFact)\n \n _parser, _parserLookupName, _parserLookupClass = parser(modelXbrl, filepath, target=modelLoaderTarget())\n etree.parse(_file, parser=_parser, base_url=filepath)\n logSyntaxErrors(_parser)\n '''\n # replace modelLoaderTarget with iterparse (as it now supports CustomElementClassLookup)\n streamingParserContext = etree.iterparse(_file, events=(\"start\",\"end\"), huge_tree=True)\n from arelle.ModelObjectFactory import setParserElementClassLookup\n modelXbrl.isStreamingMode = True # must be set before setting element class lookup\n (_parser, _parserLookupName, _parserLookupClass) = setParserElementClassLookup(streamingParserContext, modelXbrl)\n foundInstance = False\n beforeInstanceStream = beforeStartStreamingPlugin = True\n numRootFacts = 0\n factsCheckVersion = None\n def factCheckFact(fact):\n modelDocument._factsCheckMd5s += fact.md5sum\n for _tupleFact in fact.modelTupleFacts:\n factCheckFact(_tupleFact)\n for event, mdlObj in streamingParserContext:\n if event == \"start\":\n if mdlObj.tag == \"{http://www.xbrl.org/2003/instance}xbrl\":\n modelDocument = ModelDocument(modelXbrl, Type.INSTANCE, mappedUri, filepath, mdlObj.getroottree())\n modelXbrl.modelDocument = modelDocument # needed for incremental validation\n mdlObj.init(modelDocument)\n modelDocument.parser = _parser # needed for XmlUtil addChild's makeelement \n modelDocument.parserLookupName = _parserLookupName\n modelDocument.parserLookupClass = _parserLookupClass\n modelDocument.xmlRootElement = mdlObj\n modelDocument.schemaLocationElements.add(mdlObj)\n modelDocument.documentEncoding = _encoding\n modelDocument._creationSoftwareComment = precedingComment(mdlObj)\n modelDocument._factsCheckMd5s = Md5Sum()\n modelXbrl.info(\"streamingExtensions:streaming\",\n _(\"Stream processing this instance.\"),\n modelObject = modelDocument)\n elif mdlObj.getparent() is not None:\n mdlObj._init() # requires discovery as part of start elements\n if mdlObj.getparent().tag == \"{http://www.xbrl.org/2003/instance}xbrl\":\n if not foundInstance:\n foundInstance = True\n pi = precedingProcessingInstruction(mdlObj, \"xbrl-facts-check\")\n if pi is not None:\n factsCheckVersion = pi.attrib.get(\"version\", None)\n elif not foundInstance: \n break\n ns = mdlObj.qname.namespaceURI\n ln = mdlObj.qname.localName\n if beforeInstanceStream:\n if ((ns == XbrlConst.link and ln not in (\"schemaRef\", \"linkbaseRef\")) or\n (ns == XbrlConst.xbrli and ln in (\"context\", \"unit\")) or\n (ns not in (XbrlConst.link, XbrlConst.xbrli))):\n beforeInstanceStream = False\n if _streamingExtensionsValidate:\n instValidator.validate(modelXbrl, modelXbrl.modelManager.formulaOptions.typedParameters())\n else: # need default dimensions\n ValidateXbrlDimensions.loadDimensionDefaults(modelXbrl)\n elif not beforeInstanceStream and beforeStartStreamingPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.Start\"):\n pluginMethod(modelXbrl)\n beforeStartStreamingPlugin = False\n elif event == \"end\":\n parentMdlObj = mdlObj.getparent()\n ns = mdlObj.namespaceURI\n ln = mdlObj.localName\n if ns == XbrlConst.xbrli:\n if ln == \"context\":\n if mdlObj.get(\"sticky\"):\n del mdlObj.attrib[\"sticky\"]\n XmlValidate.validate(modelXbrl, mdlObj)\n modelDocument.contextDiscover(mdlObj)\n else:\n if len(contextBuffer) >= contextBufferLimit:\n # drop before adding as dropped may have same id as added\n cntx = contextBuffer.pop(0)\n if _streamingFactsPlugin or _streamingValidateFactsPlugin:\n contextsToDrop.append(cntx)\n else:\n dropContext(modelXbrl, cntx)\n #>>del parentMdlObj[parentMdlObj.index(cntx)]\n cntx = None\n XmlValidate.validate(modelXbrl, mdlObj)\n modelDocument.contextDiscover(mdlObj)\n if contextBufferLimit.is_finite():\n contextBuffer.append(mdlObj)\n if _streamingExtensionsValidate:\n contextsToCheck = (mdlObj,)\n instValidator.checkContexts(contextsToCheck)\n if modelXbrl.hasXDT:\n instValidator.checkContextsDimensions(contextsToCheck)\n del contextsToCheck # dereference\n elif ln == \"unit\":\n if len(unitBuffer) >= unitBufferLimit:\n # drop before additing as dropped may have same id as added\n unit = unitBuffer.pop(0)\n if _streamingFactsPlugin or _streamingValidateFactsPlugin:\n unitsToDrop.append(unit)\n else:\n dropUnit(modelXbrl, unit)\n #>>del parentMdlObj[parentMdlObj.index(unit)]\n unit = None \n XmlValidate.validate(modelXbrl, mdlObj)\n modelDocument.unitDiscover(mdlObj)\n if unitBufferLimit.is_finite():\n unitBuffer.append(mdlObj)\n if _streamingExtensionsValidate:\n instValidator.checkUnits( (mdlObj,) )\n elif ln == \"xbrl\": # end of document\n # check remaining batched facts if any\n if _streamingFactsPlugin or _streamingValidateFactsPlugin:\n # plugin attempts to process batch of all root facts not yet processed (not just current one)\n # finish any final batch of facts\n if len(modelXbrl.facts) > 0:\n factsToCheck = modelXbrl.facts.copy()\n # can block facts deletion if required data not yet available, such as numeric unit for DpmDB\n if _streamingValidateFactsPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.ValidateFacts\"):\n pluginMethod(instValidator, factsToCheck)\n if _streamingFactsPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.Facts\"):\n pluginMethod(modelXbrl, factsToCheck)\n for fact in factsToCheck:\n dropFact(modelXbrl, fact, modelXbrl.facts)\n #>>del parentMdlObj[parentMdlObj.index(fact)]\n for cntx in contextsToDrop:\n dropContext(modelXbrl, cntx)\n #>>del parentMdlObj[parentMdlObj.index(cntx)]\n for unit in unitsToDrop:\n dropUnit(modelXbrl, unit)\n #>>del parentMdlObj[parentMdlObj.index(unit)]\n for footnoteLink in footnoteLinksToDrop:\n dropFootnoteLink(modelXbrl, footnoteLink)\n #>>del parentMdlObj[parentMdlObj.index(footnoteLink)]\n fact = cntx = unit = footnoteLink = None\n del contextsToDrop[:]\n del unitsToDrop[:]\n del footnoteLinksToDrop[:]\n del factsToCheck\n # check remaining footnote refs\n for footnoteLink in footnoteBuffer:\n checkFootnoteHrefs(modelXbrl, footnoteLink)\n pi = childProcessingInstruction(mdlObj, \"xbrl-facts-check\", reversed=True)\n if pi is not None: # attrib is in .text, not attrib, no idea why!!!\n _match = re.search(\"([\\\\w-]+)=[\\\"']([^\\\"']+)[\\\"']\", pi.text)\n if _match:\n _matchGroups = _match.groups()\n if len(_matchGroups) == 2:\n if _matchGroups[0] == \"sum-of-fact-md5s\":\n try:\n expectedMd5 = Md5Sum(_matchGroups[1])\n if modelDocument._factsCheckMd5s != expectedMd5:\n modelXbrl.warning(\"streamingExtensions:xbrlFactsCheckWarning\",\n _(\"XBRL facts sum of md5s expected %(expectedMd5)s not matched to actual sum %(actualMd5Sum)s\"),\n modelObject=modelXbrl, expectedMd5=expectedMd5, actualMd5Sum=modelDocument._factsCheckMd5s)\n else:\n modelXbrl.info(\"info\",\n _(\"Successful XBRL facts sum of md5s.\"),\n modelObject=modelXbrl)\n except ValueError:\n modelXbrl.error(\"streamingExtensions:xbrlFactsCheckError\",\n _(\"Invalid sum-of-md5s %(sumOfMd5)s\"),\n modelObject=modelXbrl, sumOfMd5=_matchGroups[1])\n if _streamingValidateFactsPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.ValidateFinish\"):\n pluginMethod(instValidator)\n if _streamingFactsPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.Finish\"):\n pluginMethod(modelXbrl)\n elif ns == XbrlConst.link:\n if ln in (\"schemaRef\", \"linkbaseRef\"):\n modelDocument.discoverHref(mdlObj, urlRewritePluginClass=\"ModelDocument.InstanceSchemaRefRewriter\")\n elif ln in (\"roleRef\", \"arcroleRef\"):\n modelDocument.linkbaseDiscover((mdlObj,), inInstance=True)\n elif ln == \"footnoteLink\":\n XmlValidate.validate(modelXbrl, mdlObj)\n footnoteLinks = (mdlObj,)\n modelDocument.linkbaseDiscover(footnoteLinks, inInstance=True)\n if footnoteBufferLimit.is_finite():\n footnoteBuffer.append(mdlObj)\n if _streamingExtensionsValidate:\n instValidator.checkLinks(footnoteLinks)\n if len(footnoteBuffer) > footnoteBufferLimit:\n # check that hrefObjects for locators were all satisfied\n # drop before addition as dropped may have same id as added\n footnoteLink = footnoteBuffer.pop(0)\n checkFootnoteHrefs(modelXbrl, footnoteLink)\n if _streamingValidateFactsPlugin:\n footnoteLinksToDrop.append(footnoteLink)\n else:\n dropFootnoteLink(modelXbrl, footnoteLink)\n #>>del parentMdlObj[parentMdlObj.index(footnoteLink)]\n footnoteLink = None\n footnoteLinks = None\n elif parentMdlObj.qname == XbrlConst.qnXbrliXbrl and isinstance(mdlObj, ModelFact):\n numRootFacts += 1\n XmlValidate.validate(modelXbrl, mdlObj)\n modelDocument.factDiscover(mdlObj, modelXbrl.facts)\n if factsCheckVersion:\n factCheckFact(mdlObj)\n if _streamingExtensionsValidate or _streamingFactsPlugin or _streamingValidateFactsPlugin:\n factsToCheck = (mdlObj,) # validate current fact by itself\n if _streamingExtensionsValidate:\n instValidator.checkFacts(factsToCheck)\n if modelXbrl.hasXDT:\n instValidator.checkFactsDimensions(factsToCheck)\n if _streamingFactsPlugin or _streamingValidateFactsPlugin:\n # plugin attempts to process batch of all root facts not yet processed (not just current one)\n # use batches of 1000 facts\n if len(modelXbrl.facts) > 1000:\n factsToCheck = modelXbrl.facts.copy()\n # can block facts deletion if required data not yet available, such as numeric unit for DpmDB\n if _streamingValidateFactsPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.ValidateFacts\"):\n pluginMethod(instValidator, factsToCheck)\n if _streamingFactsPlugin:\n for pluginMethod in pluginClassMethods(\"Streaming.Facts\"):\n pluginMethod(modelXbrl, factsToCheck)\n for fact in factsToCheck:\n dropFact(modelXbrl, fact, modelXbrl.facts)\n #>>del parentMdlObj[parentMdlObj.index(fact)]\n for cntx in contextsToDrop:\n dropContext(modelXbrl, cntx)\n #>>del parentMdlObj[parentMdlObj.index(cntx)]\n for unit in unitsToDrop:\n dropUnit(modelXbrl, unit)\n #>>del parentMdlObj[parentMdlObj.index(unit)]\n for footnoteLink in footnoteLinksToDrop:\n dropFootnoteLink(modelXbrl, footnoteLink)\n #>>del parentMdlObj[parentMdlObj.index(footnoteLink)]\n fact = cntx = unit = footnoteLink = None\n del contextsToDrop[:]\n del unitsToDrop[:]\n del footnoteLinksToDrop[:]\n del factsToCheck # dereference fact or batch of facts\n else:\n dropFact(modelXbrl, mdlObj, modelXbrl.facts) # single fact has been processed\n #>>del parentMdlObj[parentMdlObj.index(mdlObj)]\n if numRootFacts % 1000 == 0:\n pass\n #modelXbrl.profileActivity(\"... streaming fact {0} of {1} {2:.2f}%\".format(self.numRootFacts, instInfoNumRootFacts, \n # 100.0 * self.numRootFacts / instInfoNumRootFacts), \n # minTimeToShow=20.0)\n #gc.collect()\n #sys.stdout.write (\"\\rAt fact {} of {} mem {}\".format(numRootFacts, instInfoNumRootFacts, modelXbrl.modelManager.cntlr.memoryUsed))\n if mdlObj is not None:\n mdlObj.clear()\n del _parser, _parserLookupName, _parserLookupClass \n \n if _streamingExtensionsValidate and validator is not None:\n _file.close()\n del instValidator\n validator.close()\n # track that modelXbrl has been validated by this streaming extension\n modelXbrl._streamingExtensionValidated = True\n \n modelXbrl.profileStat(_(\"streaming complete\"), time.time() - startedAt)\n return modelXbrl.modelDocument", "metadata": "root.streamingExtensionsLoader", "header": "['module', '___EOS___']", "index": 63 }, { "content": "def checkFootnoteHrefs(modelXbrl, footnoteLink):\n for locElt in footnoteLink.iterchildren(tag=\"{http://www.xbrl.org/2003/linkbase}loc\"):\n for hrefElt, _doc, _id in footnoteLink.modelDocument.hrefObjects:\n if locElt == hrefElt and id not in footnoteLink.modelDocument.idObjects:\n modelXbrl.error(\"streamingExtensions:footnoteId\",\n _(\"Footnote id %(id)s not matched to fact in buffered region\"),\n modelObject=footnoteLink, id=id)", "metadata": "root.checkFootnoteHrefs", "header": "['module', '___EOS___']", "index": 770 }, { "content": "def dropContext(modelXbrl, cntx):\n del modelXbrl.contexts[cntx.id]\n dropObject(modelXbrl, cntx)", "metadata": "root.dropContext", "header": "['module', '___EOS___']", "index": 778 }, { "content": "def dropUnit(modelXbrl, unit):\n del modelXbrl.units[unit.id]\n dropObject(modelXbrl, unit)", "metadata": "root.dropUnit", "header": "['module', '___EOS___']", "index": 782 }, { "content": "def dropFootnoteLink(modelXbrl, footnoteLink):\n for baseSet in modelXbrl.baseSets.values():\n if footnoteLink in baseSet:\n baseSet.remove(footnoteLink)\n dropObject(modelXbrl, footnoteLink)", "metadata": "root.dropFootnoteLink", "header": "['module', '___EOS___']", "index": 786 }, { "content": "def dropFact(modelXbrl, fact, facts):\n while fact.modelTupleFacts:\n dropFact(modelXbrl, fact.modelTupleFacts[0], fact.modelTupleFacts)\n modelXbrl.factsInInstance.discard(fact)\n facts.remove(fact)\n modelXbrl.modelObjects[fact.objectIndex] = None # objects found by index, can't remove position from list\n if fact.id:\n fact.modelDocument.idObjects.pop(fact.id, None)\n fact.clear()", "metadata": "root.dropFact", "header": "['module', '___EOS___']", "index": 792 }, { "content": "def dropObject(modelXbrl, mdlObj):\n for childObj in mdlObj.iterchildren():\n dropObject(modelXbrl, childObj)\n if mdlObj.qname == XbrlConst.qnLinkLoc:\n hrefs = mdlObj.modelDocument.hrefObjects\n removedHrefs = [i for i, hrefObj in enumerate(hrefs) if mdlObj == hrefObj[0]]\n for i in removedHrefs:\n del hrefs[i]\n modelXbrl.modelObjects[mdlObj.objectIndex] = None # objects found by index, can't remove position from list\n if mdlObj.id:\n mdlObj.modelDocument.idObjects.pop(mdlObj.id, None)\n mdlObj.clear()", "metadata": "root.dropObject", "header": "['module', '___EOS___']", "index": 802 }, { "content": "def streamingExtensionsSetup(cntlr, options, *args, **kwargs):\n global _streamingExtensionsCheck, _streamingExtensionsValidate\n # streaming only checked in CmdLine/web server mode if requested\n # _streamingExtensionsCheck = getattr(options, 'check_streaming', False)\n _streamingExtensionsValidate = options.validate", "metadata": "root.streamingExtensionsSetup", "header": "['module', '___EOS___']", "index": 823 }, { "content": "def streamingExtensionsIsValidated(modelXbrl, *args, **kwargs):\n return getattr(modelXbrl, \"_streamingExtensionValidated\", False)", "metadata": "root.streamingExtensionsIsValidated", "header": "['module', '___EOS___']", "index": 829 } ]
[ { "span": "import io, os, time, sys, re, gc", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 32 }, { "span": "from arelle.ModelObjectFactory import parser", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 44 }, { "span": "from arelle.ModelObject import ModelObject", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 42 }, { "span": "from arelle.HashUtil import md5hash, Md5Sum", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Stream", "ing", "Ext", "ensi", "ons", " ", "is", " ", "a", " ", "plug", "-", "in", " ", "to", " ", "bot", "h", " ", "GU", "I", " ", "menu", " ", "and", " ", "command", " ", "line", "/", "web", " ", "service", "\\", "10", ";", "tha", "t", " ", "provide", "s", " ", "an", " ", "alternative", " ", "appro", "ach", " ", "to", " ", "big", " ", "instance", " ", "document", "s", " ", "with", "out", " ", "buildi", "ng", " ", "a", " ", "DOM", ",", " ", "to", " ", "save", "\\", "10", ";", "memory", " ", "footprint", ".", " ", " ", "lx", "ml", " ", "iter", "parse", " ", "is", " ", "used", " ", "to", " ", "parse", " ", "the", " ", "big", " ", "instance", ".", " ", " ", "Model", "Object", "s", " ", "are", " ", "specialize", "d", " ", "by", " ", "features", "\\", "10", ";", "for", " ", "efficien", "cy", " ", "and", " ", "to", " ", "avoid", " ", "dependen", "cy", " ", "on", " ", "an", " ", "underl", "ying", " ", "DOM", ".", "\\", "10", ";", "\\", "10", ";", "(", "Not", "e", " ", "tha", "t", " ", "this", " ", "module", " ", "is", " ", "based", " ", "on", " ", "a", " ", "parser", " ", "target", ",", " ", "an", " ", "alternat", "e", " ", "based", " ", "on", " ", "iter", "parse", " ", "is", " ", "under", " ", "example", "s", "/", "plugin", ".)", "\\", "10", ";", "\\", "10", ";", "(", "c", ")", " ", "Copy", "right", " ", "2013", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", ",", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "Calls", " ", "these", " ", "plug", "-", "in", " ", "classe", "s", ":", "\\", "10", ";", " ", " ", " ", "Stream", "ing", ".", "Block", "ing", "Plug", "in", "(", "model", "Xbrl", "):", " ", " ", "return", "s", " ", "name", " ", "of", " ", "plug", " ", "in", " ", "blockin", "g", " ", "stream", "ing", " ", "if", " ", "it", " ", "is", " ", "bei", "ng", " ", "block", "ed", ",", " ", "else", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", "Stream", "ing", ".", "Start", "(", "model", "Xbrl", "):", " ", "notifi", "es", " ", "tha", "t", " ", "stream", "ing", " ", "is", " ", "startin", "g", " ", "for", " ", "model", "Xbrl", ";", " ", "simulat", "ed", " ", "model", "Document", " ", "is", " ", "establish", "ed", "\\", "10", ";", " ", " ", " ", "Stream", "ing", ".", "Validate", "Fact", "s", "(", "model", "Xbrl", ",", " ", "model", "Fact", "s", ")", " ", "model", "Fact", "s", " ", "are", " ", "avail", "able", " ", "for", " ", "stream", "ing", " ", "process", "ing", "\\", "10", ";", " ", " ", " ", "Stream", "ing", ".", "Finish", "(", "model", "Xbrl", "):", " ", "notifi", "es", " ", "tha", "t", " ", "stream", "ing", " ", "is", " ", "finish", "ed", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "io_", ",_", "os_", ",_", "time_", ",_", "sys_", ",_", "re_", ",_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", ",_", "Inva", "lid", "Operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "import_", "Xbrl", "Const_", ",_", "Xm", "l", "Util_", ",_", "Xm", "l", "Validate", "_", ",_", "Validate", "Xbrl", "Dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Document_", "import_", "Model", "Document_", ",_", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Object", "Factory_", "import_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Object_", "import_", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Insta", "nce", "Object_", "import_", "Model", "Fact", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Plug", "in", "Manager_", "import_", "plugin", "Class", "Methods_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Validate", "_", "import_", "Validate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Hash", "Util_", "import_", "md5", "hash_", ",_", "Md", "5", "Sum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Check_", "=_", "True_", "#", " ", "check", " ", "stream", "ing", " ", "if", " ", "enable", "d", " ", "except", " ", "for", " ", "Cmd", "Line", ",", " ", "then", " ", "only", " ", "whe", "n", " ", "requested_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "stream", "ing", "Validate", "Plugin_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "'''", "\\", "10", ";", "def", " ", "stream", "ing", "Optio", "ns", "Extend", "er", "(", "parser", "):", "\\", "10", ";", " ", " ", " ", " ", "parser", ".", "add", "\\u", "option", "(\"", "--", "check", "-", "stream", "ing", "\",", " ", "\\", "10", ";", " ", " ", " ", " ", "action", "=\"", "store", "\\u", "true", "\",", " ", "\\", "10", ";", " ", " ", " ", " ", "dest", "=\"", "check", "\\u", "stream", "ing", "\",", " ", "\\", "10", ";", " ", " ", " ", " ", "help", "=", "\\u(", "'", "Check", " ", "stream", "abilit", "y", " ", "of", " ", "instance", " ", "document", ".\"", "'))", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", "Do", " ", "not", " ", "use", " ", "\\u(", " ", ")", " ", "in", " ", "plugin", "Info", " ", "its", "elf", " ", "(", "it", " ", "is", " ", "applied", " ", "late", "r", ",", " ", "after", " ", "load", "ing", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "plugin", "Info", "\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Stream", "ing", " ", "Ext", "ensi", "ons", " ", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "0.", "9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "\"", "Thi", "s", " ", "plug", "-", "in", " ", "load", "s", " ", "big", " ", "XB", "RL", " ", "instance", "s", " ", "with", "out", " ", "buildi", "ng", " ", "a", " ", "DOM", " ", "in", " ", "memory", ".", " ", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lx", "ml", " ", "iter", "parse", " ", "parse", "s", " ", "XB", "RL", " ", "direct", "ly", " ", "int", "o", " ", "an", " ", "object", " ", "model", " ", "with", "out", " ", "a", " ", "DOM", ".", " ", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "'_", ":_", "'", "Ap", "ache", "-", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ":_", "'", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "copyr", "ight", "'_", ":_", "'(", "c", ")", " ", "Copy", "right", " ", "2014", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", ",", " ", "All", " ", "rights", " ", "reserve", "d", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "classe", "s", " ", "of", " ", "mount", " ", "points", " ", "(", "require", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", " ", "out", " ", "for", " ", "now", ":", " ", "'", "Cnt", "lr", "Cmd", "Line", ".", "Optio", "ns", "':", " ", "stream", "ing", "Optio", "ns", "Extend", "er", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cnt", "lr", "Cmd", "Line", ".", "Utili", "ty", ".", "Run", "'_", ":_", "stream", "ing", "Ext", "ensi", "ons", "Setup_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Model", "Document", ".", "Pul", "l", "Load", "er", "'_", ":_", "stream", "ing", "Ext", "ensi", "ons", "Loader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Model", "Document", ".", "Is", "Validate", "d", "'_", ":_", "stream", "ing", "Ext", "ensi", "ons", "Is", "Validate", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Not", "Insta", "nce", "Document", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Not", "Insta", "nce", "Document", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "preceding", "Process", "ing", "Instruction_", "(_", "elt_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pi_", "=_", "elt_", "._", "getpr", "evi", "ous_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "pi_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "pi_", ",_", "etree_", "._", "\\u", "Process", "ing", "Instruction_", ")_", "and_", "pi_", "._", "target_", "==_", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pi_", "=_", "pi_", "._", "getpr", "evi", "ous_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "child", "Process", "ing", "Instruction_", "(_", "elt_", ",_", "target_", ",_", "reversed_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pi_", "in_", "elt_", "._", "iter", "children_", "(_", "reversed_", "=_", "reversed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "pi_", ",_", "etree_", "._", "\\u", "Process", "ing", "Instruction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pi_", "._", "target_", "==_", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pi_", "\\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 ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "preceding", "Comment_", "(_", "elt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "elt_", "._", "getpr", "evi", "ous_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "c_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "c_", ",_", "etree_", "._", "\\u", "Comment_", ")_", "and_", "c_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "c_", "._", "text_", "+_", "'\\\\", "n", "'_", "+_", "comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "c_", "._", "getpr", "evi", "ous_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "comment_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stream", "ing", "Ext", "ensi", "ons", "Loader_", "(_", "model", "Xbrl", "_", ",_", "mapp", "ed", "Uri_", ",_", "filepath_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "big", " ", "instance", " ", "and", " ", "has", " ", "header", " ", "with", " ", "an", " ", "initial", " ", "incomplete", " ", "tree", " ", "walk", " ", "(", "just", " ", "2", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Check_", ":_", "\\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_", "#", " ", "track", " ", "whe", "ther", " ", "model", "Xbrl", " ", "has", " ", "bee", "n", " ", "validat", "ed", " ", "by", " ", "this", " ", "stream", "ing", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Xbrl", "_", "._", "\\u", "stream", "ing", "Ext", "ensi", "on", "Validate", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "log", "Syntax", "Errors_", "(_", "parser", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "error_", "in_", "parser", "context_", "._", "error", "\\u", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xml", "Schema", ":", "synta", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"%", "(", "error", ")", "s", ",", " ", "%", "(", "file", "Name", ")", "s", ",", " ", "line", " ", "%", "(", "line", ")", "s", ",", " ", "column", " ", "%", "(", "column", ")", "s", ",", " ", "%", "(", "source", "Action", ")", "s", " ", "source", " ", "element", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ",_", "file", "Name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "filepath_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "error_", "._", "message_", ",_", "line_", "=_", "error_", "._", "line_", ",_", "column_", "=_", "error_", "._", "column_", ",_", "source", "Action_", "=_", "\"", "stream", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "#", " ", "note", ":", " ", "writt", "en", " ", "for", " ", "iter", "parse", " ", "of", " ", "lx", "ml", " ", "prior", " ", "to", " ", "version", " ", "3.3", ",", " ", "other", "wis", "e", " ", "rewrite", " ", "to", " ", "use", " ", "Xm", "l", "Pul", "l", "Parser", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "note", ":", " ", "iter", "parse", " ", "want", "s", " ", "a", " ", "binar", "y", " ", "file", ",", " ", "but", " ", "file", " ", "is", " ", "text", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "file_", ",_", "=_", "model", "Xbrl", "_", "._", "file", "Source_", "._", "file_", "(_", "filepath_", ",_", "binary_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "ed", "At_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", " ", "this", " ", "see", "ms", " ", "twi", "ce", " ", "as", " ", "slow", " ", "as", " ", "iter", "parse", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "inst", "Info", "Target", "():", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "element", "\\u", "factor", "y", "=", "Non", "e", ",", " ", "parser", "=", "Non", "e", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "new", "Tree", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "stream", "ing", "Asp", "ect", "s", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "found", "Insta", "nce", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "creati", "on", "Sof", "twa", "re", "Comme", "nt", " ", "=", " ", "''", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "El", "t", "Ta", "g", " ", "=", " ", "\"(", "bef", "ore", " ", "xbr", "li", ":", "xbr", "l", ")\"", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "start", "(", "self", ",", " ", "tag", ",", " ", "attrib", ",", " ", "nsma", "p", "=", "Non", "e", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "new", "Tree", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "tag", " ", "==", " ", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "}", "xbr", "l", "\":", "\\", "10", ";", " ", " ", "self", ".", "found", "Insta", "nce", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", "self", ".", "new", "Tree", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "else", ":", " ", "#", " ", "break", " ", "\\", "10", ";", " ", " ", "raise", " ", "Not", "Insta", "nce", "Document", "Except", "ion", "()", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "not", " ", "tag", ".", "startswith", "(\"", "{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/\"", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "+=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "%", " ", "1000", " ", "==", " ", "0", ":", "\\", "10", ";", " ", " ", "model", "Xbrl", ".", "profile", "Activ", "it", "y", "(\".", "..", " ", "stream", "ing", " ", "tree", " ", "check", "\",", " ", "min", "Time", "To", "Show", "=", "20.", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "El", "t", "Ta", "g", " ", "=", " ", "tag", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "end", "(", "self", ",", " ", "tag", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "data", "(", "self", ",", " ", "data", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "comment", "(", "self", ",", " ", "text", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "self", ".", "found", "Insta", "nce", ":", " ", "#", " ", "accumulate", " ", "comment", "s", " ", "bef", "ore", " ", "xbr", "li", ":", "xbr", "l", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "creati", "on", "Sof", "twa", "re", "Comme", "nt", " ", "+=", " ", "('\\", "\\", "n", "'", " ", "if", " ", "self", ".", "creati", "on", "Sof", "twa", "re", "Comme", "nt", " ", "else", " ", "''", ")", " ", "+", " ", "text", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "not", " ", "self", ".", "creati", "on", "Sof", "twa", "re", "Comme", "nt", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "creati", "on", "Sof", "twa", "re", "Comme", "nt", " ", "=", " ", "text", " ", "#", " ", "or", " ", "first", " ", "comment", " ", "after", " ", "xbr", "li", ":", "xbr", "l", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "pi", "(", "self", ",", " ", "target", ",", " ", "data", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "target", " ", "==", " ", "\"", "xbr", "l", "-", "stream", "able", "-", "instance", "\":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "current", "El", "t", "Ta", "g", " ", "==", " ", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "}", "xbr", "l", "\":", "\\", "10", ";", " ", " ", "self", ".", "stream", "ing", "Asp", "ect", "s", " ", "=", " ", "dict", "(", "etree", ".", "PI", "(", "target", ",", "data", ").", "attrib", ".", "copy", "())", " ", "#", " ", "dereferenc", "e", " ", "target", " ", "results", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", "model", "Xbrl", ".", "error", "(\"", "stream", "ing", "Ext", "ensi", "ons", ":", "header", "Mis", "place", "d", "\",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\\u(", "\"", "Head", "er", " ", "is", " ", "mis", "place", "d", ":", " ", "%", "(", "target", ")", "s", ",", " ", "must", " ", "follow", " ", "xbr", "li", ":", "xbr", "l", " ", "element", " ", "but", " ", "was", " ", "found", " ", "at", " ", "%", "(", "element", ")", "s", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "model", "Object", "=", "model", "Xbrl", ",", " ", "target", "=", "target", ",", " ", "element", "=", "self", ".", "current", "El", "t", "Ta", "g", ")", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "close", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "self", ".", "creati", "on", "Sof", "twa", "re", "Comme", "nt", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "creati", "on", "Sof", "twa", "re", "Comme", "nt", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "inst", "Info", " ", "=", " ", "inst", "Info", "Target", "()", "\\", "10", ";", " ", " ", " ", " ", "info", "Parser", " ", "=", " ", "etree", ".", "XML", "Parser", "(", "recover", "=", "Tru", "e", ",", " ", "huge", "\\u", "tree", "=", "Tru", "e", ",", " ", "target", "=", "inst", "Info", ")", "\\", "10", ";", " ", " ", " ", " ", "try", ":", "\\", "10", ";", " ", " ", " ", " ", "etree", ".", "parse", "(\\u", "file", ",", " ", "parser", "=", "info", "Parser", ",", " ", "base", "\\u", "url", "=", "filepath", ")", "\\", "10", ";", " ", " ", " ", " ", "except", " ", "Not", "Insta", "nce", "Document", "Except", "ion", ":", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Errors_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Instance_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "ing", "Asp", "ects_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creati", "on", "Sof", "twa", "re", "Comment_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "Info", "Num", "Roo", "t", "Fact", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "El", "ts_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elt_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "Info", "Context_", "=_", "etree_", "._", "iter", "parse_", "(_", "\\u", "file_", ",_", "events_", "=_", "(_", "\"", "start", "\"_", ",_", "\"", "end", "\"_", ")_", ",_", "huge", "\\u", "tree_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "event_", ",_", "elt_", "in_", "inst", "Info", "Context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "==_", "\"", "start", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "elt_", "._", "getpar", "ent_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "elt_", "._", "getpar", "ent_", "(_", ")_", "._", "tag_", "==_", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "}", "xbr", "l", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "found", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found", "Instance_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pi_", "=_", "preceding", "Process", "ing", "Instruction_", "(_", "elt_", ",_", "\"", "xbr", "l", "-", "stream", "able", "-", "instance", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pi_", "is_", "None_", ":_", "\\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 ", " ", " _", "stream", "ing", "Asp", "ects_", "=_", "dict_", "(_", "pi_", "._", "attrib_", "._", "copy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "creati", "on", "Sof", "twa", "re", "Comment_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "creati", "on", "Sof", "twa", "re", "Comment_", "=_", "preceding", "Comment_", "(_", "elt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "elt_", "._", "tag_", "._", "startswith_", "(_", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inst", "Info", "Num", "Roo", "t", "Fact", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "inst", "Info", "Num", "Roo", "t", "Fact", "s_", "%_", "1000_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "stream", "ing", " ", "tree", " ", "check", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "20.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_", "elif_", "not_", "found", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "elt_", "._", "tag_", "==_", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "}", "xbr", "l", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "creati", "on", "Sof", "twa", "re", "Comment_", "=_", "preceding", "Comment_", "(_", "elt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "preceding", "Process", "ing", "Instruction_", "(_", "elt_", ",_", "\"", "xbr", "l", "-", "stream", "able", "-", "instance", "\"_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "header", "Mis", "place", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Head", "er", " ", "is", " ", "mis", "place", "d", ":", " ", "%", "(", "error", ")", "s", ",", " ", "must", " ", "follow", " ", "xbr", "li", ":", "xbr", "l", " ", "element", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "elt_", ")_", "\\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_", "event_", "==_", "\"", "end", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elt_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "El", "ts_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "El", "ts_", "%_", "1000_", "==_", "0_", "and_", "elt_", "._", "getpar", "ent_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "while_", "elt_", "._", "getpr", "evi", "ous_", "(_", ")_", "is_", "not_", "None_", "and_", "elt_", "._", "getpar", "ent_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "elt_", "._", "getpar", "ent_", "(_", ")_", "[_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "etree_", "._", "XML", "Syntax", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xml", "Schema", ":", "synta", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Unre", "covera", "ble", " ", "error", ":", " ", "%", "(", "error", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "file_", "._", "seek_", "(_", "0_", ",_", "io_", "._", "SEE", "K", "\\u", "SET_", ")_", "#", " ", "allow", " ", "repar", "sing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "found", "Instance_", "or_", "stream", "ing", "Asp", "ects_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "elt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "stream", "ing", " ", "tree", " ", "check", "\"_", ")_", ",_", "time_", "._", "time_", "(_", ")_", "-_", "start", "ed", "At_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "ed", "At_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "Decimal_", "(_", "stream", "ing", "Asp", "ects_", "._", "get_", "(_", "\"", "version", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "version_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "unsup", "porte", "d", "Version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Stream", "ing", " ", "version", " ", "%", "(", "version", ")", "s", ",", " ", "major", " ", "version", " ", "number", " ", "must", " ", "be", " ", "1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "elt_", ",_", "version_", "=_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Errors_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Inva", "lid", "Operation_", ",_", "Over", "flow", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "version", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Version", " ", "%", "(", "version", ")", "s", ",", " ", "number", " ", "must", " ", "be", " ", "1", ".", "n", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "elt_", ",_", "version_", "=_", "stream", "ing", "Asp", "ects_", "._", "get_", "(_", "\"", "version", "\"_", ",_", "\"(", "none", ")\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Errors_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "buf", "Asp", "ect_", "in_", "(_", "\"", "context", "Buffer", "\"_", ",_", "\"", "unit", "Buffer", "\"_", ",_", "\"", "footnote", "Buffer", "\"_", ")_", ":_", "\\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 ", " _", "buf", "Limit_", "=_", "Decimal_", "(_", "stream", "ing", "Asp", "ects_", "._", "get_", "(_", "buf", "Asp", "ect_", ",_", "\"", "INF", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "buf", "Limit_", "<_", "1_", "or_", "(_", "buf", "Limit_", "._", "is", "\\u", "finite", "_", "(_", ")_", "and_", "buf", "Limit_", "%_", "1_", "!=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "buf", "Asp", "ect_", "==_", "\"", "context", "Buffer", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "Buffer", "Limit_", "=_", "buf", "Limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "buf", "Asp", "ect_", "==_", "\"", "unit", "Buffer", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unit", "Buffer", "Limit_", "=_", "buf", "Limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "buf", "Asp", "ect_", "==_", "\"", "footnote", "Buffer", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "footnote", "Buffer", "Limit_", "=_", "buf", "Limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Inva", "lid", "Operation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "value", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Stream", "ing", " ", "%", "(", "attrib", ")", "s", " ", "%", "(", "value", ")", "s", ",", " ", "number", " ", "must", " ", "be", " ", "a", " ", "posit", "ive", " ", "integ", "er", " ", "or", " ", "INF", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "elt_", ",_", "attrib_", "=_", "buf", "Asp", "ect_", ",_", "value_", "=_", "stream", "ing", "Asp", "ects_", "._", "get_", "(_", "buf", "Asp", "ect_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Errors_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "incomp", "atible", "Validat", "ions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "validat", "e", "Disc", "los", "ure", "System_", "=_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "validat", "e", "Disc", "los", "ure", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "discl", "osu", "re", "System_", "=_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "discl", "osu", "re", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "validat", "e", "Disc", "los", "ure", "System_", "and_", "\\u", "discl", "osu", "re", "System_", "._", "validation", "Type_", "==_", "\"", "EF", "M", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "incomp", "atible", "Validat", "ions_", "._", "append_", "(_", "\"", "EF", "M", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "validat", "e", "Disc", "los", "ure", "System_", "and_", "\\u", "discl", "osu", "re", "System_", "._", "validation", "Type_", "==_", "\"", "GF", "M", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "incomp", "atible", "Validat", "ions_", "._", "append_", "(_", "\"", "GF", "M", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "validat", "e", "Disc", "los", "ure", "System_", "and_", "\\u", "discl", "osu", "re", "System_", "._", "validation", "Type_", "==_", "\"", "HM", "RC", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "incomp", "atible", "Validat", "ions_", "._", "append_", "(_", "\"", "HM", "RC", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "validat", "e", "Calc", "LB", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "incomp", "atible", "Validat", "ions_", "._", "append_", "(_", "\"", "calculati", "on", " ", "LB", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "incomp", "atible", "Validat", "ions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "incomp", "atible", "Validat", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Stream", "ing", " ", "instance", " ", "validation", " ", "doe", "s", " ", "not", " ", "support", " ", "%", "(", "incomp", "atible", "Validat", "ion", "s", ")", "s", " ", "validation", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ",_", "incomp", "atible", "Validat", "ions_", "=_", "',", " ", "'_", "._", "join_", "(_", "incomp", "atible", "Validat", "ions_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Errors_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "inst", "Info", "Context_", "._", "error", "\\u", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Errors_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log", "Syntax", "Errors_", "(_", "inst", "Info", "Context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "inst", "Info", "Context_", "#", " ", "dereferenc", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Block", "Stream", "ing", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "blockin", "g", "Plug", "in", "Name_", "=_", "plugin", "Method_", "(_", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "blockin", "g", "Plug", "in", "Name_", ":_", "#", " ", "name", " ", "of", " ", "blockin", "g", " ", "plugin", " ", "is", " ", "returned_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "incomp", "atible", "Plug", "In", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Stream", "ing", " ", "instance", " ", "not", " ", "support", "ed", " ", "by", " ", "plugin", " ", "%", "(", "blockin", "g", "Plug", "in", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ",_", "blockin", "g", "Plugin_", "=_", "\\u", "blockin", "g", "Plug", "in", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Errors_", "=_", "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_", "found", "Errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "encoding_", "=_", "Xm", "l", "Util_", "._", "encoding_", "(_", "\\u", "file_", "._", "read_", "(_", "512_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "file_", "._", "seek_", "(_", "0_", ",_", "io_", "._", "SEE", "K", "\\u", "SET_", ")_", "#", " ", "allow", " ", "repar", "sing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validator_", "=_", "Validate", "_", "(_", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "Validator_", "=_", "validator_", "._", "inst", "Validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context", "Buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "s", "To", "Drop", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unit", "Buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unit", "s", "To", "Drop", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "footnote", "Buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "footnote", "Link", "s", "To", "Drop", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", "=_", "any_", "(_", "True_", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Fact", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", "=_", "(_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "any_", "(_", "True_", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Validate", "Fact", "s", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", " ", "this", " ", "is", " ", "very", " ", "muc", "h", " ", "slowe", "r", " ", "than", " ", "iter", "parse", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "model", "Load", "er", "Target", "():", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "element", "\\u", "factor", "y", "=", "Non", "e", ",", " ", "parser", "=", "Non", "e", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "new", "Tree", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "Md", "l", "Obj", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "bef", "ore", "Insta", "nce", "Stream", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "bef", "ore", "Start", "Stream", "ing", "Plug", "in", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "model", "Xbrl", ".", "make", "element", "Parent", "Model", "Object", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "model", "Xbrl", ".", "is", "Stream", "ing", "Mode", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "fact", "s", "Check", "Version", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "fact", "s", "Check", "Md", "5", "s", " ", "=", " ", "Md", "5", "Sum", "()", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "start", "(", "self", ",", " ", "tag", ",", " ", "attrib", ",", " ", "nsma", "p", "=", "Non", "e", "):", "\\", "10", ";", " ", " ", " ", " ", "model", "Xbrl", ".", "make", "element", "Parent", "Model", "Object", " ", "=", " ", "self", ".", "current", "Md", "l", "Obj", " ", "#", " ", "pass", " ", "parent", " ", "to", " ", "make", "element", " ", "for", " ", "Model", "Object", "Factor", "y", "\\", "10", ";", " ", " ", " ", " ", "mdl", "Obj", " ", "=", " ", "\\u", "parser", ".", "make", "element", "(", "tag", ",", " ", "attrib", "=", "attrib", ",", " ", "nsma", "p", "=", "nsma", "p", ")", "\\", "10", ";", " ", " ", " ", " ", "mdl", "Obj", ".", "source", "line", " ", "=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "new", "Tree", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "new", "Tree", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "Md", "l", "Obj", " ", "=", " ", "mdl", "Obj", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", " ", "=", " ", "Model", "Document", "(", "model", "Xbrl", ",", " ", "Type", ".", "INSTANCE", ",", " ", "mapp", "ed", "Ur", "i", ",", " ", "filepath", ",", " ", "mdl", "Obj", ".", "getr", "oot", "tree", "())", "\\", "10", ";", " ", " ", " ", " ", "model", "Xbrl", ".", "model", "Document", " ", "=", " ", "model", "Document", " ", "#", " ", "need", "ed", " ", "for", " ", "incremental", " ", "validation", "\\", "10", ";", " ", " ", " ", " ", "mdl", "Obj", ".", "init", "(", "model", "Document", ")", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", ".", "parser", " ", "=", " ", "\\u", "parser", " ", "#", " ", "need", "ed", " ", "for", " ", "Xm", "l", "Ut", "il", " ", "add", "Chil", "d", "'", "s", " ", "make", "element", " ", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", ".", "parser", "Look", "up", "Name", " ", "=", " ", "\\u", "parser", "Look", "up", "Name", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", ".", "parser", "Look", "up", "Class", " ", "=", " ", "\\u", "parser", "Look", "up", "Class", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", ".", "xml", "Roo", "t", "Element", " ", "=", " ", "mdl", "Obj", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", ".", "schema", "Locat", "ion", "Element", "s", ".", "add", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", ".", "document", "Enco", "ding", " ", "=", " ", "\\u", "encoding", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", ".\\u", "creati", "on", "Sof", "twa", "re", "Comme", "nt", " ", "=", " ", "creati", "on", "Sof", "twa", "re", "Comme", "nt", "\\", "10", ";", " ", " ", " ", " ", "model", "Xbrl", ".", "info", "(\"", "stream", "ing", "Ext", "ensi", "ons", ":", "stream", "ing", "\",", "\\", "10", ";", " ", " ", " ", " ", " ", "\\u(", "\"", "Stream", " ", "process", "ing", " ", "this", " ", "instance", ".\"", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "model", "Object", " ", "=", " ", "model", "Document", ")", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "Md", "l", "Obj", ".", "append", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "Md", "l", "Obj", " ", "=", " ", "mdl", "Obj", "\\", "10", ";", " ", " ", " ", " ", "mdl", "Obj", ".\\u", "init", "()", "\\", "10", ";", " ", " ", " ", " ", "ns", " ", "=", " ", "mdl", "Obj", ".", "namespace", "URI", "\\", "10", ";", " ", " ", " ", " ", "ln", " ", "=", " ", "mdl", "Obj", ".", "local", "Name", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "self", ".", "bef", "ore", "Insta", "nce", "Stream", " ", "and", " ", "(", "\\", "10", ";", " ", " ", "(", "ns", " ", "==", " ", "Xbrl", "Const", ".", "link", " ", "and", " ", "ln", " ", "not", " ", "in", " ", "(\"", "schema", "Ref", "\",", " ", "\"", "link", "base", "Ref", "\"))", " ", "or", "\\", "10", ";", " ", " ", "(", "ns", " ", "==", " ", "Xbrl", "Const", ".", "xbr", "li", " ", "and", " ", "ln", " ", "in", " ", "(\"", "context", "\",", " ", "\"", "unit", "\"))", " ", "or", "\\", "10", ";", " ", " ", "(", "ns", " ", "not", " ", "in", " ", "(", "Xbrl", "Const", ".", "link", ",", " ", "Xbrl", "Const", ".", "xbr", "li", "))))", ":", "\\", "10", ";", " ", " ", "self", ".", "bef", "ore", "Insta", "nce", "Stream", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", ":", "\\", "10", ";", " ", " ", "inst", "Validat", "or", ".", "validat", "e", "(", "model", "Xbrl", ",", " ", "model", "Xbrl", ".", "model", "Manager", ".", "formula", "Optio", "ns", ".", "typed", "Parameter", "s", "())", "\\", "10", ";", " ", " ", "else", ":", " ", "#", " ", "need", " ", "default", " ", "dimension", "s", "\\", "10", ";", " ", " ", "Validate", "Xbrl", "Dimen", "sion", "s", ".", "load", "Dimen", "sion", "Default", "s", "(", "model", "Xbrl", ")", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "not", " ", "self", ".", "bef", "ore", "Insta", "nce", "Stream", " ", "and", " ", "self", ".", "bef", "ore", "Start", "Stream", "ing", "Plug", "in", ":", "\\", "10", ";", " ", " ", "for", " ", "plugin", "Meth", "od", " ", "in", " ", "plugin", "Class", "Meth", "ods", "(\"", "Stream", "ing", ".", "Start", "\"):", "\\", "10", ";", " ", " ", "plugin", "Meth", "od", "(", "model", "Xbrl", ")", "\\", "10", ";", " ", " ", "self", ".", "bef", "ore", "Start", "Stream", "ing", "Plug", "in", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "mdl", "Obj", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "end", "(", "self", ",", " ", "tag", "):", "\\", "10", ";", " ", " ", " ", " ", "model", "Document", " ", "=", " ", "model", "Xbrl", ".", "model", "Document", "\\", "10", ";", " ", " ", " ", " ", "mdl", "Obj", " ", "=", " ", "self", ".", "current", "Md", "l", "Obj", "\\", "10", ";", " ", " ", " ", " ", "parent", "Md", "l", "Obj", " ", "=", " ", "mdl", "Obj", ".", "getpar", "ent", "()", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "Md", "l", "Obj", " ", "=", " ", "parent", "Md", "l", "Obj", "\\", "10", ";", " ", " ", " ", " ", "ns", " ", "=", " ", "mdl", "Obj", ".", "namespace", "URI", "\\", "10", ";", " ", " ", " ", " ", "ln", " ", "=", " ", "mdl", "Obj", ".", "local", "Name", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "ns", " ", "==", " ", "Xbrl", "Const", ".", "xbr", "li", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "ln", " ", "==", " ", "\"", "context", "\":", "\\", "10", ";", " ", " ", "if", " ", "mdl", "Obj", ".", "get", "(\"", "sticky", "\"):", "\\", "10", ";", " ", " ", "del", " ", "mdl", "Obj", ".", "attrib", "[\"", "sticky", "\"]", "\\", "10", ";", " ", " ", "Xm", "l", "Validate", ".", "validat", "e", "(", "model", "Xbrl", ",", " ", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "model", "Document", ".", "context", "Discover", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "else", ":", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", " ", "and", " ", "len", "(", "context", "Buffer", ")", " ", ">=", " ", "context", "Buffer", "Limit", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "#", " ", "drop", " ", "bef", "ore", " ", "addin", "g", " ", "as", " ", "dropped", " ", "may", " ", "have", " ", "same", " ", "id", " ", "as", " ", "adde", "d", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "cnt", "x", " ", "=", " ", "context", "Buffer", ".", "pop", "(", "0", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plug", "in", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "context", "s", "To", "Drop", ".", "append", "(", "cnt", "x", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Context", "(", "model", "Xbrl", ",", " ", "cnt", "x", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "cnt", "x", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "cnt", "x", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", "#>", ">", "Xm", "l", "Validate", ".", "validat", "e", "(", "model", "Xbrl", ",", " ", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "#>", ">", "model", "Document", ".", "context", "Discover", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "if", " ", "context", "Buffer", "Limit", ".", "is", "\\u", "finite", "():", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "context", "Buffer", ".", "append", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", ":", "\\", "10", ";", " ", " ", "context", "s", "To", "Check", " ", "=", " ", "(", "mdl", "Obj", ",)", "\\", "10", ";", " ", " ", "inst", "Validat", "or", ".", "check", "Context", "s", "(", "context", "s", "To", "Check", ")", "\\", "10", ";", " ", " ", "if", " ", "model", "Xbrl", ".", "has", "XD", "T", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "inst", "Validat", "or", ".", "check", "Context", "s", "Dimen", "sion", "s", "(", "context", "s", "To", "Check", ")", "\\", "10", ";", " ", " ", "del", " ", "context", "s", "To", "Check", " ", "#", " ", "dereferenc", "e", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "ln", " ", "==", " ", "\"", "unit", "\":", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", " ", "and", " ", "len", "(", "unit", "Buffer", ")", " ", ">=", " ", "unit", "Buffer", "Limit", ":", "\\", "10", ";", " ", " ", "#", " ", "drop", " ", "bef", "ore", " ", "addin", "g", " ", "as", " ", "dropped", " ", "may", " ", "have", " ", "same", " ", "id", " ", "as", " ", "adde", "d", "\\", "10", ";", " ", " ", "unit", " ", "=", " ", "unit", "Buffer", ".", "pop", "(", "0", ")", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plug", "in", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "unit", "s", "To", "Drop", ".", "append", "(", "unit", ")", "\\", "10", ";", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Unit", "(", "model", "Xbrl", ",", " ", "unit", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "unit", ")]", "\\", "10", ";", " ", " ", "unit", " ", "=", " ", "Non", "e", " ", "\\", "10", ";", " ", " ", "#>", ">", "Xm", "l", "Validate", ".", "validat", "e", "(", "model", "Xbrl", ",", " ", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "#>", ">", "model", "Document", ".", "unit", "Discover", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "if", " ", "unit", "Buffer", "Limit", ".", "is", "\\u", "finite", "():", "\\", "10", ";", " ", " ", "unit", "Buffer", ".", "append", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", ":", "\\", "10", ";", " ", " ", "inst", "Validat", "or", ".", "check", "Unit", "s", "(", " ", "(", "mdl", "Obj", ",)", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "ln", " ", "==", " ", "\"", "xbr", "l", "\":", " ", "#", " ", "end", " ", "of", " ", "document", "\\", "10", ";", " ", " ", "#", " ", "check", " ", "rema", "inin", "g", " ", "batched", " ", "fact", "s", " ", "if", " ", "any", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plug", "in", ":", "\\", "10", ";", " ", " ", "#", " ", "plugin", " ", "atte", "mpt", "s", " ", "to", " ", "process", " ", "batch", " ", "of", " ", "all", " ", "root", " ", "fact", "s", " ", "not", " ", "ye", "t", " ", "process", "ed", " ", "(", "not", " ", "just", " ", "current", " ", "one", ")", "\\", "10", ";", " ", " ", "#", " ", "finish", " ", "any", " ", "final", " ", "batch", " ", "of", " ", "fact", "s", "\\", "10", ";", " ", " ", "if", " ", "len", "(", "model", "Xbrl", ".", "fact", "s", ")", " ", ">", " ", "0", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", "s", "To", "Check", " ", "=", " ", "model", "Xbrl", ".", "fact", "s", ".", "copy", "()", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", "s", "Ha", "ve", "Bee", "n", "Processe", "d", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "#", " ", "can", " ", "block", " ", "fact", "s", " ", "deletion", " ", "if", " ", "require", "d", " ", "data", " ", "not", " ", "ye", "t", " ", "avail", "able", ",", " ", "suc", "h", " ", "as", " ", "numeri", "c", " ", "unit", " ", "for", " ", "Dp", "m", "DB", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "plugin", "Meth", "od", " ", "in", " ", "plugin", "Class", "Meth", "ods", "(\"", "Stream", "ing", ".", "Validate", "Fact", "s", "\"):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "not", " ", "plugin", "Meth", "od", "(", "model", "Xbrl", ",", " ", "fact", "s", "To", "Check", "):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", "s", "Ha", "ve", "Bee", "n", "Processe", "d", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "fact", "s", "Ha", "ve", "Bee", "n", "Processe", "d", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "fact", " ", "in", " ", "fact", "s", "To", "Check", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Fact", "(", "model", "Xbrl", ",", " ", "fact", ",", " ", "model", "Xbrl", ".", "fact", "s", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "fact", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "cnt", "x", " ", "in", " ", "context", "s", "To", "Drop", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Context", "(", "model", "Xbrl", ",", " ", "cnt", "x", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "cnt", "x", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "unit", " ", "in", " ", "unit", "s", "To", "Drop", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Unit", "(", "model", "Xbrl", ",", " ", "unit", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "unit", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "footnote", "Link", " ", "in", " ", "footnote", "Link", "s", "To", "Drop", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Foot", "note", "Link", "(", "model", "Xbrl", ",", " ", "footnote", "Link", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "footnote", "Link", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", " ", "=", " ", "cnt", "x", " ", "=", " ", "unit", " ", "=", " ", "footnote", "Link", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "context", "s", "To", "Drop", "[:", "]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "unit", "s", "To", "Drop", "[:", "]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "footnote", "Link", "s", "To", "Drop", "[:", "]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "fact", "s", "To", "Check", "\\", "10", ";", " ", " ", "#", " ", "check", " ", "rema", "inin", "g", " ", "footnote", " ", "refs", "\\", "10", ";", " ", " ", "for", " ", "footnote", "Link", " ", "in", " ", "footnote", "Buffer", ":", "\\", "10", ";", " ", " ", "check", "Foot", "note", "Hr", "ef", "s", "(", "model", "Xbrl", ",", " ", "footnote", "Link", ")", "\\", "10", ";", " ", " ", "for", " ", "plugin", "Meth", "od", " ", "in", " ", "plugin", "Class", "Meth", "ods", "(\"", "Stream", "ing", ".", "Finish", "\"):", "\\", "10", ";", " ", " ", "plugin", "Meth", "od", "(", "model", "Xbrl", ")", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "ns", " ", "==", " ", "Xbrl", "Const", ".", "link", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "ln", " ", "==", " ", "\"", "footnote", "Link", "\":", "\\", "10", ";", " ", " ", "Xm", "l", "Validate", ".", "validat", "e", "(", "model", "Xbrl", ",", " ", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "footnote", "Link", "s", " ", "=", " ", "(", "mdl", "Obj", ",)", "\\", "10", ";", " ", " ", "model", "Document", ".", "link", "base", "Discover", "(", "footnote", "Link", "s", ",", " ", "in", "Insta", "nce", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", "if", " ", "footnote", "Buffer", "Limit", ".", "is", "\\u", "finite", "():", "\\", "10", ";", " ", " ", "footnote", "Buffer", ".", "append", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", ":", "\\", "10", ";", " ", " ", "inst", "Validat", "or", ".", "check", "Link", "s", "(", "footnote", "Link", "s", ")", "\\", "10", ";", " ", " ", "if", " ", "len", "(", "footnote", "Buffer", ")", " ", ">", " ", "footnote", "Buffer", "Limit", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "#", " ", "check", " ", "tha", "t", " ", "href", "Object", "s", " ", "for", " ", "locator", "s", " ", "wer", "e", " ", "all", " ", "satisfied", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "#", " ", "drop", " ", "bef", "ore", " ", "addition", " ", "as", " ", "dropped", " ", "may", " ", "have", " ", "same", " ", "id", " ", "as", " ", "adde", "d", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "footnote", "Link", " ", "=", " ", "footnote", "Buffer", ".", "pop", "(", "0", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "check", "Foot", "note", "Hr", "ef", "s", "(", "model", "Xbrl", ",", " ", "footnote", "Link", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plug", "in", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "footnote", "Link", "s", "To", "Drop", ".", "append", "(", "footnote", "Link", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Foot", "note", "Link", "(", "model", "Xbrl", ",", " ", "footnote", "Link", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "footnote", "Link", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "footnote", "Link", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", "footnote", "Link", "s", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "ln", " ", "in", " ", "(\"", "schema", "Ref", "\",", " ", "\"", "link", "base", "Ref", "\"):", "\\", "10", ";", " ", " ", "model", "Document", ".", "discove", "r", "Hr", "ef", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "not", " ", "model", "Xbrl", ".", "skip", "DT", "S", ":", "\\", "10", ";", " ", " ", "if", " ", "ln", " ", "in", " ", "(\"", "role", "Ref", "\",", " ", "\"", "arc", "role", "Ref", "\"):", "\\", "10", ";", " ", " ", "model", "Document", ".", "link", "base", "Discover", "((", "mdl", "Obj", ",)", ",", " ", "in", "Insta", "nce", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "parent", "Md", "l", "Obj", ".", "qna", "me", " ", "==", " ", "Xbrl", "Const", ".", "qn", "Xbrl", "i", "Xbrl", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "+=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "#>", ">", "Xm", "l", "Validate", ".", "validat", "e", "(", "model", "Xbrl", ",", " ", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", " ", " ", "#>", ">", "model", "Document", ".", "fact", "Discover", "(", "mdl", "Obj", ",", " ", "model", "Xbrl", ".", "fact", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "fact", "s", "Check", "Version", ":", "\\", "10", ";", " ", " ", "self", ".", "fact", "Check", "Fact", "(", "mdl", "Obj", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", " ", "or", " ", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plug", "in", ":", "\\", "10", ";", " ", " ", "fact", "s", "To", "Check", " ", "=", " ", "(", "mdl", "Obj", ",)", " ", " ", "#", " ", "validat", "e", " ", "current", " ", "fact", " ", "by", " ", "its", "elf", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", ":", "\\", "10", ";", " ", " ", "inst", "Validat", "or", ".", "check", "Fact", "s", "(", "fact", "s", "To", "Check", ")", "\\", "10", ";", " ", " ", "if", " ", "model", "Xbrl", ".", "has", "XD", "T", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "inst", "Validat", "or", ".", "check", "Fact", "s", "Dimen", "sion", "s", "(", "fact", "s", "To", "Check", ")", "\\", "10", ";", " ", " ", "if", " ", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plug", "in", ":", "\\", "10", ";", " ", " ", "#", " ", "plugin", " ", "atte", "mpt", "s", " ", "to", " ", "process", " ", "batch", " ", "of", " ", "all", " ", "root", " ", "fact", "s", " ", "not", " ", "ye", "t", " ", "process", "ed", " ", "(", "not", " ", "just", " ", "current", " ", "one", ")", "\\", "10", ";", " ", " ", "#", " ", "use", " ", "batche", "s", " ", "of", " ", "1000", " ", "fact", "s", "\\", "10", ";", " ", " ", "if", " ", "len", "(", "model", "Xbrl", ".", "fact", "s", ")", " ", ">", " ", "1000", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", "s", "To", "Check", " ", "=", " ", "model", "Xbrl", ".", "fact", "s", ".", "copy", "()", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", "s", "Ha", "ve", "Bee", "n", "Processe", "d", " ", "=", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "#", " ", "can", " ", "block", " ", "fact", "s", " ", "deletion", " ", "if", " ", "require", "d", " ", "data", " ", "not", " ", "ye", "t", " ", "avail", "able", ",", " ", "suc", "h", " ", "as", " ", "numeri", "c", " ", "unit", " ", "for", " ", "Dp", "m", "DB", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "plugin", "Meth", "od", " ", "in", " ", "plugin", "Class", "Meth", "ods", "(\"", "Stream", "ing", ".", "Validate", "Fact", "s", "\"):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "not", " ", "plugin", "Meth", "od", "(", "model", "Xbrl", ",", " ", "fact", "s", "To", "Check", "):", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", "s", "Ha", "ve", "Bee", "n", "Processe", "d", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "fact", "s", "Ha", "ve", "Bee", "n", "Processe", "d", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "fact", " ", "in", " ", "fact", "s", "To", "Check", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Fact", "(", "model", "Xbrl", ",", " ", "fact", ",", " ", "model", "Xbrl", ".", "fact", "s", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "fact", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "cnt", "x", " ", "in", " ", "context", "s", "To", "Drop", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Context", "(", "model", "Xbrl", ",", " ", "cnt", "x", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "cnt", "x", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "unit", " ", "in", " ", "unit", "s", "To", "Drop", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Unit", "(", "model", "Xbrl", ",", " ", "unit", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "unit", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "for", " ", "footnote", "Link", " ", "in", " ", "footnote", "Link", "s", "To", "Drop", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "drop", "Foot", "note", "Link", "(", "model", "Xbrl", ",", " ", "footnote", "Link", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "footnote", "Link", ")]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "fact", " ", "=", " ", "cnt", "x", " ", "=", " ", "unit", " ", "=", " ", "footnote", "Link", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "context", "s", "To", "Drop", "[:", "]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "unit", "s", "To", "Drop", "[:", "]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "footnote", "Link", "s", "To", "Drop", "[:", "]", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "del", " ", "fact", "s", "To", "Check", " ", "#", " ", "dereferenc", "e", " ", "fact", " ", "or", " ", "batch", " ", "of", " ", "fact", "s", "\\", "10", ";", " ", " ", "else", ":", "\\", "10", ";", " ", " ", "drop", "Fact", "(", "model", "Xbrl", ",", " ", "mdl", "Obj", ",", " ", "model", "Xbrl", ".", "fact", "s", ")", " ", "#", " ", "single", " ", "fact", " ", "has", " ", "bee", "n", " ", "process", "ed", "\\", "10", ";", " ", " ", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "mdl", "Obj", ")]", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "%", " ", "1000", " ", "==", " ", "0", ":", "\\", "10", ";", " ", " ", "pass", "\\", "10", ";", " ", " ", "#", "model", "Xbrl", ".", "profile", "Activ", "it", "y", "(\".", "..", " ", "stream", "ing", " ", "fact", " ", "{", "0", "}", " ", "of", " ", "{", "1", "}", " ", "{", "2", ":.", "2f", "}%", "\".", "format", "(", "self", ".", "num", "Roo", "t", "Fact", "s", ",", " ", "inst", "Info", "Num", "Roo", "t", "Fact", "s", ",", " ", "\\", "10", ";", " ", " ", "#", " ", " ", " ", " ", " ", " ", " ", " ", "100", ".0", " ", "*", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "/", " ", "inst", "Info", "Num", "Roo", "t", "Fact", "s", "),", " ", "\\", "10", ";", " ", " ", "#", " ", " ", " ", " ", "min", "Time", "To", "Show", "=", "20.", "0", ")", "\\", "10", ";", " ", " ", "gc", ".", "collect", "()", "\\", "10", ";", " ", " ", "sys", ".", "stdout", ".", "write", " ", "(\"", "\\\\", "r", "At", " ", "fact", " ", "{}", " ", "of", " ", "{}", " ", "mem", " ", "{}", "\".", "format", "(", "self", ".", "num", "Roo", "t", "Fact", "s", ",", " ", "inst", "Info", "Num", "Roo", "t", "Fact", "s", ",", " ", "model", "Xbrl", ".", "model", "Manager", ".", "cnt", "lr", ".", "memory", "Us", "ed", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "mdl", "Obj", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "data", "(", "self", ",", " ", "data", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "current", "Md", "l", "Obj", ".", "text", " ", "=", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "comment", "(", "self", ",", " ", "text", "):", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "pi", "(", "self", ",", " ", "target", ",", " ", "data", "):", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "target", " ", "==", " ", "\"", "xbr", "l", "-", "fact", "s", "-", "check", "\":", "\\", "10", ";", " ", " ", " ", " ", "\\u", "match", " ", "=", " ", "re", ".", "search", "(\"", "([\\\\", "\\\\", "w", "-]+)", "=[", "\\\\\"", "']", "([", "^", "\\\\\"", "']", "+)", "[\\\\", "\"'", "]\"", ",", " ", "data", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "\\u", "match", ":", "\\", "10", ";", " ", " ", "\\u", "match", "Group", "s", " ", "=", " ", "\\u", "match", ".", "group", "s", "()", "\\", "10", ";", " ", " ", "if", " ", "len", "(\\u", "match", "Group", "s", ")", " ", "==", " ", "2", ":", "\\", "10", ";", " ", " ", "if", " ", "\\u", "match", "Group", "s", "[", "0", "]", " ", "==", " ", "\"", "version", "\":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "self", ".", "fact", "s", "Check", "Version", " ", "=", " ", "\\u", "match", "Group", "s", "[", "1", "]", "\\", "10", ";", " ", " ", "eli", "f", " ", "\\u", "match", "Group", "s", "[", "0", "]", " ", "==", " ", "\"", "sum", "-", "of", "-", "fact", "-", "md5", "s", "\":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "try", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "expected", "Md", "5", " ", "=", " ", "Md", "5", "Sum", "(\\u", "match", "Group", "s", "[", "1", "])", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "if", " ", "self", ".", "fact", "s", "Check", "Md", "5", "s", " ", "!=", " ", "expected", "Md", "5", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "model", "Xbrl", ".", "warn", "ing", "(\"", "stream", "ing", "Ext", "ensi", "ons", ":", "xbr", "l", "Fact", "s", "Check", "Warn", "ing", "\",", "\\", "10", ";", " ", " ", " ", " ", "\\u(", "\"", "XB", "RL", " ", "fact", "s", " ", "sum", " ", "of", " ", "md5", "s", " ", "expected", " ", "%", "(", "expected", "Md", "5", ")", "s", " ", "not", " ", "matche", "d", " ", "to", " ", "actual", " ", "sum", " ", "%", "(", "actual", "Md", "5", "Sum", ")", "s", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", "model", "Object", "=", "model", "Xbrl", ",", " ", "expected", "Md", "5", "=", "expected", "Md", "5", ",", " ", "actual", "Md", "5", "Sum", "=", "self", ".", "fact", "s", "Check", "Md", "5", "s", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "model", "Xbrl", ".", "info", "(\"", "info", "\",", "\\", "10", ";", " ", " ", " ", " ", "\\u(", "\"", "Success", "ful", " ", "XB", "RL", " ", "fact", "s", " ", "sum", " ", "of", " ", "md5", "s", ".\"", "),", "\\", "10", ";", " ", " ", " ", " ", "model", "Object", "=", "model", "Xbrl", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "except", " ", "Value", "Error", ":", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "model", "Xbrl", ".", "error", "(\"", "stream", "ing", "Ext", "ensi", "ons", ":", "xbr", "l", "Fact", "s", "Check", "Error", "\",", "\\", "10", ";", " ", " ", " ", " ", "\\u(", "\"", "Inva", "lid", " ", "sum", "-", "of", "-", "md5", "s", " ", "%", "(", "sum", "Of", "Md", "5", ")", "s", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", "model", "Object", "=", "model", "Xbrl", ",", " ", "sum", "Of", "Md", "5", "=", "\\u", "match", "Group", "s", "[", "1", "])", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "close", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "del", " ", "model", "Xbrl", ".", "make", "element", "Parent", "Model", "Object", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "fact", "Check", "Fact", "(", "self", ",", " ", "fact", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "fact", "s", "Check", "Md", "5", "s", " ", "+=", " ", "fact", ".", "md5sum", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "\\u", "tuple", "Fact", " ", "in", " ", "fact", ".", "model", "Tup", "le", "Fact", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "fact", "Check", "Fact", "(\\u", "tuple", "Fact", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\\u", "parser", ",", " ", "\\u", "parser", "Look", "up", "Name", ",", " ", "\\u", "parser", "Look", "up", "Class", " ", "=", " ", "parser", "(", "model", "Xbrl", ",", " ", "filepath", ",", " ", "target", "=", "model", "Load", "er", "Target", "())", "\\", "10", ";", " ", " ", " ", " ", "etree", ".", "parse", "(\\u", "file", ",", " ", "parser", "=", "\\u", "parser", ",", " ", "base", "\\u", "url", "=", "filepath", ")", "\\", "10", ";", " ", " ", " ", " ", "log", "Syntax", "Error", "s", "(\\u", "parser", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "model", "Load", "er", "Target", " ", "with", " ", "iter", "parse", " ", "(", "as", " ", "it", " ", "now", " ", "support", "s", " ", "Custom", "Element", "Class", "Look", "up", ")_", "\\u\\u\\uNL\\u\\u\\u_", "stream", "ing", "Parser", "Context_", "=_", "etree_", "._", "iter", "parse_", "(_", "\\u", "file_", ",_", "events_", "=_", "(_", "\"", "start", "\"_", ",_", "\"", "end", "\"_", ")_", ",_", "huge", "\\u", "tree_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Object", "Factory_", "import_", "set", "Parser", "Element", "Class", "Lookup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "is", "Stream", "ing", "Mode_", "=_", "True_", "#", " ", "must", " ", "be", " ", "set", " ", "bef", "ore", " ", "setti", "ng", " ", "element", " ", "class", " ", "lookup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\\u", "parser_", ",_", "\\u", "parser", "Look", "up", "Name_", ",_", "\\u", "parser", "Look", "up", "Class_", ")_", "=_", "set", "Parser", "Element", "Class", "Lookup_", "(_", "stream", "ing", "Parser", "Context_", ",_", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Instance_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bef", "ore", "Insta", "nce", "Stream_", "=_", "bef", "ore", "Start", "Stream", "ing", "Plugin_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Roo", "t", "Fact", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fact", "s", "Check", "Version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fact", "Check", "Fact", "_", "(_", "fact_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Document_", "._", "\\u", "fact", "s", "Check", "Md", "5", "s_", "+=_", "fact_", "._", "md5sum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "tuple", "Fact", "_", "in_", "fact_", "._", "model", "Tup", "le", "Fact", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fact", "Check", "Fact", "_", "(_", "\\u", "tuple", "Fact", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "event_", ",_", "mdl", "Obj_", "in_", "stream", "ing", "Parser", "Context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "==_", "\"", "start", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mdl", "Obj_", "._", "tag_", "==_", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "}", "xbr", "l", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Document_", "=_", "Model", "Document_", "(_", "model", "Xbrl", "_", ",_", "Type_", "._", "INSTANCE", "_", ",_", "mapp", "ed", "Uri_", ",_", "filepath_", ",_", "mdl", "Obj_", "._", "getr", "oot", "tree_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "model", "Document_", "=_", "model", "Document_", "#", " ", "need", "ed", " ", "for", " ", "incremental", " ", "validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mdl", "Obj_", "._", "init_", "(_", "model", "Document_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "parser_", "=_", "\\u", "parser_", "#", " ", "need", "ed", " ", "for", " ", "Xm", "l", "Ut", "il", " ", "add", "Chil", "d", "'", "s", " ", "make", "element", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "parser", "Look", "up", "Name_", "=_", "\\u", "parser", "Look", "up", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "parser", "Look", "up", "Class_", "=_", "\\u", "parser", "Look", "up", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "xml", "Roo", "t", "Element_", "=_", "mdl", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "schema", "Locat", "ion", "Elements_", "._", "add_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "document", "Encoding_", "=_", "\\u", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "\\u", "creati", "on", "Sof", "twa", "re", "Comment_", "=_", "preceding", "Comment_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "\\u", "fact", "s", "Check", "Md", "5", "s_", "=_", "Md", "5", "Sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "stream", "ing", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Stream", " ", "process", "ing", " ", "this", " ", "instance", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Document_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mdl", "Obj_", "._", "getpar", "ent_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mdl", "Obj_", "._", "\\u", "init_", "(_", ")_", "#", " ", "require", "s", " ", "discove", "ry", " ", "as", " ", "part", " ", "of", " ", "start", " ", "elements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mdl", "Obj_", "._", "getpar", "ent_", "(_", ")_", "._", "tag_", "==_", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "}", "xbr", "l", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "found", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found", "Instance_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pi_", "=_", "preceding", "Process", "ing", "Instruction_", "(_", "mdl", "Obj_", ",_", "\"", "xbr", "l", "-", "fact", "s", "-", "check", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pi_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fact", "s", "Check", "Version_", "=_", "pi_", "._", "attrib_", "._", "get_", "(_", "\"", "version", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "found", "Instance_", ":_", "\\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_", "ns_", "=_", "mdl", "Obj_", "._", "qname_", "._", "namespace", "URI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ln_", "=_", "mdl", "Obj_", "._", "qname_", "._", "local", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bef", "ore", "Insta", "nce", "Stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "(_", "ns_", "==_", "Xbrl", "Const_", "._", "link_", "and_", "ln_", "not_", "in_", "(_", "\"", "schema", "Ref", "\"_", ",_", "\"", "link", "base", "Ref", "\"_", ")_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ns_", "==_", "Xbrl", "Const_", "._", "xbr", "li_", "and_", "ln_", "in_", "(_", "\"", "context", "\"_", ",_", "\"", "unit", "\"_", ")_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ns_", "not_", "in_", "(_", "Xbrl", "Const_", "._", "link_", ",_", "Xbrl", "Const_", "._", "xbr", "li_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "bef", "ore", "Insta", "nce", "Stream_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inst", "Validator_", "._", "validate_", "(_", "model", "Xbrl", "_", ",_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "formula", "Options_", "._", "typed", "Parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "need", " ", "default", " ", "dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Validate", "Xbrl", "Dimensions_", "._", "load", "Dimen", "sion", "Defaults_", "(_", "model", "Xbrl", "_", ")_", "\\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_", "not_", "bef", "ore", "Insta", "nce", "Stream_", "and_", "bef", "ore", "Start", "Stream", "ing", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Start", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plugin", "Method_", "(_", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bef", "ore", "Start", "Stream", "ing", "Plugin_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "==_", "\"", "end", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "Md", "l", "Obj_", "=_", "mdl", "Obj_", "._", "getpar", "ent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "=_", "mdl", "Obj_", "._", "namespace", "URI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ln_", "=_", "mdl", "Obj_", "._", "local", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ns_", "==_", "Xbrl", "Const_", "._", "xbr", "li_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ln_", "==_", "\"", "context", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "mdl", "Obj_", "._", "get_", "(_", "\"", "sticky", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "mdl", "Obj_", "._", "attrib_", "[_", "\"", "sticky", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Xm", "l", "Validate", "_", "._", "validate_", "(_", "model", "Xbrl", "_", ",_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "context", "Discover", "_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "context", "Buffer_", ")_", ">=_", "context", "Buffer", "Limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "drop", " ", "bef", "ore", " ", "addin", "g", " ", "as", " ", "dropped", " ", "may", " ", "have", " ", "same", " ", "id", " ", "as", " ", "added_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cnt", "x_", "=_", "context", "Buffer_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", "or_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "context", "s", "To", "Drop", "_", "._", "append_", "(_", "cnt", "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 ", " ", " _", "drop", "Context_", "(_", "model", "Xbrl", "_", ",_", "cnt", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "cnt", "x", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cnt", "x_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Xm", "l", "Validate", "_", "._", "validate_", "(_", "model", "Xbrl", "_", ",_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "context", "Discover", "_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context", "Buffer", "Limit_", "._", "is", "\\u", "finite", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "context", "Buffer_", "._", "append_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "context", "s", "To", "Check_", "=_", "(_", "mdl", "Obj_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "Validator_", "._", "check", "Context", "s_", "(_", "context", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Xbrl", "_", "._", "has", "XD", "T_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inst", "Validator_", "._", "check", "Context", "s", "Dimensions_", "(_", "context", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "context", "s", "To", "Check_", "#", " ", "dereferenc", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ln_", "==_", "\"", "unit", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "len_", "(_", "unit", "Buffer_", ")_", ">=_", "unit", "Buffer", "Limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "drop", " ", "bef", "ore", " ", "additi", "ng", " ", "as", " ", "dropped", " ", "may", " ", "have", " ", "same", " ", "id", " ", "as", " ", "added_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unit_", "=_", "unit", "Buffer_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", "or_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unit", "s", "To", "Drop", "_", "._", "append_", "(_", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Unit_", "(_", "model", "Xbrl", "_", ",_", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "unit", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Xm", "l", "Validate", "_", "._", "validate_", "(_", "model", "Xbrl", "_", ",_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "unit", "Discover", "_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unit", "Buffer", "Limit_", "._", "is", "\\u", "finite", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unit", "Buffer_", "._", "append_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inst", "Validator_", "._", "check", "Units_", "(_", "(_", "mdl", "Obj_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ln_", "==_", "\"", "xbr", "l", "\"_", ":_", "#", " ", "end", " ", "of", " ", "document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "rema", "inin", "g", " ", "batched", " ", "fact", "s", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", "or_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plugin", " ", "atte", "mpt", "s", " ", "to", " ", "process", " ", "batch", " ", "of", " ", "all", " ", "root", " ", "fact", "s", " ", "not", " ", "ye", "t", " ", "process", "ed", " ", "(", "not", " ", "just", " ", "current", " ", "one", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "finish", " ", "any", " ", "final", " ", "batch", " ", "of", " ", "facts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "model", "Xbrl", "_", "._", "facts_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fact", "s", "To", "Check_", "=_", "model", "Xbrl", "_", "._", "facts_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "block", " ", "fact", "s", " ", "deletion", " ", "if", " ", "require", "d", " ", "data", " ", "not", " ", "ye", "t", " ", "avail", "able", ",", " ", "suc", "h", " ", "as", " ", "numeri", "c", " ", "unit", " ", "for", " ", "Dp", "m", "DB_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Validate", "Fact", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plugin", "Method_", "(_", "inst", "Validator_", ",_", "fact", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Fact", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plugin", "Method_", "(_", "model", "Xbrl", "_", ",_", "fact", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fact_", "in_", "fact", "s", "To", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Fact", "_", "(_", "model", "Xbrl", "_", ",_", "fact_", ",_", "model", "Xbrl", "_", "._", "facts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "fact", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cnt", "x_", "in_", "context", "s", "To", "Drop", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Context_", "(_", "model", "Xbrl", "_", ",_", "cnt", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "cnt", "x", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "unit_", "in_", "unit", "s", "To", "Drop", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Unit_", "(_", "model", "Xbrl", "_", ",_", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "unit", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "footnote", "Link_", "in_", "footnote", "Link", "s", "To", "Drop", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Foot", "note", "Link_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "footnote", "Link", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fact_", "=_", "cnt", "x_", "=_", "unit_", "=_", "footnote", "Link_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "context", "s", "To", "Drop", "_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "unit", "s", "To", "Drop", "_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "footnote", "Link", "s", "To", "Drop", "_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "fact", "s", "To", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "rema", "inin", "g", " ", "footnote", " ", "refs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "footnote", "Link_", "in_", "footnote", "Buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "check", "Foot", "note", "Hr", "efs_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pi_", "=_", "child", "Process", "ing", "Instruction_", "(_", "mdl", "Obj_", ",_", "\"", "xbr", "l", "-", "fact", "s", "-", "check", "\"_", ",_", "reversed_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pi_", "is_", "not_", "None_", ":_", "#", " ", "attrib", " ", "is", " ", "in", " ", ".", "text", ",", " ", "not", " ", "attrib", ",", " ", "no", " ", "idea", " ", "wh", "y", "!!!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "match_", "=_", "re_", "._", "search_", "(_", "\"([", "\\\\\\\\", "w", "-]+)", "=[", "\\\\\"", "']", "([", "^", "\\\\\"", "']", "+)", "[\\\\", "\"'", "]\"_", ",_", "pi_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "match", "Groups_", "=_", "\\u", "match_", "._", "groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "\\u", "match", "Groups_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\\u", "match", "Groups_", "[_", "0_", "]_", "==_", "\"", "sum", "-", "of", "-", "fact", "-", "md5", "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 ", " ", " ", " _", "expected", "Md", "5_", "=_", "Md", "5", "Sum_", "(_", "\\u", "match", "Groups_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Document_", "._", "\\u", "fact", "s", "Check", "Md", "5", "s_", "!=_", "expected", "Md", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "model", "Xbrl", "_", "._", "warning_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "xbr", "l", "Fact", "s", "Check", "Warn", "ing", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "XB", "RL", " ", "fact", "s", " ", "sum", " ", "of", " ", "md5", "s", " ", "expected", " ", "%", "(", "expected", "Md", "5", ")", "s", " ", "not", " ", "matche", "d", " ", "to", " ", "actual", " ", "sum", " ", "%", "(", "actual", "Md", "5", "Sum", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ",_", "expected", "Md", "5_", "=_", "expected", "Md", "5_", ",_", "actual", "Md", "5", "Sum_", "=_", "model", "Document_", "._", "\\u", "fact", "s", "Check", "Md", "5", "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 ", " ", " ", " _", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "info", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Success", "ful", " ", "XB", "RL", " ", "fact", "s", " ", "sum", " ", "of", " ", "md5", "s", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ")_", "\\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 ", " ", " ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "xbr", "l", "Fact", "s", "Check", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Inva", "lid", " ", "sum", "-", "of", "-", "md5", "s", " ", "%", "(", "sum", "Of", "Md", "5", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ",_", "sum", "Of", "Md", "5_", "=_", "\\u", "match", "Groups_", "[_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Validate", "Finish", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plugin", "Method_", "(_", "inst", "Validator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Finish", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plugin", "Method_", "(_", "model", "Xbrl", "_", ")_", "\\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_", "ns_", "==_", "Xbrl", "Const_", "._", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ln_", "in_", "(_", "\"", "schema", "Ref", "\"_", ",_", "\"", "link", "base", "Ref", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model", "Document_", "._", "discove", "r", "Hr", "ef_", "(_", "mdl", "Obj_", ",_", "url", "Rewrite", "Plug", "in", "Class_", "=_", "\"", "Model", "Document", ".", "Insta", "nce", "Schema", "Ref", "Rewrite", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ln_", "in_", "(_", "\"", "role", "Ref", "\"_", ",_", "\"", "arc", "role", "Ref", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model", "Document_", "._", "link", "base", "Discover", "_", "(_", "(_", "mdl", "Obj_", ",_", ")_", ",_", "in", "Instance_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ln_", "==_", "\"", "footnote", "Link", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Xm", "l", "Validate", "_", "._", "validate_", "(_", "model", "Xbrl", "_", ",_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "footnote", "Links_", "=_", "(_", "mdl", "Obj_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "link", "base", "Discover", "_", "(_", "footnote", "Links_", ",_", "in", "Instance_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "footnote", "Buffer", "Limit_", "._", "is", "\\u", "finite", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "footnote", "Buffer_", "._", "append_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inst", "Validator_", "._", "check", "Links_", "(_", "footnote", "Links_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "footnote", "Buffer_", ")_", ">_", "footnote", "Buffer", "Limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "href", "Object", "s", " ", "for", " ", "locator", "s", " ", "wer", "e", " ", "all", " ", "satisfied", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "drop", " ", "bef", "ore", " ", "addition", " ", "as", " ", "dropped", " ", "may", " ", "have", " ", "same", " ", "id", " ", "as", " ", "added_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "footnote", "Link_", "=_", "footnote", "Buffer_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "Foot", "note", "Hr", "efs_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "footnote", "Link", "s", "To", "Drop", "_", "._", "append_", "(_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Foot", "note", "Link_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "footnote", "Link", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "footnote", "Link_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "footnote", "Links_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parent", "Md", "l", "Obj_", "._", "qname_", "==_", "Xbrl", "Const_", "._", "qn", "Xbrl", "i", "Xbrl", "_", "and_", "isinstance_", "(_", "mdl", "Obj_", ",_", "Model", "Fact", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Roo", "t", "Fact", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Xm", "l", "Validate", "_", "._", "validate_", "(_", "model", "Xbrl", "_", ",_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "._", "fact", "Discover", "_", "(_", "mdl", "Obj_", ",_", "model", "Xbrl", "_", "._", "facts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fact", "s", "Check", "Version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fact", "Check", "Fact", "_", "(_", "mdl", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", "or_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", "or_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fact", "s", "To", "Check_", "=_", "(_", "mdl", "Obj_", ",_", ")_", "#", " ", "validat", "e", " ", "current", " ", "fact", " ", "by", " ", "its", "elf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inst", "Validator_", "._", "check", "Fact", "s_", "(_", "fact", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Xbrl", "_", "._", "has", "XD", "T_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "inst", "Validator_", "._", "check", "Fact", "s", "Dimensions_", "(_", "fact", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", "or_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plugin", " ", "atte", "mpt", "s", " ", "to", " ", "process", " ", "batch", " ", "of", " ", "all", " ", "root", " ", "fact", "s", " ", "not", " ", "ye", "t", " ", "process", "ed", " ", "(", "not", " ", "just", " ", "current", " ", "one", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "batche", "s", " ", "of", " ", "1000", " ", "facts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "model", "Xbrl", "_", "._", "facts_", ")_", ">_", "1000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fact", "s", "To", "Check_", "=_", "model", "Xbrl", "_", "._", "facts_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "block", " ", "fact", "s", " ", "deletion", " ", "if", " ", "require", "d", " ", "data", " ", "not", " ", "ye", "t", " ", "avail", "able", ",", " ", "suc", "h", " ", "as", " ", "numeri", "c", " ", "unit", " ", "for", " ", "Dp", "m", "DB_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Validate", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Validate", "Fact", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plugin", "Method_", "(_", "inst", "Validator_", ",_", "fact", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Fact", "s", "Plugin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "plugin", "Method_", "in_", "plugin", "Class", "Methods_", "(_", "\"", "Stream", "ing", ".", "Fact", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "plugin", "Method_", "(_", "model", "Xbrl", "_", ",_", "fact", "s", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fact_", "in_", "fact", "s", "To", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Fact", "_", "(_", "model", "Xbrl", "_", ",_", "fact_", ",_", "model", "Xbrl", "_", "._", "facts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "fact", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cnt", "x_", "in_", "context", "s", "To", "Drop", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Context_", "(_", "model", "Xbrl", "_", ",_", "cnt", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "cnt", "x", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "unit_", "in_", "unit", "s", "To", "Drop", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Unit_", "(_", "model", "Xbrl", "_", ",_", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "unit", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "footnote", "Link_", "in_", "footnote", "Link", "s", "To", "Drop", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "drop", "Foot", "note", "Link_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "footnote", "Link", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fact_", "=_", "cnt", "x_", "=_", "unit_", "=_", "footnote", "Link_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "context", "s", "To", "Drop", "_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "unit", "s", "To", "Drop", "_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "footnote", "Link", "s", "To", "Drop", "_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "fact", "s", "To", "Check_", "#", " ", "dereferenc", "e", " ", "fact", " ", "or", " ", "batch", " ", "of", " ", "facts_", "\\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 ", " ", " _", "drop", "Fact", "_", "(_", "model", "Xbrl", "_", ",_", "mdl", "Obj_", ",_", "model", "Xbrl", "_", "._", "facts_", ")_", "#", " ", "single", " ", "fact", " ", "has", " ", "bee", "n", " ", "processed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#>", ">", "del", " ", "parent", "Md", "l", "Obj", "[", "parent", "Md", "l", "Obj", ".", "index", "(", "mdl", "Obj", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "num", "Roo", "t", "Fact", "s_", "%_", "1000_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "model", "Xbrl", ".", "profile", "Activ", "it", "y", "(\".", "..", " ", "stream", "ing", " ", "fact", " ", "{", "0", "}", " ", "of", " ", "{", "1", "}", " ", "{", "2", ":.", "2f", "}%", "\".", "format", "(", "self", ".", "num", "Roo", "t", "Fact", "s", ",", " ", "inst", "Info", "Num", "Roo", "t", "Fact", "s", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", "100", ".0", " ", "*", " ", "self", ".", "num", "Roo", "t", "Fact", "s", " ", "/", " ", "inst", "Info", "Num", "Roo", "t", "Fact", "s", "),", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "min", "Time", "To", "Show", "=", "20.", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "gc", ".", "collect", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "stdout", ".", "write", " ", "(\"", "\\\\", "r", "At", " ", "fact", " ", "{}", " ", "of", " ", "{}", " ", "mem", " ", "{}", "\".", "format", "(", "num", "Roo", "t", "Fact", "s", ",", " ", "inst", "Info", "Num", "Roo", "t", "Fact", "s", ",", " ", "model", "Xbrl", ".", "model", "Manager", ".", "cnt", "lr", ".", "memory", "Us", "ed", "))", "_", "\\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_", "mdl", "Obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mdl", "Obj_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "parser_", ",_", "\\u", "parser", "Look", "up", "Name_", ",_", "\\u", "parser", "Look", "up", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", "and_", "validator_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "inst", "Validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validator_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "track", " ", "tha", "t", " ", "model", "Xbrl", " ", "has", " ", "bee", "n", " ", "validat", "ed", " ", "by", " ", "this", " ", "stream", "ing", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Xbrl", "_", "._", "\\u", "stream", "ing", "Ext", "ensi", "on", "Validate", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "stream", "ing", " ", "complete", "\"_", ")_", ",_", "time_", "._", "time_", "(_", ")_", "-_", "start", "ed", "At_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "model", "Xbrl", "_", "._", "model", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Foot", "note", "Hr", "efs_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "loc", "El", "t_", "in_", "footnote", "Link_", "._", "iter", "children_", "(_", "tag_", "=_", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "link", "base", "}", "loc", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "href", "El", "t_", ",_", "\\u", "doc_", ",_", "\\u", "id_", "in_", "footnote", "Link_", "._", "model", "Document_", "._", "href", "Objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "loc", "El", "t_", "==_", "href", "El", "t_", "and_", "id_", "not_", "in_", "footnote", "Link_", "._", "model", "Document_", "._", "id", "Objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "stream", "ing", "Ext", "ensi", "ons", ":", "footnote", "Id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Foot", "note", " ", "id", " ", "%", "(", "id", ")", "s", " ", "not", " ", "matche", "d", " ", "to", " ", "fact", " ", "in", " ", "buffered", " ", "region", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "footnote", "Link_", ",_", "id_", "=_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "drop", "Context_", "(_", "model", "Xbrl", "_", ",_", "cnt", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "model", "Xbrl", "_", "._", "contexts_", "[_", "cnt", "x_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop", "Object_", "(_", "model", "Xbrl", "_", ",_", "cnt", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "drop", "Unit_", "(_", "model", "Xbrl", "_", ",_", "unit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "model", "Xbrl", "_", "._", "units_", "[_", "unit_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop", "Object_", "(_", "model", "Xbrl", "_", ",_", "unit_", ")_", "\\u\\u\\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_", "drop", "Foot", "note", "Link_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "base", "Set_", "in_", "model", "Xbrl", "_", "._", "base", "Sets_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "footnote", "Link_", "in_", "base", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "Set_", "._", "remove_", "(_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "drop", "Object_", "(_", "model", "Xbrl", "_", ",_", "footnote", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "drop", "Fact", "_", "(_", "model", "Xbrl", "_", ",_", "fact_", ",_", "facts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "fact_", "._", "model", "Tup", "le", "Fact", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drop", "Fact", "_", "(_", "model", "Xbrl", "_", ",_", "fact_", "._", "model", "Tup", "le", "Fact", "s_", "[_", "0_", "]_", ",_", "fact_", "._", "model", "Tup", "le", "Fact", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Xbrl", "_", "._", "fact", "s", "In", "Instance_", "._", "discard_", "(_", "fact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "facts_", "._", "remove_", "(_", "fact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "model", "Objects_", "[_", "fact_", "._", "object", "Index_", "]_", "=_", "None_", "#", " ", "object", "s", " ", "found", " ", "by", " ", "index", ",", " ", "can", "'", "t", " ", "remove", " ", "position", " ", "from", " ", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fact_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fact_", "._", "model", "Document_", "._", "id", "Objects_", "._", "pop_", "(_", "fact_", "._", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fact_", "._", "clear_", "(_", ")_", "\\u\\u\\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_", "drop", "Object_", "(_", "model", "Xbrl", "_", ",_", "mdl", "Obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child", "Obj_", "in_", "mdl", "Obj_", "._", "iter", "children_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drop", "Object_", "(_", "model", "Xbrl", "_", ",_", "child", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mdl", "Obj_", "._", "qname_", "==_", "Xbrl", "Const_", "._", "qn", "Link", "Loc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "href", "s_", "=_", "mdl", "Obj_", "._", "model", "Document_", "._", "href", "Objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remove", "d", "Hr", "efs_", "=_", "[_", "i_", "for_", "i_", ",_", "href", "Obj_", "in_", "enumerate_", "(_", "href", "s_", ")_", "if_", "mdl", "Obj_", "==_", "href", "Obj_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "remove", "d", "Hr", "efs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "href", "s_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Xbrl", "_", "._", "model", "Objects_", "[_", "mdl", "Obj_", "._", "object", "Index_", "]_", "=_", "None_", "#", " ", "object", "s", " ", "found", " ", "by", " ", "index", ",", " ", "can", "'", "t", " ", "remove", " ", "position", " ", "from", " ", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mdl", "Obj_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mdl", "Obj_", "._", "model", "Document_", "._", "id", "Objects_", "._", "pop_", "(_", "mdl", "Obj_", "._", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mdl", "Obj_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stream", "ing", "Ext", "ensi", "ons", "Setup_", "(_", "cnt", "lr_", ",_", "options_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Check_", ",_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "stream", "ing", " ", "only", " ", "checke", "d", " ", "in", " ", "Cmd", "Line", "/", "web", " ", "server", " ", "mode", " ", "if", " ", "requested_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Check", " ", "=", " ", "getattr", "(", "options", ",", " ", "'", "check", "\\u", "stream", "ing", "',", " ", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "stream", "ing", "Ext", "ensi", "ons", "Validate", "_", "=_", "options_", "._", "validate_", "\\u\\u\\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_", "stream", "ing", "Ext", "ensi", "ons", "Is", "Validate", "d_", "(_", "model", "Xbrl", "_",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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/extras/completion/py/pymel/internal/startup.py
[ { "content": "\"\"\"\nMaya-related functions, which are useful to both `api` and `core`, including `mayaInit` which ensures\nthat maya is initialized in standalone mode.\n\"\"\"\n\nfrom . import plogging\nimport pymel.util.picklezip as picklezip\nimport glob\nimport pymel.versions as versions\nimport os\nimport inspect\nimport maya\nimport cPickle as pickle\nimport maya.OpenMaya as om\nimport sys\n\nfrom pymel.util.common import subpackages\nfrom pymel.versions import shortName\nfrom collections import namedtuple\nfrom pymel.versions import installName\nfrom pymel.util.shell import shellOutput\nfrom pymel.mayautils import getUserPrefsDir\nfrom pymel.util.shell import refreshEnviron\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_finalizeCalled = True\n\npymel_options = {}\n\n_logger = None\n\nisInitializing = False\n\nwith_statement = None\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PymelCache(object):\n \n \n \n \n \n \n __dict__ = None\n \n __weakref__ = None\n \n COMPRESSED = True\n \n \n DESC = ''\n \n \n NAME = ''\n \n \n USE_VERSION = True", "metadata": "root.PymelCache", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def path(self):\n pass", "metadata": "root.PymelCache.path", "header": "['class', 'PymelCache', '(', 'object', ')', ':', '___EOS___']", "index": 25 }, { "content": " def read(self):\n pass", "metadata": "root.PymelCache.read", "header": "['class', 'PymelCache', '(', 'object', ')', ':', '___EOS___']", "index": 29 }, { "content": " def write(self, data):\n pass", "metadata": "root.PymelCache.write", "header": "['class', 'PymelCache', '(', 'object', ')', ':', '___EOS___']", "index": 33 }, { "content": "class SubItemCache(PymelCache):\n \"\"\"\n Used to store various maya information\n \n ie, api / cmd data parsed from docs\n \n To implement, create a subclass, which overrides at least the NAME, DESC,\n and _CACHE_NAMES attributes, and implements the rebuild method.\n \n Then to access data, you should initialize an instance, then call build;\n build will load the data from the cache file if possible, or call rebuild\n to build the data from scratch if not. If the data had to be rebuilt,\n a new file cache will be saved.\n \n The data may then be accessed through attributes on the instance, with\n the names given in _CACHE_NAMES.\n \n >>> class NodeCache(SubItemCache):\n ... NAME = 'mayaNodes'\n ... DESC = 'the maya nodes cache'\n ... COMPRESSED = False\n ... _CACHE_NAMES = ['nodeTypes']\n ... def rebuild(self):\n ... import maya.cmds\n ... self.nodeTypes = maya.cmds.allNodeTypes(includeAbstract=True)\n >>> cacheInst = NodeCache()\n >>> cacheInst.build()\n >>> 'polyCube' in cacheInst.nodeTypes\n True\n \"\"\"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n DEFAULT_TYPE = None\n \n \n ITEM_TYPES = {}\n \n \n STORAGE_TYPES = {}", "metadata": "root.SubItemCache", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def __init__(self):\n pass", "metadata": "root.SubItemCache.__init__", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 86 }, { "content": " def build(self):\n \"\"\"\n Used to rebuild cache, either by loading from a cache file, or rebuilding from scratch.\n \"\"\"\n \n pass", "metadata": "root.SubItemCache.build", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 90 }, { "content": " def cacheNames(self):\n pass", "metadata": "root.SubItemCache.cacheNames", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 98 }, { "content": " def contents(self):\n \"\"\"\n # was called 'caches'\n \"\"\"\n \n pass", "metadata": "root.SubItemCache.contents", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 102 }, { "content": " def initVal(self, name):\n pass", "metadata": "root.SubItemCache.initVal", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 110 }, { "content": " def itemType(self, name):\n pass", "metadata": "root.SubItemCache.itemType", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 114 }, { "content": " def load(self):\n \"\"\"\n Attempts to load the data from the cache on file.\n \n If it succeeds, it will update itself, and return the loaded items;\n if it fails, it will return None\n \"\"\"\n \n pass", "metadata": "root.SubItemCache.load", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 118 }, { "content": " def rebuild(self):\n \"\"\"\n Rebuild cache from scratch\n \n Unlike 'build', this does not attempt to load a cache file, but always\n rebuilds it by parsing the docs, etc.\n \"\"\"\n \n pass", "metadata": "root.SubItemCache.rebuild", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 129 }, { "content": " def save(self, obj=None):\n \"\"\"\n Saves the cache\n \n Will optionally update the caches from the given object (which may be\n a dictionary, or an object with the caches stored in attributes on it)\n before saving\n \"\"\"\n \n pass", "metadata": "root.SubItemCache.save", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 140 }, { "content": " def update(self, obj, cacheNames=None):\n \"\"\"\n Update all the various data from the given object, which should\n either be a dictionary, a list or tuple with the right number of items,\n or an object with the caches stored in attributes on it.\n \"\"\"\n \n pass", "metadata": "root.SubItemCache.update", "header": "['class', 'SubItemCache', '(', 'PymelCache', ')', ':', '___EOS___']", "index": 152 }, { "content": "def _dump(data, filename, protocol=-1):\n pass", "metadata": "root._dump", "header": "['module', '___EOS___']", "index": 172 }, { "content": "def mayaStartupHasStarted():\n \"\"\"\n Returns True if maya.app.startup has begun running, False otherwise.\n \n It's possible that maya.app.startup is in the process of running (ie,\n in maya.app.startup.basic, calling executeUserSetup) - unlike mayaStartup,\n this will attempt to detect if this is the case.\n \"\"\"\n\n pass", "metadata": "root.mayaStartupHasStarted", "header": "['module', '___EOS___']", "index": 176 }, { "content": "def encodeFix():\n \"\"\"\n # Fix for non US encodings in Maya\n \"\"\"\n\n pass", "metadata": "root.encodeFix", "header": "['module', '___EOS___']", "index": 188 }, { "content": "def finalize():\n pass", "metadata": "root.finalize", "header": "['module', '___EOS___']", "index": 196 }, { "content": "def initAE():\n pass", "metadata": "root.initAE", "header": "['module', '___EOS___']", "index": 200 }, { "content": "def getConfigFile():\n pass", "metadata": "root.getConfigFile", "header": "['module', '___EOS___']", "index": 204 }, { "content": "def initMEL():\n pass", "metadata": "root.initMEL", "header": "['module', '___EOS___']", "index": 208 }, { "content": "def mayaInit(forversion=None):\n \"\"\"\n Try to init Maya standalone module, use when running pymel from an external Python inerpreter,\n it is possible to pass the desired Maya version number to define which Maya to initialize\n \n \n Part of the complexity of initializing maya in standalone mode is that maya does not populate os.environ when\n parsing Maya.env. If we initialize normally, the env's are available via maya (via the shell), but not in python\n via os.environ.\n \n Note: the following example assumes that MAYA_SCRIPT_PATH is not set in your shell environment prior to launching\n python or mayapy.\n \n >>> import maya.standalone #doctest: +SKIP\n >>> maya.standalone.initialize() #doctest: +SKIP\n >>> import maya.mel as mm #doctest: +SKIP\n >>> print mm.eval(\"getenv MAYA_SCRIPT_PATH\") #doctest: +SKIP\n /Network/Servers/sv-user.luma-pictures.com/luma .....\n >>> import os #doctest: +SKIP\n >>> 'MAYA_SCRIPT_PATH' in os.environ #doctest: +SKIP\n False\n \n The solution lies in `refreshEnviron`, which copies the environment from the shell to os.environ after maya.standalone\n initializes.\n \n :rtype: bool\n :return: returns True if maya.cmds required initializing ( in other words, we are in a standalone python interpreter )\n \"\"\"\n\n pass", "metadata": "root.mayaInit", "header": "['module', '___EOS___']", "index": 212 }, { "content": "def parsePymelConfig():\n pass", "metadata": "root.parsePymelConfig", "header": "['module', '___EOS___']", "index": 244 }, { "content": "def fixMayapy2011SegFault():\n \"\"\"\n # Have all the checks inside here, in case people want to insert this in their\n # userSetup... it's currently not always on\n \"\"\"\n\n pass", "metadata": "root.fixMayapy2011SegFault", "header": "['module', '___EOS___']", "index": 248 }, { "content": "def mayaStartupHasRun():\n \"\"\"\n Returns True if maya.app.startup has already finished, False otherwise.\n \"\"\"\n\n pass", "metadata": "root.mayaStartupHasRun", "header": "['module', '___EOS___']", "index": 257 }, { "content": "def _moduleJoin(*args):\n \"\"\"\n Joins with the base pymel directory.\n :rtype: string\n \"\"\"\n\n pass", "metadata": "root._moduleJoin", "header": "['module', '___EOS___']", "index": 265 }, { "content": "def _load(filename):\n pass", "metadata": "root._load", "header": "['module', '___EOS___']", "index": 274 }, { "content": "def setupFormatting():\n pass", "metadata": "root.setupFormatting", "header": "['module', '___EOS___']", "index": 278 } ]
[ { "span": "import pymel.util.picklezip as picklezip", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 40 }, { "span": "import glob", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 11 }, { "span": "import pymel.versions as versions", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 33 }, { "span": "import inspect", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 14 }, { "span": "import cPickle as pickle", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 24 }, { "span": "import maya.OpenMaya as om", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 26 }, { "span": "import sys", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 10 }, { "span": "from pymel.util.common import subpackages", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 41 }, { "span": "from pymel.versions import shortName", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 36 }, { "span": "from collections import namedtuple", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 34 }, { "span": "from pymel.versions import installName", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 38 }, { "span": "from pymel.util.shell import shellOutput", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 40 }, { "span": "from pymel.mayautils import getUserPrefsDir", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 43 }, { "span": "from pymel.util.shell import refreshEnviron", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Maya", "-", "relate", "d", " ", "function", "s", ",", " ", "whi", "ch", " ", "are", " ", "usef", "ul", " ", "to", " ", "bot", "h", " ", "`", "api", "`", " ", "and", " ", "`", "core", "`", ",", " ", "inclu", "ding", " ", "`", "maya", "Ini", "t", "`", " ", "whi", "ch", " ", "ensure", "s", "\\", "10", ";", "tha", "t", " ", "maya", " ", "is", " ", "initialize", "d", " ", "in", " ", "standalone", " ", "mode", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "plo", "ggi", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pym", "el_", "._", "util_", "._", "pickle", "zip_", "as_", "pickle", "zip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pym", "el_", "._", "versions_", "as_", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "maya", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "maya", "_", "._", "Open", "Maya", "_", "as_", "om_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pym", "el_", "._", "util_", "._", "common_", "import_", "subpa", "ckage", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "versions_", "import_", "short", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "versions_", "import_", "install", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "util_", "._", "shell_", "import_", "shell", "Output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "maya", "utils_", "import_", "get", "User", "Prefs", "Dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "util_", "._", "shell_", "import_", "refre", "sh", "Environ", "_", "\\u\\u\\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\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EWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "finalize", "Call", "ed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "el", "\\u", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "logger_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Initializ", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with", "\\u", "statement_", "=_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Py", "mel", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "weak", "ref", "\\u\\u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COMPRESS", "ED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DESC_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NAME_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "USE", "\\u", "VERSION_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Py", "mel", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Py", "mel", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Py", "mel", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "to", " ", "store", " ", "vari", "ous", " ", "maya", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "ie", ",", " ", "api", " ", "/", " ", "cmd", " ", "data", " ", "parsed", " ", "from", " ", "docs", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "implement", ",", " ", "create", " ", "a", " ", "subclass", ",", " ", "whi", "ch", " ", "override", "s", " ", "at", " ", "leas", "t", " ", "the", " ", "NAME", ",", " ", "DESC", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "\\u", "CACHE", "\\u", "NAMES", " ", "attribute", "s", ",", " ", "and", " ", "implement", "s", " ", "the", " ", "rebu", "ild", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", "n", " ", "to", " ", "access", " ", "data", ",", " ", "you", " ", "shou", "ld", " ", "initialize", " ", "an", " ", "instance", ",", " ", "then", " ", "call", " ", "build", ";", "\\", "10", ";", " ", " ", " ", " ", "build", " ", "will", " ", "load", " ", "the", " ", "data", " ", "from", " ", "the", " ", "cache", " ", "file", " ", "if", " ", "possib", "le", ",", " ", "or", " ", "call", " ", "rebu", "ild", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "build", " ", "the", " ", "data", " ", "from", " ", "scratch", " ", "if", " ", "not", ".", " ", " ", "If", " ", "the", " ", "data", " ", "had", " ", "to", " ", "be", " ", "rebu", "ilt", ",", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "new", " ", "file", " ", "cache", " ", "will", " ", "be", " ", "saved", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "data", " ", "may", " ", "then", " ", "be", " ", "accesse", "d", " ", "through", " ", "attribute", "s", " ", "on", " ", "the", " ", "instance", ",", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "names", " ", "give", "n", " ", "in", " ", "\\u", "CACHE", "\\u", "NAMES", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "class", " ", "Node", "Cache", "(", "Sub", "Item", "Cache", "):", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "NAME", " ", "=", " ", "'", "maya", "Node", "s", "'", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "DESC", " ", "=", " ", "'", "the", " ", "maya", " ", "nodes", " ", "cache", "'", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "COMPRESS", "ED", " ", "=", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "\\u", "CACHE", "\\u", "NAMES", " ", "=", " ", "['", "node", "Type", "s", "']", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "def", " ", "rebu", "ild", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", " ", "import", " ", "maya", ".", "cmds", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", " ", "self", ".", "node", "Type", "s", " ", "=", " ", "maya", ".", "cmds", ".", "all", "Node", "Type", "s", "(", "include", "Abstract", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cache", "Ins", "t", " ", "=", " ", "Node", "Cache", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cache", "Ins", "t", ".", "build", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "'", "poly", "Cub", "e", "'", " ", "in", " ", "cache", "Ins", "t", ".", "node", "Type", "s", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "DEF", "AUL", "T", "\\u", "TYPE_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ITEM", "\\u", "TYPES_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STOR", "AGE", "\\u", "TYPES_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "to", " ", "rebu", "ild", " ", "cache", ",", " ", "eit", "her", " ", "by", " ", "load", "ing", " ", "from", " ", "a", " ", "cache", " ", "file", ",", " ", "or", " ", "rebu", "ild", "ing", " ", "from", " ", "scratch", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cache", "Names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "contents_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "was", " ", "call", "ed", " ", "'", "cache", "s", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "Val_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "Type_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Attempts", " ", "to", " ", "load", " ", "the", " ", "data", " ", "from", " ", "the", " ", "cache", " ", "on", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "it", " ", "succeeds", ",", " ", "it", " ", "will", " ", "update", " ", "its", "elf", ",", " ", "and", " ", "return", " ", "the", " ", "load", "ed", " ", "items", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "it", " ", "fail", "s", ",", " ", "it", " ", "will", " ", "return", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rebuild_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Reb", "uild", " ", "cache", " ", "from", " ", "scratch", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Unli", "ke", " ", "'", "build", "',", " ", "this", " ", "doe", "s", " ", "not", " ", "atte", "mpt", " ", "to", " ", "load", " ", "a", " ", "cache", " ", "file", ",", " ", "but", " ", "alw", "ay", "s", "\\", "10", ";", " ", " ", " ", " ", "rebu", "ild", "s", " ", "it", " ", "by", " ", "pars", "ing", " ", "the", " ", "docs", ",", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Save", "s", " ", "the", " ", "cache", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Wil", "l", " ", "option", "ally", " ", "update", " ", "the", " ", "cache", "s", " ", "from", " ", "the", " ", "give", "n", " ", "object", " ", "(", "whi", "ch", " ", "may", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "dictionar", "y", ",", " ", "or", " ", "an", " ", "object", " ", "with", " ", "the", " ", "cache", "s", " ", "store", "d", " ", "in", " ", "attribute", "s", " ", "on", " ", "it", ")", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "saving", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Item", "Cache_", "(_", "Py", "mel", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "obj_", ",_", "cache", "Names_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "all", " ", "the", " ", "vari", "ous", " ", "data", " ", "from", " ", "the", " ", "give", "n", " ", "object", ",", " ", "whi", "ch", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "eit", "her", " ", "be", " ", "a", " ", "dictionar", "y", ",", " ", "a", " ", "list", " ", "or", " ", "tuple", " ", "with", " ", "the", " ", "right", " ", "number", " ", "of", " ", "items", ",", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "an", " ", "object", " ", "with", " ", "the", " ", "cache", "s", " ", "store", "d", " ", "in", " ", "attribute", "s", " ", "on", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "dump_", "(_", "data_", ",_", "filename_", ",_", "protocol_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "maya", "Start", "up", "Has", "Started_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "maya", ".", "app", ".", "start", "up", " ", "has", " ", "beg", "un", " ", "runn", "ing", ",", " ", "Fal", "se", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "It", "'", "s", " ", "possib", "le", " ", "tha", "t", " ", "maya", ".", "app", ".", "start", "up", " ", "is", " ", "in", " ", "the", " ", "process", " ", "of", " ", "runn", "ing", " ", "(", "ie", ",", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "maya", ".", "app", ".", "start", "up", ".", "basic", ",", " ", "calling", " ", "execute", "User", "Set", "up", ")", " ", "-", " ", "unli", "ke", " ", "maya", "Start", "up", ",", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "will", " ", "atte", "mpt", " ", "to", " ", "detect", " ", "if", " ", "this", " ", "is", " ", "the", " ", "case", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode", "Fix", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Fix", " ", "for", " ", "non", " ", "US", " ", "encoding", "s", " ", "in", " ", "Maya", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finalize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "AE", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Config", "File_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "ME", "L_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "maya", "Init_", "(_", "for", "version_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tr", "y", " ", "to", " ", "init", " ", "Maya", " ", "standalone", " ", "module", ",", " ", "use", " ", "whe", "n", " ", "runn", "ing", " ", "pym", "el", " ", "from", " ", "an", " ", "external", " ", "Pyth", "on", " ", "iner", "prete", "r", ",", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "is", " ", "possib", "le", " ", "to", " ", "pass", " ", "the", " ", "desi", "red", " ", "Maya", " ", "version", " ", "number", " ", "to", " ", "defin", "e", " ", "whi", "ch", " ", "Maya", " ", "to", " ", "initialize", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Part", " ", "of", " ", "the", " ", "complex", "it", "y", " ", "of", " ", "initiali", "zin", "g", " ", "maya", " ", "in", " ", "standalone", " ", "mode", " ", "is", " ", "tha", "t", " ", "maya", " ", "doe", "s", " ", "not", " ", "populate", " ", "os", ".", "environ", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "pars", "ing", " ", "Maya", ".", "env", ".", " ", " ", "If", " ", "we", " ", "initialize", " ", "normal", "ly", ",", " ", "the", " ", "env", "'", "s", " ", "are", " ", "avail", "able", " ", "via", " ", "maya", " ", "(", "via", " ", "the", " ", "shell", "),", " ", "but", " ", "not", " ", "in", " ", "python", "\\", "10", ";", " ", " ", " ", " ", "via", " ", "os", ".", "environ", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "the", " ", "follow", "ing", " ", "example", " ", "assume", "s", " ", "tha", "t", " ", "MA", "YA", "\\u", "SCRIPT", "\\u", "PATH", " ", "is", " ", "not", " ", "set", " ", "in", " ", "your", " ", "shell", " ", "environ", "ment", " ", "prior", " ", "to", " ", "launch", "ing", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "or", " ", "maya", "py", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "maya", ".", "standalone", " ", " ", " ", " ", "#", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "maya", ".", "standalone", ".", "initialize", "()", " ", " ", "#", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "maya", ".", "mel", " ", "as", " ", "mm", " ", " ", " ", " ", " ", "#", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", " ", "mm", ".", "eval", "(\"", "gete", "nv", " ", "MA", "YA", "\\u", "SCRIPT", "\\u", "PATH", "\")", " ", " ", " ", " ", "#", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", "/", "Network", "/", "Server", "s", "/", "sv", "-", "user", ".", "lum", "a", "-", "pictures", ".", "com", "/", "lum", "a", " ", ".....", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "os", " ", " ", " ", "#", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "'", "MA", "YA", "\\u", "SCRIPT", "\\u", "PATH", "'", " ", "in", " ", "os", ".", "environ", " ", " ", "#", "docte", "st", ":", " ", "+", "SKIP", "\\", "10", ";", " ", " ", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "solut", "ion", " ", "lies", " ", "in", " ", "`", "refre", "sh", "Environ", "`", ",", " ", "whi", "ch", " ", "copie", "s", " ", "the", " ", "environ", "ment", " ", "from", " ", "the", " ", "shell", " ", "to", " ", "os", ".", "environ", " ", "after", " ", "maya", ".", "standalone", "\\", "10", ";", " ", " ", " ", " ", "initialize", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "return", "s", " ", "Tru", "e", " ", "if", " ", "maya", ".", "cmds", " ", "require", "d", " ", "initiali", "zin", "g", " ", "(", " ", "in", " ", "other", " ", "words", ",", " ", "we", " ", "are", " ", "in", " ", "a", " ", "standalone", " ", "python", " ", "interprete", "r", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Py", "mel", "Config_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fix", "Maya", "py2", "011", "Seg", "Fault_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Ha", "ve", " ", "all", " ", "the", " ", "checks", " ", "insi", "de", " ", "here", ",", " ", "in", " ", "case", " ", "people", " ", "want", " ", "to", " ", "insert", " ", "this", " ", "in", " ", "thei", "r", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "user", "Set", "up", "...", " ", "it", "'", "s", " ", "currentl", "y", " ", "not", " ", "alw", "ay", "s", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "maya", "Start", "up", "Has", "Run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "maya", ".", "app", ".", "start", "up", " ", "has", " ", "alr", "ead", "y", " ", "finish", "ed", ",", " ", "Fal", "se", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "module", "Join_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Join", "s", " ", "with", " ", "the", " ", "base", " ", "pym", "el", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "Formatt", "ing_", "(_", ")_", ":_", "\\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, 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2, 4, 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 ]
Unused local variable
pydata/pandas/pandas/stats/plm.py
[ { "content": " def _convert_x(self, x):\n # Converts non-numeric data in x to floats. x_converted is the\n # DataFrame with converted values, and x_conversion is a dict that\n # provides the reverse mapping. For example, if 'A' was converted to 0\n # for x named 'variety', then x_conversion['variety'][0] is 'A'.\n x_converted = {}\n cat_mapping = {}\n # x can be either a dict or a Panel, but in Python 3, dicts don't have\n # .iteritems\n iteritems = getattr(x, 'iteritems', x.items)\n for key, df in iteritems():\n if not isinstance(df, DataFrame):\n raise AssertionError(\"all input items must be DataFrames, \"\n \"at least one is of \"\n \"type {0}\".format(type(df)))\n\n if _is_numeric(df):\n x_converted[key] = df\n else:\n try:\n df = df.astype(float)\n except (TypeError, ValueError):\n values = df.values\n distinct_values = sorted(set(values.flat))\n cat_mapping[key] = dict(enumerate(distinct_values))\n new_values = np.searchsorted(distinct_values, values)\n x_converted[key] = DataFrame(new_values, index=df.index,\n columns=df.columns)\n\n if len(cat_mapping) == 0:\n x_converted = x\n\n return x_converted, cat_mapping", "metadata": "root.PanelOLS._convert_x", "header": "['class', 'PanelOLS', '(', 'OLS', ')', ':', '___EOS___']", "index": 173 } ]
[ { "span": "df ", "start_line": 193, "start_column": 20, "end_line": 193, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Pane", "l", "OL", "S_", "(_", "OL", "S_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "convert", "\\u", "x_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", "s", " ", "non", "-", "numeri", "c", " ", "data", " ", "in", " ", "x", " ", "to", " ", "float", "s", ".", " ", "x", "\\u", "convert", "ed", " ", "is", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Data", "Frame", " ", "with", " ", "convert", "ed", " ", "values", ",", " ", "and", " ", "x", "\\u", "conve", "rsi", "on", " ", "is", " ", "a", " ", "dict", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "provide", "s", " ", "the", " ", "reverse", " ", "mapping", ".", " ", " ", "For", " ", "example", ",", " ", "if", " ", "'", "A", "'", " ", "was", " ", "convert", "ed", " ", "to", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "x", " ", "named", " ", "'", "variet", "y", "',", " ", "then", " ", "x", "\\u", "conve", "rsi", "on", "['", "variet", "y", "']", "[", "0", "]", " ", "is", " ", "'", "A", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "converted_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cat", "\\u", "mapping_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "x", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "dict", " ", "or", " ", "a", " ", "Pane", "l", ",", " ", "but", " ", "in", " ", "Pyth", "on", " ", "3", ",", " ", "dict", "s", " ", "don", "'", "t", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "iteritems_", "\\u\\u\\uNL\\u\\u\\u_", "iteritems_", "=_", "getattr_", "(_", "x_", ",_", "'", "iter", "items", "'_", ",_", "x_", "._", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "df_", "in_", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "df_", ",_", "Data", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "all", " ", "input", " ", "items", " ", "must", " ", "be", " ", "Data", "Frame", "s", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "at", " ", "leas", "t", " ", "one", " ", "is", " ", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", " ", "{", "0", "}\"_", "._", "format_", "(_", "type_", "(_", "df_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "is", "\\u", "numeric_", "(_", "df_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "converted_", "[_", "key_", "]_", "=_", "df_", "\\u\\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 ", " ", "_", "df_", "=_", "df_", "._", "astype_", "(_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "values_", "=_", "df_", "._", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distinct", "\\u", "values_", "=_", "sorted_", "(_", "set_", "(_", "values_", "._", "flat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cat", "\\u", "mapping_", "[_", "key_", "]_", "=_", "dict_", "(_", "enumerate_", "(_", "distinct", "\\u", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "values_", "=_", "np_", "._", "searchs", "orted_", "(_", "distinct", "\\u", "values_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "converted_", "[_", "key_", "]_", "=_", "Data", "Frame_", "(_", "new", "\\u", "values_", ",_", "index_", "=_", "df_", "._", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "df_", "._", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "cat", "\\u", "mapping_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "converted_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x", "\\u", "converted_", ",_", "cat", "\\u", "mapping_", "\\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,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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 ]
Unused import
dropbox/hermes/tests/api_tests/test_labors.py
[ { "content": "import json\nimport pytest\nimport requests\n\nfrom datetime import datetime, timedelta\n\nfrom .fixtures import tornado_server, tornado_app, sample_data1_server\nfrom .util import (\n assert_error, assert_success, assert_created, assert_deleted, Client\n)\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_malformed(sample_data1_server):\n client = sample_data1_server\n assert_error(client.post(\"/quests\", data=\"Non-JSON\"), 400)", "metadata": "root.test_malformed", "header": "['module', '___EOS___']", "index": 12 }, { "content": "def test_creation(sample_data1_server):\n client = sample_data1_server\n assert_success(\n client.get(\"/events\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalEvents\": 2\n },\n strip=[\"timestamp\", \"events\"]\n )\n\n assert_success(\n client.get(\"/quests\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalQuests\": 0,\n \"quests\": []\n }\n )\n\n assert_success(\n client.get(\"/labors\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 0,\n \"labors\": []\n }\n )\n\n target_time = datetime.utcnow() + timedelta(days=7)\n\n assert_created(\n client.create(\n \"/quests\",\n creator=\"johnny\",\n fateId=1,\n targetTime=str(target_time),\n description=\"This is a quest almighty\",\n hostnames=[\"example\", \"sample\", \"test\"]\n ),\n \"/api/v1/quests/1\"\n )\n\n assert_success(\n client.get(\"/labors\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 3,\n \"labors\": [{\"ackTime\": None,\n \"ackUser\": None,\n \"fateId\": 1,\n \"closingFateId\": None,\n \"completionEventId\": None,\n \"creationEventId\": 3,\n \"targetTime\": str(target_time),\n \"hostId\": 1,\n \"forOwner\": True,\n \"forCreator\": False,\n \"id\": 1,\n \"startingLaborId\": None,\n \"questId\": 1},\n {\"ackTime\": None,\n \"ackUser\": None,\n \"completionEventId\": None,\n \"creationEventId\": 4,\n \"targetTime\": str(target_time),\n \"hostId\": 2,\n \"forOwner\": True,\n \"forCreator\": False,\n \"fateId\": 1,\n \"closingFateId\": None,\n \"id\": 2,\n \"startingLaborId\": None,\n \"questId\": 1},\n {\"ackTime\": None,\n \"ackUser\": None,\n \"completionEventId\": None,\n \"creationEventId\": 5,\n \"targetTime\": str(target_time),\n \"hostId\": 3,\n \"forOwner\": True,\n \"forCreator\": False,\n \"fateId\": 1,\n \"closingFateId\": None,\n \"id\": 3,\n \"startingLaborId\": None,\n \"questId\": 1}],\n },\n strip=[\"creationTime\", \"completionTime\"]\n )", "metadata": "root.test_creation", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def test_update(sample_data1_server):\n client = sample_data1_server\n\n # create a quest without a target_time\n assert_created(\n client.create(\n \"/quests\",\n creator=\"johnny\",\n fateId=1,\n description=\"This is a quest almighty\",\n hostnames=[\"example\", \"sample\", \"test\"]\n ),\n \"/api/v1/quests/1\"\n )\n\n # make sure 3 labors was created for this quest\n assert_success(\n client.get(\"/labors\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 3\n },\n strip=[\"creationTime\", \"labors\"]\n )\n\n # create a new event that would create another labor\n assert_created(\n client.create(\n \"/events\",\n hostname=\"example\",\n user=\"testman@example.com\",\n eventTypeId=1,\n note=\"This is a test event\"\n ),\n \"/api/v1/events/6\"\n )\n\n # make sure the labor is not attached to a quest\n assert_success(\n client.get(\"/labors/4\"),\n {\n \"ackTime\": None,\n \"ackUser\": None,\n \"completionEventId\": None,\n \"completionTime\": None,\n \"creationEventId\": 6,\n \"hostId\": 1,\n \"forOwner\": True,\n \"forCreator\": False,\n \"fateId\": 1,\n \"closingFateId\": None,\n \"id\": 4,\n \"startingLaborId\": None,\n \"questId\": None\n },\n strip=[\"creationTime\"]\n )\n\n # attach the labor to a quest\n response = client.update(\n \"/labors/4\",\n ackUser=\"johnny@example.com\",\n questId=1\n )\n\n # make sure the labor is attached to the quest\n assert_success(\n response,\n {\n \"ackUser\": \"johnny@example.com\",\n \"completionEventId\": None,\n \"completionTime\": None,\n \"creationEventId\": 6,\n \"targetTime\": None,\n \"hostId\": 1,\n \"fateId\": 1,\n \"closingFateId\": None,\n \"forOwner\": True,\n \"forCreator\": False,\n \"id\": 4,\n \"startingLaborId\": None,\n \"questId\": 1\n },\n strip=[\"creationTime\", \"ackTime\"]\n )\n\n assert response.json()['ackTime'] is not None", "metadata": "root.test_update", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def test_labor_filter_by_eventttype(sample_data1_server):\n client = sample_data1_server\n\n assert_success(\n client.get(\"/labors\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 0,\n \"labors\": []\n }\n )\n\n # create a quest without a target_time\n assert_created(\n client.create(\n \"/quests\",\n creator=\"johnny\",\n fateId=1,\n description=\"This is a quest almighty\",\n hostnames=[\"example\", \"sample\", \"test\"]\n ),\n \"/api/v1/quests/1\"\n )\n\n # create a quest without a target_time\n assert_created(\n client.create(\n \"/quests\",\n creator=\"johnny\",\n fateId=3,\n description=\"This is a 2nd quest almighty\",\n hostnames=[\"example\", \"sample\", \"test\"]\n ),\n \"/api/v1/quests/2\"\n )\n\n assert_success(\n client.get(\"/labors\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 6,\n },\n strip=[\"labors\"]\n )\n\n assert_success(\n client.get(\"/labors?hostname=example\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 2\n },\n strip=[\"labors\"]\n )\n\n assert_success(\n client.get(\"/labors?category=system-reboot&state=required\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 3\n },\n strip=[\"labors\"]\n )\n\n assert_success(\n client.get(\"/labors?category=system-maintenance\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 3\n },\n strip=[\"labors\"]\n )", "metadata": "root.test_labor_filter_by_eventttype", "header": "['module', '___EOS___']", "index": 203 }, { "content": "def test_quest_expansion(sample_data1_server):\n client = sample_data1_server\n\n # create a quest without a target_time\n assert_created(\n client.create(\n \"/quests\",\n creator=\"johnny\",\n fateId=1,\n description=\"This is a quest almighty\",\n hostnames=[\"example\"]\n ),\n \"/api/v1/quests/1\"\n )\n\n assert_created(\n client.create(\n \"/events\",\n eventTypeId=1,\n hostname=\"sample\",\n user=\"testman@example.com\",\n ),\n \"/api/v1/events/4\"\n )\n\n assert_success(\n client.get(\"/labors?expand=quests\"),\n {\n \"limit\": 10,\n \"offset\": 0,\n \"totalLabors\": 2,\n \"labors\": [\n {'ackTime': None,\n 'ackUser': None,\n 'completionEventId': None,\n 'completionTime': None,\n 'creationEventId': 3,\n 'forCreator': False,\n 'forOwner': True,\n 'hostId': 1,\n 'id': 1,\n 'fateId': 1,\n \"closingFateId\": None,\n 'quest': {\n 'completionTime': None,\n 'creator': 'johnny@example.com',\n 'description': 'This is a quest almighty',\n 'id': 1,\n 'targetTime': None\n },\n 'questId': 1,\n 'startingLaborId': None,\n 'targetTime': None\n },\n {'ackTime': None,\n 'ackUser': None,\n 'completionEventId': None,\n 'completionTime': None,\n 'creationEventId': 4,\n 'forCreator': False,\n 'forOwner': True,\n 'hostId': 2,\n 'id': 2,\n 'fateId': 1,\n \"closingFateId\": None,\n 'quest': None,\n 'questId': None,\n 'startingLaborId': None\n }\n ]\n },\n strip=[\"embarkTime\", \"creationTime\"]\n )", "metadata": "root.test_quest_expansion", "header": "['module', '___EOS___']", "index": 281 } ]
[ { "span": "import json", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 11 }, { "span": "import pytest", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 }, { "span": "import requests", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "fixtures_", "import_", "torn", "ado", "\\u", "server_", ",_", "torn", "ado", "\\u", "app_", ",_", "sample", "\\u", "data", "1", "\\u", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "error_", ",_", "assert", "\\u", "success_", ",_", "assert", "\\u", "created_", ",_", "assert", "\\u", "deleted_", ",_", "Client_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "mal", "formed", "_", "(_", "sample", "\\u", "data", "1", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "sample", "\\u", "data", "1", "\\u", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "error_", "(_", "client_", "._", "post_", "(_", "\"/", "quest", "s", "\"_", ",_", "data_", "=_", "\"", "Non", "-", "JSO", "N", "\"_", ")_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "creation_", "(_", "sample", "\\u", "data", "1", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "sample", "\\u", "data", "1", "\\u", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "events", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Event", "s", "\"_", ":_", "2_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "timestamp", "\"_", ",_", "\"", "events", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "quest", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Quest", "s", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", "s", "\"_", ":_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labor", "s", "\"_", ":_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "time_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "timedelta_", "(_", "days_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "quest", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "\"", "john", "ny", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e", "Id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Time_", "=_", "str_", "(_", "target", "\\u", "time_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostnames", "_", "=_", "[_", "\"", "example", "\"_", ",_", "\"", "sample", "\"_", ",_", "\"", "test", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labor", "s", "\"_", ":_", "[_", "{_", "\"", "ack", "Time", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ack", "User", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fat", "e", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clos", "ing", "Fat", "e", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "completion", "Event", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "creati", "on", "Event", "Id", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "Time", "\"_", ":_", "str_", "(_", "target", "\\u", "time_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Owne", "r", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Creat", "or", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "startin", "g", "Labo", "r", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", "Id", "\"_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "ack", "Time", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ack", "User", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "completion", "Event", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "creati", "on", "Event", "Id", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "Time", "\"_", ":_", "str_", "(_", "target", "\\u", "time_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "Id", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Owne", "r", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Creat", "or", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fat", "e", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clos", "ing", "Fat", "e", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "startin", "g", "Labo", "r", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", "Id", "\"_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "ack", "Time", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ack", "User", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "completion", "Event", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "creati", "on", "Event", "Id", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "Time", "\"_", ":_", "str_", "(_", "target", "\\u", "time_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "Id", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Owne", "r", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Creat", "or", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fat", "e", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clos", "ing", "Fat", "e", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "startin", "g", "Labo", "r", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", "Id", "\"_", ":_", "1_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "creati", "on", "Time", "\"_", ",_", "\"", "completion", "Time", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update_", "(_", "sample", "\\u", "data", "1", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "sample", "\\u", "data", "1", "\\u", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "quest", " ", "with", "out", " ", "a", " ", "target", "\\u", "time_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "quest", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "\"", "john", "ny", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e", "Id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostnames", "_", "=_", "[_", "\"", "example", "\"_", ",_", "\"", "sample", "\"_", ",_", "\"", "test", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "3", " ", "labor", "s", " ", "was", " ", "created", " ", "for", " ", "this", " ", "quest_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "3_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "creati", "on", "Time", "\"_", ",_", "\"", "labor", "s", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "new", " ", "event", " ", "tha", "t", " ", "wou", "ld", " ", "create", " ", "anot", "her", " ", "labor", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "events", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "\"", "example", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "\"", "testm", "an", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "Type", "Id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "note_", "=_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "test", " ", "event", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "events", "/", "6", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "the", " ", "labor", " ", "is", " ", "not", " ", "attache", "d", " ", "to", " ", "a", " ", "quest_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "/", "4", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ack", "Time", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ack", "User", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "completion", "Event", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "completion", "Time", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "creati", "on", "Event", "Id", "\"_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Owne", "r", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Creat", "or", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fat", "e", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clos", "ing", "Fat", "e", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "startin", "g", "Labo", "r", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", "Id", "\"_", ":_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "creati", "on", "Time", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attach", " ", "the", " ", "labor", " ", "to", " ", "a", " ", "quest_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "client_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "labor", "s", "/", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ack", "User_", "=_", "\"", "john", "ny", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "quest", "Id_", "=_", "1_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "the", " ", "labor", " ", "is", " ", "attache", "d", " ", "to", " ", "the", " ", "quest_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ack", "User", "\"_", ":_", "\"", "john", "ny", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "completion", "Event", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "completion", "Time", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "creati", "on", "Event", "Id", "\"_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "Time", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fat", "e", "Id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clos", "ing", "Fat", "e", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Owne", "r", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", "Creat", "or", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "startin", "g", "Labo", "r", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "quest", "Id", "\"_", ":_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "creati", "on", "Time", "\"_", ",_", "\"", "ack", "Time", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "response_", "._", "json_", "(_", ")_", "[_", "'", "ack", "Time", "'_", "]_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "labor", "\\u", "filter", "\\u", "by", "\\u", "event", "ttype_", "(_", "sample", "\\u", "data", "1", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "sample", "\\u", "data", "1", "\\u", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labor", "s", "\"_", ":_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "quest", " ", "with", "out", " ", "a", " ", "target", "\\u", "time_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "quest", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "\"", "john", "ny", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e", "Id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostnames", "_", "=_", "[_", "\"", "example", "\"_", ",_", "\"", "sample", "\"_", ",_", "\"", "test", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "quest", " ", "with", "out", " ", "a", " ", "target", "\\u", "time_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "quest", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "\"", "john", "ny", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e", "Id_", "=_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "2n", "d", " ", "quest", " ", "alm", "ight", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostnames", "_", "=_", "[_", "\"", "example", "\"_", ",_", "\"", "sample", "\"_", ",_", "\"", "test", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "labor", "s", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "?", "host", "name", "=", "example", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "2_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "labor", "s", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "?", "category", "=", "system", "-", "rebo", "ot", "&", "state", "=", "require", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "3_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "labor", "s", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "?", "category", "=", "system", "-", "maintenance", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "3_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "labor", "s", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "quest", "\\u", "expansion", "_", "(_", "sample", "\\u", "data", "1", "\\u", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "sample", "\\u", "data", "1", "\\u", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "quest", " ", "with", "out", " ", "a", " ", "target", "\\u", "time_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "quest", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "creator_", "=_", "\"", "john", "ny", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fat", "e", "Id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostnames", "_", "=_", "[_", "\"", "example", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "quest", "s", "/", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "created_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "events", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "Type", "Id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "\"", "sample", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "\"", "testm", "an", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "api", "/", "v1", "/", "events", "/", "4", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "success_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "get_", "(_", "\"/", "labor", "s", "?", "expand", "=", "quest", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offset", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "total", "Labo", "rs", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labor", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "ack", "Time", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ack", "User", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "completion", "Event", "Id", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "completion", "Time", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creati", "on", "Event", "Id", "'_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", "Creat", "or", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", "Owne", "r", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "Id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fat", "e", "Id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clos", "ing", "Fat", "e", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quest", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "completion", "Time", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creat", "or", "'_", ":_", "'", "john", "ny", "@", "example", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Thi", "s", " ", "is", " ", "a", " ", "quest", " ", "alm", "ight", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "Time", "'_", ":_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quest", "Id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "startin", "g", "Labo", "r", "Id", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "Time", "'_", ":_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "ack", "Time", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ack", "User", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "completion", "Event", "Id", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "completion", "Time", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creati", "on", "Event", "Id", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", "Creat", "or", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", "Owne", "r", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "Id", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fat", "e", "Id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "clos", "ing", "Fat", "e", "Id", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quest", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quest", "Id", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "startin", "g", "Labo", "r", "Id", "'_", ":_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip_", "=_", "[_", "\"", "emb", "ark", "Time", "\"_", ",_", "\"", "creati", "on", "Time", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
qe-team/marmot/marmot/features/alignment_feature_extractor.py
[ { "content": "from __future__ import print_function\n\nimport os\nimport sys\nimport errno\n\nfrom marmot.features.feature_extractor import FeatureExtractor\nfrom marmot.util.alignments import train_alignments, align_sentence\nfrom marmot.util.ngram_window_extractor import left_context, right_context\nfrom marmot.exceptions.no_data_error import NoDataError\n\n\n# all features that require source dictionary\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AlignmentFeatureExtractor(FeatureExtractor):\n\n\n", "metadata": "root.AlignmentFeatureExtractor", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __init__(self, align_model='', src_file='', tg_file='', tmp_dir=None, context_size=1):\n if tmp_dir is None:\n tmp_dir = os.getcwd()\n try:\n os.makedirs(tmp_dir)\n except OSError as exc: # Python >2.5\n if exc.errno == errno.EEXIST and os.path.isdir(tmp_dir):\n pass\n else:\n raise\n self.tmp_dir = tmp_dir\n\n self.model = ''\n\n # no alignment model\n if align_model == '':\n # if src_file and tg_file are not empty, it means that an alignment model needs to be trained\n # (self.model doesn't have to be defined, if context objects have alignments)\n if os.path.isfile(src_file) and os.path.isfile(tg_file):\n self.model = train_alignments(src_file, tg_file, self.tmp_dir)\n else:\n self.model = align_model\n self.context_size = context_size", "metadata": "root.AlignmentFeatureExtractor.__init__", "header": "['class', 'AlignmentFeatureExtractor', '(', 'FeatureExtractor', ')', ':', '___EOS___']", "index": 15 }, { "content": " def get_features(self, context_obj):\n if 'source' not in context_obj or context_obj['source'] is None:\n raise NoDataError('source', context_obj, 'AlignmentFeatureExtractor')\n if 'target' not in context_obj or context_obj['source'] is None or context_obj['target'] is None:\n raise NoDataError('target', context_obj, 'AlignmentFeatureExtractor')\n\n if 'alignments' not in context_obj:\n raise NoDataError('alignments', context_obj, 'AlignmentFeatureExtractor')\n# if self.model == '':\n# raise NoDataError('alignments', context_obj, 'AlignmentFeatureExtractor')\n# context_obj['alignments'] = align_sentence(context_obj['source'], context_obj['target'], self.model)\n\n # source word(s)\n try:\n align_idx = context_obj['alignments'][context_obj['index']]\n except IndexError:\n print(\"{} items in the alignment, needed {}-th\".format(len(context_obj['alignments']), context_obj['index']))\n print(context_obj['alignments'], context_obj['target'], context_obj['source'])\n sys.exit()\n # if word is unaligned - no source and no source contexts\n if align_idx == None:\n return ['__unaligned__', '|'.join(['__unaligned__' for i in range(self.context_size)]), '|'.join(['__unaligned__' for i in range(self.context_size)])]\n\n # TODO: find contexts for all words aligned to the token (now only 1st word)\n else:\n left = '|'.join(left_context(context_obj['source'], context_obj['source'][align_idx], context_size=self.context_size, idx=align_idx))\n right = '|'.join(right_context(context_obj['source'], context_obj['source'][align_idx], context_size=self.context_size, idx=align_idx))\n\n aligned_to = context_obj['source'][align_idx]\n return [aligned_to, left, right]", "metadata": "root.AlignmentFeatureExtractor.get_features", "header": "['class', 'AlignmentFeatureExtractor', '(', 'FeatureExtractor', ')', ':', '___EOS___']", "index": 39 }, { "content": " def get_feature_names(self):\n return ['aligned_token', 'src_left_context', 'src_right_context']", "metadata": "root.AlignmentFeatureExtractor.get_feature_names", "header": "['class', 'AlignmentFeatureExtractor', '(', 'FeatureExtractor', ')', ':', '___EOS___']", "index": 70 } ]
[ { "span": "from marmot.util.alignments import train_alignments, align_sentence", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 67 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mar", "mot", "_", "._", "features_", "._", "feature", "\\u", "extractor_", "import_", "Feature", "Extractor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mar", "mot", "_", "._", "util_", "._", "alignments_", "import_", "train", "\\u", "alignments_", ",_", "align", "\\u", "sentence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mar", "mot", "_", "._", "util_", "._", "ngram", "\\u", "window", "\\u", "extractor_", "import_", "left", "\\u", "context_", ",_", "right", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mar", "mot", "_", "._", "exceptions_", "._", "no", "\\u", "data\\u", "error_", "import_", "No", "Data", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "features", " ", "tha", "t", " ", "require", " ", "source", " ", "dictionary_", "\\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_", "Align", "ment", "Feature", "Extractor_", "(_", "Feature", "Extractor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Align", "ment", "Feature", "Extractor_", "(_", "Feature", "Extractor_", ")_", ":_", "\\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_", ",_", "align", "\\u", "model_", "=_", "''_", ",_", "src", "\\u", "file_", "=_", "''_", ",_", "tg", "\\u", "file_", "=_", "''_", ",_", "tmp", "\\u", "dir_", "=_", "None_", ",_", "context", "\\u", "size_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tmp", "\\u", "dir_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "dir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\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_", "._", "makedirs_", "(_", "tmp", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "exc_", ":_", "#", " ", "Pyth", "on", " ", ">", "2.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc_", "._", "errno_", "==_", "errno_", "._", "EE", "XIST", "_", "and_", "os_", "._", "path_", "._", "isdir_", "(_", "tmp", "\\u", "dir_", ")_", ":_", "\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tmp", "\\u", "dir_", "=_", "tmp", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "model_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "alignme", "nt", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "align", "\\u", "model_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "src", "\\u", "file", " ", "and", " ", "tg", "\\u", "file", " ", "are", " ", "not", " ", "empty", ",", " ", "it", " ", "means", " ", "tha", "t", " ", "an", " ", "alignme", "nt", " ", "model", " ", "need", "s", " ", "to", " ", "be", " ", "trained", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "self", ".", "model", " ", "doe", "sn", "'", "t", " ", "have", " ", "to", " ", "be", " ", "defin", "ed", ",", " ", "if", " ", "context", " ", "object", "s", " ", "have", " ", "alignme", "nts", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "src", "\\u", "file_", ")_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "tg", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "model_", "=_", "train", "\\u", "alignments_", "(_", "src", "\\u", "file_", ",_", "tg", "\\u", "file_", ",_", "self_", "._", "tmp", "\\u", "dir_", ")_", "\\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_", "._", "model_", "=_", "align", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "context", "\\u", "size_", "=_", "context", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Align", "ment", "Feature", "Extractor_", "(_", "Feature", "Extractor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "features_", "(_", "self_", ",_", "context", "\\u", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "source", "'_", "not_", "in_", "context", "\\u", "obj_", "or_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Data", "Error_", "(_", "'", "source", "'_", ",_", "context", "\\u", "obj_", ",_", "'", "Align", "ment", "Feature", "Extract", "or", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "target", "'_", "not_", "in_", "context", "\\u", "obj_", "or_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", "is_", "None_", "or_", "context", "\\u", "obj_", "[_", "'", "target", "'_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Data", "Error_", "(_", "'", "target", "'_", ",_", "context", "\\u", "obj_", ",_", "'", "Align", "ment", "Feature", "Extract", "or", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "alignme", "nts", "'_", "not_", "in_", "context", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Data", "Error_", "(_", "'", "alignme", "nts", "'_", ",_", "context", "\\u", "obj_", ",_", "'", "Align", "ment", "Feature", "Extract", "or", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "model", " ", "==", " ", "''", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "raise", " ", "No", "Data", "Error", "('", "alignme", "nts", "',", " ", "context", "\\u", "obj", ",", " ", "'", "Align", "ment", "Feature", "Extract", "or", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "context", "\\u", "obj", "['", "alignme", "nts", "']", " ", "=", " ", "align", "\\u", "sentence", "(", "context", "\\u", "obj", "['", "source", "']", ",", " ", "context", "\\u", "obj", "['", "target", "']", ",", " ", "self", ".", "model", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "source", " ", "word", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "align", "\\u", "idx_", "=_", "context", "\\u", "obj_", "[_", "'", "alignme", "nts", "'_", "]_", "[_", "context", "\\u", "obj_", "[_", "'", "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 ", " _", "print_", "(_", "\"{}", " ", "items", " ", "in", " ", "the", " ", "alignme", "nt", ",", " ", "need", "ed", " ", "{}", "-", "th", "\"_", "._", "format_", "(_", "len_", "(_", "context", "\\u", "obj_", "[_", "'", "alignme", "nts", "'_", "]_", ")_", ",_", "context", "\\u", "obj_", "[_", "'", "index", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "context", "\\u", "obj_", "[_", "'", "alignme", "nts", "'_", "]_", ",_", "context", "\\u", "obj_", "[_", "'", "target", "'_", "]_", ",_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "word", " ", "is", " ", "unal", "igne", "d", " ", "-", " ", "no", " ", "source", " ", "and", " ", "no", " ", "source", " ", "contexts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "align", "\\u", "idx_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'\\u", "\\u", "unal", "igne", "d\\u", "\\u'_", ",_", "'|'_", "._", "join_", "(_", "[_", "'\\u", "\\u", "unal", "igne", "d\\u", "\\u'_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "context", "\\u", "size_", ")_", "]_", ")_", ",_", "'|'_", "._", "join_", "(_", "[_", "'\\u", "\\u", "unal", "igne", "d\\u", "\\u'_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "context", "\\u", "size_", ")_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "find", " ", "context", "s", " ", "for", " ", "all", " ", "words", " ", "aligned", " ", "to", " ", "the", " ", "token", " ", "(", "now", " ", "only", " ", "1s", "t", " ", "word", ")_", "\\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 ", " _", "left_", "=_", "'|'_", "._", "join_", "(_", "left", "\\u", "context_", "(_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", ",_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", "[_", "align", "\\u", "idx_", "]_", ",_", "context", "\\u", "size_", "=_", "self_", "._", "context", "\\u", "size_", ",_", "idx_", "=_", "align", "\\u", "idx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "'|'_", "._", "join_", "(_", "right", "\\u", "context_", "(_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", ",_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", "[_", "align", "\\u", "idx_", "]_", ",_", "context", "\\u", "size_", "=_", "self_", "._", "context", "\\u", "size_", ",_", "idx_", "=_", "align", "\\u", "idx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aligned", "\\u", "to_", "=_", "context", "\\u", "obj_", "[_", "'", "source", "'_", "]_", "[_", "align", "\\u", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "aligned", "\\u", "to_", ",_", "left_", ",_", "right_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Align", "ment", "Feature", "Extractor_", "(_", "Feature", "Extractor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "feature", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "'", "aligned", "\\u", "token", "'_", ",_", "'", "src", "\\u", "left", "\\u", "context", "'_", ",_", "'", "src", "\\u", "right", "\\u", "context", "'_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
AndrewIngram/django-extra-views/extra_views_tests/tests.py
[ { "content": " def test_create(self):\n res = self.client.get('/formset/simple/')\n self.assertEqual(res.status_code, 200)\n self.assertTrue('formset' in res.context)\n self.assertFalse('form' in res.context)\n self.assertTemplateUsed(res, 'extra_views/address_formset.html')\n self.assertEqual(res.context['formset'].__class__.__name__, 'AddressFormFormSet')", "metadata": "root.FormSetViewTests.test_create", "header": "['class', 'FormSetViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_invalid(self):\n data = {\n 'form-0-name': 'Joe Bloggs',\n 'form-0-city': '',\n 'form-0-line1': '',\n 'form-0-line2': '',\n 'form-0-postcode': '',\n }\n data.update(self.management_data)\n\n res = self.client.post('/formset/simple/', data, follow=True)\n self.assertEqual(res.status_code, 200)\n self.assertTrue('postcode' in res.context['formset'].errors[0])", "metadata": "root.FormSetViewTests.test_invalid", "header": "['class', 'FormSetViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_create(self):\n res = self.client.get('/modelformset/simple/')\n self.assertEqual(res.status_code, 200)\n self.assertTrue('formset' in res.context)\n self.assertFalse('form' in res.context)\n self.assertTemplateUsed(res, 'extra_views/item_formset.html')\n self.assertEqual(res.context['formset'].__class__.__name__, 'ItemFormFormSet')", "metadata": "root.ModelFormSetViewTests.test_create", "header": "['class', 'ModelFormSetViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_context(self):\n order = Order(name='Dummy Order')\n order.save()\n\n for i in range(10):\n item = Item(name='Item %i' % i, sku=str(i) * 13, price=D('9.99'), order=order, status=0)\n item.save()\n\n res = self.client.get('/modelformset/simple/')\n self.assertTrue('object_list' in res.context)\n self.assertEqual(len(res.context['object_list']), 10)", "metadata": "root.ModelFormSetViewTests.test_context", "header": "['class', 'ModelFormSetViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 113 }, { "content": " def test_create(self):\n order = Order(name='Dummy Order')\n order.save()\n\n for i in range(10):\n item = Item(name='Item %i' % i, sku=str(i) * 13, price=D('9.99'), order=order, status=0)\n item.save()\n\n res = self.client.get('/inlineformset/{}/'.format(order.id))\n\n self.assertTrue('object' in res.context)\n self.assertTrue('order' in res.context)\n\n self.assertEqual(res.status_code, 200)\n self.assertTrue('formset' in res.context)\n self.assertFalse('form' in res.context)", "metadata": "root.InlineFormSetViewTests.test_create", "header": "['class', 'InlineFormSetViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_post(self):\n order = Order(name='Dummy Order')\n order.save()\n data = {}\n data.update(self.management_data)\n\n res = self.client.post('/inlineformset/{}/'.format(order.id), data, follow=True)\n self.assertEqual(res.status_code, 200)\n self.assertTrue('formset' in res.context)\n self.assertFalse('form' in res.context)", "metadata": "root.InlineFormSetViewTests.test_post", "header": "['class', 'InlineFormSetViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_get(self):\n order = Order(name='Dummy Order')\n order.save()\n\n order2 = Order(name='Other Order')\n order2.save()\n\n tag = Tag(name='Test', content_object=order)\n tag.save()\n\n tag = Tag(name='Test2', content_object=order2)\n tag.save()\n\n res = self.client.get('/genericinlineformset/{}/'.format(order.id))\n\n self.assertEqual(res.status_code, 200)\n self.assertTrue('formset' in res.context)\n self.assertFalse('form' in res.context)\n self.assertEqual('Test', res.context['formset'].forms[0]['name'].value())", "metadata": "root.GenericInlineFormSetViewTests.test_get", "header": "['class', 'GenericInlineFormSetViewTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 186 }, { "content": " def test_create(self):\n res = self.client.get('/inlines/new/')\n self.assertEqual(res.status_code, 200)\n self.assertEqual(0, Tag.objects.count())\n\n data = {\n 'name': 'Dummy Order',\n 'items-TOTAL_FORMS': '2',\n 'items-INITIAL_FORMS': '0',\n 'items-MAX_NUM_FORMS': '',\n 'items-0-name': 'Bubble Bath',\n 'items-0-sku': '1234567890123',\n 'items-0-price': D('9.99'),\n 'items-0-status': 0,\n 'items-1-DELETE': True,\n 'extra_views_tests-tag-content_type-object_id-TOTAL_FORMS': 2,\n 'extra_views_tests-tag-content_type-object_id-INITIAL_FORMS': 0,\n 'extra_views_tests-tag-content_type-object_id-MAX_NUM_FORMS': '',\n 'extra_views_tests-tag-content_type-object_id-0-name': 'Test',\n 'extra_views_tests-tag-content_type-object_id-1-DELETE': True,\n }\n\n res = self.client.post('/inlines/new/', data, follow=True)\n\n self.assertTrue('object' in res.context)\n self.assertTrue('order' in res.context)\n\n self.assertEqual(res.status_code, 200)\n self.assertEqual(1, Tag.objects.count())", "metadata": "root.ModelWithInlinesTests.test_create", "header": "['class', 'ModelWithInlinesTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 251 } ]
[ { "span": "self.assertTrue('formset' in res.context)", "start_line": 28, "start_column": 8, "end_line": 28, "end_column": 49 }, { "span": "self.assertFalse('form' in res.context)", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 47 }, { "span": "self.assertTrue('postcode' in res.context['formset'].errors[0])", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 71 }, { "span": "self.assertTrue('formset' in res.context)", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 49 }, { "span": "self.assertFalse('form' in res.context)", "start_line": 85, "start_column": 8, "end_line": 85, "end_column": 47 }, { "span": "self.assertTrue('object_list' in res.context)", "start_line": 122, "start_column": 8, "end_line": 122, "end_column": 53 }, { "span": "self.assertTrue('object' in res.context)", "start_line": 143, "start_column": 8, "end_line": 143, "end_column": 48 }, { "span": "self.assertTrue('order' in res.context)", "start_line": 144, "start_column": 8, "end_line": 144, "end_column": 47 }, { "span": "self.assertTrue('formset' in res.context)", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 49 }, { "span": "self.assertFalse('form' in res.context)", "start_line": 148, "start_column": 8, "end_line": 148, "end_column": 47 }, { "span": "self.assertTrue('formset' in res.context)", "start_line": 158, "start_column": 8, "end_line": 158, "end_column": 49 }, { "span": "self.assertFalse('form' in res.context)", "start_line": 159, "start_column": 8, "end_line": 159, "end_column": 47 }, { "span": "self.assertTrue('formset' in res.context)", "start_line": 202, "start_column": 8, "end_line": 202, "end_column": 49 }, { "span": "self.assertFalse('form' in res.context)", "start_line": 203, "start_column": 8, "end_line": 203, "end_column": 47 }, { "span": "self.assertTrue('object' in res.context)", "start_line": 275, "start_column": 8, "end_line": 275, "end_column": 48 }, { "span": "self.assertTrue('order' in res.context)", "start_line": 276, "start_column": 8, "end_line": 276, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Form", "Set", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "formset", "/", "simple", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "formset", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "form", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "res_", ",_", "'", "extra", "\\u", "views", "/", "address", "\\u", "formset", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "context_", "[_", "'", "formset", "'_", "]_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "'", "Address", "Form", "Form", "Set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Form", "Set", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "-0", "-", "name", "'_", ":_", "'", "Jo", "e", " ", "Blog", "gs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "-0", "-", "city", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "-0", "-", "line", "1", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "-0", "-", "line", "2", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "-0", "-", "postcode", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "update_", "(_", "self_", "._", "manage", "ment", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "post_", "(_", "'/", "formset", "/", "simple", "/'_", ",_", "data_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "postcode", "'_", "in_", "res_", "._", "context_", "[_", "'", "formset", "'_", "]_", "._", "errors_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Form", "Set", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "modelf", "orms", "et", "/", "simple", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "formset", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "form", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "res_", ",_", "'", "extra", "\\u", "views", "/", "item", "\\u", "formset", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "context_", "[_", "'", "formset", "'_", "]_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "'", "Item", "Form", "Form", "Set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Form", "Set", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "Order_", "(_", "name_", "=_", "'", "Du", "mm", "y", " ", "Order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "Item_", "(_", "name_", "=_", "'", "Item", " ", "%", "i", "'_", "%_", "i_", ",_", "sku", "_", "=_", "str_", "(_", "i_", ")_", "*_", "13_", ",_", "price_", "=_", "D_", "(_", "'", "9.9", "9", "'_", ")_", ",_", "order_", "=_", "order_", ",_", "status_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "modelf", "orms", "et", "/", "simple", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object\\u", "list", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", "._", "context_", "[_", "'", "object\\u", "list", "'_", "]_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "line", "Form", "Set", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "Order_", "(_", "name_", "=_", "'", "Du", "mm", "y", " ", "Order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "Item_", "(_", "name_", "=_", "'", "Item", " ", "%", "i", "'_", "%_", "i_", ",_", "sku", "_", "=_", "str_", "(_", "i_", ")_", "*_", "13_", ",_", "price_", "=_", "D_", "(_", "'", "9.9", "9", "'_", ")_", ",_", "order_", "=_", "order_", ",_", "status_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "inline", "formset", "/{}/", "'_", "._", "format_", "(_", "order_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "order", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "formset", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "form", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "line", "Form", "Set", "View", "Tests_", "(_", "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 ", " _", "order_", "=_", "Order_", "(_", "name_", "=_", "'", "Du", "mm", "y", " ", "Order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "update_", "(_", "self_", "._", "manage", "ment", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "post_", "(_", "'/", "inline", "formset", "/{}/", "'_", "._", "format_", "(_", "order_", "._", "id_", ")_", ",_", "data_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "formset", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "form", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gene", "ric", "In", "line", "Form", "Set", "View", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "Order_", "(_", "name_", "=_", "'", "Du", "mm", "y", " ", "Order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order", "2_", "=_", "Order_", "(_", "name_", "=_", "'", "Ot", "her", " ", "Order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "Tag_", "(_", "name_", "=_", "'", "Test", "'_", ",_", "content", "\\u", "object_", "=_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "Tag_", "(_", "name_", "=_", "'", "Test", "2", "'_", ",_", "content", "\\u", "object_", "=_", "order", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "gener", "ici", "nline", "formset", "/{}/", "'_", "._", "format_", "(_", "order_", "._", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "formset", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "form", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Test", "'_", ",_", "res_", "._", "context_", "[_", "'", "formset", "'_", "]_", "._", "forms_", "[_", "0_", "]_", "[_", "'", "name", "'_", "]_", "._", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "With", "In", "lines", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "inline", "s", "/", "new", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "Tag_", "._", "objects_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Du", "mm", "y", " ", "Order", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-", "TOTAL", "\\u", "FORM", "S", "'_", ":_", "'", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-", "INITIAL", "\\u", "FORM", "S", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-", "MAX", "\\u", "NUM", "\\u", "FORM", "S", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-0", "-", "name", "'_", ":_", "'", "Bu", "bble", " ", "Bat", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-0", "-", "sku", "'_", ":_", "'", "123456789012", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-0", "-", "price", "'_", ":_", "D_", "(_", "'", "9.9", "9", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-0", "-", "status", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "-1", "-", "DELET", "E", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "views", "\\u", "tests", "-", "tag", "-", "content", "\\u", "type", "-", "object\\u", "id", "-", "TOTAL", "\\u", "FORM", "S", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "views", "\\u", "tests", "-", "tag", "-", "content", "\\u", "type", "-", "object\\u", "id", "-", "INITIAL", "\\u", "FORM", "S", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "views", "\\u", "tests", "-", "tag", "-", "content", "\\u", "type", "-", "object\\u", "id", "-", "MAX", "\\u", "NUM", "\\u", "FORM", "S", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "views", "\\u", "tests", "-", "tag", "-", "content", "\\u", "type", "-", "object\\u", "id", "-0", "-", "name", "'_", ":_", "'", "Test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "views", "\\u", "tests", "-", "tag", "-", "content", "\\u", "type", "-", "object\\u", "id", "-1", "-", "DELET", "E", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "post_", "(_", "'/", "inline", "s", "/", "new", "/'_", ",_", "data_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "order", "'_", "in_", "res_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equ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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AcademicsToday/py-academicstoday/academicstoday_project/publisher/views/my_publication.py
[ { "content": "from django.shortcuts import render\nfrom django.core import serializers\nimport json\nimport datetime\nimport os\nfrom django.http import HttpResponse\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth import authenticate, login, logout\nfrom django.contrib.auth.decorators import login_required\nfrom django.conf import settings\nfrom publisher.models import Publication\nfrom registrar.models import PeerReview\nfrom publisher.forms import PublicationForm\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@login_required(login_url='/landpage')\ndef my_publications_page(request):\n try:\n publications = Publication.objects.filter(author=request.user)\n except Publication.DoesNotExist:\n publications = None\n return render(request, 'publisher/my_publication/view.html',{\n 'publications': publications,\n 'user': request.user,\n 'tab': 'my_publications',\n 'HAS_ADVERTISMENT': settings.APPLICATION_HAS_ADVERTISMENT,\n 'local_css_urls': settings.SB_ADMIN_2_CSS_LIBRARY_URLS,\n 'local_js_urls': settings.SB_ADMIN_2_JS_LIBRARY_URLS\n })", "metadata": "root.my_publications_page", "header": "['module', '___EOS___']", "index": 14 }, { "content": "@login_required()\ndef refresh_publications_table(request):\n try:\n publications = Publication.objects.filter(author=request.user)\n except Publication.DoesNotExist:\n publications = None\n return render(request, 'publisher/my_publication/table.html',{\n 'publications': publications,\n 'user': request.user,\n 'tab': 'my_publications',\n 'local_css_urls': settings.SB_ADMIN_2_CSS_LIBRARY_URLS,\n 'local_js_urls': settings.SB_ADMIN_2_JS_LIBRARY_URLS\n })", "metadata": "root.refresh_publications_table", "header": "['module', '___EOS___']", "index": 30 }, { "content": "@login_required()\ndef my_publication_modal(request):\n if request.method == u'POST':\n form = None\n publication_id = int(request.POST['publication_id'])\n if publication_id > 0:\n upload = Publication.objects.get(publication_id=publication_id)\n form = PublicationForm(instance=upload)\n else:\n form = PublicationForm()\n return render(request, 'publisher/my_publication/modal.html',{\n 'form': form,\n })", "metadata": "root.my_publication_modal", "header": "['module', '___EOS___']", "index": 45 }, { "content": "@login_required()\ndef save_publication(request):\n response_data = {'status' : 'failed', 'message' : 'unknown error with saving'}\n if request.is_ajax():\n if request.method == 'POST':\n publication_id = int(request.POST['publication_id'])\n form = PublicationForm(request.POST, request.FILES)\n \n # If publication already exists, then delete local file.\n if publication_id > 0:\n # Delete previous file.\n try:\n upload = Publication.objects.get(publication_id=publication_id)\n except Publication.DoesNotExist:\n return HttpResponse(json.dumps({\n 'status' : 'failed', 'message' : 'record does not exist'\n }), content_type=\"application/json\")\n \n if upload.file:\n if os.path.isfile(upload.file.path):\n os.remove(upload.file.path)\n upload.file = None\n upload.save()\n form.instance = upload\n \n # Save if valid\n form.instance.author = request.user\n if form.is_valid():\n form.save()\n response_data = {'status' : 'success', 'message' : 'saved'}\n else:\n response_data = {'status' : 'failed', 'message' : json.dumps(form.errors)}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.save_publication", "header": "['module', '___EOS___']", "index": 61 }, { "content": "@login_required()\ndef delete_publication(request):\n response_data = {'status' : 'failed', 'message' : 'unknown error with deleting'}\n if request.is_ajax():\n if request.method == 'POST':\n publication_id = int(request.POST['publication_id'])\n try:\n publication = Publication.objects.get(publication_id=publication_id)\n for peer_review in publication.reviews.all():\n peer_review.delete()\n publication.delete()\n response_data = {'status' : 'success', 'message' : 'deleted'}\n except Publication.DoesNotExist:\n response_data = {'status' : 'failed', 'message' : 'record not found'}\n return HttpResponse(json.dumps(response_data), content_type=\"application/json\")", "metadata": "root.delete_publication", "header": "['module', '___EOS___']", "index": 96 } ]
[ { "span": "from django.core import serializers", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 35 }, { "span": "import datetime", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 }, { "span": "from django.contrib.auth.models import User", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 43 }, { "span": "from django.contrib.auth import authenticate, login, logout", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 59 }, { "span": "from registrar.models import PeerReview", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "authenticate_", ",_", "login_", ",_", "logout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "publisher_", "._", "models_", "import_", "Public", "ation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "registrar", "_", "._", "models_", "import_", "Peer", "Review", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "publisher_", "._", "forms_", "import_", "Public", "ation", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "@_", "login", "\\u", "required_", "(_", "login", "\\u", "url_", "=_", "'/", "land", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "my", "\\u", "publications", "\\u", "page_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publications", "_", "=_", "Public", "ation_", "._", "objects_", "._", "filter_", "(_", "author_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Public", "ation_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publications", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "publi", "sher", "/", "my", "\\u", "publicat", "ion", "/", "view", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publications", "'_", ":_", "publications", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tab", "'_", ":_", "'", "my", "\\u", "publications", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HAS", "\\u", "ADV", "ERT", "IS", "MENT", "'_", ":_", "settings_", "._", "APPLICATION", "\\u", "HAS", "\\u", "ADV", "ERT", "IS", "MENT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "css", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "CS", "S", "\\u", "LIBRARY", "\\u", "URLS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "js", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "JS", "\\u", "LIBRARY", "\\u", "URLS_", "\\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_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "refre", "sh", "\\u", "publications", "\\u", "table_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publications", "_", "=_", "Public", "ation_", "._", "objects_", "._", "filter_", "(_", "author_", "=_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Public", "ation_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publications", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "publi", "sher", "/", "my", "\\u", "publicat", "ion", "/", "table", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publications", "'_", ":_", "publications", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "request_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tab", "'_", ":_", "'", "my", "\\u", "publications", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "css", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "CS", "S", "\\u", "LIBRARY", "\\u", "URLS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "js", "\\u", "urls", "'_", ":_", "settings_", "._", "SB", "\\u", "ADM", "IN", "\\u", "2", "\\u", "JS", "\\u", "LIBRARY", "\\u", "URLS_", "\\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_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "my", "\\u", "publicat", "ion", "\\u", "modal_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "u", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publicat", "ion", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "publicat", "ion", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "publicat", "ion", "\\u", "id_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upload_", "=_", "Public", "ation_", "._", "objects_", "._", "get_", "(_", "publicat", "ion", "\\u", "id_", "=_", "publicat", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Public", "ation", "Form_", "(_", "instance_", "=_", "upload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Public", "ation", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "publi", "sher", "/", "my", "\\u", "publicat", "ion", "/", "modal", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "\\u", "publicat", "ion_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "unknown", " ", "error", " ", "with", " ", "saving", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publicat", "ion", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "publicat", "ion", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Public", "ation", "Form_", "(_", "request_", "._", "POST_", ",_", "request_", "._", "FILES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "publicat", "ion", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "then", " ", "delete", " ", "local", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "publicat", "ion", "\\u", "id_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "previ", "ous", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "upload_", "=_", "Public", "ation_", "._", "objects_", "._", "get_", "(_", "publicat", "ion", "\\u", "id_", "=_", "publicat", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Public", "ation_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "record", " ", "doe", "s", " ", "not", " ", "exist", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upload_", "._", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "upload_", "._", "file_", "._", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "remove_", "(_", "upload_", "._", "file_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload_", "._", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "._", "instance_", "=_", "upload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "if", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "._", "instance_", "._", "author_", "=_", "request_", "._", "user_", "\\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_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "saved", "'_", "}_", "\\u\\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", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "json_", "._", "dumps_", "(_", "form_", "._", "errors_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "publicat", "ion_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "unknown", " ", "error", " ", "with", " ", "delet", "ing", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "is", "\\u", "ajax_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publicat", "ion", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "POST_", "[_", "'", "publicat", "ion", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "publicat", "ion_", "=_", "Public", "ation_", "._", "objects_", "._", "get_", "(_", "publicat", "ion", "\\u", "id_", "=_", "publicat", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "peer", "\\u", "review_", "in_", "publicat", "ion_", "._", "reviews_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "peer", "\\u", "review_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "publicat", "ion_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "'", "message", "'_", ":_", "'", "delete", "d", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Public", "ation_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "fail", "ed", "'_", ",_", "'", "message", "'_", ":_", "'", "record", " ", "not", " ", "found", "'_", "}_", "\\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_", "Http", "Response_", "(_", "json_", "._", "dumps_", "(_", "response", "\\u", "data_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 0, 1, 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, 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, 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, 4, 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 ]
Unused import
RobotLocomotion/director/src/python/director/segmentation.py
[ { "content": "import os\nimport sys\nimport math\nimport vtk\nimport time\nimport functools\nimport traceback\nimport PythonQt\nfrom PythonQt import QtCore, QtGui\nimport director.applogic as app\nfrom director import objectmodel as om\nfrom director import perception\nfrom director import lcmUtils\nfrom director import roboturdf\nfrom director import transformUtils\nfrom director import visualization as vis\nfrom director.transformUtils import getTransformFromAxes\nfrom director.timercallback import TimerCallback\nfrom director import mapsregistrar\nfrom director import affordancemanager\nfrom director.affordanceitems import *\nfrom director.visualization import *\nfrom director.filterUtils import *\nfrom director.fieldcontainer import FieldContainer\nfrom director.segmentationroutines import *\nfrom director import cameraview\n\nfrom thirdparty import qhull_2d\nfrom thirdparty import min_bounding_rect\n\nimport numpy as np\nimport vtkNumpy\nfrom debugVis import DebugData\nfrom shallowCopy import shallowCopy\nimport ioUtils\nfrom director.uuidutil import newUUID\n\nimport drc as lcmdrc\nimport bot_core as lcmbotcore\n\nimport vs as lcmvs\nfrom director import lcmUtils\n\n\nDRILL_TRIANGLE_BOTTOM_LEFT = 'bottom left'\nDRILL_TRIANGLE_BOTTOM_RIGHT = 'bottom right'\nDRILL_TRIANGLE_TOP_LEFT = 'top left'\nDRILL_TRIANGLE_TOP_RIGHT = 'top right'\n\n# using drc plane segmentation instead of PCL\nplaneSegmentationFilter = vtk.vtkPlaneSegmentation\n#planeSegmentationFilter = vtk.vtkPCLSACSegmentationPlane\n\n\n_defaultSegmentationView = None\n\n\n\n\n\n\n\n\n\n\n\n\n'''\nicp programmable filter\n\nimport vtkFiltersGeneralPython as filtersGeneral\n\npoints = inputs[0]\nblock = inputs[1]\n\nprint points.GetNumberOfPoints()\nprint block.GetNumberOfPoints()\n\nif points.GetNumberOfPoints() < block.GetNumberOfPoints():\n block, points = points, block\n\nicp = vtk.vtkIterativeClosestPointTransform()\nicp.SetSource(points.VTKObject)\nicp.SetTarget(block.VTKObject)\nicp.GetLandmarkTransform().SetModeToRigidBody()\nicp.Update()\n\nt = filtersGeneral.vtkTransformPolyDataFilter()\nt.SetInput(points.VTKObject)\nt.SetTransform(icp)\nt.Update()\n\noutput.ShallowCopy(t.GetOutput())\n'''\n\n\n\n\n\n\nhandAffUpdater = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nuseVoxelGrid = False\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nrefitWallCallbacks = []\n\n\n\n\n\n# this should be depreciated!\n\n# this should be depreciated!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nviewPickers = []\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n####\n# debrs task ground frame\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nsavedCameraParams = None\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getSegmentationView():\n return _defaultSegmentationView or app.getViewManager().findView('Segmentation View')", "metadata": "root.getSegmentationView", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def getDRCView():\n return app.getDRCView()", "metadata": "root.getDRCView", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def switchToView(viewName):\n app.getViewManager().switchToView(viewName)", "metadata": "root.switchToView", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def getCurrentView():\n return app.getCurrentRenderView()", "metadata": "root.getCurrentView", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def initAffordanceManager(view):\n '''\n Normally the affordance manager is initialized by the application.\n This function can be called from scripts and tests to initialize the manager.\n '''\n global affordanceManager\n affordanceManager = affordancemanager.AffordanceObjectModelManager(view)", "metadata": "root.initAffordanceManager", "header": "['module', '___EOS___']", "index": 70 }, { "content": "def cropToLineSegment(polyData, point1, point2):\n\n line = np.array(point2) - np.array(point1)\n length = np.linalg.norm(line)\n axis = line / length\n\n polyData = labelPointDistanceAlongAxis(polyData, axis, origin=point1, resultArrayName='dist_along_line')\n return thresholdPoints(polyData, 'dist_along_line', [0.0, length])", "metadata": "root.cropToLineSegment", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def computeAToB(a,b):\n\n t = vtk.vtkTransform()\n t.PostMultiply()\n t.Concatenate(b)\n t.Concatenate(a.GetLinearInverse())\n tt = vtk.vtkTransform()\n tt.SetMatrix(t.GetMatrix())\n return tt", "metadata": "root.computeAToB", "header": "['module', '___EOS___']", "index": 119 }, { "content": "def lockAffordanceToHand(aff, hand='l_hand'):\n\n linkFrame = getLinkFrame(hand)\n affT = aff.actor.GetUserTransform()\n\n if not hasattr(aff, 'handToAffT') or not aff.handToAffT:\n aff.handToAffT = computeAToB(linkFrame, affT)\n\n t = vtk.vtkTransform()\n t.PostMultiply()\n t.Concatenate(aff.handToAffT)\n t.Concatenate(linkFrame)\n aff.actor.GetUserTransform().SetMatrix(t.GetMatrix())", "metadata": "root.lockAffordanceToHand", "header": "['module', '___EOS___']", "index": 130 }, { "content": "def lockToHandOn():\n aff = getDefaultAffordanceObject()\n if not aff:\n return\n\n global handAffUpdater\n if handAffUpdater is None:\n handAffUpdater = TimerCallback()\n handAffUpdater.targetFps = 30\n\n handAffUpdater.callback = functools.partial(lockAffordanceToHand, aff)\n handAffUpdater.start()", "metadata": "root.lockToHandOn", "header": "['module', '___EOS___']", "index": 147 }, { "content": "def lockToHandOff():\n\n aff = getDefaultAffordanceObject()\n if not aff:\n return\n\n handAffUpdater.stop()\n aff.handToAffT = None", "metadata": "root.lockToHandOff", "header": "['module', '___EOS___']", "index": 161 }, { "content": "class DisparityPointCloudItem(vis.PolyDataItem):\n\n\n\n\n", "metadata": "root.DisparityPointCloudItem", "header": "['module', '___EOS___']", "index": 172 }, { "content": " def __init__(self, name, imagesChannel, cameraName, imageManager):\n vis.PolyDataItem.__init__(self, name, vtk.vtkPolyData(), view=None)\n\n self.addProperty('Channel', imagesChannel)\n self.addProperty('Camera name', cameraName)\n\n self.addProperty('Decimation', 0, attributes=om.PropertyAttributes(enumNames=['1', '2', '4', '8', '16']))\n self.addProperty('Remove Size', 1000, attributes=om.PropertyAttributes(decimals=0, minimum=0, maximum=100000.0, singleStep=1000))\n self.addProperty('Target FPS', 1.0, attributes=om.PropertyAttributes(decimals=1, minimum=0.1, maximum=30.0, singleStep=0.1))\n\n self.timer = TimerCallback()\n self.timer.callback = self.update\n self.lastUtime = 0\n self.imageManager = imageManager\n self.cameraName = cameraName\n self.setProperty('Visible', False)", "metadata": "root.DisparityPointCloudItem.__init__", "header": "['class', 'DisparityPointCloudItem', '(', 'vis', '.', 'PolyDataItem', ')', ':', '___EOS___']", "index": 174 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n vis.PolyDataItem._onPropertyChanged(self, propertySet, propertyName)\n\n if propertyName == 'Visible':\n if self.getProperty(propertyName):\n self.timer.start()\n else:\n self.timer.stop()\n\n elif propertyName in ('Decimation', 'Remove outliers'):\n self.lastUtime = 0", "metadata": "root.DisparityPointCloudItem._onPropertyChanged", "header": "['class', 'DisparityPointCloudItem', '(', 'vis', '.', 'PolyDataItem', ')', ':', '___EOS___']", "index": 191 }, { "content": " def onRemoveFromObjectModel(self):\n vis.PolyDataItem.onRemoveFromObjectModel(self)\n self.timer.stop()", "metadata": "root.DisparityPointCloudItem.onRemoveFromObjectModel", "header": "['class', 'DisparityPointCloudItem', '(', 'vis', '.', 'PolyDataItem', ')', ':', '___EOS___']", "index": 204 }, { "content": " def update(self):\n\n utime = self.imageManager.queue.getCurrentImageTime(self.cameraName)\n if utime == self.lastUtime:\n return\n\n if (utime < self.lastUtime ):\n temp=0 # dummy\n elif (utime - self.lastUtime < 1E6/self.getProperty('Target FPS')):\n return\n\n decimation = int(self.properties.getPropertyEnumValue('Decimation'))\n removeSize = int(self.properties.getProperty('Remove Size'))\n polyData = getDisparityPointCloud(decimation, imagesChannel=self.getProperty('Channel'), cameraName=self.getProperty('Camera name'),\n removeOutliers=False, removeSize=removeSize)\n self.setPolyData(polyData)\n\n if not self.lastUtime:\n self.setProperty('Color By', 'rgb_colors')\n\n self.lastUtime = utime", "metadata": "root.DisparityPointCloudItem.update", "header": "['class', 'DisparityPointCloudItem', '(', 'vis', '.', 'PolyDataItem', ')', ':', '___EOS___']", "index": 208 }, { "content": "def extractLargestCluster(polyData, minClusterSize=100):\n\n polyData = applyEuclideanClustering(polyData, minClusterSize=minClusterSize)\n return thresholdPoints(polyData, 'cluster_labels', [1, 1])", "metadata": "root.extractLargestCluster", "header": "['module', '___EOS___']", "index": 231 }, { "content": "def segmentGround(polyData, groundThickness=0.02, sceneHeightFromGround=0.05):\n ''' A More complex ground removal algorithm. Works when plane isn't\n preceisely flat. First clusters on z to find approx ground height, then fits a plane there\n '''\n\n searchRegionThickness = 0.5\n\n zvalues = vtkNumpy.getNumpyFromVtk(polyData, 'Points')[:,2]\n groundHeight = np.percentile(zvalues, 5)\n\n vtkNumpy.addNumpyToVtk(polyData, zvalues.copy(), 'z')\n searchRegion = thresholdPoints(polyData, 'z', [groundHeight - searchRegionThickness/2.0, groundHeight + searchRegionThickness/2.0])\n\n updatePolyData(searchRegion, 'ground search region', parent=getDebugFolder(), colorByName='z', visible=False)\n\n _, origin, normal = applyPlaneFit(searchRegion, distanceThreshold=0.02, expectedNormal=[0,0,1], perpendicularAxis=[0,0,1], returnOrigin=True)\n\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n dist = np.dot(points - origin, normal)\n vtkNumpy.addNumpyToVtk(polyData, dist, 'dist_to_plane')\n\n groundPoints = thresholdPoints(polyData, 'dist_to_plane', [-groundThickness/2.0, groundThickness/2.0])\n scenePoints = thresholdPoints(polyData, 'dist_to_plane', [sceneHeightFromGround, 100])\n\n return origin, normal, groundPoints, scenePoints", "metadata": "root.segmentGround", "header": "['module', '___EOS___']", "index": 237 }, { "content": "def segmentGroundPlane():\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n inputObj.setProperty('Visible', False)\n polyData = shallowCopy(inputObj.polyData)\n\n zvalues = vtkNumpy.getNumpyFromVtk(polyData, 'Points')[:,2]\n groundHeight = np.percentile(zvalues, 5)\n searchRegion = thresholdPoints(polyData, 'z', [groundHeight - 0.3, groundHeight + 0.3])\n\n updatePolyData(searchRegion, 'ground search region', parent=getDebugFolder(), colorByName='z', visible=False)\n\n _, origin, normal = applyPlaneFit(searchRegion, distanceThreshold=0.02, expectedNormal=[0,0,1], perpendicularAxis=[0,0,1], returnOrigin=True)\n\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n dist = np.dot(points - origin, normal)\n vtkNumpy.addNumpyToVtk(polyData, dist, 'dist_to_plane')\n\n groundPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n scenePoints = thresholdPoints(polyData, 'dist_to_plane', [0.05, 10])\n\n updatePolyData(groundPoints, 'ground points', alpha=0.3)\n updatePolyData(scenePoints, 'scene points', alpha=0.3)\n\n #scenePoints = applyEuclideanClustering(scenePoints, clusterTolerance=0.10, minClusterSize=100, maxClusterSize=1e6)\n #updatePolyData(scenePoints, 'scene points', colorByName='cluster_labels')", "metadata": "root.segmentGroundPlane", "header": "['module', '___EOS___']", "index": 264 }, { "content": "def applyLocalPlaneFit(polyData, searchPoint, searchRadius, searchRadiusEnd=None, removeGroundFirst=True):\n\n useVoxelGrid = True\n voxelGridSize = 0.03\n distanceToPlaneThreshold = 0.02\n\n if useVoxelGrid:\n polyData = applyVoxelGrid(polyData, leafSize=voxelGridSize)\n\n if removeGroundFirst:\n _, polyData = removeGround(polyData, groundThickness=0.02, sceneHeightFromGround=0.04)\n\n cropped = cropToSphere(polyData, searchPoint, searchRadius)\n updatePolyData(cropped, 'crop to sphere', visible=False, colorByName='distance_to_point')\n\n polyData, normal = applyPlaneFit(polyData, distanceToPlaneThreshold, searchOrigin=searchPoint, searchRadius=searchRadius)\n\n if searchRadiusEnd is not None:\n polyData, normal = applyPlaneFit(polyData, distanceToPlaneThreshold, perpendicularAxis=normal, angleEpsilon=math.radians(30), searchOrigin=searchPoint, searchRadius=searchRadiusEnd)\n\n fitPoints = thresholdPoints(polyData, 'dist_to_plane', [-distanceToPlaneThreshold, distanceToPlaneThreshold])\n\n updatePolyData(fitPoints, 'fitPoints', visible=False)\n\n fitPoints = labelDistanceToPoint(fitPoints, searchPoint)\n clusters = extractClusters(fitPoints, clusterTolerance=0.05, minClusterSize=3)\n clusters.sort(key=lambda x: vtkNumpy.getNumpyFromVtk(x, 'distance_to_point').min())\n fitPoints = clusters[0]\n\n return fitPoints, normal\n\n\n normalEstimationSearchRadius = 0.065\n\n f = vtk.vtkPCLNormalEstimation()\n f.SetSearchRadius(normalEstimationSearchRadius)\n f.SetInput(polyData)\n f.Update()\n scenePoints = shallowCopy(f.GetOutput())\n\n normals = vtkNumpy.getNumpyFromVtk(scenePoints, 'normals')\n normalsDotPlaneNormal = np.abs(np.dot(normals, normal))\n vtkNumpy.addNumpyToVtk(scenePoints, normalsDotPlaneNormal, 'normals_dot_plane_normal')\n\n showPolyData(scenePoints, 'scene_with_normals', parent=getDebugFolder(), colorByName='normals_dot_plane_normal')\n\n surfaces = thresholdPoints(scenePoints, 'normals_dot_plane_normal', [0.95, 1.0])\n\n clusters = extractClusters(surfaces, clusterTolerance=0.1, minClusterSize=5)\n clusters = clusters[:10]\n\n for i, cluster in enumerate(clusters):\n showPolyData(cluster, 'plane cluster %i' % i, parent=getDebugFolder(), visible=False)\n\n return fitPoints", "metadata": "root.applyLocalPlaneFit", "header": "['module', '___EOS___']", "index": 292 }, { "content": "def orientToMajorPlane(polyData, pickedPoint):\n '''\n Find the largest plane and transform the cloud to align that plane\n Use the given point as the origin\n '''\n distanceToPlaneThreshold=0.02\n searchRadius = 0.5\n\n\n planePoints, origin, normal = applyPlaneFit(polyData, distanceToPlaneThreshold, searchOrigin=pickedPoint, searchRadius=searchRadius, returnOrigin=True)\n vis.updatePolyData(planePoints, 'local plane fit', color=[0,1,0], parent=getDebugFolder(), visible=False)\n\n planeFrame = transformUtils.getTransformFromOriginAndNormal(pickedPoint, normal)\n vis.updateFrame(planeFrame, 'plane frame', scale=0.15, parent=getDebugFolder(), visible=False)\n\n polyData = transformPolyData(polyData, planeFrame.GetLinearInverse() )\n\n # if the mean point is below the horizontal plane, flip the cloud\n zvalues = vtkNumpy.getNumpyFromVtk(polyData, 'Points')[:,2]\n midCloudHeight = np.mean(zvalues)\n if (midCloudHeight < 0):\n flipTransform = transformUtils.frameFromPositionAndRPY([0,0,0], [0,180,0])\n polyData = transformPolyData(polyData, flipTransform )\n\n return polyData, planeFrame", "metadata": "root.orientToMajorPlane", "header": "['module', '___EOS___']", "index": 349 }, { "content": "def getMajorPlanes(polyData, useVoxelGrid=True):\n\n voxelGridSize = 0.01\n distanceToPlaneThreshold = 0.02\n\n if useVoxelGrid:\n polyData = applyVoxelGrid(polyData, leafSize=voxelGridSize)\n\n polyDataList = []\n\n minClusterSize = 100\n\n while len(polyDataList) < 25:\n\n f = planeSegmentationFilter()\n f.SetInput(polyData)\n f.SetDistanceThreshold(distanceToPlaneThreshold)\n f.Update()\n polyData = shallowCopy(f.GetOutput())\n\n outliers = thresholdPoints(polyData, 'ransac_labels', [0, 0])\n inliers = thresholdPoints(polyData, 'ransac_labels', [1, 1])\n largestCluster = extractLargestCluster(inliers)\n\n #i = len(polyDataList)\n #showPolyData(inliers, 'inliers %d' % i, color=getRandomColor(), parent='major planes')\n #showPolyData(outliers, 'outliers %d' % i, color=getRandomColor(), parent='major planes')\n #showPolyData(largestCluster, 'cluster %d' % i, color=getRandomColor(), parent='major planes')\n\n if largestCluster.GetNumberOfPoints() > minClusterSize:\n polyDataList.append(largestCluster)\n polyData = outliers\n else:\n break\n\n return polyDataList", "metadata": "root.getMajorPlanes", "header": "['module', '___EOS___']", "index": 376 }, { "content": "def showMajorPlanes(polyData=None):\n\n if not polyData:\n inputObj = om.findObjectByName('pointcloud snapshot')\n inputObj.setProperty('Visible', False)\n polyData = inputObj.polyData\n\n om.removeFromObjectModel(om.findObjectByName('major planes'))\n folderObj = om.findObjectByName('segmentation')\n folderObj = om.getOrCreateContainer('major planes', folderObj)\n\n origin = SegmentationContext.getGlobalInstance().getViewFrame().GetPosition()\n polyData = labelDistanceToPoint(polyData, origin)\n polyData = thresholdPoints(polyData, 'distance_to_point', [1, 4])\n\n polyDataList = getMajorPlanes(polyData)\n\n for i, polyData in enumerate(polyDataList):\n obj = showPolyData(polyData, 'plane %d' % i, color=getRandomColor(), visible=True, parent='major planes')\n obj.setProperty('Point Size', 3)", "metadata": "root.showMajorPlanes", "header": "['module', '___EOS___']", "index": 414 }, { "content": "def cropToBox(polyData, transform, dimensions):\n '''\n dimensions is length 3 describing box dimensions\n '''\n origin = np.array(transform.GetPosition())\n axes = transformUtils.getAxesFromTransform(transform)\n\n for axis, length in zip(axes, dimensions):\n cropAxis = np.array(axis)*(length/2.0)\n polyData = cropToLineSegment(polyData, origin - cropAxis, origin + cropAxis)\n\n return polyData", "metadata": "root.cropToBox", "header": "['module', '___EOS___']", "index": 436 }, { "content": "def cropToBounds(polyData, transform, bounds):\n '''\n bounds is a 2x3 containing the min/max values along the transform axes to use for cropping\n '''\n origin = np.array(transform.GetPosition())\n axes = transformUtils.getAxesFromTransform(transform)\n\n for axis, bound in zip(axes, bounds):\n axis = np.array(axis)/np.linalg.norm(axis)\n polyData = cropToLineSegment(polyData, origin + axis*bound[0], origin + axis*bound[1])\n\n return polyData", "metadata": "root.cropToBounds", "header": "['module', '___EOS___']", "index": 449 }, { "content": "def cropToSphere(polyData, origin, radius):\n polyData = labelDistanceToPoint(polyData, origin)\n return thresholdPoints(polyData, 'distance_to_point', [0, radius])", "metadata": "root.cropToSphere", "header": "['module', '___EOS___']", "index": 463 }, { "content": "def applyPlaneFit(polyData, distanceThreshold=0.02, expectedNormal=None, perpendicularAxis=None, angleEpsilon=0.2, returnOrigin=False, searchOrigin=None, searchRadius=None):\n\n expectedNormal = expectedNormal if expectedNormal is not None else [-1,0,0]\n\n fitInput = polyData\n if searchOrigin is not None:\n assert searchRadius\n fitInput = cropToSphere(fitInput, searchOrigin, searchRadius)\n\n # perform plane segmentation\n f = planeSegmentationFilter()\n f.SetInput(fitInput)\n f.SetDistanceThreshold(distanceThreshold)\n if perpendicularAxis is not None:\n f.SetPerpendicularConstraintEnabled(True)\n f.SetPerpendicularAxis(perpendicularAxis)\n f.SetAngleEpsilon(angleEpsilon)\n f.Update()\n origin = f.GetPlaneOrigin()\n normal = np.array(f.GetPlaneNormal())\n\n # flip the normal if needed\n if np.dot(normal, expectedNormal) < 0:\n normal = -normal\n\n # for each point, compute signed distance to plane\n\n polyData = shallowCopy(polyData)\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n dist = np.dot(points - origin, normal)\n vtkNumpy.addNumpyToVtk(polyData, dist, 'dist_to_plane')\n\n if returnOrigin:\n return polyData, origin, normal\n else:\n return polyData, normal", "metadata": "root.applyPlaneFit", "header": "['module', '___EOS___']", "index": 468 }, { "content": "def flipNormalsWithViewDirection(polyData, viewDirection):\n normals = vnp.getNumpyFromVtk(polyData, 'normals')\n normals[np.dot(normals, viewDirection) > 0] *= -1", "metadata": "root.flipNormalsWithViewDirection", "header": "['module', '___EOS___']", "index": 506 }, { "content": "def normalEstimation(dataObj, searchCloud=None, searchRadius=0.05, useVoxelGrid=False, voxelGridLeafSize=0.05):\n\n f = vtk.vtkPCLNormalEstimation()\n f.SetSearchRadius(searchRadius)\n f.SetInput(dataObj)\n if searchCloud:\n f.SetInput(1, searchCloud)\n elif useVoxelGrid:\n f.SetInput(1, applyVoxelGrid(dataObj, voxelGridLeafSize))\n f.Update()\n dataObj = shallowCopy(f.GetOutput())\n dataObj.GetPointData().SetNormals(dataObj.GetPointData().GetArray('normals'))\n\n return dataObj", "metadata": "root.normalEstimation", "header": "['module', '___EOS___']", "index": 511 }, { "content": "def addCoordArraysToPolyData(polyData):\n polyData = shallowCopy(polyData)\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n vtkNumpy.addNumpyToVtk(polyData, points[:,0].copy(), 'x')\n vtkNumpy.addNumpyToVtk(polyData, points[:,1].copy(), 'y')\n vtkNumpy.addNumpyToVtk(polyData, points[:,2].copy(), 'z')\n\n viewFrame = SegmentationContext.getGlobalInstance().getViewFrame()\n viewOrigin = viewFrame.TransformPoint([0.0, 0.0, 0.0])\n viewX = viewFrame.TransformVector([1.0, 0.0, 0.0])\n viewY = viewFrame.TransformVector([0.0, 1.0, 0.0])\n viewZ = viewFrame.TransformVector([0.0, 0.0, 1.0])\n polyData = labelPointDistanceAlongAxis(polyData, viewX, origin=viewOrigin, resultArrayName='distance_along_view_x')\n polyData = labelPointDistanceAlongAxis(polyData, viewY, origin=viewOrigin, resultArrayName='distance_along_view_y')\n polyData = labelPointDistanceAlongAxis(polyData, viewZ, origin=viewOrigin, resultArrayName='distance_along_view_z')\n\n return polyData", "metadata": "root.addCoordArraysToPolyData", "header": "['module', '___EOS___']", "index": 527 }, { "content": "def getDebugRevolutionData():\n #dataDir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../drc-data'))\n #filename = os.path.join(dataDir, 'valve_wall.vtp')\n #filename = os.path.join(dataDir, 'bungie_valve.vtp')\n #filename = os.path.join(dataDir, 'cinder-blocks.vtp')\n #filename = os.path.join(dataDir, 'cylinder_table.vtp')\n #filename = os.path.join(dataDir, 'firehose.vtp')\n #filename = os.path.join(dataDir, 'debris.vtp')\n #filename = os.path.join(dataDir, 'rev1.vtp')\n #filename = os.path.join(dataDir, 'drill-in-hand.vtp')\n\n filename = os.path.expanduser('~/Desktop/scans/debris-scan.vtp')\n\n return addCoordArraysToPolyData(ioUtils.readPolyData(filename))", "metadata": "root.getDebugRevolutionData", "header": "['module', '___EOS___']", "index": 546 }, { "content": "def getCurrentScanBundle():\n obj = om.findObjectByName('SCANS_HALF_SWEEP')\n if not obj:\n return None\n\n revPolyData = obj.polyData\n if not revPolyData or not revPolyData.GetNumberOfPoints():\n return None\n\n if useVoxelGrid:\n revPolyData = applyVoxelGrid(revPolyData, leafSize=0.015)\n\n return addCoordArraysToPolyData(revPolyData)", "metadata": "root.getCurrentScanBundle", "header": "['module', '___EOS___']", "index": 562 }, { "content": "def getCurrentRevolutionData():\n revPolyData = perception._multisenseItem.model.revPolyData\n if not revPolyData or not revPolyData.GetNumberOfPoints():\n return getCurrentScanBundle()\n\n if useVoxelGrid:\n revPolyData = applyVoxelGrid(revPolyData, leafSize=0.015)\n\n return addCoordArraysToPolyData(revPolyData)", "metadata": "root.getCurrentRevolutionData", "header": "['module', '___EOS___']", "index": 577 }, { "content": "def getDisparityPointCloud(decimation=4, removeOutliers=True, removeSize=0, imagesChannel='CAMERA', cameraName='CAMERA_LEFT'):\n\n p = cameraview.getStereoPointCloud(decimation, imagesChannel=imagesChannel, cameraName=cameraName, removeSize=removeSize)\n if not p:\n return None\n\n if removeOutliers:\n # attempt to scale outlier filtering, best tuned for decimation of 2 or 4\n scaling = (10*16)/(decimation*decimation)\n p = labelOutliers(p, searchRadius=0.06, neighborsInSearchRadius=scaling)\n p = thresholdPoints(p, 'is_outlier', [0.0, 0.0])\n\n return p", "metadata": "root.getDisparityPointCloud", "header": "['module', '___EOS___']", "index": 588 }, { "content": "def getCurrentMapServerData():\n mapServer = om.findObjectByName('Map Server')\n polyData = None\n if mapServer and mapServer.getProperty('Visible'):\n polyData = mapServer.source.polyData\n\n if not polyData or not polyData.GetNumberOfPoints():\n return None\n\n return addCoordArraysToPolyData(polyData)", "metadata": "root.getCurrentMapServerData", "header": "['module', '___EOS___']", "index": 603 }, { "content": "def segmentGroundPlanes():\n\n objs = []\n for obj in om.getObjects():\n name = obj.getProperty('Name')\n if name.startswith('pointcloud snapshot'):\n objs.append(obj)\n\n objs = sorted(objs, key=lambda x: x.getProperty('Name'))\n\n d = DebugData()\n\n prevHeadAxis = None\n for obj in objs:\n name = obj.getProperty('Name')\n print '----- %s---------' % name\n print 'head axis:', obj.headAxis\n origin, normal, groundPoints, _ = segmentGround(obj.polyData)\n print 'ground normal:', normal\n showPolyData(groundPoints, name + ' ground points', visible=False)\n a = np.array([0,0,1])\n b = np.array(normal)\n diff = math.degrees(math.acos(np.dot(a,b) / (np.linalg.norm(a) * np.linalg.norm(b))))\n if diff > 90:\n print 180 - diff\n else:\n print diff\n\n if prevHeadAxis is not None:\n a = prevHeadAxis\n b = np.array(obj.headAxis)\n diff = math.degrees(math.acos(np.dot(a,b) / (np.linalg.norm(a) * np.linalg.norm(b))))\n if diff > 90:\n print 180 - diff\n else:\n print diff\n prevHeadAxis = np.array(obj.headAxis)\n\n d.addLine([0,0,0], normal)\n\n updatePolyData(d.getPolyData(), 'normals')", "metadata": "root.segmentGroundPlanes", "header": "['module', '___EOS___']", "index": 620 }, { "content": "def extractCircle(polyData, distanceThreshold=0.04, radiusLimit=None):\n\n circleFit = vtk.vtkPCLSACSegmentationCircle()\n circleFit.SetDistanceThreshold(distanceThreshold)\n circleFit.SetInput(polyData)\n if radiusLimit is not None:\n circleFit.SetRadiusLimit(radiusLimit)\n circleFit.SetRadiusConstraintEnabled(True)\n circleFit.Update()\n\n polyData = thresholdPoints(circleFit.GetOutput(), 'ransac_labels', [1.0, 1.0])\n return polyData, circleFit", "metadata": "root.extractCircle", "header": "['module', '___EOS___']", "index": 663 }, { "content": "def removeMajorPlane(polyData, distanceThreshold=0.02):\n\n # perform plane segmentation\n f = planeSegmentationFilter()\n f.SetInput(polyData)\n f.SetDistanceThreshold(distanceThreshold)\n f.Update()\n\n polyData = thresholdPoints(f.GetOutput(), 'ransac_labels', [0.0, 0.0])\n return polyData, f", "metadata": "root.removeMajorPlane", "header": "['module', '___EOS___']", "index": 677 }, { "content": "def removeGroundSimple(polyData, groundThickness=0.02, sceneHeightFromGround=0.05):\n ''' Simple ground plane removal algorithm. Uses ground height\n and does simple z distance filtering.\n Suitable for noisy data e.g. kinect/stereo camera\n (Default args should be relaxed, filtering simplfied)\n '''\n groundHeight = SegmentationContext.getGlobalInstance().getGroundHeight()\n origin = [0, 0, groundHeight]\n normal = [0, 0, 1]\n\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n dist = np.dot(points - origin, normal)\n vtkNumpy.addNumpyToVtk(polyData, dist, 'dist_to_plane')\n\n groundPoints = thresholdPoints(polyData, 'dist_to_plane', [-groundThickness/2.0, groundThickness/2.0])\n scenePoints = thresholdPoints(polyData, 'dist_to_plane', [sceneHeightFromGround, 100])\n\n return groundPoints, scenePoints", "metadata": "root.removeGroundSimple", "header": "['module', '___EOS___']", "index": 689 }, { "content": "def removeGround(polyData, groundThickness=0.02, sceneHeightFromGround=0.05):\n origin, normal, groundPoints, scenePoints = segmentGround(polyData, groundThickness, sceneHeightFromGround)\n return groundPoints, scenePoints", "metadata": "root.removeGround", "header": "['module', '___EOS___']", "index": 709 }, { "content": "def generateFeetForValve():\n\n aff = om.findObjectByName('valve affordance')\n assert aff\n\n\n params = aff.params\n\n origin = np.array(params['origin'])\n origin[2] = 0.0\n\n xaxis = -params['axis']\n zaxis = np.array([0,0,1])\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n\n stanceWidth = 0.2\n stanceRotation = 25.0\n stanceOffset = [-1.0, -0.5, 0.0]\n\n valveFrame = getTransformFromAxes(xaxis, yaxis, zaxis)\n valveFrame.PostMultiply()\n valveFrame.Translate(origin)\n\n stanceFrame, lfootFrame, rfootFrame = getFootFramesFromReferenceFrame(valveFrame, stanceWidth, stanceRotation, stanceOffset)\n\n showFrame(boardFrame, 'board ground frame', parent=aff, scale=0.15, visible=False)\n showFrame(lfootFrame, 'lfoot frame', parent=aff, scale=0.15)\n showFrame(rfootFrame, 'rfoot frame', parent=aff, scale=0.15)\n\n #d = DebugData()\n #d.addLine(valveFrame.GetPosition(), stanceFrame.GetPosition())\n #updatePolyData(d.getPolyData(), 'stance debug')\n #publishSteppingGoal(lfootFrame, rfootFrame)", "metadata": "root.generateFeetForValve", "header": "['module', '___EOS___']", "index": 714 }, { "content": "def generateFeetForDebris():\n\n aff = om.findObjectByName('board A')\n if not aff:\n return\n\n params = aff.params\n\n origin = np.array(params['origin'])\n\n origin = origin + params['zaxis']*params['zwidth']/2.0 - params['xaxis']*params['xwidth']/2.0\n origin[2] = 0.0\n\n yaxis = params['zaxis']\n zaxis = np.array([0,0,1])\n xaxis = np.cross(yaxis, zaxis)\n\n stanceWidth = 0.35\n stanceRotation = 0.0\n stanceOffset = [-0.48, -0.08, 0]\n\n boardFrame = getTransformFromAxes(xaxis, yaxis, zaxis)\n boardFrame.PostMultiply()\n boardFrame.Translate(origin)\n\n stanceFrame, lfootFrame, rfootFrame = getFootFramesFromReferenceFrame(boardFrame, stanceWidth, stanceRotation, stanceOffset)\n\n showFrame(boardFrame, 'board ground frame', parent=aff, scale=0.15, visible=False)\n lfoot = showFrame(lfootFrame, 'lfoot frame', parent=aff, scale=0.15)\n rfoot = showFrame(rfootFrame, 'rfoot frame', parent=aff, scale=0.15)\n\n for obj in [lfoot, rfoot]:\n obj.addToView(app.getDRCView())\n\n #d = DebugData()\n #d.addLine(valveFrame.GetPosition(), stanceFrame.GetPosition())\n #updatePolyData(d.getPolyData(), 'stance debug')\n #publishSteppingGoal(lfootFrame, rfootFrame)", "metadata": "root.generateFeetForDebris", "header": "['module', '___EOS___']", "index": 750 }, { "content": "def generateFeetForWye():\n\n aff = om.findObjectByName('wye points')\n if not aff:\n return\n\n params = aff.params\n\n origin = np.array(params['origin'])\n origin[2] = 0.0\n\n yaxis = params['xaxis']\n xaxis = -params['zaxis']\n zaxis = np.cross(xaxis, yaxis)\n\n stanceWidth = 0.20\n stanceRotation = 0.0\n stanceOffset = [-0.48, -0.08, 0]\n\n affGroundFrame = getTransformFromAxes(xaxis, yaxis, zaxis)\n affGroundFrame.PostMultiply()\n affGroundFrame.Translate(origin)\n\n stanceFrame, lfootFrame, rfootFrame = getFootFramesFromReferenceFrame(affGroundFrame, stanceWidth, stanceRotation, stanceOffset)\n\n showFrame(affGroundFrame, 'affordance ground frame', parent=aff, scale=0.15, visible=False)\n lfoot = showFrame(lfootFrame, 'lfoot frame', parent=aff, scale=0.15)\n rfoot = showFrame(rfootFrame, 'rfoot frame', parent=aff, scale=0.15)\n\n for obj in [lfoot, rfoot]:\n obj.addToView(app.getDRCView())", "metadata": "root.generateFeetForWye", "header": "['module', '___EOS___']", "index": 790 }, { "content": "def getFootFramesFromReferenceFrame(referenceFrame, stanceWidth, stanceRotation, stanceOffset):\n\n footHeight=0.0745342\n\n ref = vtk.vtkTransform()\n ref.SetMatrix(referenceFrame.GetMatrix())\n\n stanceFrame = vtk.vtkTransform()\n stanceFrame.PostMultiply()\n stanceFrame.RotateZ(stanceRotation)\n stanceFrame.Translate(stanceOffset)\n stanceFrame.Concatenate(ref)\n\n lfootFrame = vtk.vtkTransform()\n lfootFrame.PostMultiply()\n lfootFrame.Translate(0, stanceWidth/2.0, footHeight)\n lfootFrame.Concatenate(stanceFrame)\n\n rfootFrame = vtk.vtkTransform()\n rfootFrame.PostMultiply()\n rfootFrame.Translate(0, -stanceWidth/2.0, footHeight)\n rfootFrame.Concatenate(stanceFrame)\n\n return stanceFrame, lfootFrame, rfootFrame", "metadata": "root.getFootFramesFromReferenceFrame", "header": "['module', '___EOS___']", "index": 824 }, { "content": "def poseFromFrame(frame):\n\n trans = lcmbotcore.vector_3d_t()\n trans.x, trans.y, trans.z = frame.GetPosition()\n\n wxyz = range(4)\n perception.drc.vtkMultisenseSource.GetBotQuaternion(frame, wxyz)\n quat = lcmbotcore.quaternion_t()\n quat.w, quat.x, quat.y, quat.z = wxyz\n\n pose = lcmbotcore.position_3d_t()\n pose.translation = trans\n pose.rotation = quat\n return pose", "metadata": "root.poseFromFrame", "header": "['module', '___EOS___']", "index": 850 }, { "content": "def cropToPlane(polyData, origin, normal, threshold):\n polyData = shallowCopy(polyData)\n normal = normal/np.linalg.norm(normal)\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n dist = np.dot(points - origin, normal)\n vtkNumpy.addNumpyToVtk(polyData, dist, 'dist_to_plane')\n cropped = thresholdPoints(polyData, 'dist_to_plane', threshold)\n return cropped, polyData", "metadata": "root.cropToPlane", "header": "['module', '___EOS___']", "index": 866 }, { "content": "def createLine(blockDimensions, p1, p2):\n\n\n sliceWidth = np.array(blockDimensions).max()/2.0 + 0.02\n sliceThreshold = [-sliceWidth, sliceWidth]\n\n\n # require p1 to be point on left\n if p1[0] > p2[0]:\n p1, p2 = p2, p1\n\n _, worldPt1 = getRayFromDisplayPoint(app.getCurrentRenderView(), p1)\n _, worldPt2 = getRayFromDisplayPoint(app.getCurrentRenderView(), p2)\n\n cameraPt = np.array(app.getCurrentRenderView().camera().GetPosition())\n\n leftRay = worldPt1 - cameraPt\n rightRay = worldPt2 - cameraPt\n middleRay = (leftRay + rightRay) / 2.0\n\n\n d = DebugData()\n d.addLine(cameraPt, worldPt1)\n d.addLine(cameraPt, worldPt2)\n d.addLine(worldPt1, worldPt2)\n d.addLine(cameraPt, cameraPt + middleRay)\n updatePolyData(d.getPolyData(), 'line annotation', parent=getDebugFolder(), visible=False)\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n if inputObj:\n polyData = shallowCopy(inputObj.polyData)\n else:\n polyData = getCurrentRevolutionData()\n\n origin = cameraPt\n\n normal = np.cross(rightRay, leftRay)\n leftNormal = np.cross(normal, leftRay)\n rightNormal = np.cross(rightRay, normal)\n\n normal /= np.linalg.norm(normal)\n leftNormal /= np.linalg.norm(leftNormal)\n rightNormal /= np.linalg.norm(rightNormal)\n middleRay /= np.linalg.norm(middleRay)\n\n cropped, polyData = cropToPlane(polyData, origin, normal, sliceThreshold)\n\n updatePolyData(polyData, 'slice dist', parent=getDebugFolder(), colorByName='dist_to_plane', colorByRange=[-0.5, 0.5], visible=False)\n updatePolyData(cropped, 'slice', parent=getDebugFolder(), colorByName='dist_to_plane', visible=False)\n\n cropped, _ = cropToPlane(cropped, origin, leftNormal, [-1e6, 0])\n cropped, _ = cropToPlane(cropped, origin, rightNormal, [-1e6, 0])\n\n updatePolyData(cropped, 'slice segment', parent=getDebugFolder(), colorByName='dist_to_plane', visible=False)\n\n planePoints, planeNormal = applyPlaneFit(cropped, distanceThreshold=0.005, perpendicularAxis=middleRay, angleEpsilon=math.radians(60))\n planePoints = thresholdPoints(planePoints, 'dist_to_plane', [-0.005, 0.005])\n updatePolyData(planePoints, 'board segmentation', parent=getDebugFolder(), color=getRandomColor(), visible=False)\n\n '''\n names = ['board A', 'board B', 'board C', 'board D', 'board E', 'board F', 'board G', 'board H', 'board I']\n for name in names:\n if not om.findObjectByName(name):\n break\n else:\n name = 'board'\n '''\n name = 'board'\n\n segmentBlockByTopPlane(planePoints, blockDimensions, expectedNormal=-middleRay, expectedXAxis=middleRay, edgeSign=-1, name=name)", "metadata": "root.createLine", "header": "['module', '___EOS___']", "index": 876 }, { "content": "def updateBlockAffordances(polyData=None):\n\n for obj in om.getObjects():\n if isinstance(obj, BoxAffordanceItem):\n if 'refit' in obj.getProperty('Name'):\n om.removeFromObjectModel(obj)\n\n for obj in om.getObjects():\n if isinstance(obj, BoxAffordanceItem):\n updateBlockFit(obj, polyData)", "metadata": "root.updateBlockAffordances", "header": "['module', '___EOS___']", "index": 948 }, { "content": "def updateBlockFit(affordanceObj, polyData=None):\n\n affordanceObj.updateParamsFromActorTransform()\n\n name = affordanceObj.getProperty('Name') + ' refit'\n origin = affordanceObj.params['origin']\n normal = affordanceObj.params['yaxis']\n edgePerpAxis = affordanceObj.params['xaxis']\n blockDimensions = [affordanceObj.params['xwidth'], affordanceObj.params['ywidth']]\n\n if polyData is None:\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = shallowCopy(inputObj.polyData)\n\n cropThreshold = 0.1\n cropped = polyData\n cropped, _ = cropToPlane(cropped, origin, normal, [-cropThreshold, cropThreshold])\n cropped, _ = cropToPlane(cropped, origin, edgePerpAxis, [-cropThreshold, cropThreshold])\n\n updatePolyData(cropped, 'refit search region', parent=getDebugFolder(), visible=False)\n\n cropped = extractLargestCluster(cropped)\n\n planePoints, planeNormal = applyPlaneFit(cropped, distanceThreshold=0.005, perpendicularAxis=normal, angleEpsilon=math.radians(10))\n planePoints = thresholdPoints(planePoints, 'dist_to_plane', [-0.005, 0.005])\n updatePolyData(planePoints, 'refit board segmentation', parent=getDebugFolder(), visible=False)\n\n refitObj = segmentBlockByTopPlane(planePoints, blockDimensions, expectedNormal=normal, expectedXAxis=edgePerpAxis, edgeSign=-1, name=name)\n\n refitOrigin = np.array(refitObj.params['origin'])\n refitLength = refitObj.params['zwidth']\n refitZAxis = refitObj.params['zaxis']\n refitEndPoint1 = refitOrigin + refitZAxis*refitLength/2.0\n\n originalLength = affordanceObj.params['zwidth']\n correctedOrigin = refitEndPoint1 - refitZAxis*originalLength/2.0\n originDelta = correctedOrigin - refitOrigin\n\n refitObj.params['zwidth'] = originalLength\n refitObj.polyData.DeepCopy(affordanceObj.polyData)\n refitObj.actor.GetUserTransform().Translate(originDelta)\n refitObj.updateParamsFromActorTransform()", "metadata": "root.updateBlockFit", "header": "['module', '___EOS___']", "index": 960 }, { "content": "def startInteractiveLineDraw(blockDimensions):\n\n picker = LineDraw(app.getCurrentRenderView())\n addViewPicker(picker)\n picker.enabled = True\n picker.start()\n picker.annotationFunc = functools.partial(createLine, blockDimensions)", "metadata": "root.startInteractiveLineDraw", "header": "['module', '___EOS___']", "index": 1004 }, { "content": "def startLeverValveSegmentation():\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentLeverValve)", "metadata": "root.startLeverValveSegmentation", "header": "['module', '___EOS___']", "index": 1013 }, { "content": "def refitValveAffordance(aff, point1, origin, normal):\n\n xaxis = aff.params['xaxis']\n yaxis = aff.params['yaxis']\n zaxis = aff.params['zaxis']\n origin = aff.params['origin']\n\n zaxis = normal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n aff.actor.GetUserTransform().SetMatrix(t.GetMatrix())\n aff.updateParamsFromActorTransform()", "metadata": "root.refitValveAffordance", "header": "['module', '___EOS___']", "index": 1023 }, { "content": "def segmentValve(expectedValveRadius, point1, point2):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n\n polyData, _, wallNormal = applyPlaneFit(polyData, expectedNormal=viewPlaneNormal, searchOrigin=point1, searchRadius=0.2, angleEpsilon=0.7, returnOrigin=True)\n\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'wall points', parent=getDebugFolder(), visible=False)\n\n\n polyData, _, _ = applyPlaneFit(polyData, expectedNormal=wallNormal, searchOrigin=point2, searchRadius=expectedValveRadius, angleEpsilon=0.2, returnOrigin=True)\n valveCluster = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n valveCluster = cropToSphere(valveCluster, point2, expectedValveRadius*2)\n valveCluster = extractLargestCluster(valveCluster, minClusterSize=1)\n updatePolyData(valveCluster, 'valve cluster', parent=getDebugFolder(), visible=False)\n origin = np.average(vtkNumpy.getNumpyFromVtk(valveCluster, 'Points') , axis=0)\n\n zaxis = wallNormal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n zwidth = 0.03\n radius = expectedValveRadius\n\n\n d = DebugData()\n d.addLine(np.array([0,0,-zwidth/2.0]), np.array([0,0,zwidth/2.0]), radius=radius)\n\n name = 'valve affordance'\n obj = showPolyData(d.getPolyData(), name, cls=FrameAffordanceItem, parent='affordances', color=[0,1,0])\n obj.actor.SetUserTransform(t)\n obj.addToView(app.getDRCView())\n refitWallCallbacks.append(functools.partial(refitValveAffordance, obj))\n\n params = dict(axis=zaxis, radius=radius, length=zwidth, origin=origin, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis,\n xwidth=radius, ywidth=radius, zwidth=zwidth,\n otdf_type='steering_cyl', friendly_name='valve')\n\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()\n\n frameObj = showFrame(obj.actor.GetUserTransform(), name + ' frame', parent=obj, scale=radius, visible=False)\n frameObj.addToView(app.getDRCView())", "metadata": "root.segmentValve", "header": "['module', '___EOS___']", "index": 1044 }, { "content": "def segmentValveByBoundingBox(polyData, searchPoint):\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n\n polyData = cropToSphere(polyData, searchPoint, radius=0.6)\n polyData = applyVoxelGrid(polyData, leafSize=0.015)\n\n # extract tube search region\n polyData = labelDistanceToLine(polyData, searchPoint, np.array(searchPoint) + np.array([0,0,1]))\n searchRegion = thresholdPoints(polyData, 'distance_to_line', [0.0, 0.2])\n updatePolyData(searchRegion, 'valve tube search region', parent=getDebugFolder(), color=[1,0,0], visible=False)\n\n # guess valve plane\n _, origin, normal = applyPlaneFit(searchRegion, distanceThreshold=0.01, perpendicularAxis=viewDirection, angleEpsilon=math.radians(30), expectedNormal=-viewDirection, returnOrigin=True)\n\n # extract plane search region\n polyData = labelPointDistanceAlongAxis(polyData, normal, origin)\n searchRegion = thresholdPoints(polyData, 'distance_along_axis', [-0.05, 0.05])\n updatePolyData(searchRegion, 'valve plane search region', parent=getDebugFolder(), colorByName='distance_along_axis', visible=False)\n\n\n valvePoints = extractLargestCluster(searchRegion, minClusterSize=1)\n updatePolyData(valvePoints, 'valve cluster', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n\n valvePoints, _ = applyPlaneFit(valvePoints, expectedNormal=normal, perpendicularAxis=normal, distanceThreshold=0.01)\n valveFit = thresholdPoints(valvePoints, 'dist_to_plane', [-0.01, 0.01])\n\n updatePolyData(valveFit, 'valve cluster', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n points = vtkNumpy.getNumpyFromVtk(valveFit, 'Points')\n zvalues = points[:,2].copy()\n minZ = np.min(zvalues)\n maxZ = np.max(zvalues)\n\n tubeRadius = 0.017\n radius = float((maxZ - minZ) / 2.0) - tubeRadius\n\n fields = makePolyDataFields(valveFit)\n origin = np.array(fields.frame.GetPosition())\n\n #origin = computeCentroid(valveFit)\n\n zaxis = [0,0,1]\n xaxis = normal\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n pose = transformUtils.poseFromTransform(t)\n desc = dict(classname='CapsuleRingAffordanceItem', Name='valve', uuid=newUUID(), pose=pose, Color=[0,1,0], Radius=radius, Segments=20)\n desc['Tube Radius'] = tubeRadius\n\n obj = affordanceManager.newAffordanceFromDescription(desc)\n obj.params = dict(radius=radius)\n\n return obj", "metadata": "root.segmentValveByBoundingBox", "header": "['module', '___EOS___']", "index": 1099 }, { "content": "def segmentDoorPlane(polyData, doorPoint, stanceFrame):\n\n doorPoint = np.array(doorPoint)\n doorBand = 1.5\n\n polyData = cropToLineSegment(polyData, doorPoint + [0.0,0.0,doorBand/2], doorPoint - [0.0,0.0,doorBand/2])\n fitPoints, normal = applyLocalPlaneFit(polyData, doorPoint, searchRadius=0.2, searchRadiusEnd=1.0, removeGroundFirst=False)\n\n updatePolyData(fitPoints, 'door points', visible=False, color=[0,1,0])\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n if np.dot(normal, viewDirection) > 0:\n normal = -normal\n\n origin = computeCentroid(fitPoints)\n groundHeight = stanceFrame.GetPosition()[2]\n origin = [origin[0], origin[1], groundHeight]\n\n xaxis = -normal\n zaxis = [0,0,1]\n\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n return t", "metadata": "root.segmentDoorPlane", "header": "['module', '___EOS___']", "index": 1163 }, { "content": "def segmentValveByRim(polyData, rimPoint1, rimPoint2):\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n\n yaxis = np.array(rimPoint2) - np.array(rimPoint1)\n zaxis = [0,0,1]\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n\n # flip xaxis to be with view direction\n if np.dot(xaxis, viewDirection) < 0:\n xaxis = -xaxis\n\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n\n origin = (np.array(rimPoint2) + np.array(rimPoint1)) / 2.0\n\n polyData = labelPointDistanceAlongAxis(polyData, xaxis, origin)\n polyData = thresholdPoints(polyData, 'distance_along_axis', [-0.05, 0.05])\n updatePolyData(polyData, 'valve plane region', parent=getDebugFolder(), colorByName='distance_along_axis', visible=False)\n\n\n polyData = cropToSphere(polyData, origin, radius=0.4)\n polyData = applyVoxelGrid(polyData, leafSize=0.015)\n\n updatePolyData(polyData, 'valve search region', parent=getDebugFolder(), color=[1,0,0], visible=False)\n\n\n valveFit = extractLargestCluster(polyData, minClusterSize=1)\n updatePolyData(valveFit, 'valve cluster', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n points = vtkNumpy.getNumpyFromVtk(valveFit, 'Points')\n zvalues = points[:,2].copy()\n minZ = np.min(zvalues)\n maxZ = np.max(zvalues)\n\n tubeRadius = 0.017\n radius = float((maxZ - minZ) / 2.0) - tubeRadius\n\n fields = makePolyDataFields(valveFit)\n origin = np.array(fields.frame.GetPosition())\n vis.updatePolyData(transformPolyData(fields.box, fields.frame), 'valve cluster bounding box', visible=False)\n\n #origin = computeCentroid(valveFit)\n\n '''\n zaxis = [0,0,1]\n xaxis = normal\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n '''\n\n radius = np.max(fields.dims)/2.0 - tubeRadius\n\n\n proj = [np.abs(np.dot(xaxis, axis)) for axis in fields.axes]\n xaxisNew = fields.axes[np.argmax(proj)]\n if np.dot(xaxisNew, xaxis) < 0:\n xaxisNew = -xaxisNew\n\n xaxis = xaxisNew\n\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n pose = transformUtils.poseFromTransform(t)\n desc = dict(classname='CapsuleRingAffordanceItem', Name='valve', uuid=newUUID(), pose=pose, Color=[0,1,0], Radius=float(radius), Segments=20)\n desc['Tube Radius'] = tubeRadius\n\n obj = affordanceManager.newAffordanceFromDescription(desc)\n obj.params = dict(radius=radius)\n\n return obj", "metadata": "root.segmentValveByRim", "header": "['module', '___EOS___']", "index": 1196 }, { "content": "def segmentValveByWallPlane(expectedValveRadius, point1, point2):\n\n\n centerPoint = (point1 + point2) / 2.0\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n _ , polyData = removeGround(polyData)\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=-viewDirection, returnOrigin=True)\n\n\n perpLine = np.cross(point2 - point1, normal)\n #perpLine /= np.linalg.norm(perpLine)\n #perpLine * np.linalg.norm(point2 - point1)/2.0\n point3, point4 = centerPoint + perpLine/2.0, centerPoint - perpLine/2.0\n\n d = DebugData()\n d.addLine(point1, point2)\n d.addLine(point3, point4)\n updatePolyData(d.getPolyData(), 'crop lines', parent=getDebugFolder(), visible=False)\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'valve wall', parent=getDebugFolder(), visible=False)\n\n searchRegion = thresholdPoints(polyData, 'dist_to_plane', [0.05, 0.5])\n searchRegion = cropToLineSegment(searchRegion, point1, point2)\n searchRegion = cropToLineSegment(searchRegion, point3, point4)\n\n updatePolyData(searchRegion, 'valve search region', parent=getDebugFolder(), color=[1,0,0], visible=False)\n\n searchRegionSpokes = shallowCopy(searchRegion)\n\n searchRegion, origin, _ = applyPlaneFit(searchRegion, expectedNormal=normal, perpendicularAxis=normal, returnOrigin=True)\n searchRegion = thresholdPoints(searchRegion, 'dist_to_plane', [-0.015, 0.015])\n\n updatePolyData(searchRegion, 'valve search region 2', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n\n largestCluster = extractLargestCluster(searchRegion, minClusterSize=1)\n\n updatePolyData(largestCluster, 'valve cluster', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n\n radiusLimit = [expectedValveRadius - 0.01, expectedValveRadius + 0.01] if expectedValveRadius else None\n #radiusLimit = None\n\n polyData, circleFit = extractCircle(largestCluster, distanceThreshold=0.01, radiusLimit=radiusLimit)\n updatePolyData(polyData, 'circle fit', parent=getDebugFolder(), visible=False)\n\n\n #polyData, circleFit = extractCircle(polyData, distanceThreshold=0.01)\n #showPolyData(polyData, 'circle fit', colorByName='z')\n\n\n radius = circleFit.GetCircleRadius()\n origin = np.array(circleFit.GetCircleOrigin())\n circleNormal = np.array(circleFit.GetCircleNormal())\n circleNormal = circleNormal/np.linalg.norm(circleNormal)\n\n if np.dot(circleNormal, normal) < 0:\n circleNormal *= -1\n\n # force use of the plane normal\n circleNormal = normal\n radius = expectedValveRadius\n\n d = DebugData()\n d.addLine(origin - normal*radius, origin + normal*radius)\n d.addCircle(origin, circleNormal, radius)\n updatePolyData(d.getPolyData(), 'valve axes', parent=getDebugFolder(), visible=False)\n\n\n zaxis = -circleNormal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n #t = getTransformFromAxes(xaxis, yaxis, zaxis) # this was added to be consistent with segmentValveByRim\n t = getTransformFromAxes(zaxis, -yaxis, xaxis) # this was added to be consistent with segmentValveByRim\n t.PostMultiply()\n t.Translate(origin)\n\n\n # Spoke angle fitting:\n if (1==0): # disabled jan 2015\n # extract the relative positon of the points to the valve axis:\n searchRegionSpokes = labelDistanceToLine(searchRegionSpokes, origin, [origin + circleNormal])\n searchRegionSpokes = thresholdPoints(searchRegionSpokes, 'distance_to_line', [0.05, radius-0.04])\n updatePolyData(searchRegionSpokes, 'valve spoke search', parent=getDebugFolder(), visible=False)\n searchRegionSpokesLocal = transformPolyData(searchRegionSpokes, t.GetLinearInverse() )\n points = vtkNumpy.getNumpyFromVtk(searchRegionSpokesLocal , 'Points')\n\n spoke_angle = findValveSpokeAngle(points)\n else:\n spoke_angle = 0\n\n spokeAngleTransform = transformUtils.frameFromPositionAndRPY([0,0,0], [0,0,spoke_angle])\n spokeTransform = transformUtils.copyFrame(t)\n spokeAngleTransform.Concatenate(spokeTransform)\n spokeObj = showFrame(spokeAngleTransform, 'spoke frame', parent=getDebugFolder(), visible=False, scale=radius)\n spokeObj.addToView(app.getDRCView())\n t = spokeAngleTransform\n\n tubeRadius = 0.017\n\n pose = transformUtils.poseFromTransform(t)\n desc = dict(classname='CapsuleRingAffordanceItem', Name='valve', uuid=newUUID(), pose=pose, Color=[0,1,0], Radius=float(radius), Segments=20)\n desc['Tube Radius'] = tubeRadius\n\n obj = affordanceManager.newAffordanceFromDescription(desc)\n obj.params = dict(radius=radius)", "metadata": "root.segmentValveByWallPlane", "header": "['module', '___EOS___']", "index": 1281 }, { "content": "def showHistogram(polyData, arrayName, numberOfBins=100):\n\n import matplotlib.pyplot as plt\n\n x = vnp.getNumpyFromVtk(polyData, arrayName)\n hist, bins = np.histogram(x, bins=numberOfBins)\n width = 0.7 * (bins[1] - bins[0])\n center = (bins[:-1] + bins[1:]) / 2\n plt.bar(center, hist, align='center', width=width)\n plt.show()\n\n return bins[np.argmax(hist)] + (bins[1] - bins[0])/2.0", "metadata": "root.showHistogram", "header": "['module', '___EOS___']", "index": 1400 }, { "content": "def showTable(table, parent):\n '''\n explictly draw a table and its frames\n '''\n pose = transformUtils.poseFromTransform(table.frame)\n desc = dict(classname='MeshAffordanceItem', Name='table', Color=[0,1,0], pose=pose)\n aff = affordanceManager.newAffordanceFromDescription(desc)\n aff.setPolyData(table.mesh)\n\n tableBox = vis.showPolyData(table.box, 'table box', parent=aff, color=[0,1,0], visible=False)\n tableBox.actor.SetUserTransform(table.frame)", "metadata": "root.showTable", "header": "['module', '___EOS___']", "index": 1414 }, { "content": "def applyKmeansLabel(polyData, arrayName, numberOfClusters, whiten=False):\n\n import scipy.cluster\n ar = vnp.getNumpyFromVtk(polyData, arrayName).copy()\n\n if whiten:\n scipy.cluster.vq.whiten(ar)\n\n codes, disturbances = scipy.cluster.vq.kmeans(ar, numberOfClusters)\n\n if arrayName == 'normals' and numberOfClusters == 2:\n v1 = codes[0]\n v2 = codes[1]\n v1 /= np.linalg.norm(v1)\n v2 /= np.linalg.norm(v2)\n angle = np.arccos(np.dot(v1, v2))\n print 'angle between normals:', np.degrees(angle)\n\n code, distance = scipy.cluster.vq.vq(ar, codes)\n\n polyData = shallowCopy(polyData)\n vnp.addNumpyToVtk(polyData, code, '%s_kmeans_label' % arrayName)\n return polyData", "metadata": "root.applyKmeansLabel", "header": "['module', '___EOS___']", "index": 1427 }, { "content": "def findValveSpokeAngle(points):\n '''\n Determine the location of the valve spoke angle\n By binning the spoke returns. returns angle in degrees\n '''\n\n #np.savetxt(\"/home/mfallon/Desktop/spoke_points.csv\", points, delimiter=\",\")\n\n\n # convert all points to degrees in range [0,120]\n angle = np.degrees( np.arctan2( points[:,1] , points[:,0] ) )\n qq = np.where(angle < 0)[0]\n angle[qq] += 360\n angle = np.mod( angle, 120)\n\n # find the spoke as the max of a histogram:\n bins = range(0,130,10) # 0,10,...130\n freq, bins = np.histogram(angle, bins)\n amax = np.argmax(freq)\n spoke_angle = bins[amax] + 5 # correct for 5deg offset\n\n return spoke_angle", "metadata": "root.findValveSpokeAngle", "header": "['module', '___EOS___']", "index": 1452 }, { "content": "def findWallCenter(polyData, removeGroundMethod=removeGround):\n '''\n Find a frame at the center of the valve wall\n X&Y: average of points on the wall plane\n Z: 4 feet off the ground (determined using robot's feet\n Orientation: z-normal into plane, y-axis horizontal\n '''\n\n _ , polyData = removeGroundMethod(polyData)\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=-viewDirection, returnOrigin=True)\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n wallPoints = applyVoxelGrid(wallPoints, leafSize=0.03)\n wallPoints = extractLargestCluster(wallPoints, minClusterSize=100)\n\n updatePolyData(wallPoints, 'auto valve wall', parent=getDebugFolder(), visible=False)\n\n xvalues = vtkNumpy.getNumpyFromVtk(wallPoints, 'Points')[:,0]\n yvalues = vtkNumpy.getNumpyFromVtk(wallPoints, 'Points')[:,1]\n\n # median or mid of max or min?\n #xcenter = np.median(xvalues)\n #ycenter = np.median(yvalues)\n xcenter = (np.max(xvalues)+np.min(xvalues))/2\n ycenter = (np.max(yvalues)+np.min(yvalues))/2\n\n # not used, not very reliable\n #zvalues = vtkNumpy.getNumpyFromVtk(wallPoints, 'Points')[:,2]\n #zcenter = np.median(zvalues)\n zcenter = SegmentationContext.getGlobalInstance().getGroundHeight() + 1.2192 # valves are 4ft from ground\n point1 =np.array([ xcenter, ycenter, zcenter ]) # center of the valve wall\n\n zaxis = -normal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(point1)\n\n normalObj = showFrame(t, 'valve wall frame', parent=getDebugFolder(), visible=False) # z direction out of wall\n normalObj.addToView(app.getDRCView())\n\n return t", "metadata": "root.findWallCenter", "header": "['module', '___EOS___']", "index": 1477 }, { "content": "def segmentValveWallAuto(expectedValveRadius=.195, mode='both', removeGroundMethod=removeGround ):\n '''\n Automatically segment a valve hanging in front of the wall at the center\n '''\n\n # find the valve wall and its center\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n t = findWallCenter(polyData, removeGroundMethod)\n\n valve_point1 = [ 0 , 0.6 , 0]\n valveTransform1 = transformUtils.frameFromPositionAndRPY(valve_point1, [0,0,0])\n valveTransform1.Concatenate(t)\n point1 = np.array(valveTransform1.GetPosition()) # left of wall\n\n valve_point2 = [ 0 , -0.6 , 0]\n valveTransform2 = transformUtils.frameFromPositionAndRPY(valve_point2, [0,0,0])\n valveTransform2.Concatenate(t)\n point2 = np.array(valveTransform2.GetPosition()) # left of wall\n\n valve_point3 = [ 0 , 1.0 , 0] # lever can over hang\n valveTransform3 = transformUtils.frameFromPositionAndRPY(valve_point3, [0,0,0])\n valveTransform3.Concatenate(t)\n point3 =valveTransform3.GetPosition() # right of wall\n\n\n d = DebugData()\n d.addSphere(point2, radius=0.01)\n d.addSphere(point1, radius=0.03)\n d.addSphere(point3, radius=0.01)\n updatePolyData(d.getPolyData(), 'auto wall points', parent=getDebugFolder(), visible=False)\n\n if (mode=='valve'):\n segmentValveByWallPlane(expectedValveRadius, point1, point2)\n elif (mode=='lever'):\n segmentLeverByWallPlane(point1, point3)\n elif (mode=='both'):\n segmentValveByWallPlane(expectedValveRadius, point1, point2)\n segmentLeverByWallPlane(point1, point3)\n else:\n raise Exception('unexpected segmentation mode: ' + mode)", "metadata": "root.segmentValveWallAuto", "header": "['module', '___EOS___']", "index": 1527 }, { "content": "def segmentLeverByWallPlane(point1, point2):\n '''\n determine the position (including rotation of a lever near a wall\n input is as for the valve - to points on the wall either side of the lever\n '''\n\n # 1. determine the wall plane and normal\n centerPoint = (point1 + point2) / 2.0\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=-viewDirection, returnOrigin=True)\n\n # 2. Crop the cloud down to the lever only using the wall plane\n perpLine = np.cross(point2 - point1, -normal)\n #perpLine /= np.linalg.norm(perpLine)\n #perpLine * np.linalg.norm(point2 - point1)/2.0\n point3, point4 = centerPoint + perpLine/2.0, centerPoint - perpLine/2.0\n\n d = DebugData()\n d.addLine(point1, point2)\n d.addLine(point3, point4)\n updatePolyData(d.getPolyData(), 'lever crop lines', parent=getDebugFolder(), visible=False)\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'lever valve wall', parent=getDebugFolder(), visible=False)\n\n searchRegion = thresholdPoints(polyData, 'dist_to_plane', [0.12, 0.2]) # very tight threshold\n searchRegion = cropToLineSegment(searchRegion, point1, point2)\n searchRegion = cropToLineSegment(searchRegion, point3, point4)\n updatePolyData(searchRegion, 'lever search region', parent=getDebugFolder(), color=[1,0,0], visible=False)\n\n\n # 3. fit line to remaining points - all assumed to be the lever\n linePoint, lineDirection, _ = applyLineFit(searchRegion, distanceThreshold=0.02)\n #if np.dot(lineDirection, forwardDirection) < 0:\n # lineDirection = -lineDirection\n\n d = DebugData()\n d.addSphere(linePoint, radius=0.02)\n updatePolyData(d.getPolyData(), 'lever point', parent=getDebugFolder(), visible=False)\n\n pts = vtkNumpy.getNumpyFromVtk(searchRegion, 'Points')\n dists = np.dot(pts-linePoint, lineDirection)\n lever_center = linePoint + lineDirection*np.min(dists)\n lever_tip = linePoint + lineDirection*np.max(dists)\n\n\n # 4. determine which lever point is closest to the lower left of the wall. That's the lever_center point\n zaxis = -normal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(point1)\n\n # a distant point down and left from wall\n wall_point_lower_left = [ -20 , -20.0 , 0]\n wall_point_lower_left_Transform = transformUtils.frameFromPositionAndRPY(wall_point_lower_left, [0,0,0])\n wall_point_lower_left_Transform.Concatenate(t)\n wall_point_lower_left = wall_point_lower_left_Transform.GetPosition()\n d1 = np.sqrt( np.sum((wall_point_lower_left- projectPointToPlane(lever_center, origin, normal) )**2) )\n d2 = np.sqrt( np.sum((wall_point_lower_left- projectPointToPlane(lever_tip, origin, normal) )**2) )\n\n if (d2 < d1): # flip the points to match variable names\n p_temp = lever_center\n lever_center = lever_tip\n lever_tip = p_temp\n lineDirection = -lineDirection\n\n\n # 5. compute the rotation angle of the lever and, using that, its frame\n zaxis = -normal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(lever_center) # nominal frame at lever center\n\n rotationAngle = -computeSignedAngleBetweenVectors(lineDirection, [0, 0, 1], -normal)\n t_lever = transformUtils.frameFromPositionAndRPY( [0,0,0], [0,0, math.degrees( rotationAngle ) ] )\n t_lever.PostMultiply()\n t_lever.Concatenate(t)\n\n\n d = DebugData()\n # d.addSphere( point1 , radius=0.1)\n d.addSphere( wall_point_lower_left , radius=0.1)\n d.addSphere(lever_center, radius=0.04)\n d.addSphere(lever_tip, radius=0.01)\n d.addLine(lever_center, lever_tip)\n updatePolyData(d.getPolyData(), 'lever end points', color=[0,1,0], parent=getDebugFolder(), visible=False)\n\n\n radius = 0.01\n length = np.sqrt( np.sum((lever_tip - lever_center )**2) )\n\n d = DebugData()\n d.addLine([0,0,0], [length, 0, 0], radius=radius)\n d.addSphere ( [0, 0, 0], 0.02)\n geometry = d.getPolyData()\n\n obj = showPolyData(geometry, 'valve lever', cls=FrameAffordanceItem, parent='affordances' , color=[0,1,0], visible=True)\n obj.actor.SetUserTransform(t_lever)\n obj.addToView(app.getDRCView())\n frameObj = showFrame(t_lever, 'lever frame', parent=obj, visible=False)\n frameObj.addToView(app.getDRCView())\n\n otdfType = 'lever_valve'\n params = dict(origin=np.array(t_lever.GetPosition()), xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1, radius=radius, length=length, friendly_name=otdfType, otdf_type=otdfType)\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()", "metadata": "root.segmentLeverByWallPlane", "header": "['module', '___EOS___']", "index": 1572 }, { "content": "def applyICP(source, target):\n\n icp = vtk.vtkIterativeClosestPointTransform()\n icp.SetSource(source)\n icp.SetTarget(target)\n icp.GetLandmarkTransform().SetModeToRigidBody()\n icp.Update()\n t = vtk.vtkTransform()\n t.SetMatrix(icp.GetMatrix())\n return t", "metadata": "root.applyICP", "header": "['module', '___EOS___']", "index": 1695 }, { "content": "def applyDiskGlyphs(polyData, computeNormals=True):\n\n voxelGridLeafSize = 0.03\n normalEstimationSearchRadius = 0.05\n diskRadius = 0.015\n diskResolution = 12\n\n if computeNormals:\n scanInput = polyData\n\n pd = applyVoxelGrid(scanInput, leafSize=voxelGridLeafSize)\n\n pd = labelOutliers(pd, searchRadius=normalEstimationSearchRadius, neighborsInSearchRadius=3)\n pd = thresholdPoints(pd, 'is_outlier', [0, 0])\n\n pd = normalEstimation(pd, searchRadius=normalEstimationSearchRadius, searchCloud=scanInput)\n else:\n pd = polyData\n\n assert polyData.GetPointData().GetNormals()\n\n disk = vtk.vtkDiskSource()\n disk.SetOuterRadius(diskRadius)\n disk.SetInnerRadius(0.0)\n disk.SetRadialResolution(0)\n disk.SetCircumferentialResolution(diskResolution)\n disk.Update()\n\n t = vtk.vtkTransform()\n t.RotateY(90)\n disk = transformPolyData(disk.GetOutput(), t)\n\n glyph = vtk.vtkGlyph3D()\n glyph.ScalingOff()\n glyph.OrientOn()\n glyph.SetSource(disk)\n glyph.SetInput(pd)\n glyph.SetVectorModeToUseNormal()\n glyph.Update()\n\n return shallowCopy(glyph.GetOutput())", "metadata": "root.applyDiskGlyphs", "header": "['module', '___EOS___']", "index": 1707 }, { "content": "def applyArrowGlyphs(polyData, computeNormals=True, voxelGridLeafSize=0.03, normalEstimationSearchRadius=0.05, arrowSize=0.02):\n\n if computeNormals:\n polyData = applyVoxelGrid(polyData, leafSize=0.02)\n voxelData = applyVoxelGrid(polyData, leafSize=voxelGridLeafSize)\n polyData = normalEstimation(polyData, searchRadius=normalEstimationSearchRadius, searchCloud=voxelData)\n polyData = removeNonFinitePoints(polyData, 'normals')\n flipNormalsWithViewDirection(polyData, SegmentationContext.getGlobalInstance().getViewDirection())\n\n assert polyData.GetPointData().GetNormals()\n\n arrow = vtk.vtkArrowSource()\n arrow.Update()\n\n glyph = vtk.vtkGlyph3D()\n glyph.SetScaleFactor(arrowSize)\n glyph.SetSource(arrow.GetOutput())\n glyph.SetInput(polyData)\n glyph.SetVectorModeToUseNormal()\n glyph.Update()\n\n return shallowCopy(glyph.GetOutput())", "metadata": "root.applyArrowGlyphs", "header": "['module', '___EOS___']", "index": 1750 }, { "content": "def segmentLeverValve(point1, point2):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=viewPlaneNormal, searchOrigin=point1, searchRadius=0.2, angleEpsilon=0.7, returnOrigin=True)\n\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'wall points', parent=getDebugFolder(), visible=False)\n\n radius = 0.01\n length = 0.33\n\n normal = -normal # set z to face into wall\n zaxis = normal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(point2)\n\n leverP1 = point2\n leverP2 = point2 + xaxis * length\n d = DebugData()\n d.addLine([0,0,0], [length, 0, 0], radius=radius)\n d.addSphere ( [0, 0, 0], 0.02)\n geometry = d.getPolyData()\n\n\n obj = showPolyData(geometry, 'valve lever', cls=FrameAffordanceItem, parent='affordances', color=[0,1,0], visible=True)\n obj.actor.SetUserTransform(t)\n obj.addToView(app.getDRCView())\n frameObj = showFrame(t, 'lever frame', parent=obj, visible=False)\n frameObj.addToView(app.getDRCView())\n\n otdfType = 'lever_valve'\n params = dict(origin=np.array(t.GetPosition()), xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1, radius=radius, length=length, friendly_name=otdfType, otdf_type=otdfType)\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()", "metadata": "root.segmentLeverValve", "header": "['module', '___EOS___']", "index": 1774 }, { "content": "def segmentWye(point1, point2):\n\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=viewPlaneNormal, searchOrigin=point1, searchRadius=0.2, angleEpsilon=0.7, returnOrigin=True)\n\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'wall points', parent=getDebugFolder(), visible=False)\n\n wyeMesh = ioUtils.readPolyData(os.path.join(app.getDRCBase(), 'software/models/otdf/wye.obj'))\n\n wyeMeshPoint = np.array([0.0, 0.0, 0.005])\n wyeMeshLeftHandle = np.array([0.032292, 0.02949, 0.068485])\n\n xaxis = -normal\n zaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PreMultiply()\n t.Translate(-wyeMeshPoint)\n t.PostMultiply()\n t.Translate(point2)\n\n d = DebugData()\n d.addSphere(point2, radius=0.005)\n updatePolyData(d.getPolyData(), 'wye pick point', parent=getDebugFolder(), visible=False)\n\n wyeObj = showPolyData(wyeMesh, 'wye', cls=FrameAffordanceItem, color=[0,1,0], visible=True)\n wyeObj.actor.SetUserTransform(t)\n wyeObj.addToView(app.getDRCView())\n frameObj = showFrame(t, 'wye frame', parent=wyeObj, visible=False)\n frameObj.addToView(app.getDRCView())\n\n params = dict(origin=np.array(t.GetPosition()), xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1, friendly_name='wye', otdf_type='wye')\n wyeObj.setAffordanceParams(params)\n wyeObj.updateParamsFromActorTransform()", "metadata": "root.segmentWye", "header": "['module', '___EOS___']", "index": 1820 }, { "content": "def segmentDoorHandle(otdfType, point1, point2):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=viewPlaneNormal, searchOrigin=point1, searchRadius=0.2, angleEpsilon=0.7, returnOrigin=True)\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'wall points', parent=getDebugFolder(), visible=False)\n\n handlePoint = np.array([0.005, 0.065, 0.011])\n\n xaxis = -normal\n zaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n\n xwidth = 0.01\n ywidth = 0.13\n zwidth = 0.022\n cube = vtk.vtkCubeSource()\n cube.SetXLength(xwidth)\n cube.SetYLength(ywidth)\n cube.SetZLength(zwidth)\n cube.Update()\n cube = shallowCopy(cube.GetOutput())\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n #t.PreMultiply()\n #t.Translate(-handlePoint)\n t.PostMultiply()\n t.Translate(point2)\n\n name = 'door handle'\n obj = showPolyData(cube, name, cls=FrameAffordanceItem, parent='affordances')\n obj.actor.SetUserTransform(t)\n obj.addToView(app.getDRCView())\n\n params = dict(origin=origin, xwidth=xwidth, ywidth=ywidth, zwidth=zwidth, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, friendly_name=name, otdf_type=otdfType)\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()\n\n frameObj = showFrame(obj.actor.GetUserTransform(), name + ' frame', parent=obj, visible=False)\n frameObj.addToView(app.getDRCView())", "metadata": "root.segmentDoorHandle", "header": "['module', '___EOS___']", "index": 1866 }, { "content": "def segmentTruss(point1, point2):\n\n\n\n edge = point2 - point1\n edgeLength = np.linalg.norm(edge)\n\n stanceOffset = [-0.42, 0.0, 0.0]\n stanceYaw = 0.0\n\n\n d = DebugData()\n p1 = [0.0, 0.0, 0.0]\n p2 = -np.array([0.0, -1.0, 0.0]) * edgeLength\n d.addSphere(p1, radius=0.02)\n d.addSphere(p2, radius=0.02)\n d.addLine(p1, p2)\n\n stanceTransform = vtk.vtkTransform()\n stanceTransform.PostMultiply()\n stanceTransform.Translate(stanceOffset)\n #stanceTransform.RotateZ(stanceYaw)\n\n geometry = transformPolyData(d.getPolyData(), stanceTransform.GetLinearInverse())\n\n yaxis = edge/edgeLength\n zaxis = [0.0, 0.0, 1.0]\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n\n\n xwidth = 0.1\n ywidth = edgeLength\n zwidth = 0.1\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PreMultiply()\n t.Concatenate(stanceTransform)\n t.PostMultiply()\n t.Translate(point1)\n\n name = 'truss'\n otdfType = 'robot_knees'\n obj = showPolyData(geometry, name, cls=FrameAffordanceItem, parent='affordances')\n obj.actor.SetUserTransform(t)\n obj.addToView(app.getDRCView())\n\n params = dict(origin=t.GetPosition(), xwidth=xwidth, ywidth=ywidth, zwidth=zwidth, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, friendly_name=name, otdf_type=otdfType)\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()\n\n frameObj = showFrame(obj.actor.GetUserTransform(), name + ' frame', parent=obj, visible=False)\n frameObj.addToView(app.getDRCView())", "metadata": "root.segmentTruss", "header": "['module', '___EOS___']", "index": 1915 }, { "content": "def segmentHoseNozzle(point1):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n searchRegion = cropToSphere(polyData, point1, 0.10)\n updatePolyData(searchRegion, 'nozzle search region', parent=getDebugFolder(), visible=False)\n\n xaxis = [1,0,0]\n yaxis = [0,-1,0]\n zaxis = [0,0,-1]\n origin = point1\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(point1)\n\n nozzleRadius = 0.0266\n nozzleLength = 0.042\n nozzleTipRadius = 0.031\n nozzleTipLength = 0.024\n\n\n d = DebugData()\n d.addLine(np.array([0,0,-nozzleLength/2.0]), np.array([0,0,nozzleLength/2.0]), radius=nozzleRadius)\n d.addLine(np.array([0,0,nozzleLength/2.0]), np.array([0,0,nozzleLength/2.0 + nozzleTipLength]), radius=nozzleTipRadius)\n\n obj = showPolyData(d.getPolyData(), 'hose nozzle', cls=FrameAffordanceItem, color=[0,1,0], visible=True)\n obj.actor.SetUserTransform(t)\n obj.addToView(app.getDRCView())\n frameObj = showFrame(t, 'nozzle frame', parent=obj, visible=False)\n frameObj.addToView(app.getDRCView())\n\n params = dict(origin=origin, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1, friendly_name='firehose', otdf_type='firehose')\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()", "metadata": "root.segmentHoseNozzle", "header": "['module', '___EOS___']", "index": 1972 }, { "content": "def segmentDrillWall(point1, point2, point3):\n\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n\n\n points = [point1, point2, point3]\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n expectedNormal = np.cross(point2 - point1, point3 - point1)\n expectedNormal /= np.linalg.norm(expectedNormal)\n if np.dot(expectedNormal, viewPlaneNormal) < 0:\n expectedNormal *= -1.0\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=expectedNormal, searchOrigin=(point1 + point2 + point3)/3.0, searchRadius=0.3, angleEpsilon=0.3, returnOrigin=True)\n\n points = [projectPointToPlane(point, origin, normal) for point in points]\n\n xaxis = -normal\n zaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(points[0])\n\n d = DebugData()\n pointsInWallFrame = []\n for p in points:\n pp = np.zeros(3)\n t.GetLinearInverse().TransformPoint(p, pp)\n pointsInWallFrame.append(pp)\n d.addSphere(pp, radius=0.02)\n\n for a, b in zip(pointsInWallFrame, pointsInWallFrame[1:] + [pointsInWallFrame[0]]):\n d.addLine(a, b, radius=0.015)\n\n aff = showPolyData(d.getPolyData(), 'drill target', cls=FrameAffordanceItem, color=[0,1,0], visible=True)\n aff.actor.SetUserTransform(t)\n showFrame(t, 'drill target frame', parent=aff, visible=False)\n refitWallCallbacks.append(functools.partial(refitDrillWall, aff))\n\n params = dict(origin=points[0], xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1,\n p1y=pointsInWallFrame[0][1], p1z=pointsInWallFrame[0][2],\n p2y=pointsInWallFrame[1][1], p2z=pointsInWallFrame[1][2],\n p3y=pointsInWallFrame[2][1], p3z=pointsInWallFrame[2][2],\n friendly_name='drill_wall', otdf_type='drill_wall')\n\n aff.setAffordanceParams(params)\n aff.updateParamsFromActorTransform()\n aff.addToView(app.getDRCView())", "metadata": "root.segmentDrillWall", "header": "['module', '___EOS___']", "index": 2010 }, { "content": "def refitWall(point1):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=viewPlaneNormal, searchOrigin=point1, searchRadius=0.2, angleEpsilon=0.7, returnOrigin=True)\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'wall points', parent=getDebugFolder(), visible=False)\n\n for func in refitWallCallbacks:\n func(point1, origin, normal)", "metadata": "root.refitWall", "header": "['module', '___EOS___']", "index": 2070 }, { "content": "def refitDrillWall(aff, point1, origin, normal):\n\n t = aff.actor.GetUserTransform()\n\n targetOrigin = np.array(t.GetPosition())\n\n projectedOrigin = projectPointToPlane(targetOrigin, origin, normal)\n projectedOrigin[2] = targetOrigin[2]\n\n xaxis = -normal\n zaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(projectedOrigin)\n aff.actor.GetUserTransform().SetMatrix(t.GetMatrix())", "metadata": "root.refitDrillWall", "header": "['module', '___EOS___']", "index": 2086 }, { "content": "def getGroundHeightFromFeet():\n rfoot = getLinkFrame( drcargs.getDirectorConfig()['rightFootLink'] )\n return np.array(rfoot.GetPosition())[2] - 0.0745342", "metadata": "root.getGroundHeightFromFeet", "header": "['module', '___EOS___']", "index": 2108 }, { "content": "def getTranslationRelativeToFoot(t):\n rfoot = getLinkFrame( drcargs.getDirectorConfig()['rightFootLink'] )", "metadata": "root.getTranslationRelativeToFoot", "header": "['module', '___EOS___']", "index": 2113 }, { "content": "def segmentDrillWallConstrained(rightAngleLocation, point1, point2):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n expectedNormal = np.cross(point2 - point1, [0.0, 0.0, 1.0])\n expectedNormal /= np.linalg.norm(expectedNormal)\n if np.dot(expectedNormal, viewPlaneNormal) < 0:\n expectedNormal *= -1.0\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=expectedNormal, searchOrigin=point1, searchRadius=0.3, angleEpsilon=0.3, returnOrigin=True)\n\n triangleOrigin = projectPointToPlane(point2, origin, normal)\n\n xaxis = -normal\n zaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(triangleOrigin)\n\n createDrillWall(rightAngleLocation, t)", "metadata": "root.segmentDrillWallConstrained", "header": "['module', '___EOS___']", "index": 2117 }, { "content": "def createDrillWall(rightAngleLocation, trianglePose):\n\n # recover the origin and axes from the pose:\n triangleOrigin = trianglePose.GetPosition()\n xaxis, yaxis, zaxis = transformUtils.getAxesFromTransform( trianglePose )\n\n # 0.6096 = 24 * .0254 (m = feet)\n # 0.3048 = 12 * .0254 (m = feet)\n edgeRight = np.array([0.0, -1.0, 0.0]) * (0.6)\n edgeUp = np.array([0.0, 0.0, 1.0]) * (0.3)\n\n\n pointsInWallFrame = np.zeros((3,3))\n\n if rightAngleLocation == DRILL_TRIANGLE_BOTTOM_LEFT:\n pointsInWallFrame[1] = edgeUp\n pointsInWallFrame[2] = edgeRight\n\n elif rightAngleLocation == DRILL_TRIANGLE_BOTTOM_RIGHT:\n pointsInWallFrame[1] = edgeUp # edgeRight +edgeUp\n pointsInWallFrame[2] = -edgeRight # edgeRight\n\n elif rightAngleLocation == DRILL_TRIANGLE_TOP_LEFT:\n pointsInWallFrame[1] = edgeRight\n pointsInWallFrame[2] = -edgeUp\n\n elif rightAngleLocation == DRILL_TRIANGLE_TOP_RIGHT:\n pointsInWallFrame[1] = edgeRight\n pointsInWallFrame[2] = edgeRight - edgeUp\n else:\n raise Exception('unexpected value for right angle location: ', + rightAngleLocation)\n\n center = pointsInWallFrame.sum(axis=0)/3.0\n shrinkFactor = 1#0.90\n shrinkPoints = (pointsInWallFrame - center) * shrinkFactor + center\n\n d = DebugData()\n for p in pointsInWallFrame:\n d.addSphere(p, radius=0.015)\n\n for a, b in zip(pointsInWallFrame, np.vstack((pointsInWallFrame[1:], pointsInWallFrame[0]))):\n d.addLine(a, b, radius=0.005)#01)\n\n for a, b in zip(shrinkPoints, np.vstack((shrinkPoints[1:], shrinkPoints[0]))):\n d.addLine(a, b, radius=0.005)#0.025\n\n folder = om.getOrCreateContainer('affordances')\n\n wall = om.findObjectByName('wall')\n om.removeFromObjectModel(wall)\n\n aff = showPolyData(d.getPolyData(), 'wall', cls=FrameAffordanceItem, color=[0,1,0], visible=True, parent=folder)\n aff.actor.SetUserTransform(trianglePose)\n aff.addToView(app.getDRCView())\n\n refitWallCallbacks.append(functools.partial(refitDrillWall, aff))\n\n frameObj = showFrame(trianglePose, 'wall frame', parent=aff, scale=0.2, visible=False)\n frameObj.addToView(app.getDRCView())\n\n params = dict(origin=triangleOrigin, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1,\n p1y=shrinkPoints[0][1], p1z=shrinkPoints[0][2],\n p2y=shrinkPoints[1][1], p2z=shrinkPoints[1][2],\n p3y=shrinkPoints[2][1], p3z=shrinkPoints[2][2],\n friendly_name='drill_wall', otdf_type='drill_wall')\n\n aff.setAffordanceParams(params)\n aff.updateParamsFromActorTransform()\n\n\n '''\n rfoot = getLinkFrame(drcargs.getDirectorConfig()['rightFootLink'])\n tt = getTransformFromAxes(xaxis, yaxis, zaxis)\n tt.PostMultiply()\n tt.Translate(rfoot.GetPosition())\n showFrame(tt, 'rfoot with wall orientation')\n aff.footToAffTransform = computeAToB(tt, trianglePose)\n\n footToAff = list(aff.footToAffTransform.GetPosition())\n tt.TransformVector(footToAff, footToAff)\n\n d = DebugData()\n d.addSphere(tt.GetPosition(), radius=0.02)\n d.addLine(tt.GetPosition(), np.array(tt.GetPosition()) + np.array(footToAff))\n showPolyData(d.getPolyData(), 'rfoot debug')\n '''", "metadata": "root.createDrillWall", "header": "['module', '___EOS___']", "index": 2145 }, { "content": "def getDrillAffordanceParams(origin, xaxis, yaxis, zaxis, drillType=\"dewalt_button\"):\n\n if (drillType==\"dewalt_button\"):\n params = dict(origin=origin, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1,\n button_x=0.007,\n button_y=-0.035,\n button_z=-0.06,\n button_roll=-90.0,\n button_pitch=-90.0,\n button_yaw=0.0,\n bit_x=-0.01,\n bit_y=0.0,\n bit_z=0.15,\n bit_roll=0,\n bit_pitch=-90,\n bit_yaw=0,\n friendly_name='dewalt_button', otdf_type='dewalt_button')\n else:\n params = dict(origin=origin, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis, xwidth=0.1, ywidth=0.1, zwidth=0.1,\n button_x=0.007,\n button_y=-0.035,\n button_z=-0.06,\n button_roll=0.0,\n button_pitch=0.0,\n button_yaw=0.0,\n bit_x=0.18,\n bit_y=0.0,\n bit_z=0.13,\n bit_roll=0,\n bit_pitch=0,\n bit_yaw=0,\n friendly_name='dewalt_barrel', otdf_type='dewalt_barrel')\n\n return params", "metadata": "root.getDrillAffordanceParams", "header": "['module', '___EOS___']", "index": 2233 }, { "content": "def getDrillMesh(applyBitOffset=False):\n\n button = np.array([0.007, -0.035, -0.06])\n drillMesh = ioUtils.readPolyData(os.path.join(app.getDRCBase(), 'software/models/otdf/dewalt_button.obj'))\n\n if applyBitOffset:\n t = vtk.vtkTransform()\n t.Translate(0.01, 0.0, 0.0)\n drillMesh = transformPolyData(drillMesh, t)\n\n d = DebugData()\n d.addPolyData(drillMesh)\n d.addSphere(button, radius=0.005, color=[0,1,0])\n d.addLine([0.0,0.0,0.155], [0.0, 0.0, 0.14], radius=0.001, color=[0,1,0])\n\n return shallowCopy(d.getPolyData())", "metadata": "root.getDrillMesh", "header": "['module', '___EOS___']", "index": 2269 }, { "content": "def getDrillBarrelMesh():\n return ioUtils.readPolyData(os.path.join(app.getDRCBase(), 'software/models/otdf/dewalt.ply'), computeNormals=True)", "metadata": "root.getDrillBarrelMesh", "header": "['module', '___EOS___']", "index": 2289 }, { "content": "def segmentDrill(point1, point2, point3):\n\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=viewPlaneNormal, searchOrigin=point1, searchRadius=0.2, angleEpsilon=0.7, returnOrigin=True)\n\n\n tablePoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(tablePoints, 'table plane points', parent=getDebugFolder(), visible=False)\n\n\n searchRegion = thresholdPoints(polyData, 'dist_to_plane', [0.03, 0.4])\n searchRegion = cropToSphere(searchRegion, point2, 0.30)\n drillPoints = extractLargestCluster(searchRegion)\n\n drillToTopPoint = np.array([-0.002904, -0.010029, 0.153182])\n\n zaxis = normal\n yaxis = point3 - point2\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis = np.cross(zaxis, xaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PreMultiply()\n t.Translate(-drillToTopPoint)\n t.PostMultiply()\n t.Translate(point2)\n\n drillMesh = getDrillMesh()\n\n aff = showPolyData(drillMesh, 'drill', cls=FrameAffordanceItem, visible=True)\n aff.actor.SetUserTransform(t)\n showFrame(t, 'drill frame', parent=aff, visible=False).addToView(app.getDRCView())\n\n params = getDrillAffordanceParams(origin, xaxis, yaxis, zaxis)\n aff.setAffordanceParams(params)\n aff.updateParamsFromActorTransform()\n aff.addToView(app.getDRCView())", "metadata": "root.segmentDrill", "header": "['module', '___EOS___']", "index": 2293 }, { "content": "def makePolyDataFields(pd):\n mesh = computeDelaunay3D(pd)\n\n if not mesh.GetNumberOfPoints():\n return None\n\n origin, edges, wireframe = getOrientedBoundingBox(mesh)\n\n edgeLengths = np.array([np.linalg.norm(edge) for edge in edges])\n axes = [edge / np.linalg.norm(edge) for edge in edges]\n\n # Use upward axis for z direction\n zaxis = [0, 0, 1]\n dot_products = [ np.dot(axe, zaxis) for axe in axes ]\n axes = [ axes[i] for i in np.argsort( dot_products ) ]\n edgeLengths = [ edgeLengths[i] for i in np.argsort( dot_products ) ]\n\n boxCenter = computeCentroid(wireframe)\n\n t = getTransformFromAxes(axes[0], axes[1], axes[2])\n t.PostMultiply()\n t.Translate(boxCenter)\n\n pd = transformPolyData(pd, t.GetLinearInverse())\n wireframe = transformPolyData(wireframe, t.GetLinearInverse())\n mesh = transformPolyData(mesh, t.GetLinearInverse())\n\n return FieldContainer(points=pd, box=wireframe, mesh=mesh, frame=t, dims=edgeLengths, axes=axes)", "metadata": "root.makePolyDataFields", "header": "['module', '___EOS___']", "index": 2339 }, { "content": "def makeMovable(obj, initialTransform=None):\n '''\n Adds a child frame to the given PolyDataItem. If initialTransform is not\n given, then an origin frame is computed for the polydata using the\n center and orientation of the oriented bounding of the polydata. The polydata\n is transformed using the inverse of initialTransform and then a child frame\n is assigned to the object to reposition it.\n '''\n pd = obj.polyData\n t = initialTransform\n\n if t is None:\n origin, edges, wireframe = getOrientedBoundingBox(pd)\n edgeLengths = np.array([np.linalg.norm(edge) for edge in edges])\n axes = [edge / np.linalg.norm(edge) for edge in edges]\n boxCenter = computeCentroid(wireframe)\n t = getTransformFromAxes(axes[0], axes[1], axes[2])\n t.PostMultiply()\n t.Translate(boxCenter)\n\n pd = transformPolyData(pd, t.GetLinearInverse())\n obj.setPolyData(pd)\n\n frame = obj.getChildFrame()\n if frame:\n frame.copyFrame(t)\n else:\n frame = vis.showFrame(t, obj.getProperty('Name') + ' frame', parent=obj, scale=0.2, visible=False)\n obj.actor.SetUserTransform(t)", "metadata": "root.makeMovable", "header": "['module', '___EOS___']", "index": 2369 }, { "content": "def segmentTable(polyData, searchPoint):\n '''\n NB: If you wish to use the table frame use segmentTableAndFrame instead \n ##################\n Segment a horizontal table surface (perpendicular to +Z) in the given polyData\n Input:\n - polyData\n - search point on plane\n\n Output:\n - polyData, tablePoints, origin, normal\n - polyData is the input polyData with a new 'dist_to_plane' attribute.\n '''\n expectedNormal = np.array([0.0, 0.0, 1.0])\n tableNormalEpsilon = 0.4\n\n polyData = applyVoxelGrid(polyData, leafSize=0.01)\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=expectedNormal, perpendicularAxis=expectedNormal, searchOrigin=searchPoint, searchRadius=0.3, angleEpsilon=tableNormalEpsilon, returnOrigin=True)\n tablePoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n\n tablePoints = labelDistanceToPoint(tablePoints, searchPoint)\n tablePointsClusters = extractClusters(tablePoints, minClusterSize=10, clusterTolerance=0.1)\n tablePointsClusters.sort(key=lambda x: vtkNumpy.getNumpyFromVtk(x, 'distance_to_point').min())\n\n tablePoints = tablePointsClusters[0]\n\n updatePolyData(tablePoints, 'table plane points', parent=getDebugFolder(), visible=False)\n updatePolyData(tablePoints, 'table points', parent=getDebugFolder(), visible=False)\n\n return polyData, tablePoints, origin, normal", "metadata": "root.segmentTable", "header": "['module', '___EOS___']", "index": 2400 }, { "content": "def filterClusterObjects(clusters):\n\n result = []\n for cluster in clusters:\n\n if np.abs(np.dot(cluster.axes[2], [0,0,1])) < 0.5:\n continue\n\n if cluster.dims[2] < 0.1:\n continue\n\n result.append(cluster)\n return result", "metadata": "root.filterClusterObjects", "header": "['module', '___EOS___']", "index": 2433 }, { "content": "def segmentTableScene(polyData, searchPoint, filterClustering = True):\n objectClusters, tableData = segmentTableSceneClusters(polyData, searchPoint)\n\n clusters = [makePolyDataFields(cluster) for cluster in objectClusters]\n clusters = [cluster for cluster in clusters if cluster is not None]\n\n # Add an additional frame to these objects which has z-axis aligned upwards\n # but rotated to have the x-axis facing away from the robot\n table_axes= transformUtils.getAxesFromTransform(tableData.frame)\n for cluster in clusters:\n cluster_axes= transformUtils.getAxesFromTransform(cluster.frame)\n\n zaxis = cluster_axes[2]\n xaxis = table_axes[0]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n orientedFrame = transformUtils.getTransformFromAxesAndOrigin(xaxis, yaxis, zaxis, cluster.frame.GetPosition() )\n cluster._add_fields(oriented_frame=orientedFrame)\n\n if (filterClustering):\n clusters = filterClusterObjects(clusters)\n\n return FieldContainer(table=tableData, clusters=clusters)", "metadata": "root.segmentTableScene", "header": "['module', '___EOS___']", "index": 2449 }, { "content": "def segmentTableSceneClusters(polyData, searchPoint, clusterInXY=False):\n ''' Given a point cloud of a table with some objects on it\n and a point on that table\n determine the plane of the table and\n extract clusters above the table\n '''\n\n tableData, polyData = segmentTableAndFrame(polyData, searchPoint)\n\n searchRegion = thresholdPoints(polyData, 'dist_to_plane', [0.02, 0.5])\n # TODO: replace with 'all points above the table':\n searchRegion = cropToSphere(searchRegion, tableData.frame.GetPosition() , 0.5) # was 1.0\n\n showFrame(tableData.frame, 'tableFrame', visible=False, parent=getDebugFolder(), scale=0.15)\n showPolyData(searchRegion, 'searchRegion', color=[1,0,0], visible=False, parent=getDebugFolder())\n\n objectClusters = extractClusters(searchRegion, clusterInXY, clusterTolerance=0.02, minClusterSize=10)\n\n #print 'got %d clusters' % len(objectClusters)\n for i,c in enumerate(objectClusters):\n name= \"cluster %d\" % i\n showPolyData(c, name, color=getRandomColor(), visible=False, parent=getDebugFolder())\n\n return objectClusters, tableData", "metadata": "root.segmentTableSceneClusters", "header": "['module', '___EOS___']", "index": 2476 }, { "content": "def segmentTableAndFrame(polyData, searchPoint):\n '''\n Segment a table using a searchPoint on the table top\n and then recover its coordinate frame, facing away from the robot\n Objects/points on the table are ignored\n\n Input: polyData and searchPoint on the table\n\n Output: FieldContainer with:\n - all relevent details about the table (only)\n\n '''\n\n polyData, tablePoints, _, _ = segmentTable(polyData, searchPoint)\n tableMesh = computeDelaunay3D(tablePoints)\n\n viewFrame = SegmentationContext.getGlobalInstance().getViewFrame()\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n robotYaw = math.atan2( viewDirection[1], viewDirection[0] )*180.0/np.pi\n linkFrame = transformUtils.frameFromPositionAndRPY( viewFrame.GetPosition() , [0,0, robotYaw ] ) \n\n # Function returns corner point that is far right from the robot\n cornerTransform, rectDepth, rectWidth, _ = findMinimumBoundingRectangle(tablePoints, linkFrame)\n rectHeight = 0.02 # arbitrary table width\n \n # recover mid point\n t = transformUtils.copyFrame(cornerTransform)\n t.PreMultiply()\n table_center = [-rectDepth/2, rectWidth/2, 0]\n t3 = transformUtils.frameFromPositionAndRPY(table_center,[0,0,0])\n t.Concatenate(t3)\n\n # Create required outputs\n edgeLengths = [rectDepth, rectWidth, rectHeight]\n tableXAxis, tableYAxis, tableZAxis = transformUtils.getAxesFromTransform(t)\n axes = tableXAxis, tableYAxis, tableZAxis\n wf = vtk.vtkOutlineSource()\n wf.SetBounds([-rectDepth/2,rectDepth/2, -rectWidth/2,rectWidth/2, -rectHeight/2,rectHeight/2])\n #wf.SetBoxTypeToOriented()\n #cube =[0,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,1,1,1,1,1]\n #wf.SetCorners(cube)\n wireframe = wf.GetOutput()\n\n tablePoints = transformPolyData(tablePoints, t.GetLinearInverse())\n #wireframe = transformPolyData(wireframe, t.GetLinearInverse())\n tableMesh = transformPolyData(tableMesh, t.GetLinearInverse())\n\n return FieldContainer(points=tablePoints, box=wireframe, mesh=tableMesh, frame=t, dims=edgeLengths, axes=axes), polyData", "metadata": "root.segmentTableAndFrame", "header": "['module', '___EOS___']", "index": 2502 }, { "content": "def segmentDrillAuto(point1, polyData=None):\n\n if polyData is None:\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n expectedNormal = np.array([0.0, 0.0, 1.0])\n\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=expectedNormal, perpendicularAxis=expectedNormal, searchOrigin=point1, searchRadius=0.4, angleEpsilon=0.2, returnOrigin=True)\n\n\n tablePoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(tablePoints, 'table plane points', parent=getDebugFolder(), visible=False)\n\n tablePoints = labelDistanceToPoint(tablePoints, point1)\n tablePointsClusters = extractClusters(tablePoints)\n tablePointsClusters.sort(key=lambda x: vtkNumpy.getNumpyFromVtk(x, 'distance_to_point').min())\n\n tablePoints = tablePointsClusters[0]\n updatePolyData(tablePoints, 'table points', parent=getDebugFolder(), visible=False)\n\n searchRegion = thresholdPoints(polyData, 'dist_to_plane', [0.03, 0.4])\n searchRegion = cropToSphere(searchRegion, point1, 0.30)\n drillPoints = extractLargestCluster(searchRegion, minClusterSize=1)\n\n\n # determine drill orientation (rotation about z axis)\n\n centroids = computeCentroids(drillPoints, axis=normal)\n\n centroidsPolyData = vtkNumpy.getVtkPolyDataFromNumpyPoints(centroids)\n d = DebugData()\n updatePolyData(centroidsPolyData, 'cluster centroids', parent=getDebugFolder(), visible=False)\n\n drillToTopPoint = np.array([-0.002904, -0.010029, 0.153182])\n\n zaxis = normal\n yaxis = centroids[0] - centroids[-1]\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis = np.cross(zaxis, xaxis)\n\n # note this hack to orient the drill correctly:\n t = getTransformFromAxes(yaxis, -xaxis, zaxis)\n t.PreMultiply()\n t.Translate(-drillToTopPoint)\n t.PostMultiply()\n t.Translate(centroids[-1])\n\n drillMesh = getDrillMesh()\n\n aff = showPolyData(drillMesh, 'drill', cls=FrameAffordanceItem, visible=True)\n aff.actor.SetUserTransform(t)\n showFrame(t, 'drill frame', parent=aff, visible=False, scale=0.2).addToView(app.getDRCView())\n\n params = getDrillAffordanceParams(origin, xaxis, yaxis, zaxis)\n aff.setAffordanceParams(params)\n aff.updateParamsFromActorTransform()\n aff.addToView(app.getDRCView())", "metadata": "root.segmentDrillAuto", "header": "['module', '___EOS___']", "index": 2552 }, { "content": "def segmentDrillButton(point1):\n d = DebugData()\n d.addSphere([0,0,0], radius=0.005)\n obj = updatePolyData(d.getPolyData(), 'sensed drill button', color=[0,0.5,0.5], visible=True)\n\n # there is no orientation, but this allows the XYZ point to be queried\n pointerTipFrame = transformUtils.frameFromPositionAndRPY(point1, [0,0,0])\n obj.actor.SetUserTransform(pointerTipFrame)\n obj.addToView(app.getDRCView())\n\n frameObj = updateFrame(obj.actor.GetUserTransform(), 'sensed drill button frame', parent=obj, scale=0.2, visible=False)\n frameObj.addToView(app.getDRCView())", "metadata": "root.segmentDrillButton", "header": "['module', '___EOS___']", "index": 2615 }, { "content": "def segmentPointerTip(point1):\n d = DebugData()\n d.addSphere([0,0,0], radius=0.005)\n obj = updatePolyData(d.getPolyData(), 'sensed pointer tip', color=[0.5,0.5,0.0], visible=True)\n\n # there is no orientation, but this allows the XYZ point to be queried\n pointerTipFrame = transformUtils.frameFromPositionAndRPY(point1, [0,0,0])\n obj.actor.SetUserTransform(pointerTipFrame)\n obj.addToView(app.getDRCView())\n\n frameObj = updateFrame(obj.actor.GetUserTransform(), 'sensed pointer tip frame', parent=obj, scale=0.2, visible=False)\n frameObj.addToView(app.getDRCView())", "metadata": "root.segmentPointerTip", "header": "['module', '___EOS___']", "index": 2629 }, { "content": "def fitGroundObject(polyData=None, expectedDimensionsMin=[0.2, 0.02], expectedDimensionsMax=[1.3, 0.1]):\n\n removeGroundFunc = removeGroundSimple\n\n polyData = polyData or getCurrentRevolutionData()\n groundPoints, scenePoints = removeGroundFunc(polyData, groundThickness=0.02, sceneHeightFromGround=0.035)\n\n searchRegion = thresholdPoints(scenePoints, 'dist_to_plane', [0.05, 0.2])\n\n clusters = extractClusters(searchRegion, clusterTolerance=0.07, minClusterSize=4)\n\n candidates = []\n for clusterId, cluster in enumerate(clusters):\n\n\n origin, edges, _ = getOrientedBoundingBox(cluster)\n edgeLengths = [np.linalg.norm(edge) for edge in edges[:2]]\n\n found = (expectedDimensionsMin[0] <= edgeLengths[0] < expectedDimensionsMax[0]\n and expectedDimensionsMin[1] <= edgeLengths[1] < expectedDimensionsMax[1])\n\n if not found:\n updatePolyData(cluster, 'candidate cluster %d' % clusterId, color=[1,1,0], parent=getDebugFolder(), visible=False)\n continue\n\n updatePolyData(cluster, 'cluster %d' % clusterId, color=[0,1,0], parent=getDebugFolder(), visible=False)\n candidates.append(cluster)\n\n if not candidates:\n return None\n\n\n viewFrame = SegmentationContext.getGlobalInstance().getViewFrame()\n viewOrigin = np.array(viewFrame.GetPosition())\n\n dists = [np.linalg.norm(viewOrigin - computeCentroid(cluster)) for cluster in candidates]\n candidates = [candidates[i] for i in np.argsort(dists)]\n\n cluster = candidates[0]\n obj = makePolyDataFields(cluster)\n\n return vis.showClusterObjects([obj], parent='segmentation')[0]", "metadata": "root.fitGroundObject", "header": "['module', '___EOS___']", "index": 2643 }, { "content": "def findHorizontalSurfaces(polyData, removeGroundFirst=False, normalEstimationSearchRadius=0.05,\n clusterTolerance=0.025, minClusterSize=150, distanceToPlaneThreshold=0.0025, normalsDotUpRange=[0.95, 1.0], showClusters=False):\n '''\n Find the horizontal surfaces, tuned to work with walking terrain\n '''\n\n searchZ = [0.0, 2.0]\n voxelGridLeafSize = 0.01\n verboseFlag = False\n\n if (removeGroundFirst):\n groundPoints, scenePoints = removeGround(polyData, groundThickness=0.02, sceneHeightFromGround=0.05)\n scenePoints = thresholdPoints(scenePoints, 'dist_to_plane', searchZ)\n updatePolyData(groundPoints, 'ground points', parent=getDebugFolder(), visible=verboseFlag)\n else:\n scenePoints = polyData\n\n\n\n if not scenePoints.GetNumberOfPoints():\n return\n\n f = vtk.vtkPCLNormalEstimation()\n f.SetSearchRadius(normalEstimationSearchRadius)\n f.SetInput(scenePoints)\n f.SetInput(1, applyVoxelGrid(scenePoints, voxelGridLeafSize))\n\n # Duration 0.2 sec for V1 log:\n f.Update()\n scenePoints = shallowCopy(f.GetOutput())\n\n normals = vtkNumpy.getNumpyFromVtk(scenePoints, 'normals')\n normalsDotUp = np.abs(np.dot(normals, [0,0,1]))\n\n vtkNumpy.addNumpyToVtk(scenePoints, normalsDotUp, 'normals_dot_up')\n surfaces = thresholdPoints(scenePoints, 'normals_dot_up', normalsDotUpRange)\n\n updatePolyData(scenePoints, 'scene points', parent=getDebugFolder(), colorByName='normals_dot_up', visible=verboseFlag)\n updatePolyData(surfaces, 'surfaces points', parent=getDebugFolder(), colorByName='normals_dot_up', visible=verboseFlag)\n\n clusters = extractClusters(surfaces, clusterTolerance=clusterTolerance, minClusterSize=minClusterSize)\n planeClusters = []\n clustersLarge = []\n\n om.removeFromObjectModel(om.findObjectByName('surface clusters'))\n folder = om.getOrCreateContainer('surface clusters', parentObj=getDebugFolder())\n\n for i, cluster in enumerate(clusters):\n\n updatePolyData(cluster, 'surface cluster %d' % i, parent=folder, color=getRandomColor(), visible=verboseFlag)\n planePoints, _ = applyPlaneFit(cluster, distanceToPlaneThreshold)\n planePoints = thresholdPoints(planePoints, 'dist_to_plane', [-distanceToPlaneThreshold, distanceToPlaneThreshold])\n\n if planePoints.GetNumberOfPoints() > minClusterSize:\n clustersLarge.append(cluster)\n obj = makePolyDataFields(planePoints)\n if obj is not None:\n planeClusters.append(obj)\n\n folder = om.getOrCreateContainer('surface objects', parentObj=getDebugFolder())\n if showClusters:\n vis.showClusterObjects(planeClusters, parent=folder)\n\n return clustersLarge", "metadata": "root.findHorizontalSurfaces", "header": "['module', '___EOS___']", "index": 2686 }, { "content": "def fitVerticalPosts(polyData):\n\n groundPoints, scenePoints = removeGround(polyData)\n scenePoints = thresholdPoints(scenePoints, 'dist_to_plane', [0.1, 4.0])\n\n if not scenePoints.GetNumberOfPoints():\n return\n\n scenePoints = applyVoxelGrid(scenePoints, leafSize=0.03)\n clusters = extractClusters(scenePoints, clusterTolerance=0.15, minClusterSize=10)\n\n\n\n\n def isPostCluster(cluster, lineDirection):\n\n up = [0,0,1]\n minPostLength = 1.0\n maxRadius = 0.3\n angle = math.degrees(math.acos(np.dot(up,lineDirection) / (np.linalg.norm(up) * np.linalg.norm(lineDirection))))\n\n if angle > 15:\n return False\n\n origin, edges, _ = getOrientedBoundingBox(cluster)\n edgeLengths = [np.linalg.norm(edge) for edge in edges]\n\n if edgeLengths[0] < minPostLength:\n return False\n\n # extract top half\n zvalues = vtkNumpy.getNumpyFromVtk(cluster, 'Points')[:,2].copy()\n vtkNumpy.addNumpyToVtk(cluster, zvalues, 'z')\n\n minZ = np.min(zvalues)\n maxZ = np.max(zvalues)\n\n cluster = thresholdPoints(cluster, 'z', [(minZ + maxZ)/2.0, maxZ])\n origin, edges, _ = getOrientedBoundingBox(cluster)\n edgeLengths = [np.linalg.norm(edge) for edge in edges]\n\n if edgeLengths[1] > maxRadius or edgeLengths[2] > maxRadius:\n return False\n\n return True\n\n def makeCylinderAffordance(linePoints, lineDirection, lineOrigin, postId):\n\n pts = vtkNumpy.getNumpyFromVtk(linePoints, 'Points')\n dists = np.dot(pts-lineOrigin, lineDirection)\n p1 = lineOrigin + lineDirection*np.min(dists)\n p2 = lineOrigin + lineDirection*np.max(dists)\n\n origin = (p1+p2)/2.0\n lineLength = np.linalg.norm(p2-p1)\n t = transformUtils.getTransformFromOriginAndNormal(origin, lineDirection)\n pose = transformUtils.poseFromTransform(t)\n\n desc = dict(classname='CylinderAffordanceItem', Name='post %d' % postId,\n uuid=newUUID(), pose=pose, Radius=0.05, Length=float(lineLength), Color=[0.0, 1.0, 0.0])\n desc['Collision Enabled'] = True\n\n return affordanceManager.newAffordanceFromDescription(desc)\n\n\n rejectFolder = om.getOrCreateContainer('nonpost clusters', parentObj=getDebugFolder())\n keepFolder = om.getOrCreateContainer('post clusters', parentObj=getDebugFolder())\n\n for i, cluster in enumerate(clusters):\n\n linePoint, lineDirection, linePoints = applyLineFit(cluster, distanceThreshold=0.1)\n if isPostCluster(cluster, lineDirection):\n vis.showPolyData(cluster, 'cluster %d' % i, visible=False, color=getRandomColor(), alpha=0.5, parent=keepFolder)\n makeCylinderAffordance(linePoints, lineDirection, linePoint, i)\n else:\n vis.showPolyData(cluster, 'cluster %d' % i, visible=False, color=getRandomColor(), alpha=0.5, parent=rejectFolder)", "metadata": "root.fitVerticalPosts", "header": "['module', '___EOS___']", "index": 2752 }, { "content": "def findAndFitDrillBarrel(polyData=None):\n ''' Find the horizontal surfaces\n on the horizontal surfaces, find all the drills\n '''\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = polyData or inputObj.polyData\n\n groundPoints, scenePoints = removeGround(polyData, groundThickness=0.02, sceneHeightFromGround=0.50)\n\n scenePoints = thresholdPoints(scenePoints, 'dist_to_plane', [0.5, 1.7])\n\n if not scenePoints.GetNumberOfPoints():\n return\n\n normalEstimationSearchRadius = 0.10\n\n f = vtk.vtkPCLNormalEstimation()\n f.SetSearchRadius(normalEstimationSearchRadius)\n f.SetInput(scenePoints)\n f.Update()\n scenePoints = shallowCopy(f.GetOutput())\n\n normals = vtkNumpy.getNumpyFromVtk(scenePoints, 'normals')\n normalsDotUp = np.abs(np.dot(normals, [0,0,1]))\n\n vtkNumpy.addNumpyToVtk(scenePoints, normalsDotUp, 'normals_dot_up')\n\n surfaces = thresholdPoints(scenePoints, 'normals_dot_up', [0.95, 1.0])\n\n\n updatePolyData(groundPoints, 'ground points', parent=getDebugFolder(), visible=False)\n updatePolyData(scenePoints, 'scene points', parent=getDebugFolder(), colorByName='normals_dot_up', visible=False)\n updatePolyData(surfaces, 'surfaces', parent=getDebugFolder(), visible=False)\n\n clusters = extractClusters(surfaces, clusterTolerance=0.15, minClusterSize=50)\n\n fitResults = []\n\n viewFrame = SegmentationContext.getGlobalInstance().getViewFrame()\n forwardDirection = np.array([1.0, 0.0, 0.0])\n viewFrame.TransformVector(forwardDirection, forwardDirection)\n robotOrigin = viewFrame.GetPosition()\n robotForward =forwardDirection\n\n #print 'robot origin:', robotOrigin\n #print 'robot forward:', robotForward\n centroid =[]\n\n for clusterId, cluster in enumerate(clusters):\n clusterObj = updatePolyData(cluster, 'surface cluster %d' % clusterId, color=[1,1,0], parent=getDebugFolder(), visible=False)\n\n origin, edges, _ = getOrientedBoundingBox(cluster)\n edgeLengths = [np.linalg.norm(edge) for edge in edges[:2]]\n\n skipCluster = False\n for edgeLength in edgeLengths:\n #print 'cluster %d edge length: %f' % (clusterId, edgeLength)\n if edgeLength < 0.35 or edgeLength > 0.75:\n skipCluster = True\n\n if skipCluster:\n continue\n\n clusterObj.setSolidColor([0, 0, 1])\n centroid = np.average(vtkNumpy.getNumpyFromVtk(cluster, 'Points'), axis=0)\n\n try:\n drillFrame = segmentDrillBarrelFrame(centroid, polyData=scenePoints, forwardDirection=robotForward)\n if drillFrame is not None:\n fitResults.append((clusterObj, drillFrame))\n except:\n print traceback.format_exc()\n print 'fit drill failed for cluster:', clusterId\n\n if not fitResults:\n return\n\n sortFittedDrills(fitResults, robotOrigin, robotForward)\n\n return centroid", "metadata": "root.findAndFitDrillBarrel", "header": "['module', '___EOS___']", "index": 2831 }, { "content": "def sortFittedDrills(fitResults, robotOrigin, robotForward):\n\n angleToFitResults = []\n\n for fitResult in fitResults:\n cluster, drillFrame = fitResult\n drillOrigin = np.array(drillFrame.GetPosition())\n angleToDrill = np.abs(computeSignedAngleBetweenVectors(robotForward, drillOrigin - robotOrigin, [0,0,1]))\n angleToFitResults.append((angleToDrill, cluster, drillFrame))\n #print 'angle to candidate drill:', angleToDrill\n\n angleToFitResults.sort(key=lambda x: x[0])\n\n #print 'using drill at angle:', angleToFitResults[0][0]\n\n drillMesh = getDrillBarrelMesh()\n\n for i, fitResult in enumerate(angleToFitResults):\n\n angleToDrill, cluster, drillFrame = fitResult\n\n if i == 0:\n\n drill = om.findObjectByName('drill')\n drill = updatePolyData(drillMesh, 'drill', color=[0, 1, 0], cls=FrameAffordanceItem, visible=True)\n drillFrame = updateFrame(drillFrame, 'drill frame', parent=drill, visible=False)\n drill.actor.SetUserTransform(drillFrame.transform)\n\n drill.setAffordanceParams(dict(otdf_type='dewalt_button', friendly_name='dewalt_button'))\n drill.updateParamsFromActorTransform()\n\n drill.setSolidColor([0, 1, 0])\n #cluster.setProperty('Visible', True)\n\n else:\n\n drill = showPolyData(drillMesh, 'drill candidate', color=[1,0,0], visible=False, parent=getDebugFolder())\n drill.actor.SetUserTransform(drillFrame)\n om.addToObjectModel(drill, parentObj=getDebugFolder())", "metadata": "root.sortFittedDrills", "header": "['module', '___EOS___']", "index": 2913 }, { "content": "def computeSignedAngleBetweenVectors(v1, v2, perpendicularVector):\n '''\n Computes the signed angle between two vectors in 3d, given a perpendicular vector\n to determine sign. Result returned is radians.\n '''\n v1 = np.array(v1)\n v2 = np.array(v2)\n perpendicularVector = np.array(perpendicularVector)\n v1 /= np.linalg.norm(v1)\n v2 /= np.linalg.norm(v2)\n perpendicularVector /= np.linalg.norm(perpendicularVector)\n return math.atan2(np.dot(perpendicularVector, np.cross(v1, v2)), np.dot(v1, v2))", "metadata": "root.computeSignedAngleBetweenVectors", "header": "['module', '___EOS___']", "index": 2954 }, { "content": "def segmentDrillBarrelFrame(point1, polyData, forwardDirection):\n\n tableClusterSearchRadius = 0.4\n drillClusterSearchRadius = 0.5 #0.3\n\n\n expectedNormal = np.array([0.0, 0.0, 1.0])\n\n if not polyData.GetNumberOfPoints():\n return\n\n polyData, plane_origin, plane_normal = applyPlaneFit(polyData, expectedNormal=expectedNormal,\n perpendicularAxis=expectedNormal, searchOrigin=point1,\n searchRadius=tableClusterSearchRadius, angleEpsilon=0.2, returnOrigin=True)\n\n\n if not polyData.GetNumberOfPoints():\n return\n\n tablePoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(tablePoints, 'table plane points', parent=getDebugFolder(), visible=False)\n\n tablePoints = labelDistanceToPoint(tablePoints, point1)\n tablePointsClusters = extractClusters(tablePoints)\n tablePointsClusters.sort(key=lambda x: vtkNumpy.getNumpyFromVtk(x, 'distance_to_point').min())\n\n if not tablePointsClusters:\n return\n\n tablePoints = tablePointsClusters[0]\n updatePolyData(tablePoints, 'table points', parent=getDebugFolder(), visible=False)\n\n searchRegion = thresholdPoints(polyData, 'dist_to_plane', [0.02, 0.3])\n if not searchRegion.GetNumberOfPoints():\n return\n\n searchRegion = cropToSphere(searchRegion, point1, drillClusterSearchRadius)\n #drillPoints = extractLargestCluster(searchRegion, minClusterSize=1)\n\n t = fitDrillBarrel (searchRegion, forwardDirection, plane_origin, plane_normal)\n return t", "metadata": "root.segmentDrillBarrelFrame", "header": "['module', '___EOS___']", "index": 2968 }, { "content": "def segmentDrillBarrel(point1):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n forwardDirection = -np.array(getCurrentView().camera().GetViewPlaneNormal())\n\n t = segmentDrillBarrel(point1, polyData, forwardDirection)\n assert t is not None\n\n drillMesh = getDrillBarrelMesh()\n\n aff = showPolyData(drillMesh, 'drill', visible=True)\n aff.addToView(app.getDRCView())\n\n aff.actor.SetUserTransform(t)\n drillFrame = showFrame(t, 'drill frame', parent=aff, visible=False)\n drillFrame.addToView(app.getDRCView())\n return aff, drillFrame", "metadata": "root.segmentDrillBarrel", "header": "['module', '___EOS___']", "index": 3014 }, { "content": "def segmentDrillAlignedWithTable(point, polyData = None):\n '''\n Yet Another Drill Fitting Algorithm [tm]\n This one fits the button drill assuming its on the table\n and aligned with the table frame (because the button drill orientation is difficult to find)\n Table must have long side facing robot\n '''\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = polyData or inputObj.polyData\n\n # segment the table and recover the precise up direction normal:\n polyDataOut, tablePoints, origin, normal = segmentTable(polyData,point)\n #print origin # this origin is bunk\n #tableCentroid = computeCentroid(tablePoints)\n\n # get the bounding box edges\n OBBorigin, edges, _ = getOrientedBoundingBox(tablePoints)\n #print \"OBB out\"\n #print OBBorigin\n #print edges\n edgeLengths = np.array([np.linalg.norm(edge) for edge in edges])\n axes = [edge / np.linalg.norm(edge) for edge in edges]\n #print edgeLengths\n #print axes\n\n # check which direction the robot is facing and flip x-axis of table if necessary\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n #print \"main axes\", axes[1]\n #print \"viewDirection\", viewDirection\n #dp = np.dot(axes[1], viewDirection)\n #print dp\n\n if np.dot(axes[1], viewDirection) < 0:\n #print \"flip the x-direction\"\n axes[1] = -axes[1]\n\n\n # define the x-axis to be along the 2nd largest edge\n xaxis = axes[1]\n xaxis = np.array(xaxis)\n zaxis = np.array( normal )\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n tableOrientation = transformUtils.getTransformFromAxes(xaxis, yaxis, zaxis)\n\n #tableTransform = transformUtils.frameFromPositionAndRPY( tableCentroid , tableOrientation.GetOrientation() )\n #updateFrame(tableTransform, 'table frame [z up, x away face]', parent=\"segmentation\", visible=True).addToView(app.getDRCView())\n\n data = segmentTableScene(polyData, point )\n #vis.showClusterObjects(data.clusters + [data.table], parent='segmentation')\n\n # crude use of the table frame to determine the frame of the drill on the table\n #t2 = transformUtils.frameFromPositionAndRPY([0,0,0], [180, 0 , 90] )\n #drillOrientationTransform = transformUtils.copyFrame( om.findObjectByName('object 1 frame').transform )\n #drillOrientationTransform.PreMultiply()\n #drillOrientationTransform.Concatenate(t2)\n #vis.updateFrame(t, 'drillOrientationTransform',visible=True)\n\n #table_xaxis, table_yaxis, table_zaxis = transformUtils.getAxesFromTransform( data.table.frame )\n #drillOrientation = transformUtils.orientationFromAxes( table_yaxis, table_xaxis, -1*np.array( table_zaxis) )\n drillTransform = transformUtils.frameFromPositionAndRPY( data.clusters[0].frame.GetPosition() , tableOrientation.GetOrientation() )\n\n drillMesh = getDrillMesh()\n\n drill = om.findObjectByName('drill')\n om.removeFromObjectModel(drill)\n\n aff = showPolyData(drillMesh, 'drill', color=[0.0, 1.0, 0.0], cls=FrameAffordanceItem, visible=True)\n aff.actor.SetUserTransform(drillTransform)\n aff.addToView(app.getDRCView())\n\n frameObj = updateFrame(drillTransform, 'drill frame', parent=aff, scale=0.2, visible=False)\n frameObj.addToView(app.getDRCView())\n\n params = getDrillAffordanceParams(np.array(drillTransform.GetPosition()), [1,0,0], [0,1,0], [0,0,1], drillType=\"dewalt_button\")\n aff.setAffordanceParams(params)", "metadata": "root.segmentDrillAlignedWithTable", "header": "['module', '___EOS___']", "index": 3036 }, { "content": "def segmentDrillInHand(p1, p2):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n distanceToLineThreshold = 0.05\n\n polyData = labelDistanceToLine(polyData, p1, p2)\n polyData = thresholdPoints(polyData, 'distance_to_line', [0.0, distanceToLineThreshold])\n\n lineSegment = p2 - p1\n lineLength = np.linalg.norm(lineSegment)\n\n cropped, polyData = cropToPlane(polyData, p1, lineSegment/lineLength, [-0.03, lineLength + 0.03])\n\n updatePolyData(cropped, 'drill cluster', parent=getDebugFolder(), visible=False)\n\n\n drillPoints = cropped\n normal = lineSegment/lineLength\n\n centroids = computeCentroids(drillPoints, axis=normal)\n\n centroidsPolyData = vtkNumpy.getVtkPolyDataFromNumpyPoints(centroids)\n d = DebugData()\n updatePolyData(centroidsPolyData, 'cluster centroids', parent=getDebugFolder(), visible=False)\n\n drillToTopPoint = np.array([-0.002904, -0.010029, 0.153182])\n\n zaxis = normal\n yaxis = centroids[0] - centroids[-1]\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis = np.cross(zaxis, xaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PreMultiply()\n t.Translate(-drillToTopPoint)\n t.PostMultiply()\n t.Translate(p2)\n\n drillMesh = getDrillMesh()\n\n aff = showPolyData(drillMesh, 'drill', cls=FrameAffordanceItem, visible=True)\n aff.actor.SetUserTransform(t)\n showFrame(t, 'drill frame', parent=aff, visible=False).addToView(app.getDRCView())\n\n params = getDrillAffordanceParams(np.array(t.GetPosition()), xaxis, yaxis, zaxis)\n aff.setAffordanceParams(params)\n aff.updateParamsFromActorTransform()\n aff.addToView(app.getDRCView())", "metadata": "root.segmentDrillInHand", "header": "['module', '___EOS___']", "index": 3115 }, { "content": "def addDrillAffordance():\n\n drillMesh = getDrillMesh()\n\n aff = showPolyData(drillMesh, 'drill', cls=FrameAffordanceItem, visible=True)\n t = vtk.vtkTransform()\n t.PostMultiply()\n aff.actor.SetUserTransform(t)\n showFrame(t, 'drill frame', parent=aff, visible=False).addToView(app.getDRCView())\n\n params = getDrillAffordanceParams(np.array(t.GetPosition()), [1,0,0], [0,1,0], [0,0,1])\n aff.setAffordanceParams(params)\n aff.updateParamsFromActorTransform()\n aff.addToView(app.getDRCView())\n return aff", "metadata": "root.addDrillAffordance", "header": "['module', '___EOS___']", "index": 3170 }, { "content": "def getLinkFrame(linkName):\n robotStateModel = om.findObjectByName('robot state model')\n robotStateModel = robotStateModel or getVisibleRobotModel()\n assert robotStateModel\n t = vtk.vtkTransform()\n robotStateModel.model.getLinkToWorld(linkName, t)\n return t", "metadata": "root.getLinkFrame", "header": "['module', '___EOS___']", "index": 3187 }, { "content": "def getDrillInHandOffset(zRotation=0.0, zTranslation=0.0, xTranslation=0.0, yTranslation=0.0,flip=False):\n\n drillOffset = vtk.vtkTransform()\n drillOffset.PostMultiply()\n if flip:\n drillOffset.RotateY(180)\n drillOffset.RotateZ(zRotation)\n drillOffset.RotateY(-90)\n #drillOffset.Translate(0, 0.09, zTranslation - 0.015)\n #drillOffset.Translate(zTranslation - 0.015, 0.035 + xTranslation, 0.0)\n drillOffset.Translate(zTranslation, xTranslation, 0.0 + yTranslation)\n return drillOffset", "metadata": "root.getDrillInHandOffset", "header": "['module', '___EOS___']", "index": 3196 }, { "content": "def moveDrillToHand(drillOffset, hand='right'):\n drill = om.findObjectByName('drill')\n if not drill:\n drill = addDrillAffordance()\n\n assert hand in ('right', 'left')\n drillTransform = drill.actor.GetUserTransform()\n rightBaseLink = getLinkFrame('%s_hand_face' % hand[0])\n drillTransform.PostMultiply()\n drillTransform.Identity()\n drillTransform.Concatenate(drillOffset)\n drillTransform.Concatenate(rightBaseLink)\n drill._renderAllViews()", "metadata": "root.moveDrillToHand", "header": "['module', '___EOS___']", "index": 3210 }, { "content": "class PointPicker(TimerCallback):\n\n\n\n\n\n\n\n\n", "metadata": "root.PointPicker", "header": "['module', '___EOS___']", "index": 3224 }, { "content": " def __init__(self, numberOfPoints=3):\n TimerCallback.__init__(self)\n self.targetFps = 30\n self.enabled = False\n self.numberOfPoints = numberOfPoints\n self.annotationObj = None\n self.drawLines = True\n self.clear()", "metadata": "root.PointPicker.__init__", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3226 }, { "content": " def clear(self):\n self.points = [None for i in xrange(self.numberOfPoints)]\n self.hoverPos = None\n self.annotationFunc = None\n self.lastMovePos = [0, 0]", "metadata": "root.PointPicker.clear", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3235 }, { "content": " def onMouseMove(self, displayPoint, modifiers=None):\n self.lastMovePos = displayPoint", "metadata": "root.PointPicker.onMouseMove", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3241 }, { "content": " def onMousePress(self, displayPoint, modifiers=None):\n\n #print 'mouse press:', modifiers\n #if not modifiers:\n # return\n\n for i in xrange(self.numberOfPoints):\n if self.points[i] is None:\n self.points[i] = self.hoverPos\n break\n\n if self.points[-1] is not None:\n self.finish()", "metadata": "root.PointPicker.onMousePress", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3244 }, { "content": " def finish(self):\n\n self.enabled = False\n om.removeFromObjectModel(self.annotationObj)\n\n points = [p.copy() for p in self.points]\n if self.annotationFunc is not None:\n self.annotationFunc(*points)\n\n removeViewPicker(self)", "metadata": "root.PointPicker.finish", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3258 }, { "content": " def handleRelease(self, displayPoint):\n pass", "metadata": "root.PointPicker.handleRelease", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3269 }, { "content": " def draw(self):\n\n d = DebugData()\n\n points = [p if p is not None else self.hoverPos for p in self.points]\n\n # draw points\n for p in points:\n if p is not None:\n d.addSphere(p, radius=0.01)\n\n if self.drawLines:\n # draw lines\n for a, b in zip(points, points[1:]):\n if b is not None:\n d.addLine(a, b)\n\n # connect end points\n if points[-1] is not None:\n d.addLine(points[0], points[-1])\n\n\n self.annotationObj = updatePolyData(d.getPolyData(), 'annotation', parent=getDebugFolder())\n self.annotationObj.setProperty('Color', QtGui.QColor(0, 255, 0))\n self.annotationObj.actor.SetPickable(False)", "metadata": "root.PointPicker.draw", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3272 }, { "content": " def tick(self):\n\n if not self.enabled:\n return\n\n if not om.findObjectByName('pointcloud snapshot'):\n self.annotationFunc = None\n self.finish()\n return\n\n self.hoverPos = pickPoint(self.lastMovePos, getSegmentationView(), obj='pointcloud snapshot')\n self.draw()", "metadata": "root.PointPicker.tick", "header": "['class', 'PointPicker', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3299 }, { "content": "class LineDraw(TimerCallback):\n\n\n\n\n\n\n\n", "metadata": "root.LineDraw", "header": "['module', '___EOS___']", "index": 3313 }, { "content": " def __init__(self, view):\n TimerCallback.__init__(self)\n self.targetFps = 30\n self.enabled = False\n self.view = view\n self.renderer = view.renderer()\n self.line = vtk.vtkLeaderActor2D()\n self.line.SetArrowPlacementToNone()\n self.line.GetPositionCoordinate().SetCoordinateSystemToViewport()\n self.line.GetPosition2Coordinate().SetCoordinateSystemToViewport()\n self.line.GetProperty().SetLineWidth(4)\n self.line.SetPosition(0,0)\n self.line.SetPosition2(0,0)\n self.clear()", "metadata": "root.LineDraw.__init__", "header": "['class', 'LineDraw', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3315 }, { "content": " def clear(self):\n self.p1 = None\n self.p2 = None\n self.annotationFunc = None\n self.lastMovePos = [0, 0]\n self.renderer.RemoveActor2D(self.line)", "metadata": "root.LineDraw.clear", "header": "['class', 'LineDraw', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3330 }, { "content": " def onMouseMove(self, displayPoint, modifiers=None):\n self.lastMovePos = displayPoint", "metadata": "root.LineDraw.onMouseMove", "header": "['class', 'LineDraw', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3337 }, { "content": " def onMousePress(self, displayPoint, modifiers=None):\n\n if self.p1 is None:\n self.p1 = list(self.lastMovePos)\n if self.p1 is not None:\n self.renderer.AddActor2D(self.line)\n else:\n self.p2 = self.lastMovePos\n self.finish()", "metadata": "root.LineDraw.onMousePress", "header": "['class', 'LineDraw', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3340 }, { "content": " def finish(self):\n\n self.enabled = False\n self.renderer.RemoveActor2D(self.line)\n if self.annotationFunc is not None:\n self.annotationFunc(self.p1, self.p2)", "metadata": "root.LineDraw.finish", "header": "['class', 'LineDraw', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3350 }, { "content": " def handleRelease(self, displayPoint):\n pass", "metadata": "root.LineDraw.handleRelease", "header": "['class', 'LineDraw', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3358 }, { "content": " def tick(self):\n\n if not self.enabled:\n return\n\n if self.p1:\n self.line.SetPosition(self.p1)\n self.line.SetPosition2(self.lastMovePos)\n self.view.render()", "metadata": "root.LineDraw.tick", "header": "['class', 'LineDraw', '(', 'TimerCallback', ')', ':', '___EOS___']", "index": 3361 }, { "content": "def addViewPicker(picker):\n global viewPickers\n viewPickers.append(picker)", "metadata": "root.addViewPicker", "header": "['module', '___EOS___']", "index": 3373 }, { "content": "def removeViewPicker(picker):\n global viewPickers\n viewPickers.remove(picker)", "metadata": "root.removeViewPicker", "header": "['module', '___EOS___']", "index": 3377 }, { "content": "def distanceToLine(x0, x1, x2):\n numerator = np.sqrt(np.sum(np.cross((x0 - x1), (x0-x2))**2))\n denom = np.linalg.norm(x2-x1)\n return numerator / denom", "metadata": "root.distanceToLine", "header": "['module', '___EOS___']", "index": 3382 }, { "content": "def labelDistanceToLine(polyData, linePoint1, linePoint2, resultArrayName='distance_to_line'):\n\n x0 = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n x1 = np.array(linePoint1)\n x2 = np.array(linePoint2)\n\n numerator = np.sqrt(np.sum(np.cross((x0 - x1), (x0-x2))**2, axis=1))\n denom = np.linalg.norm(x2-x1)\n\n dists = numerator / denom\n\n polyData = shallowCopy(polyData)\n vtkNumpy.addNumpyToVtk(polyData, dists, resultArrayName)\n return polyData", "metadata": "root.labelDistanceToLine", "header": "['module', '___EOS___']", "index": 3388 }, { "content": "def labelDistanceToPoint(polyData, point, resultArrayName='distance_to_point'):\n assert polyData.GetNumberOfPoints()\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n points = points - point\n dists = np.sqrt(np.sum(points**2, axis=1))\n polyData = shallowCopy(polyData)\n vtkNumpy.addNumpyToVtk(polyData, dists, resultArrayName)\n return polyData", "metadata": "root.labelDistanceToPoint", "header": "['module', '___EOS___']", "index": 3404 }, { "content": "def getPlaneEquationFromPolyData(polyData, expectedNormal):\n\n _, origin, normal = applyPlaneFit(polyData, expectedNormal=expectedNormal, returnOrigin=True)\n return origin, normal, np.hstack((normal, [np.dot(origin, normal)]))", "metadata": "root.getPlaneEquationFromPolyData", "header": "['module', '___EOS___']", "index": 3414 }, { "content": "def computeEdge(polyData, edgeAxis, perpAxis, binWidth=0.03):\n\n polyData = labelPointDistanceAlongAxis(polyData, edgeAxis, resultArrayName='dist_along_edge')\n polyData = labelPointDistanceAlongAxis(polyData, perpAxis, resultArrayName='dist_perp_to_edge')\n\n\n polyData, bins = binByScalar(polyData, 'dist_along_edge', binWidth)\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n binLabels = vtkNumpy.getNumpyFromVtk(polyData, 'bin_labels')\n distToEdge = vtkNumpy.getNumpyFromVtk(polyData, 'dist_perp_to_edge')\n\n numberOfBins = len(bins) - 1\n edgePoints = []\n for i in xrange(numberOfBins):\n binPoints = points[binLabels == i]\n binDists = distToEdge[binLabels == i]\n if len(binDists):\n edgePoints.append(binPoints[binDists.argmax()])\n\n return np.array(edgePoints)", "metadata": "root.computeEdge", "header": "['module', '___EOS___']", "index": 3422 }, { "content": "def computeCentroids(polyData, axis, binWidth=0.025):\n\n polyData = labelPointDistanceAlongAxis(polyData, axis, resultArrayName='dist_along_axis')\n\n polyData, bins = binByScalar(polyData, 'dist_along_axis', binWidth)\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n binLabels = vtkNumpy.getNumpyFromVtk(polyData, 'bin_labels')\n\n numberOfBins = len(bins) - 1\n centroids = []\n for i in xrange(numberOfBins):\n binPoints = points[binLabels == i]\n\n if len(binPoints):\n centroids.append(np.average(binPoints, axis=0))\n\n return np.array(centroids)", "metadata": "root.computeCentroids", "header": "['module', '___EOS___']", "index": 3444 }, { "content": "def computePointCountsAlongAxis(polyData, axis, binWidth=0.025):\n\n polyData = labelPointDistanceAlongAxis(polyData, axis, resultArrayName='dist_along_axis')\n\n polyData, bins = binByScalar(polyData, 'dist_along_axis', binWidth)\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n binLabels = vtkNumpy.getNumpyFromVtk(polyData, 'bin_labels')\n\n numberOfBins = len(bins) - 1\n binCount = []\n for i in xrange(numberOfBins):\n binPoints = points[binLabels == i]\n binCount.append(len(binPoints))\n\n return np.array(binCount)", "metadata": "root.computePointCountsAlongAxis", "header": "['module', '___EOS___']", "index": 3463 }, { "content": "def binByScalar(lidarData, scalarArrayName, binWidth, binLabelsArrayName='bin_labels'):\n '''\n Gets the array with name scalarArrayName from lidarData.\n Computes bins by dividing the scalar array into bins of size binWidth.\n Adds a new label array to the lidar points identifying which bin the point belongs to,\n where the first bin is labeled with 0.\n Returns the new, labeled lidar data and the bins.\n The bins are an array where each value represents a bin edge.\n '''\n\n scalars = vtkNumpy.getNumpyFromVtk(lidarData, scalarArrayName)\n bins = np.arange(scalars.min(), scalars.max()+binWidth, binWidth)\n binLabels = np.digitize(scalars, bins) - 1\n assert(len(binLabels) == len(scalars))\n newData = shallowCopy(lidarData)\n vtkNumpy.addNumpyToVtk(newData, binLabels, binLabelsArrayName)\n return newData, bins", "metadata": "root.binByScalar", "header": "['module', '___EOS___']", "index": 3482 }, { "content": "def showObbs(polyData):\n\n labelsArrayName = 'cluster_labels'\n assert polyData.GetPointData().GetArray(labelsArrayName)\n\n f = vtk.vtkAnnotateOBBs()\n f.SetInputArrayToProcess(0,0,0, vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS, labelsArrayName)\n f.SetInput(polyData)\n f.Update()\n showPolyData(f.GetOutput(), 'bboxes')", "metadata": "root.showObbs", "header": "['module', '___EOS___']", "index": 3501 }, { "content": "def getOrientedBoundingBox(polyData):\n '''\n returns origin, edges, and outline wireframe\n '''\n nPoints = polyData.GetNumberOfPoints()\n assert nPoints\n polyData = shallowCopy(polyData)\n\n labelsArrayName = 'bbox_labels'\n labels = np.ones(nPoints)\n vtkNumpy.addNumpyToVtk(polyData, labels, labelsArrayName)\n\n f = vtk.vtkAnnotateOBBs()\n f.SetInputArrayToProcess(0,0,0, vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS, labelsArrayName)\n f.SetInput(polyData)\n f.Update()\n\n assert f.GetNumberOfBoundingBoxes() == 1\n\n origin = np.zeros(3)\n edges = [np.zeros(3) for i in xrange(3)]\n\n f.GetBoundingBoxOrigin(0, origin)\n for i in xrange(3):\n f.GetBoundingBoxEdge(0, i, edges[i])\n\n return origin, edges, shallowCopy(f.GetOutput())", "metadata": "root.getOrientedBoundingBox", "header": "['module', '___EOS___']", "index": 3513 }, { "content": "def segmentBlockByAnnotation(blockDimensions, p1, p2, p3):\n\n segmentationObj = om.findObjectByName('pointcloud snapshot')\n segmentationObj.mapper.ScalarVisibilityOff()\n segmentationObj.setProperty('Point Size', 2)\n segmentationObj.setProperty('Alpha', 0.8)\n\n # constraint z to lie in plane\n #p1[2] = p2[2] = p3[2] = max(p1[2], p2[2], p3[2])\n\n zedge = p2 - p1\n zaxis = zedge / np.linalg.norm(zedge)\n\n #xwidth = distanceToLine(p3, p1, p2)\n\n # expected dimensions\n xwidth, ywidth = blockDimensions\n\n zwidth = np.linalg.norm(zedge)\n\n yaxis = np.cross(p2 - p1, p3 - p1)\n yaxis = yaxis / np.linalg.norm(yaxis)\n\n xaxis = np.cross(yaxis, zaxis)\n\n # reorient axes\n viewPlaneNormal = getSegmentationView().camera().GetViewPlaneNormal()\n if np.dot(yaxis, viewPlaneNormal) < 0:\n yaxis *= -1\n\n if np.dot(xaxis, p3 - p1) < 0:\n xaxis *= -1\n\n # make right handed\n zaxis = np.cross(xaxis, yaxis)\n\n origin = ((p1 + p2) / 2.0) + xaxis*xwidth/2.0 + yaxis*ywidth/2.0\n\n d = DebugData()\n d.addSphere(origin, radius=0.01)\n d.addLine(origin - xaxis*xwidth/2.0, origin + xaxis*xwidth/2.0)\n d.addLine(origin - yaxis*ywidth/2.0, origin + yaxis*ywidth/2.0)\n d.addLine(origin - zaxis*zwidth/2.0, origin + zaxis*zwidth/2.0)\n obj = updatePolyData(d.getPolyData(), 'block axes')\n obj.setProperty('Color', QtGui.QColor(255, 255, 0))\n obj.setProperty('Visible', False)\n om.findObjectByName('annotation').setProperty('Visible', False)\n\n cube = vtk.vtkCubeSource()\n cube.SetXLength(xwidth)\n cube.SetYLength(ywidth)\n cube.SetZLength(zwidth)\n cube.Update()\n cube = shallowCopy(cube.GetOutput())\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n obj = updatePolyData(cube, 'block affordance', cls=BlockAffordanceItem, parent='affordances')\n obj.actor.SetUserTransform(t)\n\n obj.addToView(app.getDRCView())\n\n params = dict(origin=origin, xwidth=xwidth, ywidth=ywidth, zwidth=zwidth, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis)\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()", "metadata": "root.segmentBlockByAnnotation", "header": "['module', '___EOS___']", "index": 3542 }, { "content": "def getBoardCorners(params):\n axes = [np.array(params[axis]) for axis in ['xaxis', 'yaxis', 'zaxis']]\n widths = [np.array(params[axis])/2.0 for axis in ['xwidth', 'ywidth', 'zwidth']]\n edges = [axes[i] * widths[i] for i in xrange(3)]\n origin = np.array(params['origin'])\n return [\n origin + edges[0] + edges[1] + edges[2],\n origin - edges[0] + edges[1] + edges[2],\n origin - edges[0] - edges[1] + edges[2],\n origin + edges[0] - edges[1] + edges[2],\n origin + edges[0] + edges[1] - edges[2],\n origin - edges[0] + edges[1] - edges[2],\n origin - edges[0] - edges[1] - edges[2],\n origin + edges[0] - edges[1] - edges[2],\n ]", "metadata": "root.getBoardCorners", "header": "['module', '___EOS___']", "index": 3615 }, { "content": "def getPointDistances(target, points):\n return np.array([np.linalg.norm(target - p) for p in points])", "metadata": "root.getPointDistances", "header": "['module', '___EOS___']", "index": 3631 }, { "content": "def computeClosestCorner(aff, referenceFrame):\n corners = getBoardCorners(aff.params)\n dists = getPointDistances(np.array(referenceFrame.GetPosition()), corners)\n return corners[dists.argmin()]", "metadata": "root.computeClosestCorner", "header": "['module', '___EOS___']", "index": 3635 }, { "content": "def computeGroundFrame(aff, referenceFrame):\n\n refAxis = [0.0, -1.0, 0.0]\n referenceFrame.TransformVector(refAxis, refAxis)\n\n refAxis = np.array(refAxis)\n\n axes = [np.array(aff.params[axis]) for axis in ['xaxis', 'yaxis', 'zaxis']]\n axisProjections = np.array([np.abs(np.dot(axis, refAxis)) for axis in axes])\n boardAxis = axes[axisProjections.argmax()]\n if np.dot(boardAxis, refAxis) < 0:\n boardAxis = -boardAxis\n\n xaxis = boardAxis\n zaxis = np.array([0.0, 0.0, 1.0])\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n closestCorner = computeClosestCorner(aff, referenceFrame)\n groundFrame = getTransformFromAxes(xaxis, yaxis, zaxis)\n groundFrame.PostMultiply()\n groundFrame.Translate(closestCorner[0], closestCorner[1], 0.0)\n return groundFrame", "metadata": "root.computeGroundFrame", "header": "['module', '___EOS___']", "index": 3641 }, { "content": "def computeCornerFrame(aff, referenceFrame):\n\n refAxis = [0.0, -1.0, 0.0]\n referenceFrame.TransformVector(refAxis, refAxis)\n\n refAxis = np.array(refAxis)\n\n axes = [np.array(aff.params[axis]) for axis in ['xaxis', 'yaxis', 'zaxis']]\n edgeLengths = [edgeLength for edgeLength in ['xwidth', 'ywidth', 'zwidth']]\n\n axisProjections = np.array([np.abs(np.dot(axis, refAxis)) for axis in axes])\n boardAxis = axes[axisProjections.argmax()]\n if np.dot(boardAxis, refAxis) < 0:\n boardAxis = -boardAxis\n\n longAxis = axes[np.argmax(edgeLengths)]\n\n xaxis = boardAxis\n yaxis = axes[2]\n zaxis = np.cross(xaxis, yaxis)\n\n closestCorner = computeClosestCorner(aff, referenceFrame)\n cornerFrame = getTransformFromAxes(xaxis, yaxis, zaxis)\n cornerFrame.PostMultiply()\n cornerFrame.Translate(closestCorner)\n return cornerFrame", "metadata": "root.computeCornerFrame", "header": "['module', '___EOS___']", "index": 3666 }, { "content": "def publishTriad(transform, collectionId=1234):\n\n o = lcmvs.obj_t()\n\n xyz = transform.GetPosition()\n rpy = transformUtils.rollPitchYawFromTransform(transform)\n\n o.roll, o.pitch, o.yaw = rpy\n o.x, o.y, o.z = xyz\n o.id = 1\n\n m = lcmvs.obj_collection_t()\n m.id = collectionId\n m.name = 'stance_triads'\n m.type = lcmvs.obj_collection_t.AXIS3D\n m.nobjs = 1\n m.reset = False\n m.objs = [o]\n\n lcmUtils.publish('OBJ_COLLECTION', m)", "metadata": "root.publishTriad", "header": "['module', '___EOS___']", "index": 3694 }, { "content": "def createBlockAffordance(origin, xaxis, yaxis, zaxis, xwidth, ywidth, zwidth, name, parent='affordances'):\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n obj = BoxAffordanceItem(name, view=app.getCurrentRenderView())\n obj.setProperty('Dimensions', [float(v) for v in [xwidth, ywidth, zwidth]])\n obj.actor.SetUserTransform(t)\n\n om.addToObjectModel(obj, parentObj=om.getOrCreateContainer(parent))\n frameObj = vis.showFrame(t, name + ' frame', scale=0.2, visible=False, parent=obj)\n\n obj.addToView(app.getDRCView())\n frameObj.addToView(app.getDRCView())\n\n affordanceManager.registerAffordance(obj)\n return obj", "metadata": "root.createBlockAffordance", "header": "['module', '___EOS___']", "index": 3716 }, { "content": "def segmentBlockByTopPlane(polyData, blockDimensions, expectedNormal, expectedXAxis, edgeSign=1, name='block affordance'):\n\n polyData, planeOrigin, normal = applyPlaneFit(polyData, distanceThreshold=0.05, expectedNormal=expectedNormal, returnOrigin=True)\n\n _, lineDirection, _ = applyLineFit(polyData)\n\n zaxis = lineDirection\n yaxis = normal\n xaxis = np.cross(yaxis, zaxis)\n\n if np.dot(xaxis, expectedXAxis) < 0:\n xaxis *= -1\n\n # make right handed\n zaxis = np.cross(xaxis, yaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis /= np.linalg.norm(zaxis)\n\n expectedXAxis = np.array(xaxis)\n\n edgePoints = computeEdge(polyData, zaxis, xaxis*edgeSign)\n edgePoints = vtkNumpy.getVtkPolyDataFromNumpyPoints(edgePoints)\n\n d = DebugData()\n obj = updatePolyData(edgePoints, 'edge points', parent=getDebugFolder(), visible=False)\n\n linePoint, lineDirection, _ = applyLineFit(edgePoints)\n zaxis = lineDirection\n xaxis = np.cross(yaxis, zaxis)\n\n\n if np.dot(xaxis, expectedXAxis) < 0:\n xaxis *= -1\n\n # make right handed\n zaxis = np.cross(xaxis, yaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis /= np.linalg.norm(zaxis)\n\n polyData = labelPointDistanceAlongAxis(polyData, xaxis, resultArrayName='dist_along_line')\n pts = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n\n dists = np.dot(pts-linePoint, zaxis)\n\n p1 = linePoint + zaxis*np.min(dists)\n p2 = linePoint + zaxis*np.max(dists)\n\n p1 = projectPointToPlane(p1, planeOrigin, normal)\n p2 = projectPointToPlane(p2, planeOrigin, normal)\n\n xwidth, ywidth = blockDimensions\n zwidth = np.linalg.norm(p2 - p1)\n\n origin = p1 - edgeSign*xaxis*xwidth/2.0 - yaxis*ywidth/2.0 + zaxis*zwidth/2.0\n\n d = DebugData()\n\n #d.addSphere(linePoint, radius=0.02)\n #d.addLine(linePoint, linePoint + yaxis*ywidth)\n #d.addLine(linePoint, linePoint + xaxis*xwidth)\n #d.addLine(linePoint, linePoint + zaxis*zwidth)\n\n\n d.addSphere(p1, radius=0.01)\n d.addSphere(p2, radius=0.01)\n d.addLine(p1, p2)\n\n d.addSphere(origin, radius=0.01)\n #d.addLine(origin - xaxis*xwidth/2.0, origin + xaxis*xwidth/2.0)\n #d.addLine(origin - yaxis*ywidth/2.0, origin + yaxis*ywidth/2.0)\n #d.addLine(origin - zaxis*zwidth/2.0, origin + zaxis*zwidth/2.0)\n\n d.addLine(origin, origin + xaxis*xwidth/2.0)\n d.addLine(origin, origin + yaxis*ywidth/2.0)\n d.addLine(origin, origin + zaxis*zwidth/2.0)\n\n\n #obj = updatePolyData(d.getPolyData(), 'block axes')\n #obj.setProperty('Color', QtGui.QColor(255, 255, 0))\n #obj.setProperty('Visible', False)\n\n obj = createBlockAffordance(origin, xaxis, yaxis, zaxis, xwidth, ywidth, zwidth, name)\n obj.setProperty('Color', [222/255.0, 184/255.0, 135/255.0])\n\n computeDebrisGraspSeed(obj)\n t = computeDebrisStanceFrame(obj)\n if t:\n showFrame(t, 'debris stance frame', parent=obj)\n obj.publishCallback = functools.partial(publishDebrisStanceFrame, obj)\n\n return obj", "metadata": "root.segmentBlockByTopPlane", "header": "['module', '___EOS___']", "index": 3736 }, { "content": "def computeDebrisGraspSeed(aff):\n\n debrisReferenceFrame = om.findObjectByName('debris reference frame')\n if debrisReferenceFrame:\n\n debrisReferenceFrame = debrisReferenceFrame.transform\n affCornerFrame = computeCornerFrame(aff, debrisReferenceFrame)\n showFrame(affCornerFrame, 'board corner frame', parent=aff, visible=False)", "metadata": "root.computeDebrisGraspSeed", "header": "['module', '___EOS___']", "index": 3831 }, { "content": "def computeDebrisStanceFrame(aff):\n\n debrisReferenceFrame = om.findObjectByName('debris reference frame')\n debrisWallEdge = om.findObjectByName('debris plane edge')\n\n if debrisReferenceFrame and debrisWallEdge:\n\n debrisReferenceFrame = debrisReferenceFrame.transform\n\n affGroundFrame = computeGroundFrame(aff, debrisReferenceFrame)\n\n updateFrame(affGroundFrame, 'board ground frame', parent=getDebugFolder(), visible=False)\n\n affWallEdge = computeGroundFrame(aff, debrisReferenceFrame)\n\n framePos = np.array(affGroundFrame.GetPosition())\n p1, p2 = debrisWallEdge.points\n edgeAxis = p2 - p1\n edgeAxis /= np.linalg.norm(edgeAxis)\n projectedPos = p1 + edgeAxis * np.dot(framePos - p1, edgeAxis)\n\n affWallFrame = vtk.vtkTransform()\n affWallFrame.PostMultiply()\n\n useWallFrameForRotation = True\n\n if useWallFrameForRotation:\n affWallFrame.SetMatrix(debrisReferenceFrame.GetMatrix())\n affWallFrame.Translate(projectedPos - np.array(debrisReferenceFrame.GetPosition()))\n\n stanceWidth = 0.20\n stanceOffsetX = -0.35\n stanceOffsetY = 0.45\n stanceRotation = 0.0\n\n else:\n affWallFrame.SetMatrix(affGroundFrame.GetMatrix())\n affWallFrame.Translate(projectedPos - framePos)\n\n stanceWidth = 0.20\n stanceOffsetX = -0.35\n stanceOffsetY = -0.45\n stanceRotation = math.pi/2.0\n\n stanceFrame, _, _ = getFootFramesFromReferenceFrame(affWallFrame, stanceWidth, math.degrees(stanceRotation), [stanceOffsetX, stanceOffsetY, 0.0])\n\n return stanceFrame", "metadata": "root.computeDebrisStanceFrame", "header": "['module', '___EOS___']", "index": 3841 }, { "content": "def publishDebrisStanceFrame(aff):\n frame = computeDebrisStanceFrame(aff)\n publishTriad(frame)", "metadata": "root.publishDebrisStanceFrame", "header": "['module', '___EOS___']", "index": 3890 }, { "content": "def segmentBlockByPlanes(blockDimensions):\n\n planes = om.findObjectByName('selected planes').children()[:2]\n\n viewPlaneNormal = getSegmentationView().camera().GetViewPlaneNormal()\n origin1, normal1, plane1 = getPlaneEquationFromPolyData(planes[0].polyData, expectedNormal=viewPlaneNormal)\n origin2, normal2, plane2 = getPlaneEquationFromPolyData(planes[1].polyData, expectedNormal=viewPlaneNormal)\n\n xaxis = normal2\n yaxis = normal1\n zaxis = np.cross(xaxis, yaxis)\n xaxis = np.cross(yaxis, zaxis)\n\n pts1 = vtkNumpy.getNumpyFromVtk(planes[0].polyData, 'Points')\n pts2 = vtkNumpy.getNumpyFromVtk(planes[1].polyData, 'Points')\n\n linePoint = np.zeros(3)\n centroid2 = np.sum(pts2, axis=0)/len(pts2)\n vtk.vtkPlane.ProjectPoint(centroid2, origin1, normal1, linePoint)\n\n dists = np.dot(pts1-linePoint, zaxis)\n\n p1 = linePoint + zaxis*np.min(dists)\n p2 = linePoint + zaxis*np.max(dists)\n\n xwidth, ywidth = blockDimensions\n zwidth = np.linalg.norm(p2 - p1)\n\n origin = p1 + xaxis*xwidth/2.0 + yaxis*ywidth/2.0 + zaxis*zwidth/2.0\n\n d = DebugData()\n\n d.addSphere(linePoint, radius=0.02)\n d.addSphere(p1, radius=0.01)\n d.addSphere(p2, radius=0.01)\n d.addLine(p1, p2)\n\n d.addSphere(origin, radius=0.01)\n d.addLine(origin - xaxis*xwidth/2.0, origin + xaxis*xwidth/2.0)\n d.addLine(origin - yaxis*ywidth/2.0, origin + yaxis*ywidth/2.0)\n d.addLine(origin - zaxis*zwidth/2.0, origin + zaxis*zwidth/2.0)\n obj = updatePolyData(d.getPolyData(), 'block axes')\n obj.setProperty('Color', QtGui.QColor(255, 255, 0))\n obj.setProperty('Visible', False)\n\n cube = vtk.vtkCubeSource()\n cube.SetXLength(xwidth)\n cube.SetYLength(ywidth)\n cube.SetZLength(zwidth)\n cube.Update()\n cube = shallowCopy(cube.GetOutput())\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n obj = updatePolyData(cube, 'block affordance', cls=BlockAffordanceItem, parent='affordances')\n obj.actor.SetUserTransform(t)\n obj.addToView(app.getDRCView())\n\n params = dict(origin=origin, xwidth=xwidth, ywidth=ywidth, zwidth=zwidth, xaxis=xaxis, yaxis=yaxis, zaxis=zaxis)\n obj.setAffordanceParams(params)\n obj.updateParamsFromActorTransform()", "metadata": "root.segmentBlockByPlanes", "header": "['module', '___EOS___']", "index": 3895 }, { "content": "def estimatePointerTip(robotModel, polyData):\n '''\n Given a robot model, uses forward kinematics to determine a pointer tip\n search region, then does a ransac line fit in the search region to find\n points on the pointer, and selects the maximum point along the line fit\n as the pointer tip. Returns the pointer tip xyz on success and returns\n None on failure.\n '''\n palmFrame = robotModel.getLinkFrame('r_hand_force_torque')\n p1 = [0.0, 0.14, -0.06]\n p2 = [0.0, 0.24, -0.06]\n\n palmFrame.TransformPoint(p1, p1)\n palmFrame.TransformPoint(p2, p2)\n\n p1 = np.array(p1)\n p2 = np.array(p2)\n\n d = DebugData()\n d.addSphere(p1, radius=0.005)\n d.addSphere(p2, radius=0.005)\n d.addLine(p1, p2)\n vis.updatePolyData(d.getPolyData(), 'pointer line', color=[1,0,0], parent=getDebugFolder(), visible=False)\n\n polyData = cropToLineSegment(polyData, p1, p2)\n if not polyData.GetNumberOfPoints():\n #print 'pointer search region is empty'\n return None\n\n vis.updatePolyData(polyData, 'cropped to pointer line', parent=getDebugFolder(), visible=False)\n\n polyData = labelDistanceToLine(polyData, p1, p2)\n\n polyData = thresholdPoints(polyData, 'distance_to_line', [0.0, 0.07])\n\n if polyData.GetNumberOfPoints() < 2:\n #print 'pointer search region is empty'\n return None\n\n updatePolyData(polyData, 'distance to pointer line', colorByName='distance_to_line', parent=getDebugFolder(), visible=False)\n\n ransacDistanceThreshold = 0.0075\n lineOrigin, lineDirection, polyData = applyLineFit(polyData, distanceThreshold=ransacDistanceThreshold)\n updatePolyData(polyData, 'line fit ransac', colorByName='ransac_labels', parent=getDebugFolder(), visible=False)\n\n\n lineDirection = np.array(lineDirection)\n lineDirection /= np.linalg.norm(lineDirection)\n\n if np.dot(lineDirection, (p2 - p1)) < 0:\n lineDirection *= -1\n\n polyData = thresholdPoints(polyData, 'ransac_labels', [1.0, 1.0])\n\n if polyData.GetNumberOfPoints() < 2:\n #print 'pointer ransac line fit failed to find inliers'\n return None\n\n obj = updatePolyData(polyData, 'line fit points', colorByName='dist_along_line', parent=getDebugFolder(), visible=True)\n obj.setProperty('Point Size', 5)\n\n pts = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n\n dists = np.dot(pts-lineOrigin, lineDirection)\n\n p1 = lineOrigin + lineDirection*np.min(dists)\n p2 = lineOrigin + lineDirection*np.max(dists)\n\n d = DebugData()\n #d.addSphere(p1, radius=0.005)\n d.addSphere(p2, radius=0.005)\n d.addLine(p1, p2)\n vis.updatePolyData(d.getPolyData(), 'fit pointer line', color=[0,1,0], parent=getDebugFolder(), visible=True)\n\n return p2", "metadata": "root.estimatePointerTip", "header": "['module', '___EOS___']", "index": 3960 }, { "content": "def startBoundedPlaneSegmentation():\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.start()\n picker.annotationFunc = functools.partial(segmentBoundedPlaneByAnnotation)", "metadata": "root.startBoundedPlaneSegmentation", "header": "['module', '___EOS___']", "index": 4037 }, { "content": "def startValveSegmentationByWallPlane(expectedValveRadius):\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.start()\n picker.annotationFunc = functools.partial(segmentValveByWallPlane, expectedValveRadius)", "metadata": "root.startValveSegmentationByWallPlane", "header": "['module', '___EOS___']", "index": 4046 }, { "content": "def startValveSegmentationManual(expectedValveRadius):\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentValve, expectedValveRadius)", "metadata": "root.startValveSegmentationManual", "header": "['module', '___EOS___']", "index": 4055 }, { "content": "def startRefitWall():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.start()\n picker.annotationFunc = refitWall", "metadata": "root.startRefitWall", "header": "['module', '___EOS___']", "index": 4065 }, { "content": "def startWyeSegmentation():\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentWye)", "metadata": "root.startWyeSegmentation", "header": "['module', '___EOS___']", "index": 4075 }, { "content": "def startDoorHandleSegmentation(otdfType):\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentDoorHandle, otdfType)", "metadata": "root.startDoorHandleSegmentation", "header": "['module', '___EOS___']", "index": 4085 }, { "content": "def startTrussSegmentation():\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = True\n picker.start()\n picker.annotationFunc = functools.partial(segmentTruss)", "metadata": "root.startTrussSegmentation", "header": "['module', '___EOS___']", "index": 4095 }, { "content": "def startHoseNozzleSegmentation():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentHoseNozzle)", "metadata": "root.startHoseNozzleSegmentation", "header": "['module', '___EOS___']", "index": 4105 }, { "content": "def storePoint(p):\n global _pickPoint\n _pickPoint = p", "metadata": "root.storePoint", "header": "['module', '___EOS___']", "index": 4115 }, { "content": "def getPickPoint():\n global _pickPoint\n return _pickPoint", "metadata": "root.getPickPoint", "header": "['module', '___EOS___']", "index": 4120 }, { "content": "def startPickPoint():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = storePoint", "metadata": "root.startPickPoint", "header": "['module', '___EOS___']", "index": 4125 }, { "content": "def startSelectToolTip():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = selectToolTip", "metadata": "root.startSelectToolTip", "header": "['module', '___EOS___']", "index": 4135 }, { "content": "def startDrillSegmentation():\n\n picker = PointPicker(numberOfPoints=3)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrill)", "metadata": "root.startDrillSegmentation", "header": "['module', '___EOS___']", "index": 4145 }, { "content": "def startDrillAutoSegmentation():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrillAuto)", "metadata": "root.startDrillAutoSegmentation", "header": "['module', '___EOS___']", "index": 4155 }, { "content": "def startDrillButtonSegmentation():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrillButton)", "metadata": "root.startDrillButtonSegmentation", "header": "['module', '___EOS___']", "index": 4165 }, { "content": "def startPointerTipSegmentation():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentPointerTip)", "metadata": "root.startPointerTipSegmentation", "header": "['module', '___EOS___']", "index": 4175 }, { "content": "def startDrillAutoSegmentationAlignedWithTable():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrillAlignedWithTable)", "metadata": "root.startDrillAutoSegmentationAlignedWithTable", "header": "['module', '___EOS___']", "index": 4185 }, { "content": "def startDrillBarrelSegmentation():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrillBarrel)", "metadata": "root.startDrillBarrelSegmentation", "header": "['module', '___EOS___']", "index": 4195 }, { "content": "def startDrillWallSegmentation():\n\n picker = PointPicker(numberOfPoints=3)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = True\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrillWall)", "metadata": "root.startDrillWallSegmentation", "header": "['module', '___EOS___']", "index": 4205 }, { "content": "def startDrillWallSegmentationConstrained(rightAngleLocation):\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = False\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrillWallConstrained, rightAngleLocation)", "metadata": "root.startDrillWallSegmentationConstrained", "header": "['module', '___EOS___']", "index": 4214 }, { "content": "def startDrillInHandSegmentation():\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.drawLines = True\n picker.start()\n picker.annotationFunc = functools.partial(segmentDrillInHand)", "metadata": "root.startDrillInHandSegmentation", "header": "['module', '___EOS___']", "index": 4223 }, { "content": "def startSegmentDebrisWall():\n\n picker = PointPicker(numberOfPoints=1)\n addViewPicker(picker)\n picker.enabled = True\n picker.start()\n picker.annotationFunc = functools.partial(segmentDebrisWall)", "metadata": "root.startSegmentDebrisWall", "header": "['module', '___EOS___']", "index": 4233 }, { "content": "def startSegmentDebrisWallManual():\n\n picker = PointPicker(numberOfPoints=2)\n addViewPicker(picker)\n picker.enabled = True\n picker.start()\n picker.annotationFunc = functools.partial(segmentDebrisWallManual)", "metadata": "root.startSegmentDebrisWallManual", "header": "['module', '___EOS___']", "index": 4241 }, { "content": "def selectToolTip(point1):\n print point1", "metadata": "root.selectToolTip", "header": "['module', '___EOS___']", "index": 4250 }, { "content": "def segmentDebrisWallManual(point1, point2):\n\n p1, p2 = point1, point2\n\n d = DebugData()\n d.addSphere(p1, radius=0.01)\n d.addSphere(p2, radius=0.01)\n d.addLine(p1, p2)\n edgeObj = updatePolyData(d.getPolyData(), 'debris plane edge', visible=True)\n edgeObj.points = [p1, p2]\n\n xaxis = p2 - p1\n xaxis /= np.linalg.norm(xaxis)\n zaxis = np.array([0.0, 0.0, 1.0])\n yaxis = np.cross(zaxis, xaxis)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(p1)\n\n updateFrame(t, 'debris plane frame', parent=edgeObj, visible=False)\n\n refFrame = vtk.vtkTransform()\n refFrame.PostMultiply()\n refFrame.SetMatrix(t.GetMatrix())\n refFrame.Translate(-xaxis + yaxis + zaxis*20.0)\n updateFrame(refFrame, 'debris reference frame', parent=edgeObj, visible=False)", "metadata": "root.segmentDebrisWallManual", "header": "['module', '___EOS___']", "index": 4255 }, { "content": "def segmentDebrisWall(point1):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = shallowCopy(inputObj.polyData)\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n\n polyData, origin, normal = applyPlaneFit(polyData, distanceThreshold=0.02, expectedNormal=viewPlaneNormal, perpendicularAxis=viewPlaneNormal,\n searchOrigin=point1, searchRadius=0.25, angleEpsilon=0.7, returnOrigin=True)\n\n\n planePoints = thresholdPoints(polyData, 'dist_to_plane', [-0.02, 0.02])\n updatePolyData(planePoints, 'unbounded plane points', parent=getDebugFolder(), visible=False)\n\n\n planePoints = applyVoxelGrid(planePoints, leafSize=0.03)\n planePoints = labelOutliers(planePoints, searchRadius=0.06, neighborsInSearchRadius=10)\n\n updatePolyData(planePoints, 'voxel plane points', parent=getDebugFolder(), colorByName='is_outlier', visible=False)\n\n planePoints = thresholdPoints(planePoints, 'is_outlier', [0, 0])\n\n planePoints = labelDistanceToPoint(planePoints, point1)\n clusters = extractClusters(planePoints, clusterTolerance=0.10)\n clusters.sort(key=lambda x: vtkNumpy.getNumpyFromVtk(x, 'distance_to_point').min())\n\n planePoints = clusters[0]\n planeObj = updatePolyData(planePoints, 'debris plane points', parent=getDebugFolder(), visible=False)\n\n\n perpAxis = [0,0,-1]\n perpAxis /= np.linalg.norm(perpAxis)\n edgeAxis = np.cross(normal, perpAxis)\n\n edgePoints = computeEdge(planePoints, edgeAxis, perpAxis)\n edgePoints = vtkNumpy.getVtkPolyDataFromNumpyPoints(edgePoints)\n updatePolyData(edgePoints, 'edge points', parent=getDebugFolder(), visible=False)\n\n\n linePoint, lineDirection, _ = applyLineFit(edgePoints)\n\n #binCounts = computePointCountsAlongAxis(planePoints, lineDirection)\n\n\n xaxis = lineDirection\n yaxis = normal\n\n zaxis = np.cross(xaxis, yaxis)\n\n if np.dot(zaxis, [0, 0, 1]) < 0:\n zaxis *= -1\n xaxis *= -1\n\n pts = vtkNumpy.getNumpyFromVtk(planePoints, 'Points')\n\n dists = np.dot(pts-linePoint, xaxis)\n\n p1 = linePoint + xaxis*np.min(dists)\n p2 = linePoint + xaxis*np.max(dists)\n\n p1 = projectPointToPlane(p1, origin, normal)\n p2 = projectPointToPlane(p2, origin, normal)\n\n d = DebugData()\n d.addSphere(p1, radius=0.01)\n d.addSphere(p2, radius=0.01)\n d.addLine(p1, p2)\n edgeObj = updatePolyData(d.getPolyData(), 'debris plane edge', parent=planeObj, visible=True)\n edgeObj.points = [p1, p2]\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(p1)\n\n updateFrame(t, 'debris plane frame', parent=planeObj, visible=False)\n\n refFrame = vtk.vtkTransform()\n refFrame.PostMultiply()\n refFrame.SetMatrix(t.GetMatrix())\n refFrame.Translate(-xaxis + yaxis + zaxis*20.0)\n updateFrame(refFrame, 'debris reference frame', parent=planeObj, visible=False)", "metadata": "root.segmentDebrisWall", "header": "['module', '___EOS___']", "index": 4284 }, { "content": "def segmentBoundedPlaneByAnnotation(point1, point2):\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = shallowCopy(inputObj.polyData)\n\n\n viewPlaneNormal = np.array(getSegmentationView().camera().GetViewPlaneNormal())\n\n polyData, origin, normal = applyPlaneFit(polyData, distanceThreshold=0.015, expectedNormal=viewPlaneNormal, perpendicularAxis=viewPlaneNormal,\n searchOrigin=point1, searchRadius=0.3, angleEpsilon=0.7, returnOrigin=True)\n\n\n planePoints = thresholdPoints(polyData, 'dist_to_plane', [-0.015, 0.015])\n updatePolyData(planePoints, 'unbounded plane points', parent=getDebugFolder(), visible=False)\n\n\n planePoints = applyVoxelGrid(planePoints, leafSize=0.03)\n planePoints = labelOutliers(planePoints, searchRadius=0.06, neighborsInSearchRadius=12)\n\n updatePolyData(planePoints, 'voxel plane points', parent=getDebugFolder(), colorByName='is_outlier', visible=False)\n\n planePoints = thresholdPoints(planePoints, 'is_outlier', [0, 0])\n\n planePoints = labelDistanceToPoint(planePoints, point1)\n clusters = extractClusters(planePoints, clusterTolerance=0.10)\n clusters.sort(key=lambda x: vtkNumpy.getNumpyFromVtk(x, 'distance_to_point').min())\n\n planePoints = clusters[0]\n updatePolyData(planePoints, 'plane points', parent=getDebugFolder(), visible=False)\n\n\n perpAxis = point2 - point1\n perpAxis /= np.linalg.norm(perpAxis)\n edgeAxis = np.cross(normal, perpAxis)\n\n edgePoints = computeEdge(planePoints, edgeAxis, perpAxis)\n edgePoints = vtkNumpy.getVtkPolyDataFromNumpyPoints(edgePoints)\n updatePolyData(edgePoints, 'edge points', parent=getDebugFolder(), visible=False)\n\n\n linePoint, lineDirection, _ = applyLineFit(edgePoints)\n\n zaxis = normal\n yaxis = lineDirection\n xaxis = np.cross(yaxis, zaxis)\n\n if np.dot(xaxis, perpAxis) < 0:\n xaxis *= -1\n\n # make right handed\n yaxis = np.cross(zaxis, xaxis)\n\n pts = vtkNumpy.getNumpyFromVtk(planePoints, 'Points')\n\n dists = np.dot(pts-linePoint, yaxis)\n\n p1 = linePoint + yaxis*np.min(dists)\n p2 = linePoint + yaxis*np.max(dists)\n\n p1 = projectPointToPlane(p1, origin, normal)\n p2 = projectPointToPlane(p2, origin, normal)\n\n d = DebugData()\n d.addSphere(p1, radius=0.01)\n d.addSphere(p2, radius=0.01)\n d.addLine(p1, p2)\n updatePolyData(d.getPolyData(), 'plane edge', parent=getDebugFolder(), visible=False)\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate((p1 + p2)/ 2.0)\n\n updateFrame(t, 'plane edge frame', parent=getDebugFolder(), visible=False)", "metadata": "root.segmentBoundedPlaneByAnnotation", "header": "['module', '___EOS___']", "index": 4367 }, { "content": "def perspective():\n\n global savedCameraParams\n if savedCameraParams is None:\n return\n\n aff = getDefaultAffordanceObject()\n if aff:\n aff.setProperty('Alpha', 1.0)\n\n obj = om.findObjectByName('pointcloud snapshot')\n if obj is not None:\n obj.actor.SetPickable(1)\n\n view = getSegmentationView()\n c = view.camera()\n c.ParallelProjectionOff()\n c.SetPosition(savedCameraParams['Position'])\n c.SetFocalPoint(savedCameraParams['FocalPoint'])\n c.SetViewUp(savedCameraParams['ViewUp'])\n view.setCameraManipulationStyle()\n view.render()", "metadata": "root.perspective", "header": "['module', '___EOS___']", "index": 4445 }, { "content": "def saveCameraParams(overwrite=False):\n\n global savedCameraParams\n if overwrite or (savedCameraParams is None):\n\n view = getSegmentationView()\n c = view.camera()\n savedCameraParams = dict(Position=c.GetPosition(), FocalPoint=c.GetFocalPoint(), ViewUp=c.GetViewUp())", "metadata": "root.saveCameraParams", "header": "['module', '___EOS___']", "index": 4469 }, { "content": "def getDefaultAffordanceObject():\n\n obj = om.getActiveObject()\n if isinstance(obj, AffordanceItem):\n return obj\n\n for obj in om.getObjects():\n if isinstance(obj, AffordanceItem):\n return obj", "metadata": "root.getDefaultAffordanceObject", "header": "['module', '___EOS___']", "index": 4480 }, { "content": "def getVisibleRobotModel():\n for obj in om.getObjects():\n if isinstance(obj, roboturdf.RobotModelItem) and obj.getProperty('Visible'):\n return obj", "metadata": "root.getVisibleRobotModel", "header": "['module', '___EOS___']", "index": 4490 }, { "content": "def orthoX():\n\n aff = getDefaultAffordanceObject()\n if not aff:\n return\n\n saveCameraParams()\n\n aff.updateParamsFromActorTransform()\n aff.setProperty('Alpha', 0.3)\n om.findObjectByName('pointcloud snapshot').actor.SetPickable(0)\n\n view = getSegmentationView()\n c = view.camera()\n c.ParallelProjectionOn()\n\n origin = aff.params['origin']\n viewDirection = aff.params['xaxis']\n viewUp = -aff.params['yaxis']\n viewDistance = aff.params['xwidth']*3\n scale = aff.params['zwidth']\n\n c.SetFocalPoint(origin)\n c.SetPosition(origin - viewDirection*viewDistance)\n c.SetViewUp(viewUp)\n c.SetParallelScale(scale)\n\n view.setActorManipulationStyle()\n view.render()", "metadata": "root.orthoX", "header": "['module', '___EOS___']", "index": 4495 }, { "content": "def orthoY():\n\n aff = getDefaultAffordanceObject()\n if not aff:\n return\n\n saveCameraParams()\n\n aff.updateParamsFromActorTransform()\n aff.setProperty('Alpha', 0.3)\n om.findObjectByName('pointcloud snapshot').actor.SetPickable(0)\n\n view = getSegmentationView()\n c = view.camera()\n c.ParallelProjectionOn()\n\n origin = aff.params['origin']\n viewDirection = aff.params['yaxis']\n viewUp = -aff.params['xaxis']\n viewDistance = aff.params['ywidth']*4\n scale = aff.params['zwidth']\n\n c.SetFocalPoint(origin)\n c.SetPosition(origin - viewDirection*viewDistance)\n c.SetViewUp(viewUp)\n c.SetParallelScale(scale)\n\n view.setActorManipulationStyle()\n view.render()", "metadata": "root.orthoY", "header": "['module', '___EOS___']", "index": 4526 }, { "content": "def orthoZ():\n\n aff = getDefaultAffordanceObject()\n if not aff:\n return\n\n saveCameraParams()\n\n aff.updateParamsFromActorTransform()\n aff.setProperty('Alpha', 0.3)\n om.findObjectByName('pointcloud snapshot').actor.SetPickable(0)\n\n view = getSegmentationView()\n c = view.camera()\n c.ParallelProjectionOn()\n\n origin = aff.params['origin']\n viewDirection = aff.params['zaxis']\n viewUp = -aff.params['yaxis']\n viewDistance = aff.params['zwidth']\n scale = aff.params['ywidth']*6\n\n c.SetFocalPoint(origin)\n c.SetPosition(origin - viewDirection*viewDistance)\n c.SetViewUp(viewUp)\n c.SetParallelScale(scale)\n\n view.setActorManipulationStyle()\n view.render()", "metadata": "root.orthoZ", "header": "['module', '___EOS___']", "index": 4557 }, { "content": "def zoomToDisplayPoint(displayPoint, boundsRadius=0.5, view=None):\n\n pickedPoint = pickPoint(displayPoint, getSegmentationView(), obj='pointcloud snapshot')\n if pickedPoint is None:\n return\n\n view = view or app.getCurrentRenderView()\n\n worldPt1, worldPt2 = getRayFromDisplayPoint(getSegmentationView(), displayPoint)\n\n diagonal = np.array([boundsRadius, boundsRadius, boundsRadius])\n bounds = np.hstack([pickedPoint - diagonal, pickedPoint + diagonal])\n bounds = [bounds[0], bounds[3], bounds[1], bounds[4], bounds[2], bounds[5]]\n view.renderer().ResetCamera(bounds)\n view.camera().SetFocalPoint(pickedPoint)\n view.render()", "metadata": "root.zoomToDisplayPoint", "header": "['module', '___EOS___']", "index": 4588 }, { "content": "def extractPointsAlongClickRay(position, ray, polyData=None, distanceToLineThreshold=0.025, nearestToCamera=False):\n\n #segmentationObj = om.findObjectByName('pointcloud snapshot')\n if polyData is None:\n polyData = getCurrentRevolutionData()\n\n if not polyData or not polyData.GetNumberOfPoints():\n return None\n\n polyData = labelDistanceToLine(polyData, position, position + ray)\n\n # extract points near line\n polyData = thresholdPoints(polyData, 'distance_to_line', [0.0, distanceToLineThreshold])\n if not polyData.GetNumberOfPoints():\n return None\n\n\n polyData = labelPointDistanceAlongAxis(polyData, ray, origin=position, resultArrayName='distance_along_line')\n polyData = thresholdPoints(polyData, 'distance_along_line', [0.20, 1e6])\n if not polyData.GetNumberOfPoints():\n return None\n\n updatePolyData(polyData, 'ray points', colorByName='distance_to_line', visible=False, parent=getDebugFolder())\n\n if nearestToCamera:\n dists = vtkNumpy.getNumpyFromVtk(polyData, 'distance_along_line')\n else:\n dists = vtkNumpy.getNumpyFromVtk(polyData, 'distance_to_line')\n\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n intersectionPoint = points[dists.argmin()]\n\n d = DebugData()\n d.addSphere( intersectionPoint, radius=0.005)\n d.addLine(position, intersectionPoint)\n obj = updatePolyData(d.getPolyData(), 'intersecting ray', visible=False, color=[0,1,0], parent=getDebugFolder())\n obj.actor.GetProperty().SetLineWidth(2)\n\n d2 = DebugData()\n end_of_ray = position + 2*ray\n d2.addLine(position, end_of_ray)\n obj2 = updatePolyData(d2.getPolyData(), 'camera ray', visible=False, color=[1,0,0], parent=getDebugFolder())\n obj2.actor.GetProperty().SetLineWidth(2)\n\n return intersectionPoint", "metadata": "root.extractPointsAlongClickRay", "header": "['module', '___EOS___']", "index": 4606 }, { "content": "def segmentDrillWallFromTag(position, ray):\n '''\n Fix the drill wall relative to a ray intersected with the wall\n Desc: given a position and a ray (typically derived from a camera pixel)\n Use that point to determine a position for the Drill Wall\n This function uses a hard coded offset between the position on the wall\n to produce the drill cutting origin\n '''\n\n\n #inputObj = om.findObjectByName('pointcloud snapshot')\n #polyData = shallowCopy(inputObj.polyData)\n polyData = getCurrentRevolutionData()\n\n if (polyData is None): # no data yet\n print \"no LIDAR data yet\"\n return False\n\n point1 = extractPointsAlongClickRay(position, ray, polyData )\n\n # view direction is out:\n viewDirection = -1 * SegmentationContext.getGlobalInstance().getViewDirection()\n polyDataOut, origin, normal = applyPlaneFit(polyData, expectedNormal=viewDirection, searchOrigin=point1, searchRadius=0.3, angleEpsilon=0.3, returnOrigin=True)\n\n # project the lidar point onto the plane (older, variance is >1cm with robot 2m away)\n #intersection_point = projectPointToPlane(point1, origin, normal)\n # intersect the ray with the plane (variance was about 4mm with robot 2m away)\n intersection_point = intersectLineWithPlane(position, ray, origin, normal)\n\n # Define a frame:\n xaxis = -normal\n zaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n t = transformUtils.getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(intersection_point)\n\n t2 = transformUtils.copyFrame(t)\n t2.PreMultiply()\n t3 = transformUtils.frameFromPositionAndRPY( [0,0.6,-0.25] , [0,0,0] )\n t2.Concatenate(t3)\n\n rightAngleLocation = 'bottom left'\n createDrillWall(rightAngleLocation, t2)\n\n wall= om.findObjectByName('wall')\n vis.updateFrame( t ,'wall fit tag', parent=wall, visible=False, scale=0.2)\n\n\n d = DebugData()\n d.addSphere( intersection_point, radius=0.002)\n obj = updatePolyData(d.getPolyData(), 'intersection', parent=wall, visible=False, color=[0,1,0]) #\n obj.actor.GetProperty().SetLineWidth(1)\n return True", "metadata": "root.segmentDrillWallFromTag", "header": "['module', '___EOS___']", "index": 4653 }, { "content": "def segmentDrillWallFromWallCenter():\n '''\n Get the drill wall target as an offset from the center of\n the full wall\n '''\n\n # find the valve wall and its center\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n # hardcoded position to target frame from center of wall\n # conincides with the distance from the april tag to this position\n wallFrame = transformUtils.copyFrame( findWallCenter(polyData) )\n wallFrame.PreMultiply()\n t3 = transformUtils.frameFromPositionAndRPY( [-0.07,-0.3276,0] , [180,-90,0] )\n wallFrame.Concatenate(t3)\n\n rightAngleLocation = 'bottom left'\n createDrillWall(rightAngleLocation, wallFrame)\n\n wall= om.findObjectByName('wall')\n vis.updateFrame( wallFrame ,'wall fit lidar', parent=wall, visible=False, scale=0.2)", "metadata": "root.segmentDrillWallFromWallCenter", "header": "['module', '___EOS___']", "index": 4711 }, { "content": "def findFarRightCorner(polyData, linkFrame):\n '''\n Within a point cloud find the point to the far right from the link\n The input is the 4 corners of a minimum bounding box\n '''\n\n diagonalTransform = transformUtils.copyFrame(linkFrame)\n diagonalTransform.PreMultiply()\n diagonalTransform.Concatenate( transformUtils.frameFromPositionAndRPY([0,0,0], [0,0,45]) )\n vis.updateFrame(diagonalTransform, 'diagonal frame', parent=getDebugFolder(), visible=False)\n\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n viewOrigin = diagonalTransform.TransformPoint([0.0, 0.0, 0.0])\n viewX = diagonalTransform.TransformVector([1.0, 0.0, 0.0])\n viewY = diagonalTransform.TransformVector([0.0, 1.0, 0.0])\n viewZ = diagonalTransform.TransformVector([0.0, 0.0, 1.0])\n polyData = labelPointDistanceAlongAxis(polyData, viewY, origin=viewOrigin, resultArrayName='distance_along_foot_y')\n\n vis.updatePolyData( polyData, 'cornerPoints', parent='segmentation', visible=False)\n farRightIndex = vtkNumpy.getNumpyFromVtk(polyData, 'distance_along_foot_y').argmin()\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n return points[farRightIndex,:]", "metadata": "root.findFarRightCorner", "header": "['module', '___EOS___']", "index": 4736 }, { "content": "def findMinimumBoundingRectangle(polyData, linkFrame):\n '''\n Find minimum bounding rectangle of a rectangular point cloud\n The input is assumed to be a rectangular point cloud e.g. the top of a block or table\n Returns transform of far right corner (pointing away from robot)\n '''\n\n # Originally From: https://github.com/dbworth/minimum-area-bounding-rectangle\n polyData = applyVoxelGrid(polyData, leafSize=0.02)\n\n def get2DAsPolyData(xy_points):\n '''\n Convert a 2D numpy array to a 3D polydata by appending z=0\n '''\n d = np.vstack((xy_points.T, np.zeros( xy_points.shape[0]) )).T\n d2=d.copy()\n return vtkNumpy.getVtkPolyDataFromNumpyPoints( d2 )\n\n pts =vtkNumpy.getNumpyFromVtk( polyData , 'Points' )\n xy_points = pts[:,[0,1]]\n vis.updatePolyData( get2DAsPolyData(xy_points) , 'xy_points', parent=getDebugFolder(), visible=False)\n hull_points = qhull_2d.qhull2D(xy_points)\n vis.updatePolyData( get2DAsPolyData(hull_points) , 'hull_points', parent=getDebugFolder(), visible=False)\n # Reverse order of points, to match output from other qhull implementations\n hull_points = hull_points[::-1]\n # print 'Convex hull points: \\n', hull_points, \"\\n\"\n\n # Find minimum area bounding rectangle\n (rot_angle, rectArea, rectDepth, rectWidth, center_point, corner_points_ground) = min_bounding_rect.minBoundingRect(hull_points)\n vis.updatePolyData( get2DAsPolyData(corner_points_ground) , 'corner_points_ground', parent=getDebugFolder(), visible=False)\n\n polyDataCentroid = computeCentroid(polyData)\n cornerPoints = np.vstack((corner_points_ground.T, polyDataCentroid[2]*np.ones( corner_points_ground.shape[0]) )).T\n cornerPolyData = vtkNumpy.getVtkPolyDataFromNumpyPoints(cornerPoints)\n\n # Create a frame at the far right point - which points away from the robot\n farRightCorner = findFarRightCorner(cornerPolyData , linkFrame)\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n\n viewFrame = SegmentationContext.getGlobalInstance().getViewFrame()\n #vis.showFrame(viewFrame, \"viewFrame\")\n\n robotYaw = math.atan2( viewDirection[1], viewDirection[0] )*180.0/np.pi\n blockAngle = rot_angle*(180/math.pi)\n #print \"robotYaw \", robotYaw\n #print \"blockAngle \", blockAngle\n blockAngleAll = np.array([blockAngle , blockAngle+90 , blockAngle+180, blockAngle+270])\n\n values = blockAngleAll - robotYaw\n for i in range(0,4):\n if(values[i]>180):\n values[i]=values[i]-360\n\n values = abs(values)\n min_idx = np.argmin(values)\n if ( (min_idx==1) or (min_idx==3) ):\n #print \"flip rectDepth and rectWidth as angle is not away from robot\"\n temp = rectWidth ; rectWidth = rectDepth ; rectDepth = temp\n\n #print \"best angle\", blockAngleAll[min_idx]\n rot_angle = blockAngleAll[min_idx]*math.pi/180.0\n\n cornerTransform = transformUtils.frameFromPositionAndRPY( farRightCorner , [0,0, np.rad2deg(rot_angle) ] )\n\n vis.showFrame(cornerTransform, \"cornerTransform\", parent=getDebugFolder(), visible=False)\n\n #print \"Minimum area bounding box:\"\n #print \"Rotation angle:\", rot_angle, \"rad (\", rot_angle*(180/math.pi), \"deg )\"\n #print \"rectDepth:\", rectDepth, \" rectWidth:\", rectWidth, \" Area:\", rectArea\n #print \"Center point: \\n\", center_point # numpy array\n #print \"Corner points: \\n\", cornerPoints, \"\\n\" # numpy array\n return cornerTransform, rectDepth, rectWidth, rectArea", "metadata": "root.findMinimumBoundingRectangle", "header": "['module', '___EOS___']", "index": 4760 } ]
[ { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "import time", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 }, { "span": "import PythonQt", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 15 }, { "span": "from PythonQt import QtCore, QtGui", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 34 }, { "span": "from director import mapsregistrar", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 34 }, { "span": "import drc as lcmdrc", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vtk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Pyth", "on", "Qt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Pyth", "on", "Qt_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "director_", "._", "appl", "ogi", "c_", "as_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "object", "model_", "as_", "om_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "percept", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "lcm", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "robot", "ur", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "transform", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "visualization", "_", "as_", "vis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "transform", "Utils_", "import_", "get", "Transform", "Fro", "m", "Axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "timer", "callback_", "import_", "Time", "r", "Callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "maps", "registrar", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "aff", "orda", "nce", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "aff", "orda", "nce", "items_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "visualization", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "filter", "Utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "field", "container_", "import_", "Field", "Container_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "segmentation", "routin", "es_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "came", "rav", "iew_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "third", "party_", "import_", "qh", "ull", "\\u", "2d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "third", "party_", "import_", "min", "\\u", "bound", "ing", "\\u", "rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vtk", "Num", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "debug", "Vis", "_", "import_", "Deb", "ug", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shallow", "Copy_", "import_", "shallow", "Copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "._", "uuid", "util_", "import_", "new", "UUID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "dr", "c_", "as_", "lcm", "dr", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bot", "\\u", "core_", "as_", "lcm", "bot", "core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "vs_", "as_", "lcm", "vs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "director_", "import_", "lcm", "Utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "BOT", "TOM", "\\u", "LEFT_", "=_", "'", "bottom", " ", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "BOT", "TOM", "\\u", "RIGHT_", "=_", "'", "bottom", " ", "right", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "TOP", "\\u", "LEFT_", "=_", "'", "top", " ", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "TOP", "\\u", "RIGHT_", "=_", "'", "top", " ", "right", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "dr", "c", " ", "plane", " ", "segmentation", " ", "inst", "ead", " ", "of", " ", "PC", "L_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Segmentation", "Filter_", "=_", "vtk_", "._", "vtk", "Plan", "e", "Segmentation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "plane", "Segmentation", "Filter", " ", "=", " ", "vtk", ".", "vtk", "PC", "LS", "ACS", "eg", "menta", "tion", "Plane_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "default", "Segmentation", "View_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "'''", "\\", "10", ";", "icp", " ", "program", "mab", "le", " ", "filter", "\\", "10", ";", "\\", "10", ";", "import", " ", "vtk", "Filter", "s", "General", "Pyth", "on", " ", "as", " ", "filter", "s", "General", "\\", "10", ";", "\\", "10", ";", "points", " ", "=", " ", "inputs", "[", "0", "]", "\\", "10", ";", "block", " ", "=", " ", "inputs", "[", "1", "]", "\\", "10", ";", "\\", "10", ";", "print", " ", "points", ".", "Get", "Number", "Of", "Point", "s", "()", "\\", "10", ";", "print", " ", "block", ".", "Get", "Number", "Of", "Point", "s", "()", "\\", "10", ";", "\\", "10", ";", "if", " ", "points", ".", "Get", "Number", "Of", "Point", "s", "()", " ", "<", " ", "block", ".", "Get", "Number", "Of", "Point", "s", "():", "\\", "10", ";", " ", " ", " ", " ", "block", ",", " ", "points", " ", "=", " ", "points", ",", " ", "block", "\\", "10", ";", "\\", "10", ";", "icp", " ", "=", " ", "vtk", ".", "vtk", "Iterat", "ive", "Closes", "t", "Point", "Transform", "()", "\\", "10", ";", "icp", ".", "Set", "Sou", "rce", "(", "points", ".", "VT", "KO", "bject", ")", "\\", "10", ";", "icp", ".", "Set", "Target", "(", "block", ".", "VT", "KO", "bject", ")", "\\", "10", ";", "icp", ".", "Get", "Land", "mark", "Transform", "()", ".", "Set", "Mode", "To", "Rig", "id", "Bod", "y", "()", "\\", "10", ";", "icp", ".", "Update", "()", "\\", "10", ";", "\\", "10", ";", "t", " ", "=", " ", "filter", "s", "General", ".", "vtk", "Transform", "Poly", "Data", "Filter", "()", "\\", "10", ";", "t", ".", "Set", "Inp", "ut", "(", "points", ".", "VT", "KO", "bject", ")", "\\", "10", ";", "t", ".", "Set", "Transform", "(", "icp", ")", "\\", "10", ";", "t", ".", "Update", "()", "\\", "10", ";", "\\", "10", ";", "output", ".", "Sha", "llow", "Copy", "(", "t", ".", "Get", "Output", "())", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hand", "Aff", "Updater_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "use", "Vo", "xel", "Grid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "refi", "t", "Wall", "Callbacks_", "=_", "[_", "]_", "\\u\\u\\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_", "#", " ", "this", " ", "shou", "ld", " ", "be", " ", "depre", "ciat", "ed", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "be", " ", "depre", "ciat", "ed", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\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\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view", "Picke", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "deb", "rs", " ", "task", " ", "ground", " ", "frame_", "\\u\\u\\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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\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved", "Came", "ra", "Params_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Segmentation", "View_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "default", "Segmentation", "View_", "or_", "app_", "._", "get", "View", "Manager_", "(_", ")_", "._", "find", "View_", "(_", "'", "Segmentation", " ", "View", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "DR", "CV", "iew_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", "\\u\\u\\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_", "switch", "To", "View_", "(_", "view", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "get", "View", "Manager_", "(_", ")_", "._", "switch", "To", "View_", "(_", "view", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Curr", "ent", "View_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "app_", "._", "get", "Curr", "ent", "Render", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "Aff", "orda", "nce", "Manager_", "(_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Normal", "ly", " ", "the", " ", "aff", "orda", "nce", " ", "manage", "r", " ", "is", " ", "initialize", "d", " ", "by", " ", "the", " ", "applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "can", " ", "be", " ", "call", "ed", " ", "from", " ", "scripts", " ", "and", " ", "tests", " ", "to", " ", "initialize", " ", "the", " ", "manage", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "aff", "orda", "nce", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "orda", "nce", "Manager_", "=_", "aff", "orda", "nce", "manager_", "._", "Aff", "orda", "nce", "Object", "Model", "Manager_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "np_", "._", "array_", "(_", "point2_", ")_", "-_", "np_", "._", "array_", "(_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis_", "=_", "line_", "/_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "axis_", ",_", "origin_", "=_", "point1_", ",_", "result", "Array", "Name_", "=_", "'", "dist", "\\u", "along", "\\u", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "along", "\\u", "line", "'_", ",_", "[_", "0.0_", ",_", "length_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute", "AT", "o", "B_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "a_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tt_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tt_", "._", "Set", "Matrix_", "(_", "t_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tt_", "\\u\\u\\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_", "lock", "Aff", "orda", "nce", "To", "Hand_", "(_", "aff", "_", ",_", "hand_", "=_", "'", "l\\u", "hand", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link", "Frame_", "=_", "get", "Link", "Frame_", "(_", "hand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "T_", "=_", "aff", "_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "aff", "_", ",_", "'", "hand", "To", "Aff", "T", "'_", ")_", "or_", "not_", "aff", "_", "._", "hand", "To", "Aff", "T_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "._", "hand", "To", "Aff", "T_", "=_", "compute", "AT", "o", "B_", "(_", "link", "Frame_", ",_", "aff", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "aff", "_", "._", "hand", "To", "Aff", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "link", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "._", "Set", "Matrix_", "(_", "t_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "lock", "To", "Hand", "On_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "get", "Default", "Aff", "orda", "nce", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "aff", "_", ":_", "\\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_", "global_", "hand", "Aff", "Updater_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hand", "Aff", "Updater_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hand", "Aff", "Updater_", "=_", "Time", "r", "Callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "Aff", "Updater_", "._", "target", "Fp", "s_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hand", "Aff", "Updater_", "._", "callback_", "=_", "functools_", "._", "partial_", "(_", "lock", "Aff", "orda", "nce", "To", "Hand_", ",_", "aff", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hand", "Aff", "Updater_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lock", "To", "Hand", "Off_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "get", "Default", "Aff", "orda", "nce", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "aff", "_", ":_", "\\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_", "hand", "Aff", "Updater_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "hand", "To", "Aff", "T_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dispa", "rity", "Point", "Cloud", "Item_", "(_", "vis_", "._", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Dispa", "rity", "Point", "Cloud", "Item_", "(_", "vis_", "._", "Poly", "Data", "Item_", ")_", ":_", "\\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_", ",_", "name_", ",_", "images", "Channel_", ",_", "came", "ra", "Name_", ",_", "image", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vis_", "._", "Poly", "Data", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "vtk_", "._", "vtk", "Poly", "Data_", "(_", ")_", ",_", "view_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Chan", "nel", "'_", ",_", "images", "Channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Came", "ra", " ", "name", "'_", ",_", "came", "ra", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Deci", "mati", "on", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "enum", "Names_", "=_", "[_", "'", "1", "'_", ",_", "'", "2", "'_", ",_", "'", "4", "'_", ",_", "'", "8", "'_", ",_", "'", "16", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Remove", " ", "Size", "'_", ",_", "1000_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "0_", ",_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "100000", ".0_", ",_", "single", "Step_", "=_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Target", " ", "FPS", "'_", ",_", "1.0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "1_", ",_", "minimum_", "=_", "0.1_", ",_", "maximum_", "=_", "30.0_", ",_", "single", "Step_", "=_", "0.1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "timer_", "=_", "Time", "r", "Callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "._", "callback_", "=_", "self_", "._", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Ut", "ime_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "image", "Manager_", "=_", "image", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "came", "ra", "Name_", "=_", "came", "ra", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispa", "rity", "Point", "Cloud", "Item_", "(_", "vis_", "._", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vis_", "._", "Poly", "Data", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "property", "Name_", "==_", "'", "Vis", "ibl", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "Property_", "(_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "timer_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "timer_", "._", "stop_", "(_", ")_", "\\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_", "property", "Name_", "in_", "(_", "'", "Deci", "mati", "on", "'_", ",_", "'", "Remove", " ", "outliers", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Ut", "ime_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispa", "rity", "Point", "Cloud", "Item_", "(_", "vis_", "._", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Remove", "Fro", "m", "Object", "Model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vis_", "._", "Poly", "Data", "Item_", "._", "on", "Remove", "Fro", "m", "Object", "Model_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispa", "rity", "Point", "Cloud", "Item_", "(_", "vis_", "._", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utime", "_", "=_", "self_", "._", "image", "Manager_", "._", "queue_", "._", "get", "Curr", "ent", "Image", "Time_", "(_", "self_", "._", "came", "ra", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "utime", "_", "==_", "self_", "._", "last", "Ut", "ime_", ":_", "\\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_", "(_", "utime", "_", "<_", "self_", "._", "last", "Ut", "ime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "0_", "#", " ", "dummy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "utime", "_", "-_", "self_", "._", "last", "Ut", "ime_", "<_", "1E", "6_", "/_", "self_", "._", "get", "Property_", "(_", "'", "Target", " ", "FPS", "'_", ")_", ")_", ":_", "\\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_", "decima", "tion_", "=_", "int_", "(_", "self_", "._", "properties_", "._", "get", "Proper", "ty", "Enum", "Value_", "(_", "'", "Deci", "mati", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remove", "Size_", "=_", "int_", "(_", "self_", "._", "properties_", "._", "get", "Property_", "(_", "'", "Remove", " ", "Size", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "get", "Dispa", "rity", "Point", "Cloud_", "(_", "decima", "tion_", ",_", "images", "Channel_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Chan", "nel", "'_", ")_", ",_", "came", "ra", "Name_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Came", "ra", " ", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "Outl", "iers", "_", "=_", "False_", ",_", "remove", "Size_", "=_", "remove", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Poly", "Data_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "last", "Ut", "ime_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Property_", "(_", "'", "Color", " ", "By", "'_", ",_", "'", "rgb", "\\u", "colors", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "last", "Ut", "ime_", "=_", "utime", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "Large", "st", "Cluster_", "(_", "poly", "Data_", ",_", "min", "Cluster", "Size_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "appl", "y", "Euc", "lide", "an", "Clustering", "_", "(_", "poly", "Data_", ",_", "min", "Cluster", "Size_", "=_", "min", "Cluster", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "cluster", "\\u", "labels", "'_", ",_", "[_", "1_", ",_", "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_", "segment", "Gro", "und_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", "=_", "0.02_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "0.05_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "A", " ", "Mor", "e", " ", "complex", " ", "ground", " ", "removal", " ", "algo", "rit", "hm", ".", " ", "Works", " ", "whe", "n", " ", "plane", " ", "isn", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "prece", "ise", "ly", " ", "flat", ".", " ", "Fi", "rst", " ", "cluster", "s", " ", "on", " ", "z", " ", "to", " ", "find", " ", "approx", " ", "ground", " ", "height", ",", " ", "then", " ", "fits", " ", "a", " ", "plane", " ", "there", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region", "Thickness", "_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zv", "alues", "_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "[_", ":_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Height_", "=_", "np_", "._", "percentile_", "(_", "zv", "alues", "_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "zv", "alues", "_", "._", "copy_", "(_", ")_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "z", "'_", ",_", "[_", "ground", "Height_", "-_", "search", "Region", "Thickness", "_", "/_", "2.0_", ",_", "ground", "Height_", "+_", "search", "Region", "Thickness", "_", "/_", "2.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "ground", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "z", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "search", "Region_", ",_", "distance", "Threshold_", "=_", "0.02_", ",_", "expected", "Normal_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "np_", "._", "dot_", "(_", "points_", "-_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "dist_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ground", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "ground", "Thickness", "_", "/_", "2.0_", ",_", "ground", "Thickness", "_", "/_", "2.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", ",_", "100_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "origin_", ",_", "normal_", ",_", "ground", "Points_", ",_", "scen", "e", "Points_", "\\u\\u\\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_", "segment", "Gro", "und", "Plane_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "Obj_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "input", "Obj_", "._", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zv", "alues", "_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "[_", ":_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Height_", "=_", "np_", "._", "percentile_", "(_", "zv", "alues", "_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "z", "'_", ",_", "[_", "ground", "Height_", "-_", "0.3_", ",_", "ground", "Height_", "+_", "0.3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "ground", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "z", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "search", "Region_", ",_", "distance", "Threshold_", "=_", "0.02_", ",_", "expected", "Normal_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "np_", "._", "dot_", "(_", "points_", "-_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "dist_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ground", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.05_", ",_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "ground", "Points_", ",_", "'", "ground", " ", "points", "'_", ",_", "alpha_", "=_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "scen", "e", "Points_", ",_", "'", "scen", "e", " ", "points", "'_", ",_", "alpha_", "=_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "scen", "e", "Point", "s", " ", "=", " ", "appl", "y", "Euc", "lide", "an", "Clustering", "(", "scen", "e", "Point", "s", ",", " ", "cluster", "Tolerance", "=", "0.10", ",", " ", "min", "Cluster", "Size", "=", "100", ",", " ", "max", "Cluster", "Size", "=", "1e", "6", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", "Poly", "Data", "(", "scen", "e", "Point", "s", ",", " ", "'", "scen", "e", " ", "points", "',", " ", "color", "By", "Name", "='", "cluster", "\\u", "labels", "')", "_", "\\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_", "appl", "y", "Local", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "search", "Point_", ",_", "search", "Radius_", ",_", "search", "Rad", "ius", "End_", "=_", "None_", ",_", "remove", "Gro", "und", "First_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "Vo", "xel", "Grid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voxel", "Grid", "Size_", "=_", "0.03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distance", "To", "Plan", "e", "Threshold_", "=_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "use", "Vo", "xel", "Grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "voxel", "Grid", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "remove", "Gro", "und", "First_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "poly", "Data_", "=_", "remove", "Gro", "und_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", "=_", "0.02_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "0.04_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cropped", "_", "=_", "crop", "To", "Sphere", "_", "(_", "poly", "Data_", ",_", "search", "Point_", ",_", "search", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "cropped", "_", ",_", "'", "crop", " ", "to", " ", "sphere", "'_", ",_", "visible_", "=_", "False_", ",_", "color", "By", "Name_", "=_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "To", "Plan", "e", "Threshold_", ",_", "search", "Origin_", "=_", "search", "Point_", ",_", "search", "Radius_", "=_", "search", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "search", "Rad", "ius", "End_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "To", "Plan", "e", "Threshold_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "normal_", ",_", "angle", "Eps", "ilon", "_", "=_", "math_", "._", "radians_", "(_", "30_", ")_", ",_", "search", "Origin_", "=_", "search", "Point_", ",_", "search", "Radius_", "=_", "search", "Rad", "ius", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fit", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "distance", "To", "Plan", "e", "Threshold_", ",_", "distance", "To", "Plan", "e", "Threshold_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "fit", "Points_", ",_", "'", "fit", "Point", "s", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fit", "Points_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "fit", "Points_", ",_", "search", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "fit", "Points_", ",_", "cluster", "Tolerance", "_", "=_", "0.05_", ",_", "min", "Cluster", "Size_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "x_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit", "Points_", "=_", "clusters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "fit", "Points_", ",_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", "=_", "0.06", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "vtk_", "._", "vtk", "PC", "LN", "ormal", "Estimat", "ion_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Sear", "ch", "Radius_", "(_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "shallow", "Copy_", "(_", "f_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normals_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "scen", "e", "Points_", ",_", "'", "normal", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal", "s", "Dot", "Plan", "e", "Normal_", "=_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "normals_", ",_", "normal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "scen", "e", "Points_", ",_", "normal", "s", "Dot", "Plan", "e", "Normal_", ",_", "'", "normal", "s", "\\u", "dot", "\\u", "plane", "\\u", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "show", "Poly", "Data_", "(_", "scen", "e", "Points_", ",_", "'", "scen", "e\\u", "with", "\\u", "normal", "s", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "normal", "s", "\\u", "dot", "\\u", "plane", "\\u", "normal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "surfaces", "_", "=_", "threshol", "d", "Points_", "(_", "scen", "e", "Points_", ",_", "'", "normal", "s", "\\u", "dot", "\\u", "plane", "\\u", "normal", "'_", ",_", "[_", "0.95_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "surfaces", "_", ",_", "cluster", "Tolerance", "_", "=_", "0.1_", ",_", "min", "Cluster", "Size_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "clusters_", "[_", ":_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "cluster_", "in_", "enumerate_", "(_", "clusters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "Poly", "Data_", "(_", "cluster_", ",_", "'", "plane", " ", "cluster", " ", "%", "i", "'_", "%_", "i_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fit", "Points_", "\\u\\u\\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_", "orient", "To", "Maj", "or", "Plane_", "(_", "poly", "Data_", ",_", "picked", "Point_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "the", " ", "large", "st", " ", "plane", " ", "and", " ", "transform", " ", "the", " ", "cloud", " ", "to", " ", "align", " ", "tha", "t", " ", "plane", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "the", " ", "give", "n", " ", "point", " ", "as", " ", "the", " ", "orig", "in", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distance", "To", "Plan", "e", "Threshold_", "=_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Radius_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "To", "Plan", "e", "Threshold_", ",_", "search", "Origin_", "=_", "picked", "Point_", ",_", "search", "Radius_", "=_", "search", "Radius_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "local", " ", "plane", " ", "fit", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Frame_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Orig", "in", "And", "Normal_", "(_", "picked", "Point_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "plane", "Frame_", ",_", "'", "plane", " ", "frame", "'_", ",_", "scale_", "=_", "0.15_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "transform", "Poly", "Data_", "(_", "poly", "Data_", ",_", "plane", "Frame_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "mean", " ", "point", " ", "is", " ", "belo", "w", " ", "the", " ", "horizon", "tal", " ", "plane", ",", " ", "flip", " ", "the", " ", "cloud_", "\\u\\u\\uNL\\u\\u\\u_", "zv", "alues", "_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "[_", ":_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid", "Cloud", "Height_", "=_", "np_", "._", "mean_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "mid", "Cloud", "Height_", "<_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flip", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "180_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "transform", "Poly", "Data_", "(_", "poly", "Data_", ",_", "flip", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "poly", "Data_", ",_", "plane", "Frame_", "\\u\\u\\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", "Maj", "or", "Plan", "es_", "(_", "poly", "Data_", ",_", "use", "Vo", "xel", "Grid_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voxel", "Grid", "Size_", "=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distance", "To", "Plan", "e", "Threshold_", "=_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "use", "Vo", "xel", "Grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "voxel", "Grid", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poly", "Data", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "min", "Cluster", "Size_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "len_", "(_", "poly", "Data", "List_", ")_", "<_", "25_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "plane", "Segmentation", "Filter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Distan", "ce", "Threshold_", "(_", "distance", "To", "Plan", "e", "Threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "f_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outliers", "_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "rans", "ac", "\\u", "labels", "'_", ",_", "[_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inli", "ers_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "rans", "ac", "\\u", "labels", "'_", ",_", "[_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "large", "st", "Cluster_", "=_", "extract", "Large", "st", "Cluster_", "(_", "inli", "ers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "i", " ", "=", " ", "len", "(", "poly", "Data", "List", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "Poly", "Data", "(", "inli", "ers", ",", " ", "'", "inli", "ers", " ", "%", "d", "'", " ", "%", " ", "i", ",", " ", "color", "=", "get", "Random", "Color", "()", ",", " ", "parent", "='", "major", " ", "plane", "s", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "Poly", "Data", "(", "outliers", ",", " ", "'", "outliers", " ", "%", "d", "'", " ", "%", " ", "i", ",", " ", "color", "=", "get", "Random", "Color", "()", ",", " ", "parent", "='", "major", " ", "plane", "s", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "Poly", "Data", "(", "large", "st", "Cluster", ",", " ", "'", "cluster", " ", "%", "d", "'", " ", "%", " ", "i", ",", " ", "color", "=", "get", "Random", "Color", "()", ",", " ", "parent", "='", "major", " ", "plane", "s", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "large", "st", "Cluster_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ">_", "min", "Cluster", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data", "List_", "._", "append_", "(_", "large", "st", "Cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "outliers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "poly", "Data", "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_", "def_", "show", "Maj", "or", "Plan", "es_", "(_", "poly", "Data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "poly", "Data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "Obj_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "major", " ", "plane", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "segmentation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "Obj_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "major", " ", "plane", "s", "'_", ",_", "folder", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Frame_", "(_", ")_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "poly", "Data_", ",_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ",_", "[_", "1_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data", "List_", "=_", "get", "Maj", "or", "Plan", "es_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "poly", "Data_", "in_", "enumerate_", "(_", "poly", "Data", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "show", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "plane", " ", "%", "d", "'_", "%_", "i_", ",_", "color_", "=_", "get", "Random", "Color_", "(_", ")_", ",_", "visible_", "=_", "True_", ",_", "parent_", "=_", "'", "major", " ", "plane", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Point", " ", "Size", "'_", ",_", "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_", "crop", "To", "Box_", "(_", "poly", "Data_", ",_", "transform_", ",_", "dimensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "dimension", "s", " ", "is", " ", "length", " ", "3", " ", "descri", "bing", " ", "box", " ", "dimension", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "transform_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "axis_", ",_", "length_", "in_", "zip_", "(_", "axes_", ",_", "dimensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crop", "Axis_", "=_", "np_", "._", "array_", "(_", "axis_", ")_", "*_", "(_", "length_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "origin_", "-_", "crop", "Axis_", ",_", "origin_", "+_", "crop", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "poly", "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_", "def_", "crop", "To", "Bounds_", "(_", "poly", "Data_", ",_", "transform_", ",_", "bounds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "bound", "s", " ", "is", " ", "a", " ", "2x", "3", " ", "contain", "ing", " ", "the", " ", "min", "/", "max", " ", "values", " ", "along", " ", "the", " ", "transform", " ", "axes", " ", "to", " ", "use", " ", "for", " ", "crop", "ping", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "transform_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "axis_", ",_", "bound_", "in_", "zip_", "(_", "axes_", ",_", "bounds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis_", "=_", "np_", "._", "array_", "(_", "axis_", ")_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "origin_", "+_", "axis_", "*_", "bound_", "[_", "0_", "]_", ",_", "origin_", "+_", "axis_", "*_", "bound_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "poly", "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_", "def_", "crop", "To", "Sphere", "_", "(_", "poly", "Data_", ",_", "origin_", ",_", "radius_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "poly", "Data_", ",_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ",_", "[_", "0_", ",_", "radius_", "]_", ")_", "\\u\\u\\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_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "0.02_", ",_", "expected", "Normal_", "=_", "None_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "None_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.2_", ",_", "return", "Origin_", "=_", "False_", ",_", "search", "Origin_", "=_", "None_", ",_", "search", "Radius_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "Normal_", "=_", "expected", "Normal_", "if_", "expected", "Normal_", "is_", "not_", "None_", "else_", "[_", "-_", "1_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fit", "Input_", "=_", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "search", "Origin_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "search", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit", "Input_", "=_", "crop", "To", "Sphere", "_", "(_", "fit", "Input_", ",_", "search", "Origin_", ",_", "search", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", " ", "plane", " ", "segmentation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "plane", "Segmentation", "Filter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "fit", "Input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Distan", "ce", "Threshold_", "(_", "distance", "Threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "perp", "endi", "cula", "r", "Axis_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "Set", "Per", "pend", "icul", "ar", "Constr", "aint", "Enabled_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Per", "pend", "icul", "ar", "Axis_", "(_", "perp", "endi", "cula", "r", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Ang", "le", "Eps", "ilon", "_", "(_", "angle", "Eps", "ilon", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "f_", "._", "Get", "Plan", "e", "Origin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal_", "=_", "np_", "._", "array_", "(_", "f_", "._", "Get", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flip", " ", "the", " ", "normal", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "normal_", ",_", "expected", "Normal_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normal_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "point", ",", " ", "compute", " ", "sign", "ed", " ", "distance", " ", "to", " ", "plane_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "np_", "._", "dot_", "(_", "points_", "-_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "dist_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "return", "Origin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "\\u\\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_", "poly", "Data_", ",_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flip", "Normal", "s", "With", "View", "Direction_", "(_", "poly", "Data_", ",_", "view", "Direction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normals_", "=_", "vn", "p_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "normal", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normals_", "[_", "np_", "._", "dot_", "(_", "normals_", ",_", "view", "Direction_", ")_", ">_", "0_", "]_", "*=_", "-_", "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_", "normal", "Estimat", "ion_", "(_", "data", "Obj_", ",_", "search", "Cloud_", "=_", "None_", ",_", "search", "Radius_", "=_", "0.05_", ",_", "use", "Vo", "xel", "Grid_", "=_", "False_", ",_", "voxel", "Grid", "Lea", "f", "Size_", "=_", "0.05_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "vtk_", "._", "vtk", "PC", "LN", "ormal", "Estimat", "ion_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Sear", "ch", "Radius_", "(_", "search", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "data", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "search", "Cloud_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "Set", "Input_", "(_", "1_", ",_", "search", "Cloud_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "use", "Vo", "xel", "Grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "Set", "Input_", "(_", "1_", ",_", "appl", "y", "Vo", "xel", "Grid_", "(_", "data", "Obj_", ",_", "voxel", "Grid", "Lea", "f", "Size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Obj_", "=_", "shallow", "Copy_", "(_", "f_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Obj_", "._", "Get", "Point", "Data_", "(_", ")_", "._", "Set", "Normal", "s_", "(_", "data", "Obj_", "._", "Get", "Point", "Data_", "(_", ")_", "._", "Get", "Array_", "(_", "'", "normal", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "data", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Coord", "Arrays", "To", "Poly", "Data_", "(_", "poly", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "points_", "[_", ":_", ",_", "0_", "]_", "._", "copy_", "(_", ")_", ",_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "points_", "[_", ":_", ",_", "1_", "]_", "._", "copy_", "(_", ")_", ",_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "points_", "[_", ":_", ",_", "2_", "]_", "._", "copy_", "(_", ")_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Frame_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Origin_", "=_", "view", "Frame_", "._", "Transform", "Point_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "X_", "=_", "view", "Frame_", "._", "Transform", "Vector_", "(_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Y_", "=_", "view", "Frame_", "._", "Transform", "Vector_", "(_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Z_", "=_", "view", "Frame_", "._", "Transform", "Vector_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "view", "X_", ",_", "origin_", "=_", "view", "Origin_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "view", "\\u", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "view", "Y_", ",_", "origin_", "=_", "view", "Origin_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "view", "\\u", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "view", "Z_", ",_", "origin_", "=_", "view", "Origin_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "view", "\\u", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "poly", "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_", "def_", "get", "Deb", "ug", "Revo", "luti", "on", "Data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "data", "Dir", " ", "=", " ", "os", ".", "path", ".", "abs", "path", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dir", "name", "(\\u", "\\u", "file", "\\u\\u)", ",", " ", "'../../", "../../", "dr", "c", "-", "data", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "valve", "\\u", "wall", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "bun", "gie", "\\u", "valve", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "cinde", "r", "-", "blocks", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "cylinder", "\\u", "table", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "fire", "hos", "e", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "deb", "ris", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "rev", "1", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "data", "Dir", ",", " ", "'", "drill", "-", "in", "-", "hand", ".", "vt", "p", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "Des", "kto", "p", "/", "scans", "/", "deb", "ris", "-", "scan", ".", "vt", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "add", "Coord", "Arrays", "To", "Poly", "Data_", "(_", "io", "Utils_", "._", "read", "Poly", "Data_", "(_", "filename_", ")_", ")_", "\\u\\u\\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", "Curr", "ent", "Sca", "n", "Bundle_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "SCAN", "S", "\\u", "HALF", "\\u", "SW", "EE", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\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_", "rev", "Poly", "Data_", "=_", "obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "rev", "Poly", "Data_", "or_", "not_", "rev", "Poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "Vo", "xel", "Grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rev", "Poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "rev", "Poly", "Data_", ",_", "leaf", "Size_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "add", "Coord", "Arrays", "To", "Poly", "Data_", "(_", "rev", "Poly", "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_", "def_", "get", "Curr", "ent", "Revo", "luti", "on", "Data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rev", "Poly", "Data_", "=_", "percept", "ion_", "._", "\\u", "multis", "ense", "Item_", "._", "model_", "._", "rev", "Poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "rev", "Poly", "Data_", "or_", "not_", "rev", "Poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "Curr", "ent", "Sca", "n", "Bundle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "Vo", "xel", "Grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rev", "Poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "rev", "Poly", "Data_", ",_", "leaf", "Size_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "add", "Coord", "Arrays", "To", "Poly", "Data_", "(_", "rev", "Poly", "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_", "def_", "get", "Dispa", "rity", "Point", "Cloud_", "(_", "decima", "tion_", "=_", "4_", ",_", "remove", "Outl", "iers", "_", "=_", "True_", ",_", "remove", "Size_", "=_", "0_", ",_", "images", "Channel_", "=_", "'", "CAMER", "A", "'_", ",_", "came", "ra", "Name_", "=_", "'", "CAMER", "A", "\\u", "LEF", "T", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "came", "rav", "iew_", "._", "get", "Ster", "eo", "Point", "Cloud_", "(_", "decima", "tion_", ",_", "images", "Channel_", "=_", "images", "Channel_", ",_", "came", "ra", "Name_", "=_", "came", "ra", "Name_", ",_", "remove", "Size_", "=_", "remove", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "remove", "Outl", "iers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "scale", " ", "outlier", " ", "filtering", ",", " ", "best", " ", "tune", "d", " ", "for", " ", "decima", "tion", " ", "of", " ", "2", " ", "or", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scaling_", "=_", "(_", "10_", "*_", "16_", ")_", "/_", "(_", "decima", "tion_", "*_", "decima", "tion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "label", "Outl", "iers", "_", "(_", "p_", ",_", "search", "Radius_", "=_", "0.06_", ",_", "neighbor", "s", "In", "Sear", "ch", "Radius_", "=_", "scaling_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "threshol", "d", "Points_", "(_", "p_", ",_", "'", "is", "\\u", "outlier", "'_", ",_", "[_", "0.0_", ",_", "0.0_", "]_", ")_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Curr", "ent", "Map", "Server", "Data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "map", "Server_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "Map", " ", "Server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "map", "Server_", "and_", "map", "Server_", "._", "get", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "map", "Server_", "._", "source_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "poly", "Data_", "or_", "not_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "add", "Coord", "Arrays", "To", "Poly", "Data_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "segment", "Gro", "und", "Plan", "es_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "om_", "._", "get", "Objects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "obj_", "._", "get", "Property_", "(_", "'", "Name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "._", "startswith_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "objs_", "._", "append_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "=_", "sorted_", "(_", "objs_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "._", "get", "Property_", "(_", "'", "Name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "Head", "Axis_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "objs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "obj_", "._", "get", "Property_", "(_", "'", "Name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'-----", " ", "%", "s", "---------", "'_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "head", " ", "axis", ":'_", ",_", "obj_", "._", "head", "Axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", ",_", "normal_", ",_", "ground", "Points_", ",_", "\\u_", "=_", "segment", "Gro", "und_", "(_", "obj_", "._", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "ground", " ", "normal", ":'_", ",_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Poly", "Data_", "(_", "ground", "Points_", ",_", "name_", "+_", "'", " ", "ground", " ", "points", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "np_", "._", "array_", "(_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "math_", "._", "degrees_", "(_", "math_", "._", "acos", "_", "(_", "np_", "._", "dot_", "(_", "a_", ",_", "b_", ")_", "/_", "(_", "np_", "._", "linalg_", "._", "norm_", "(_", "a_", ")_", "*_", "np_", "._", "linalg_", "._", "norm_", "(_", "b_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "diff_", ">_", "90_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "180_", "-_", "diff_", "\\u\\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_", "diff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prev", "Head", "Axis_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "prev", "Head", "Axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "np_", "._", "array_", "(_", "obj_", "._", "head", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "math_", "._", "degrees_", "(_", "math_", "._", "acos", "_", "(_", "np_", "._", "dot_", "(_", "a_", ",_", "b_", ")_", "/_", "(_", "np_", "._", "linalg_", "._", "norm_", "(_", "a_", ")_", "*_", "np_", "._", "linalg_", "._", "norm_", "(_", "b_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "diff_", ">_", "90_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "180_", "-_", "diff_", "\\u\\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_", "diff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prev", "Head", "Axis_", "=_", "np_", "._", "array_", "(_", "obj_", "._", "head", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "normal", "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_", "extract", "Circle_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "0.04_", ",_", "radi", "us", "Limit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "circle", "Fit_", "=_", "vtk_", "._", "vtk", "PC", "LS", "ACS", "eg", "menta", "tion", "Circle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Fit_", "._", "Set", "Distan", "ce", "Threshold_", "(_", "distance", "Threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Fit_", "._", "Set", "Input_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "radi", "us", "Limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "circle", "Fit_", "._", "Set", "Rad", "ius", "Limit_", "(_", "radi", "us", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Fit_", "._", "Set", "Rad", "ius", "Constr", "aint", "Enabled_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "circle", "Fit_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "circle", "Fit_", "._", "Get", "Output_", "(_", ")_", ",_", "'", "rans", "ac", "\\u", "labels", "'_", ",_", "[_", "1.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "poly", "Data_", ",_", "circle", "Fit_", "\\u\\u\\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_", "remove", "Maj", "or", "Plane_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "0.02_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", " ", "plane", " ", "segmentation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "plane", "Segmentation", "Filter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Distan", "ce", "Threshold_", "(_", "distance", "Threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "f_", "._", "Get", "Output_", "(_", ")_", ",_", "'", "rans", "ac", "\\u", "labels", "'_", ",_", "[_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "poly", "Data_", ",_", "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_", "remove", "Gro", "und", "Simple_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", "=_", "0.02_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "0.05_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Simple", " ", "ground", " ", "plane", " ", "removal", " ", "algo", "rit", "hm", ".", " ", "Us", "es", " ", "ground", " ", "height", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "doe", "s", " ", "simple", " ", "z", " ", "distance", " ", "filtering", ".", "\\", "10", ";", " ", " ", " ", " ", "Suit", "able", " ", "for", " ", "noisy", " ", "data", " ", "e", ".", "g", ".", " ", "kine", "ct", "/", "stereo", " ", "came", "ra", "\\", "10", ";", " ", " ", " ", " ", "(", "Default", " ", "args", " ", "shou", "ld", " ", "be", " ", "relaxed", ",", " ", "filtering", " ", "simp", "lf", "ied", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Height_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "Gro", "und", "Height_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "[_", "0_", ",_", "0_", ",_", "ground", "Height_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "np_", "._", "dot_", "(_", "points_", "-_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "dist_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ground", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "ground", "Thickness", "_", "/_", "2.0_", ",_", "ground", "Thickness", "_", "/_", "2.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", ",_", "100_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "ground", "Points_", ",_", "scen", "e", "Points_", "\\u\\u\\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_", "remove", "Gro", "und_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", "=_", "0.02_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "0.05_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "origin_", ",_", "normal_", ",_", "ground", "Points_", ",_", "scen", "e", "Points_", "=_", "segment", "Gro", "und_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ground", "Points_", ",_", "scen", "e", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e", "Fee", "t", "For", "Val", "ve_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "valve", " ", "aff", "orda", "nce", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "aff", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "aff", "_", "._", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "params_", "[_", "'", "orig", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "[_", "2_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "params_", "[_", "'", "axis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Width_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Rotation_", "=_", "25.0", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Offset_", "=_", "[_", "-_", "1.0_", ",_", "-_", "0.5_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "Frame_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Frame_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Frame_", ",_", "lf", "oot", "Frame_", ",_", "rf", "oot", "Frame_", "=_", "get", "Foot", "Frame", "s", "Fro", "m", "Reference", "Frame_", "(_", "valve", "Frame_", ",_", "stance", "Width_", ",_", "stance", "Rotation_", ",_", "stance", "Offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "show", "Frame_", "(_", "board", "Frame_", ",_", "'", "board", " ", "ground", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "lf", "oot", "Frame_", ",_", "'", "lf", "oot", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "rf", "oot", "Frame_", ",_", "'", "rf", "oot", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", " ", "=", " ", "Deb", "ug", "Data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "valve", "Frame", ".", "Get", "Position", "()", ",", " ", "stance", "Frame", ".", "Get", "Position", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", "Poly", "Data", "(", "d", ".", "get", "Poly", "Data", "()", ",", " ", "'", "stance", " ", "debug", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "publi", "sh", "Step", "ping", "Goal", "(", "lf", "oot", "Frame", ",", " ", "rf", "oot", "Frame", ")_", "\\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_", "generat", "e", "Fee", "t", "For", "Deb", "ris_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "board", " ", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "aff", "_", ":_", "\\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_", "params_", "=_", "aff", "_", "._", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "params_", "[_", "'", "orig", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "origin_", "+_", "params_", "[_", "'", "za", "xis", "'_", "]_", "*_", "params_", "[_", "'", "zw", "idt", "h", "'_", "]_", "/_", "2.0_", "-_", "params_", "[_", "'", "xaxis", "'_", "]_", "*_", "params_", "[_", "'", "xw", "idt", "h", "'_", "]_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "[_", "2_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "params_", "[_", "'", "za", "xis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Width_", "=_", "0.35_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Rotation_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Offset_", "=_", "[_", "-_", "0.48", "_", ",_", "-_", "0.08_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "board", "Frame_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board", "Frame_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Frame_", ",_", "lf", "oot", "Frame_", ",_", "rf", "oot", "Frame_", "=_", "get", "Foot", "Frame", "s", "Fro", "m", "Reference", "Frame_", "(_", "board", "Frame_", ",_", "stance", "Width_", ",_", "stance", "Rotation_", ",_", "stance", "Offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "show", "Frame_", "(_", "board", "Frame_", ",_", "'", "board", " ", "ground", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "oot_", "=_", "show", "Frame_", "(_", "lf", "oot", "Frame_", ",_", "'", "lf", "oot", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rf", "oot_", "=_", "show", "Frame_", "(_", "rf", "oot", "Frame_", ",_", "'", "rf", "oot", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "[_", "lf", "oot_", ",_", "rf", "oot_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", " ", "=", " ", "Deb", "ug", "Data", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "valve", "Frame", ".", "Get", "Position", "()", ",", " ", "stance", "Frame", ".", "Get", "Position", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", "Poly", "Data", "(", "d", ".", "get", "Poly", "Data", "()", ",", " ", "'", "stance", " ", "debug", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "publi", "sh", "Step", "ping", "Goal", "(", "lf", "oot", "Frame", ",", " ", "rf", "oot", "Frame", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e", "Fee", "t", "For", "Wy", "e_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "wy", "e", " ", "points", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "aff", "_", ":_", "\\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_", "params_", "=_", "aff", "_", "._", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "params_", "[_", "'", "orig", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "[_", "2_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "params_", "[_", "'", "xaxis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "-_", "params_", "[_", "'", "za", "xis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Width_", "=_", "0.20", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Rotation_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Offset_", "=_", "[_", "-_", "0.48", "_", ",_", "-_", "0.08_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "Gro", "und", "Frame_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "Gro", "und", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "Gro", "und", "Frame_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Frame_", ",_", "lf", "oot", "Frame_", ",_", "rf", "oot", "Frame_", "=_", "get", "Foot", "Frame", "s", "Fro", "m", "Reference", "Frame_", "(_", "aff", "Gro", "und", "Frame_", ",_", "stance", "Width_", ",_", "stance", "Rotation_", ",_", "stance", "Offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "show", "Frame_", "(_", "aff", "Gro", "und", "Frame_", ",_", "'", "aff", "orda", "nce", " ", "ground", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "oot_", "=_", "show", "Frame_", "(_", "lf", "oot", "Frame_", ",_", "'", "lf", "oot", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rf", "oot_", "=_", "show", "Frame_", "(_", "rf", "oot", "Frame_", ",_", "'", "rf", "oot", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "[_", "lf", "oot_", ",_", "rf", "oot_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "Foot", "Frame", "s", "Fro", "m", "Reference", "Frame_", "(_", "reference", "Frame_", ",_", "stance", "Width_", ",_", "stance", "Rotation_", ",_", "stance", "Offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foot", "Height_", "=_", "0.07", "453", "42_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", "._", "Set", "Matrix_", "(_", "reference", "Frame_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Frame_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Rotate", "Z_", "(_", "stance", "Rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Translate", "_", "(_", "stance", "Offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Frame_", "._", "Concat", "enat", "e_", "(_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lf", "oot", "Frame_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "oot", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "oot", "Frame_", "._", "Translate", "_", "(_", "0_", ",_", "stance", "Width_", "/_", "2.0_", ",_", "foot", "Height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "oot", "Frame_", "._", "Concat", "enat", "e_", "(_", "stance", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rf", "oot", "Frame_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rf", "oot", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rf", "oot", "Frame_", "._", "Translate", "_", "(_", "0_", ",_", "-_", "stance", "Width_", "/_", "2.0_", ",_", "foot", "Height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rf", "oot", "Frame_", "._", "Concat", "enat", "e_", "(_", "stance", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "stance", "Frame_", ",_", "lf", "oot", "Frame_", ",_", "rf", "oot", "Frame_", "\\u\\u\\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_", "pose", "Fro", "m", "Frame_", "(_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans_", "=_", "lcm", "bot", "core_", "._", "vector", "\\u", "3d", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "._", "x_", ",_", "trans_", "._", "y_", ",_", "trans_", "._", "z_", "=_", "frame_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wx", "yz_", "=_", "range_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "percept", "ion_", "._", "dr", "c_", "._", "vtk", "Multi", "sense", "Source_", "._", "Get", "Bot", "Quaternion", "_", "(_", "frame_", ",_", "wx", "yz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quat_", "=_", "lcm", "bot", "core_", "._", "quaternion", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quat_", "._", "w_", ",_", "quat_", "._", "x_", ",_", "quat_", "._", "y_", ",_", "quat_", "._", "z_", "=_", "wx", "yz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "lcm", "bot", "core_", "._", "position", "\\u", "3d", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pose_", "._", "translation_", "=_", "trans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pose_", "._", "rotation_", "=_", "quat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pose_", "\\u\\u\\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_", "crop", "To", "Plane_", "(_", "poly", "Data_", ",_", "origin_", ",_", "normal_", ",_", "threshold_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal_", "=_", "normal_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "np_", "._", "dot_", "(_", "points_", "-_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "dist_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cropped", "_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cropped", "_", ",_", "poly", "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_", "def_", "create", "Line_", "(_", "block", "Dimensions_", ",_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "Width_", "=_", "np_", "._", "array_", "(_", "block", "Dimensions_", ")_", "._", "max_", "(_", ")_", "/_", "2.0_", "+_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "Threshold_", "=_", "[_", "-_", "slice", "Width_", ",_", "slice", "Width_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", " ", "p1", " ", "to", " ", "be", " ", "point", " ", "on", " ", "left_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p1_", "[_", "0_", "]_", ">_", "p2_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p1_", ",_", "p2_", "=_", "p2_", ",_", "p1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", ",_", "world", "Pt", "1_", "=_", "get", "Ray", "Fro", "m", "Display", "Point_", "(_", "app_", "._", "get", "Curr", "ent", "Render", "View_", "(_", ")_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "world", "Pt", "2_", "=_", "get", "Ray", "Fro", "m", "Display", "Point_", "(_", "app_", "._", "get", "Curr", "ent", "Render", "View_", "(_", ")_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "came", "ra", "Pt_", "=_", "np_", "._", "array_", "(_", "app_", "._", "get", "Curr", "ent", "Render", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "left", "Ray", "_", "=_", "world", "Pt", "1_", "-_", "came", "ra", "Pt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Ray", "_", "=_", "world", "Pt", "2_", "-_", "came", "ra", "Pt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "middle", "Ray", "_", "=_", "(_", "left", "Ray", "_", "+_", "right", "Ray", "_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "came", "ra", "Pt_", ",_", "world", "Pt", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "came", "ra", "Pt_", ",_", "world", "Pt", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "world", "Pt", "1_", ",_", "world", "Pt", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "came", "ra", "Pt_", ",_", "came", "ra", "Pt_", "+_", "middle", "Ray", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "line", " ", "annot", "ation", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "Obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "input", "Obj_", "._", "poly", "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 ", " _", "poly", "Data_", "=_", "get", "Curr", "ent", "Revo", "luti", "on", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "origin_", "=_", "came", "ra", "Pt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normal_", "=_", "np_", "._", "cross_", "(_", "right", "Ray", "_", ",_", "left", "Ray", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Normal_", "=_", "np_", "._", "cross_", "(_", "normal_", ",_", "left", "Ray", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Normal_", "=_", "np_", "._", "cross_", "(_", "right", "Ray", "_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normal_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "Normal_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "left", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Normal_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "right", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "middle", "Ray", "_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "middle", "Ray", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cropped", "_", ",_", "poly", "Data_", "=_", "crop", "To", "Plane_", "(_", "poly", "Data_", ",_", "origin_", ",_", "normal_", ",_", "slice", "Threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "slice", " ", "dist", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "color", "By", "Range_", "=_", "[_", "-_", "0.5_", ",_", "0.5_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "cropped", "_", ",_", "'", "slice", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cropped", "_", ",_", "\\u_", "=_", "crop", "To", "Plane_", "(_", "cropped", "_", ",_", "origin_", ",_", "left", "Normal_", ",_", "[_", "-_", "1e6_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cropped", "_", ",_", "\\u_", "=_", "crop", "To", "Plane_", "(_", "cropped", "_", ",_", "origin_", ",_", "right", "Normal_", ",_", "[_", "-_", "1e6_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "cropped", "_", ",_", "'", "slice", " ", "segment", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", ",_", "plane", "Normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "cropped", "_", ",_", "distance", "Threshold_", "=_", "0.005_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "middle", "Ray", "_", ",_", "angle", "Eps", "ilon", "_", "=_", "math_", "._", "radians_", "(_", "60_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", "=_", "threshol", "d", "Points_", "(_", "plane", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.005_", ",_", "0.005_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "board", " ", "segmentation", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "get", "Random", "Color_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "names", " ", "=", " ", "['", "board", " ", "A", "',", " ", "'", "board", " ", "B", "',", " ", "'", "board", " ", "C", "',", " ", "'", "board", " ", "D", "',", " ", "'", "board", " ", "E", "',", " ", "'", "board", " ", "F", "',", " ", "'", "board", " ", "G", "',", " ", "'", "board", " ", "H", "',", " ", "'", "board", " ", "I", "']", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "name", " ", "in", " ", "names", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "om", ".", "find", "Object", "By", "Name", "(", "name", "):", "\\", "10", ";", " ", " ", " ", " ", "break", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "=", " ", "'", "board", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "board", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "segment", "Block", "By", "Top", "Plane_", "(_", "plane", "Points_", ",_", "block", "Dimensions_", ",_", "expected", "Normal_", "=_", "-_", "middle", "Ray", "_", ",_", "expected", "XA", "xis_", "=_", "middle", "Ray", "_", ",_", "edge", "Sign_", "=_", "-_", "1_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Block", "Aff", "orda", "nces_", "(_", "poly", "Data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "om_", "._", "get", "Objects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "Box", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "refi", "t", "'_", "in_", "obj_", "._", "get", "Property_", "(_", "'", "Name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "obj_", "in_", "om_", "._", "get", "Objects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "Box", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "Block", "Fit_", "(_", "obj_", ",_", "poly", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Block", "Fit_", "(_", "aff", "orda", "nce", "Obj_", ",_", "poly", "Data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "orda", "nce", "Obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "aff", "orda", "nce", "Obj_", "._", "get", "Property_", "(_", "'", "Name", "'_", ")_", "+_", "'", " ", "refi", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "aff", "orda", "nce", "Obj_", "._", "params_", "[_", "'", "orig", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal_", "=_", "aff", "orda", "nce", "Obj_", "._", "params_", "[_", "'", "yax", "is", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Per", "p", "Axis_", "=_", "aff", "orda", "nce", "Obj_", "._", "params_", "[_", "'", "xaxis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "Dimensions_", "=_", "[_", "aff", "orda", "nce", "Obj_", "._", "params_", "[_", "'", "xw", "idt", "h", "'_", "]_", ",_", "aff", "orda", "nce", "Obj_", "._", "params_", "[_", "'", "yw", "idt", "h", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "poly", "Data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "input", "Obj_", "._", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "crop", "Threshold_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cropped", "_", "=_", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cropped", "_", ",_", "\\u_", "=_", "crop", "To", "Plane_", "(_", "cropped", "_", ",_", "origin_", ",_", "normal_", ",_", "[_", "-_", "crop", "Threshold_", ",_", "crop", "Threshold_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cropped", "_", ",_", "\\u_", "=_", "crop", "To", "Plane_", "(_", "cropped", "_", ",_", "origin_", ",_", "edge", "Per", "p", "Axis_", ",_", "[_", "-_", "crop", "Threshold_", ",_", "crop", "Threshold_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "cropped", "_", ",_", "'", "refi", "t", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cropped", "_", "=_", "extract", "Large", "st", "Cluster_", "(_", "cropped", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", ",_", "plane", "Normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "cropped", "_", ",_", "distance", "Threshold_", "=_", "0.005_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "normal_", ",_", "angle", "Eps", "ilon", "_", "=_", "math_", "._", "radians_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", "=_", "threshol", "d", "Points_", "(_", "plane", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.005_", ",_", "0.005_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "refi", "t", " ", "board", " ", "segmentation", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "refi", "t", "Obj_", "=_", "segment", "Block", "By", "Top", "Plane_", "(_", "plane", "Points_", ",_", "block", "Dimensions_", ",_", "expected", "Normal_", "=_", "normal_", ",_", "expected", "XA", "xis_", "=_", "edge", "Per", "p", "Axis_", ",_", "edge", "Sign_", "=_", "-_", "1_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "refi", "t", "Origin_", "=_", "np_", "._", "array_", "(_", "refi", "t", "Obj_", "._", "params_", "[_", "'", "orig", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "Length_", "=_", "refi", "t", "Obj_", "._", "params_", "[_", "'", "zw", "idt", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "ZA", "xis_", "=_", "refi", "t", "Obj_", "._", "params_", "[_", "'", "za", "xis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "End", "Point", "1_", "=_", "refi", "t", "Origin_", "+_", "refi", "t", "ZA", "xis_", "*_", "refi", "t", "Length_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "original", "Length_", "=_", "aff", "orda", "nce", "Obj_", "._", "params_", "[_", "'", "zw", "idt", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corrected", "Origin_", "=_", "refi", "t", "End", "Point", "1_", "-_", "refi", "t", "ZA", "xis_", "*_", "original", "Length_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "Delta_", "=_", "corrected", "Origin_", "-_", "refi", "t", "Origin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "refi", "t", "Obj_", "._", "params_", "[_", "'", "zw", "idt", "h", "'_", "]_", "=_", "original", "Length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "Obj_", "._", "poly", "Data_", "._", "De", "ep", "Copy_", "(_", "aff", "orda", "nce", "Obj_", "._", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "Obj_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "._", "Translate", "_", "(_", "orig", "in", "Delta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "Obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "start", "Interact", "ive", "Line", "Draw_", "(_", "block", "Dimensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Line", "Draw_", "(_", "app_", "._", "get", "Curr", "ent", "Render", "View_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "create", "Line_", ",_", "block", "Dimensions_", ")_", "\\u\\u\\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_", "start", "Leve", "r", "Val", "ve", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Leve", "r", "Val", "ve_", ")_", "\\u\\u\\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_", "refi", "t", "Val", "ve", "Aff", "orda", "nce_", "(_", "aff", "_", ",_", "point1_", ",_", "origin_", ",_", "normal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "=_", "aff", "_", "._", "params_", "[_", "'", "xaxis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "aff", "_", "._", "params_", "[_", "'", "yax", "is", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "aff", "_", "._", "params_", "[_", "'", "za", "xis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "aff", "_", "._", "params_", "[_", "'", "orig", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "._", "Set", "Matrix_", "(_", "t_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "segment", "Val", "ve_", "(_", "expected", "Val", "ve", "Radius_", ",_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "\\u_", ",_", "wall", "Normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.2_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "wall", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "\\u_", ",_", "\\u_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "wall", "Normal_", ",_", "search", "Origin_", "=_", "point2_", ",_", "search", "Radius_", "=_", "expected", "Val", "ve", "Radius_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.2_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Cluster_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Cluster_", "=_", "crop", "To", "Sphere", "_", "(_", "valve", "Cluster_", ",_", "point2_", ",_", "expected", "Val", "ve", "Radius_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Cluster_", "=_", "extract", "Large", "st", "Cluster_", "(_", "valve", "Cluster_", ",_", "min", "Cluster", "Size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "valve", "Cluster_", ",_", "'", "valve", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "average_", "(_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "valve", "Cluster_", ",_", "'", "Point", "s", "'_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "wall", "Normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zw", "idth_", "=_", "0.03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "expected", "Val", "ve", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "-_", "zw", "idth_", "/_", "2.0_", "]_", ")_", ",_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "zw", "idth_", "/_", "2.0_", "]_", ")_", ",_", "radius_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "valve", " ", "aff", "orda", "nce", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "name_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "Wall", "Callbacks_", "._", "append_", "(_", "functools_", "._", "partial_", "(_", "refi", "t", "Val", "ve", "Aff", "orda", "nce_", ",_", "obj_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "axis_", "=_", "za", "xis_", ",_", "radius_", "=_", "radius_", ",_", "length_", "=_", "zw", "idth_", ",_", "origin_", "=_", "origin_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xw", "idth_", "=_", "radius_", ",_", "yw", "idth_", "=_", "radius_", ",_", "zw", "idth_", "=_", "zw", "idth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "df", "\\u", "type_", "=_", "'", "steer", "ing", "\\u", "cyl", "'_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "valve", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "obj_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", ",_", "name_", "+_", "'", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "scale_", "=_", "radius_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\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_", "segment", "Val", "ve", "By", "Bound", "ing", "Box_", "(_", "poly", "Data_", ",_", "search", "Point_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "crop", "To", "Sphere", "_", "(_", "poly", "Data_", ",_", "search", "Point_", ",_", "radius_", "=_", "0.6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "tube", " ", "search", " ", "region_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Distan", "ce", "To", "Line_", "(_", "poly", "Data_", ",_", "search", "Point_", ",_", "np_", "._", "array_", "(_", "search", "Point_", ")_", "+_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "[_", "0.0_", ",_", "0.2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "valve", " ", "tube", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "guess", " ", "valve", " ", "plane_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "search", "Region_", ",_", "distance", "Threshold_", "=_", "0.01_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "view", "Direction_", ",_", "angle", "Eps", "ilon", "_", "=_", "math_", "._", "radians_", "(_", "30_", ")_", ",_", "expected", "Normal_", "=_", "-_", "view", "Direction_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "plane", " ", "search", " ", "region_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "normal_", ",_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "along", "\\u", "axis", "'_", ",_", "[_", "-_", "0.05_", ",_", "0.05_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "valve", " ", "plane", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "axis", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "Points_", "=_", "extract", "Large", "st", "Cluster_", "(_", "search", "Region_", ",_", "min", "Cluster", "Size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "valve", "Points_", ",_", "'", "valve", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "Points_", ",_", "\\u_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "valve", "Points_", ",_", "expected", "Normal_", "=_", "normal_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "normal_", ",_", "distance", "Threshold_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Fit_", "=_", "threshol", "d", "Points_", "(_", "valve", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "valve", "Fit_", ",_", "'", "valve", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "valve", "Fit_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zv", "alues", "_", "=_", "points_", "[_", ":_", ",_", "2_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Z_", "=_", "np_", "._", "min_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Z_", "=_", "np_", "._", "max_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tube", "Radius_", "=_", "0.01", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "float_", "(_", "(_", "max", "Z_", "-_", "min", "Z_", ")_", "/_", "2.0_", ")_", "-_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "make", "Poly", "Data", "Fields_", "(_", "valve", "Fit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "fields_", "._", "frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "orig", "in", " ", "=", " ", "compute", "Centro", "id", "(", "valve", "Fit", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "valve", "'_", ",_", "uuid_", "=_", "new", "UUID_", "(_", ")_", ",_", "pose_", "=_", "pose_", ",_", "Color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "Radius_", "=_", "radius_", ",_", "Segments", "_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "[_", "'", "Tu", "be", " ", "Rad", "ius", "'_", "]_", "=_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "params_", "=_", "dict_", "(_", "radius_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Doo", "r", "Plane_", "(_", "poly", "Data_", ",_", "door", "Point_", ",_", "stance", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "door", "Point_", "=_", "np_", "._", "array_", "(_", "door", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "door", "Band_", "=_", "1.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "door", "Point_", "+_", "[_", "0.0_", ",_", "0.0_", ",_", "door", "Band_", "/_", "2_", "]_", ",_", "door", "Point_", "-_", "[_", "0.0_", ",_", "0.0_", ",_", "door", "Band_", "/_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit", "Points_", ",_", "normal_", "=_", "appl", "y", "Local", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "door", "Point_", ",_", "search", "Radius_", "=_", "0.2_", ",_", "search", "Rad", "ius", "End_", "=_", "1.0_", ",_", "remove", "Gro", "und", "First_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "fit", "Points_", ",_", "'", "door", " ", "points", "'_", ",_", "visible_", "=_", "False_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "normal_", ",_", "view", "Direction_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normal_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "origin_", "=_", "compute", "Centro", "id_", "(_", "fit", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Height_", "=_", "stance", "Frame_", "._", "Get", "Position_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "[_", "origin_", "[_", "0_", "]_", ",_", "origin_", "[_", "1_", "]_", ",_", "ground", "Height_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Val", "ve", "By", "Ri", "m_", "(_", "poly", "Data_", ",_", "rim", "Point", "1_", ",_", "rim", "Point", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "array_", "(_", "rim", "Point", "2_", ")_", "-_", "np_", "._", "array_", "(_", "rim", "Point", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flip", " ", "xaxis", " ", "to", " ", "be", " ", "with", " ", "view", " ", "direction_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "view", "Direction_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "=_", "-_", "xaxis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "(_", "np_", "._", "array_", "(_", "rim", "Point", "2_", ")_", "+_", "np_", "._", "array_", "(_", "rim", "Point", "1_", ")_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "xaxis_", ",_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "along", "\\u", "axis", "'_", ",_", "[_", "-_", "0.05_", ",_", "0.05_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "valve", " ", "plane", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "axis", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "crop", "To", "Sphere", "_", "(_", "poly", "Data_", ",_", "origin_", ",_", "radius_", "=_", "0.4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "valve", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "Fit_", "=_", "extract", "Large", "st", "Cluster_", "(_", "poly", "Data_", ",_", "min", "Cluster", "Size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "valve", "Fit_", ",_", "'", "valve", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "valve", "Fit_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zv", "alues", "_", "=_", "points_", "[_", ":_", ",_", "2_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Z_", "=_", "np_", "._", "min_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Z_", "=_", "np_", "._", "max_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tube", "Radius_", "=_", "0.01", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "float_", "(_", "(_", "max", "Z_", "-_", "min", "Z_", ")_", "/_", "2.0_", ")_", "-_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "make", "Poly", "Data", "Fields_", "(_", "valve", "Fit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "fields_", "._", "frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "transform", "Poly", "Data_", "(_", "fields_", "._", "box_", ",_", "fields_", "._", "frame_", ")_", ",_", "'", "valve", " ", "cluster", " ", "bound", "ing", " ", "box", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "orig", "in", " ", "=", " ", "compute", "Centro", "id", "(", "valve", "Fit", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "za", "xis", " ", "=", " ", "[", "0", ",", "0", ",", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "xaxis", " ", "=", " ", "normal", "\\", "10", ";", " ", " ", " ", " ", "yax", "is", " ", "=", " ", "np", ".", "cross", "(", "za", "xis", ",", " ", "xaxis", ")", "\\", "10", ";", " ", " ", " ", " ", "yax", "is", " ", "/", "=", " ", "np", ".", "linalg", ".", "norm", "(", "yax", "is", ")", "\\", "10", ";", " ", " ", " ", " ", "xaxis", " ", "=", " ", "np", ".", "cross", "(", "yax", "is", ",", " ", "za", "xis", ")", "\\", "10", ";", " ", " ", " ", " ", "xaxis", " ", "/", "=", " ", "np", ".", "linalg", ".", "norm", "(", "xaxis", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "np_", "._", "max_", "(_", "fields_", "._", "dims_", ")_", "/_", "2.0_", "-_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proj_", "=_", "[_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "axis_", ")_", ")_", "for_", "axis_", "in_", "fields_", "._", "axes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis", "New_", "=_", "fields_", "._", "axes_", "[_", "np_", "._", "argmax_", "(_", "proj_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis", "New_", ",_", "xaxis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis", "New_", "=_", "-_", "xaxis", "New_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xaxis_", "=_", "xaxis", "New_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "valve", "'_", ",_", "uuid_", "=_", "new", "UUID_", "(_", ")_", ",_", "pose_", "=_", "pose_", ",_", "Color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "Radius_", "=_", "float_", "(_", "radius_", ")_", ",_", "Segments", "_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "[_", "'", "Tu", "be", " ", "Rad", "ius", "'_", "]_", "=_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "params_", "=_", "dict_", "(_", "radius_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Val", "ve", "By", "Wall", "Plane_", "(_", "expected", "Val", "ve", "Radius_", ",_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "center", "Point_", "=_", "(_", "point1_", "+_", "point2_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "poly", "Data_", "=_", "remove", "Gro", "und_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "-_", "view", "Direction_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "perp", "Line_", "=_", "np_", "._", "cross_", "(_", "point2_", "-_", "point1_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "perp", "Line", " ", "/", "=", " ", "np", ".", "linalg", ".", "norm", "(", "perp", "Line", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "perp", "Line", " ", "*", " ", "np", ".", "linalg", ".", "norm", "(", "point", "2", " ", "-", " ", "point", "1", ")/", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "point", "3_", ",_", "point", "4_", "=_", "center", "Point_", "+_", "perp", "Line_", "/_", "2.0_", ",_", "center", "Point_", "-_", "perp", "Line_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "point", "3_", ",_", "point", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "crop", " ", "lines", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "valve", " ", "wall", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.05_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Line", "Segment_", "(_", "search", "Region_", ",_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Line", "Segment_", "(_", "search", "Region_", ",_", "point", "3_", ",_", "point", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "valve", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region", "Spo", "kes", "_", "=_", "shallow", "Copy_", "(_", "search", "Region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", ",_", "origin_", ",_", "\\u_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "search", "Region_", ",_", "expected", "Normal_", "=_", "normal_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "normal_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "search", "Region_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.015", "_", ",_", "0.015", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "valve", " ", "search", " ", "region", " ", "2", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "large", "st", "Cluster_", "=_", "extract", "Large", "st", "Cluster_", "(_", "search", "Region_", ",_", "min", "Cluster", "Size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "large", "st", "Cluster_", ",_", "'", "valve", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radi", "us", "Limit_", "=_", "[_", "expected", "Val", "ve", "Radius_", "-_", "0.01_", ",_", "expected", "Val", "ve", "Radius_", "+_", "0.01_", "]_", "if_", "expected", "Val", "ve", "Radius_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "radi", "us", "Limit", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "circle", "Fit_", "=_", "extract", "Circle_", "(_", "large", "st", "Cluster_", ",_", "distance", "Threshold_", "=_", "0.01_", ",_", "radi", "us", "Limit_", "=_", "radi", "us", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "circle", " ", "fit", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "poly", "Data", ",", " ", "circle", "Fit", " ", "=", " ", "extract", "Circ", "le", "(", "poly", "Data", ",", " ", "distance", "Thresh", "old", "=", "0.01", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "Poly", "Data", "(", "poly", "Data", ",", " ", "'", "circle", " ", "fit", "',", " ", "color", "By", "Name", "='", "z", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "circle", "Fit_", "._", "Get", "Circ", "le", "Radius_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "circle", "Fit_", "._", "Get", "Circ", "le", "Origin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Normal_", "=_", "np_", "._", "array_", "(_", "circle", "Fit_", "._", "Get", "Circ", "le", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Normal_", "=_", "circle", "Normal_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "circle", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "circle", "Normal_", ",_", "normal_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "circle", "Normal_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "use", " ", "of", " ", "the", " ", "plane", " ", "normal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "circle", "Normal_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "expected", "Val", "ve", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "normal_", "*_", "radius_", ",_", "origin_", "+_", "normal_", "*_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Circle_", "(_", "origin_", ",_", "circle", "Normal_", ",_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "valve", " ", "axes", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "-_", "circle", "Normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "t", " ", "=", " ", "get", "Transform", "Fro", "m", "Axe", "s", "(", "xaxis", ",", " ", "yax", "is", ",", " ", "za", "xis", ")", " ", "#", " ", "this", " ", "was", " ", "adde", "d", " ", "to", " ", "be", " ", "consistent", " ", "with", " ", "segment", "Val", "ve", "By", "Ri", "m_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "za", "xis_", ",_", "-_", "yaxis_", ",_", "xaxis_", ")_", "#", " ", "this", " ", "was", " ", "adde", "d", " ", "to", " ", "be", " ", "consistent", " ", "with", " ", "segment", "Val", "ve", "By", "Ri", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Spo", "ke", " ", "angle", " ", "fitting", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "1_", "==_", "0_", ")_", ":_", "#", " ", "disable", "d", " ", "jan", " ", "2015_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "extract", " ", "the", " ", "relative", " ", "posit", "on", " ", "of", " ", "the", " ", "points", " ", "to", " ", "the", " ", "valve", " ", "axis", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "Region", "Spo", "kes", "_", "=_", "label", "Distan", "ce", "To", "Line_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "origin_", ",_", "[_", "origin_", "+_", "circle", "Normal_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region", "Spo", "kes", "_", "=_", "threshol", "d", "Points_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "[_", "0.05_", ",_", "radius_", "-_", "0.04_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "'", "valve", " ", "spoke", " ", "search", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region", "Spo", "kes", "Local_", "=_", "transform", "Poly", "Data_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "search", "Region", "Spo", "kes", "Local_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spoke", "\\u", "angle_", "=_", "find", "Val", "ve", "Spo", "ke", "Angle_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spoke", "\\u", "angle_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spoke", "Ang", "le", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "spoke", "\\u", "angle_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Transform_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Ang", "le", "Transform_", "._", "Concat", "enat", "e_", "(_", "spoke", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Obj_", "=_", "show", "Frame_", "(_", "spoke", "Ang", "le", "Transform_", ",_", "'", "spoke", " ", "frame", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "spoke", "Ang", "le", "Transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tube", "Radius_", "=_", "0.01", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "valve", "'_", ",_", "uuid_", "=_", "new", "UUID_", "(_", ")_", ",_", "pose_", "=_", "pose_", ",_", "Color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "Radius_", "=_", "float_", "(_", "radius_", ")_", ",_", "Segments", "_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "[_", "'", "Tu", "be", " ", "Rad", "ius", "'_", "]_", "=_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "params_", "=_", "dict_", "(_", "radius_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "Histogram", "_", "(_", "poly", "Data_", ",_", "array", "Name_", ",_", "number", "Of", "Bins_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "vn", "p_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", ",_", "bins_", "=_", "np_", "._", "histogram_", "(_", "x_", ",_", "bins_", "=_", "number", "Of", "Bins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "0.7_", "*_", "(_", "bins_", "[_", "1_", "]_", "-_", "bins_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center_", "=_", "(_", "bins_", "[_", ":_", "-_", "1_", "]_", "+_", "bins_", "[_", "1_", ":_", "]_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "bar_", "(_", "center_", ",_", "hist_", ",_", "align_", "=_", "'", "center", "'_", ",_", "width_", "=_", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bins_", "[_", "np_", "._", "argmax_", "(_", "hist_", ")_", "]_", "+_", "(_", "bins_", "[_", "1_", "]_", "-_", "bins_", "[_", "0_", "]_", ")_", "/_", "2.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_", "show", "Table_", "(_", "table_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "expl", "ict", "ly", " ", "draw", " ", "a", " ", "table", " ", "and", " ", "its", " ", "frames", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "table_", "._", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Mesh", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "table", "'_", ",_", "Color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "pose_", "=_", "pose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "=_", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Poly", "Data_", "(_", "table_", "._", "mesh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Box_", "=_", "vis_", "._", "show", "Poly", "Data_", "(_", "table_", "._", "box_", ",_", "'", "table", " ", "box", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Box_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "table_", "._", "frame_", ")_", "\\u\\u\\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_", "appl", "y", "Km", "ean", "s", "Label_", "(_", "poly", "Data_", ",_", "array", "Name_", ",_", "number", "Of", "Cluster", "s_", ",_", "whiten", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "scipy_", "._", "cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar_", "=_", "vn", "p_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "array", "Name_", ")_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "whiten", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scipy_", "._", "cluster_", "._", "vq", "_", "._", "whiten", "_", "(_", "ar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "codes_", ",_", "dist", "urban", "ces_", "=_", "scipy_", "._", "cluster_", "._", "vq", "_", "._", "kmeans", "_", "(_", "ar_", ",_", "number", "Of", "Cluster", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "array", "Name_", "==_", "'", "normal", "s", "'_", "and_", "number", "Of", "Cluster", "s_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v1_", "=_", "codes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2_", "=_", "codes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "v1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "v2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "np_", "._", "arcc", "os_", "(_", "np_", "._", "dot_", "(_", "v1_", ",_", "v2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "angle", " ", "bet", "ween", " ", "normal", "s", ":'_", ",_", "np_", "._", "degrees_", "(_", "angle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "code_", ",_", "distance_", "=_", "scipy_", "._", "cluster_", "._", "vq", "_", "._", "vq", "_", "(_", "ar_", ",_", "codes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vn", "p_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "code_", ",_", "'%", "s", "\\u", "kmeans", "\\u", "label", "'_", "%_", "array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "poly", "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_", "def_", "find", "Val", "ve", "Spo", "ke", "Angle_", "(_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", " ", "the", " ", "location", " ", "of", " ", "the", " ", "valve", " ", "spoke", " ", "angle", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "binning", " ", "the", " ", "spoke", " ", "return", "s", ".", " ", "return", "s", " ", "angle", " ", "in", " ", "degr", "ees", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "np", ".", "save", "txt", "(\"", "/", "home", "/", "mf", "allo", "n", "/", "Des", "kto", "p", "/", "spoke", "\\u", "points", ".", "csv", "\",", " ", "points", ",", " ", "delimiter", "=\"", ",\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "all", " ", "points", " ", "to", " ", "degr", "ees", " ", "in", " ", "range", " ", "[", "0", ",", "120", "]_", "\\u\\u\\uNL\\u\\u\\u_", "angle_", "=_", "np_", "._", "degrees_", "(_", "np_", "._", "arctan", "2_", "(_", "points_", "[_", ":_", ",_", "1_", "]_", ",_", "points_", "[_", ":_", ",_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qq", "_", "=_", "np_", "._", "where_", "(_", "angle_", "<_", "0_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "[_", "qq", "_", "]_", "+=_", "360_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "np_", "._", "mod_", "(_", "angle_", ",_", "120_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "spoke", " ", "as", " ", "the", " ", "max", " ", "of", " ", "a", " ", "histo", "gram", ":_", "\\u\\u\\uNL\\u\\u\\u_", "bins_", "=_", "range_", "(_", "0_", ",_", "130_", ",_", "10_", ")_", "#", " ", "0", ",", "10", ",...", "130_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "freq_", ",_", "bins_", "=_", "np_", "._", "histogram_", "(_", "angle_", ",_", "bins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amax_", "=_", "np_", "._", "argmax_", "(_", "freq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "\\u", "angle_", "=_", "bins_", "[_", "amax_", "]_", "+_", "5_", "#", " ", "correct", " ", "for", " ", "5d", "eg", " ", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "spoke", "\\u", "angle_", "\\u\\u\\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", "Wall", "Center_", "(_", "poly", "Data_", ",_", "remove", "Gro", "und", "Method_", "=_", "remove", "Gro", "und_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "a", " ", "frame", " ", "at", " ", "the", " ", "center", " ", "of", " ", "the", " ", "valve", " ", "wall", "\\", "10", ";", " ", " ", " ", " ", "X", "&", "Y", ":", " ", "averag", "e", " ", "of", " ", "points", " ", "on", " ", "the", " ", "wall", " ", "plane", "\\", "10", ";", " ", " ", " ", " ", "Z", ":", " ", "4", " ", "feet", " ", "off", " ", "the", " ", "ground", " ", "(", "dete", "rmin", "ed", " ", "usi", "ng", " ", "robot", "'", "s", " ", "feet", "\\", "10", ";", " ", " ", " ", " ", "Orient", "ation", ":", " ", "z", "-", "normal", " ", "int", "o", " ", "plane", ",", " ", "y", "-", "axis", " ", "horizon", "tal", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "poly", "Data_", "=_", "remove", "Gro", "und", "Method_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "-_", "view", "Direction_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "Points_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "wall", "Points_", ",_", "leaf", "Size_", "=_", "0.03_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "Points_", "=_", "extract", "Large", "st", "Cluster_", "(_", "wall", "Points_", ",_", "min", "Cluster", "Size_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "auto", " ", "valve", " ", "wall", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xval", "ues_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "wall", "Points_", ",_", "'", "Point", "s", "'_", ")_", "[_", ":_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yval", "ues_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "wall", "Points_", ",_", "'", "Point", "s", "'_", ")_", "[_", ":_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "median", " ", "or", " ", "mid", " ", "of", " ", "max", " ", "or", " ", "min", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "xce", "nter", " ", "=", " ", "np", ".", "median", "(", "xval", "ues", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ycen", "ter", " ", "=", " ", "np", ".", "median", "(", "yval", "ues", ")_", "\\u\\u\\uNL\\u\\u\\u_", "xce", "nter", "_", "=_", "(_", "np_", "._", "max_", "(_", "xval", "ues_", ")_", "+_", "np_", "._", "min_", "(_", "xval", "ues_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ycen", "ter_", "=_", "(_", "np_", "._", "max_", "(_", "yval", "ues_", ")_", "+_", "np_", "._", "min_", "(_", "yval", "ues_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "used", ",", " ", "not", " ", "very", " ", "reliab", "le_", "\\u\\u\\uNL\\u\\u\\u_", "#", "zv", "alues", " ", "=", " ", "vtk", "Num", "py", ".", "get", "Num", "py", "Fro", "m", "Vt", "k", "(", "wall", "Point", "s", ",", " ", "'", "Point", "s", "')", "[:,", "2", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "zc", "enter", " ", "=", " ", "np", ".", "median", "(", "zv", "alues", ")_", "\\u\\u\\uNL\\u\\u\\u_", "zc", "enter_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "Gro", "und", "Height_", "(_", ")_", "+_", "1.2", "192_", "#", " ", "valve", "s", " ", "are", " ", "4f", "t", " ", "from", " ", "ground_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point1_", "=_", "np_", "._", "array_", "(_", "[_", "xce", "nter", "_", ",_", "ycen", "ter_", ",_", "zc", "enter_", "]_", ")_", "#", " ", "center", " ", "of", " ", "the", " ", "valve", " ", "wall_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normal", "Obj_", "=_", "show", "Frame_", "(_", "t_", ",_", "'", "valve", " ", "wall", " ", "frame", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "#", " ", "z", " ", "direction", " ", "out", " ", "of", " ", "wall_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Val", "ve", "Wall", "Auto", "_", "(_", "expected", "Val", "ve", "Radius_", "=_", ".1", "95_", ",_", "mode_", "=_", "'", "bot", "h", "'_", ",_", "remove", "Gro", "und", "Method_", "=_", "remove", "Gro", "und_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Automat", "ical", "ly", " ", "segment", " ", "a", " ", "valve", " ", "hang", "ing", " ", "in", " ", "front", " ", "of", " ", "the", " ", "wall", " ", "at", " ", "the", " ", "center", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "valve", " ", "wall", " ", "and", " ", "its", " ", "center_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "find", "Wall", "Center_", "(_", "poly", "Data_", ",_", "remove", "Gro", "und", "Method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "\\u", "point1_", "=_", "[_", "0_", ",_", "0.6_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Transform", "1_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "valve", "\\u", "point1_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Transform", "1_", "._", "Concat", "enat", "e_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point1_", "=_", "np_", "._", "array_", "(_", "valve", "Transform", "1_", "._", "Get", "Position_", "(_", ")_", ")_", "#", " ", "left", " ", "of", " ", "wall_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "\\u", "point2_", "=_", "[_", "0_", ",_", "-_", "0.6_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Transform", "2_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "valve", "\\u", "point2_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Transform", "2_", "._", "Concat", "enat", "e_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point2_", "=_", "np_", "._", "array_", "(_", "valve", "Transform", "2_", "._", "Get", "Position_", "(_", ")_", ")_", "#", " ", "left", " ", "of", " ", "wall_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "\\u", "point", "3_", "=_", "[_", "0_", ",_", "1.0_", ",_", "0_", "]_", "#", " ", "leve", "r", " ", "can", " ", "over", " ", "hang", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Transform", "3_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "valve", "\\u", "point", "3_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valve", "Transform", "3_", "._", "Concat", "enat", "e_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point", "3_", "=_", "valve", "Transform", "3_", "._", "Get", "Position_", "(_", ")_", "#", " ", "right", " ", "of", " ", "wall_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "point2_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "point1_", ",_", "radius_", "=_", "0.03_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "point", "3_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "auto", " ", "wall", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "mode_", "==_", "'", "valve", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segment", "Val", "ve", "By", "Wall", "Plane_", "(_", "expected", "Val", "ve", "Radius_", ",_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "mode_", "==_", "'", "leve", "r", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segment", "Leve", "r", "By", "Wall", "Plane_", "(_", "point1_", ",_", "point", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "mode_", "==_", "'", "bot", "h", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segment", "Val", "ve", "By", "Wall", "Plane_", "(_", "expected", "Val", "ve", "Radius_", ",_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segment", "Leve", "r", "By", "Wall", "Plane_", "(_", "point1_", ",_", "point", "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 ", " _", "raise_", "Exception_", "(_", "'", "unexpected", " ", "segmentation", " ", "mode", ":", " ", "'_", "+_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Leve", "r", "By", "Wall", "Plane_", "(_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "dete", "rmin", "e", " ", "the", " ", "position", " ", "(", "inclu", "ding", " ", "rotati", "on", " ", "of", " ", "a", " ", "leve", "r", " ", "near", " ", "a", " ", "wall", "\\", "10", ";", " ", " ", " ", " ", "input", " ", "is", " ", "as", " ", "for", " ", "the", " ", "valve", " ", "-", " ", "to", " ", "points", " ", "on", " ", "the", " ", "wall", " ", "eit", "her", " ", "side", " ", "of", " ", "the", " ", "leve", "r", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "dete", "rmin", "e", " ", "the", " ", "wall", " ", "plane", " ", "and", " ", "normal_", "\\u\\u\\uNL\\u\\u\\u_", "center", "Point_", "=_", "(_", "point1_", "+_", "point2_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "-_", "view", "Direction_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "Cro", "p", " ", "the", " ", "cloud", " ", "down", " ", "to", " ", "the", " ", "leve", "r", " ", "only", " ", "usi", "ng", " ", "the", " ", "wall", " ", "plane_", "\\u\\u\\uNL\\u\\u\\u_", "perp", "Line_", "=_", "np_", "._", "cross_", "(_", "point2_", "-_", "point1_", ",_", "-_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "perp", "Line", " ", "/", "=", " ", "np", ".", "linalg", ".", "norm", "(", "perp", "Line", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "perp", "Line", " ", "*", " ", "np", ".", "linalg", ".", "norm", "(", "point", "2", " ", "-", " ", "point", "1", ")/", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "point", "3_", ",_", "point", "4_", "=_", "center", "Point_", "+_", "perp", "Line_", "/_", "2.0_", ",_", "center", "Point_", "-_", "perp", "Line_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "point", "3_", ",_", "point", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "leve", "r", " ", "crop", " ", "lines", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "leve", "r", " ", "valve", " ", "wall", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.12_", ",_", "0.2_", "]_", ")_", "#", " ", "very", " ", "tig", "ht", " ", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Line", "Segment_", "(_", "search", "Region_", ",_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Line", "Segment_", "(_", "search", "Region_", ",_", "point", "3_", ",_", "point", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "leve", "r", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ".", " ", "fit", " ", "line", " ", "to", " ", "rema", "inin", "g", " ", "points", " ", "-", " ", "all", " ", "assume", "d", " ", "to", " ", "be", " ", "the", " ", "leve", "r_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Point_", ",_", "line", "Direction_", ",_", "\\u_", "=_", "appl", "y", "Line", "Fit_", "(_", "search", "Region_", ",_", "distance", "Threshold_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "np", ".", "dot", "(", "line", "Directi", "on", ",", " ", "forward", "Directi", "on", ")", " ", "<", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "line", "Directi", "on", " ", "=", " ", "-", "line", "Direction_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "line", "Point_", ",_", "radius_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "leve", "r", " ", "point", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "search", "Region_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts_", "-_", "line", "Point_", ",_", "line", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leve", "r", "\\u", "center_", "=_", "line", "Point_", "+_", "line", "Direction_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leve", "r", "\\u", "tip_", "=_", "line", "Point_", "+_", "line", "Direction_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", ".", " ", "dete", "rmin", "e", " ", "whi", "ch", " ", "leve", "r", " ", "point", " ", "is", " ", "closest", " ", "to", " ", "the", " ", "lower", " ", "left", " ", "of", " ", "the", " ", "wall", ".", " ", "Tha", "t", "'", "s", " ", "the", " ", "leve", "r", "\\u", "center", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "distan", "t", " ", "point", " ", "down", " ", "and", " ", "left", " ", "from", " ", "wall_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left_", "=_", "[_", "-_", "20_", ",_", "-_", "20.0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left", "\\u", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left", "\\u", "Transform_", "._", "Concat", "enat", "e_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left_", "=_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left", "\\u", "Transform_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "(_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left_", "-_", "project", "Point", "To", "Plane_", "(_", "leve", "r", "\\u", "center_", ",_", "origin_", ",_", "normal_", ")_", ")_", "**_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "(_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left_", "-_", "project", "Point", "To", "Plane_", "(_", "leve", "r", "\\u", "tip_", ",_", "origin_", ",_", "normal_", ")_", ")_", "**_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "d2_", "<_", "d1_", ")_", ":_", "#", " ", "flip", " ", "the", " ", "points", " ", "to", " ", "match", " ", "variab", "le", " ", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "temp_", "=_", "leve", "r", "\\u", "center_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leve", "r", "\\u", "center_", "=_", "leve", "r", "\\u", "tip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leve", "r", "\\u", "tip_", "=_", "p", "\\u", "temp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "Direction_", "=_", "-_", "line", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "5", ".", " ", "compute", " ", "the", " ", "rotati", "on", " ", "angle", " ", "of", " ", "the", " ", "leve", "r", " ", "and", ",", " ", "usi", "ng", " ", "tha", "t", ",", " ", "its", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "za", "xis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "leve", "r", "\\u", "center_", ")_", "#", " ", "nominal", " ", "frame", " ", "at", " ", "leve", "r", " ", "center_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rotati", "on", "Angle_", "=_", "-_", "compute", "Signe", "d", "Ang", "le", "Bet", "ween", "Vectors_", "(_", "line", "Direction_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ",_", "-_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "leve", "r_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "math_", "._", "degrees_", "(_", "rotati", "on", "Angle_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "leve", "r_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "leve", "r_", "._", "Concat", "enat", "e_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "d", ".", "add", "Sphere", "(", " ", "point", "1", " ", ",", " ", "radi", "us", "=", "0.", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "wall", "\\u", "point", "\\u", "lower", "\\u", "left_", ",_", "radius_", "=_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "leve", "r", "\\u", "center_", ",_", "radius_", "=_", "0.04_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "leve", "r", "\\u", "tip_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "leve", "r", "\\u", "center_", ",_", "leve", "r", "\\u", "tip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "leve", "r", " ", "end", " ", "points", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "(_", "leve", "r", "\\u", "tip_", "-_", "leve", "r", "\\u", "center_", ")_", "**_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "length_", ",_", "0_", ",_", "0_", "]_", ",_", "radius_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geometry_", "=_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "show", "Poly", "Data_", "(_", "geometry_", ",_", "'", "valve", " ", "leve", "r", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t", "\\u", "leve", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "t", "\\u", "leve", "r_", ",_", "'", "leve", "r", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "df", "Type_", "=_", "'", "leve", "r", "\\u", "valve", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "np_", "._", "array_", "(_", "t", "\\u", "leve", "r_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "radius_", "=_", "radius_", ",_", "length_", "=_", "length_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "ot", "df", "Type_", ",_", "ot", "df", "\\u", "type_", "=_", "ot", "df", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "appl", "y", "IC", "P_", "(_", "source_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icp", "_", "=_", "vtk_", "._", "vtk", "Iterat", "ive", "Closes", "t", "Point", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icp", "_", "._", "Set", "Source_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icp", "_", "._", "Set", "Target_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icp", "_", "._", "Get", "Land", "mark", "Transform_", "(_", ")_", "._", "Set", "Mode", "To", "Rig", "id", "Body_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icp", "_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Set", "Matrix_", "(_", "icp", "_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "Disk", "Glyphs", "_", "(_", "poly", "Data_", ",_", "compute", "Normal", "s_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "voxel", "Grid", "Lea", "f", "Size_", "=_", "0.03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "Radius_", "=_", "0.015", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "Resolution_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compute", "Normal", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scan", "Input_", "=_", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pd_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "scan", "Input_", ",_", "leaf", "Size_", "=_", "voxel", "Grid", "Lea", "f", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pd_", "=_", "label", "Outl", "iers", "_", "(_", "pd_", ",_", "search", "Radius_", "=_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", ",_", "neighbor", "s", "In", "Sear", "ch", "Radius_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd_", "=_", "threshol", "d", "Points_", "(_", "pd_", ",_", "'", "is", "\\u", "outlier", "'_", ",_", "[_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pd_", "=_", "normal", "Estimat", "ion_", "(_", "pd_", ",_", "search", "Radius_", "=_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", ",_", "search", "Cloud_", "=_", "scan", "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 ", " _", "pd_", "=_", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "poly", "Data_", "._", "Get", "Point", "Data_", "(_", ")_", "._", "Get", "Normal", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disk_", "=_", "vtk_", "._", "vtk", "Disk", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "._", "Set", "Out", "er", "Radius_", "(_", "disk", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "._", "Set", "In", "ner", "Radius_", "(_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "._", "Set", "Radia", "l", "Resolution_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "._", "Set", "Circ", "um", "fer", "ential", "Resolution_", "(_", "disk", "Resolution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Rotate", "Y_", "(_", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk_", "=_", "transform", "Poly", "Data_", "(_", "disk_", "._", "Get", "Output_", "(_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "glyph_", "=_", "vtk_", "._", "vtk", "Gl", "yp", "h", "3", "D_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Sca", "ling", "Off_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Orient", "On_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Set", "Source_", "(_", "disk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Set", "Input_", "(_", "pd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Set", "Vector", "Mode", "To", "Us", "e", "Normal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "shallow", "Copy_", "(_", "glyph_", "._", "Get", "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_", "def_", "appl", "y", "Arrow", "Glyphs", "_", "(_", "poly", "Data_", ",_", "compute", "Normal", "s_", "=_", "True_", ",_", "voxel", "Grid", "Lea", "f", "Size_", "=_", "0.03_", ",_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", "=_", "0.05_", ",_", "arrow", "Size_", "=_", "0.02_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "compute", "Normal", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voxel", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "voxel", "Grid", "Lea", "f", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "normal", "Estimat", "ion_", "(_", "poly", "Data_", ",_", "search", "Radius_", "=_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", ",_", "search", "Cloud_", "=_", "voxel", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "remove", "Non", "Fini", "te", "Points_", "(_", "poly", "Data_", ",_", "'", "normal", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flip", "Normal", "s", "With", "View", "Direction_", "(_", "poly", "Data_", ",_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "poly", "Data_", "._", "Get", "Point", "Data_", "(_", ")_", "._", "Get", "Normal", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arrow_", "=_", "vtk_", "._", "vtk", "Arrow", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arrow_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "glyph_", "=_", "vtk_", "._", "vtk", "Gl", "yp", "h", "3", "D_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Set", "Scale", "Factor_", "(_", "arrow", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Set", "Source_", "(_", "arrow_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Set", "Input_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Set", "Vector", "Mode", "To", "Us", "e", "Normal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glyph_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "shallow", "Copy_", "(_", "glyph_", "._", "Get", "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_", "def_", "segment", "Leve", "r", "Val", "ve_", "(_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.2_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "wall", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "0.33", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normal_", "=_", "-_", "normal_", "#", " ", "set", " ", "z", " ", "to", " ", "face", " ", "int", "o", " ", "wall_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "leve", "r", "P1_", "=_", "point2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leve", "r", "P2_", "=_", "point2_", "+_", "xaxis_", "*_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "length_", ",_", "0_", ",_", "0_", "]_", ",_", "radius_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geometry_", "=_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "show", "Poly", "Data_", "(_", "geometry_", ",_", "'", "valve", " ", "leve", "r", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "t_", ",_", "'", "leve", "r", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "df", "Type_", "=_", "'", "leve", "r", "\\u", "valve", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "np_", "._", "array_", "(_", "t_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "radius_", "=_", "radius_", ",_", "length_", "=_", "length_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "ot", "df", "Type_", ",_", "ot", "df", "\\u", "type_", "=_", "ot", "df", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "segment", "Wy", "e_", "(_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.2_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "wall", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wy", "e", "Mesh_", "=_", "io", "Utils_", "._", "read", "Poly", "Data_", "(_", "os_", "._", "path_", "._", "join_", "(_", "app_", "._", "get", "DR", "CB", "ase_", "(_", ")_", ",_", "'", "software", "/", "model", "s", "/", "ot", "df", "/", "wy", "e", ".", "obj", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wy", "e", "Mesh", "Point_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.005_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wy", "e", "Mesh", "Le", "ft", "Handle_", "=_", "np_", "._", "array_", "(_", "[_", "0.03", "229", "2_", ",_", "0.02", "949", "_", ",_", "0.06", "848", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "-_", "wy", "e", "Mesh", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "point2_", ",_", "radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "wy", "e", " ", "pick", " ", "point", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wy", "e", "Obj_", "=_", "show", "Poly", "Data_", "(_", "wy", "e", "Mesh_", ",_", "'", "wy", "e", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wy", "e", "Obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wy", "e", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "t_", ",_", "'", "wy", "e", " ", "frame", "'_", ",_", "parent_", "=_", "wy", "e", "Obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "np_", "._", "array_", "(_", "t_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "wy", "e", "'_", ",_", "ot", "df", "\\u", "type_", "=_", "'", "wy", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wy", "e", "Obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wy", "e", "Obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "segment", "Doo", "r", "Handle_", "(_", "ot", "df", "Type_", ",_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.2_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "wall", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle", "Point_", "=_", "np_", "._", "array_", "(_", "[_", "0.005_", ",_", "0.06", "5_", ",_", "0.011", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xw", "idth_", "=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yw", "idth_", "=_", "0.13", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zw", "idth_", "=_", "0.02", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "=_", "vtk_", "._", "vtk", "Cub", "e", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "XL", "ength", "_", "(_", "xw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "YL", "ength", "_", "(_", "yw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "ZL", "ength", "_", "(_", "zw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "=_", "shallow", "Copy_", "(_", "cube_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "t", ".", "Pre", "Multiply", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "t", ".", "Translate", "(-", "handle", "Point", ")_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "door", " ", "handle", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "show", "Poly", "Data_", "(_", "cube_", ",_", "name_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "origin_", ",_", "xw", "idth_", "=_", "xw", "idth_", ",_", "yw", "idth_", "=_", "yw", "idth_", ",_", "zw", "idth_", "=_", "zw", "idth_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "name_", ",_", "ot", "df", "\\u", "type_", "=_", "ot", "df", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "obj_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", ",_", "name_", "+_", "'", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\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_", "segment", "Tru", "ss_", "(_", "point1_", ",_", "point2_", ")_", ":_", "\\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\\uINDENT\\u\\u\\u ", " _", "edge_", "=_", "point2_", "-_", "point1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Offset_", "=_", "[_", "-_", "0.42", "_", ",_", "0.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Ya", "w_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "-_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "-_", "1.0_", ",_", "0.0_", "]_", ")_", "*_", "edge", "Length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Transform_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Transform_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Transform_", "._", "Translate", "_", "(_", "stance", "Offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "stance", "Transform", ".", "Rotate", "Z", "(", "stance", "Ya", "w", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "geometry_", "=_", "transform", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "stance", "Transform_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "edge_", "/_", "edge", "Length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xw", "idth_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yw", "idth_", "=_", "edge", "Length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zw", "idth_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "stance", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "tru", "ss", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ot", "df", "Type_", "=_", "'", "robot", "\\u", "kne", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "show", "Poly", "Data_", "(_", "geometry_", ",_", "name_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "t_", "._", "Get", "Position_", "(_", ")_", ",_", "xw", "idth_", "=_", "xw", "idth_", ",_", "yw", "idth_", "=_", "yw", "idth_", ",_", "zw", "idth_", "=_", "zw", "idth_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "name_", ",_", "ot", "df", "\\u", "type_", "=_", "ot", "df", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "obj_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", ",_", "name_", "+_", "'", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\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_", "segment", "Ho", "se", "No", "zzle", "_", "(_", "point1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Sphere", "_", "(_", "poly", "Data_", ",_", "point1_", ",_", "0.10", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "no", "zzle", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "[_", "0_", ",_", "-_", "1_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "point1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "no", "zzle", "Radius_", "=_", "0.02", "66_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "zzle", "Length_", "=_", "0.04", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "zzle", "Tip", "Radius_", "=_", "0.031", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "zzle", "Tip", "Length_", "=_", "0.02", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "-_", "no", "zzle", "Length_", "/_", "2.0_", "]_", ")_", ",_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "no", "zzle", "Length_", "/_", "2.0_", "]_", ")_", ",_", "radius_", "=_", "no", "zzle", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "no", "zzle", "Length_", "/_", "2.0_", "]_", ")_", ",_", "np_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "no", "zzle", "Length_", "/_", "2.0_", "+_", "no", "zzle", "Tip", "Length_", "]_", ")_", ",_", "radius_", "=_", "no", "zzle", "Tip", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "hos", "e", " ", "no", "zzle", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "t_", ",_", "'", "no", "zzle", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "origin_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "fire", "hos", "e", "'_", ",_", "ot", "df", "\\u", "type_", "=_", "'", "fire", "hos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "segment", "Dri", "ll", "Wall", "_", "(_", "point1_", ",_", "point2_", ",_", "point", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "point1_", ",_", "point2_", ",_", "point", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "Normal_", "=_", "np_", "._", "cross_", "(_", "point2_", "-_", "point1_", ",_", "point", "3_", "-_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "Normal_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "expected", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "expected", "Normal_", ",_", "view", "Plan", "e", "Normal_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "Normal_", "*=_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "search", "Origin_", "=_", "(_", "point1_", "+_", "point2_", "+_", "point", "3_", ")_", "/_", "3.0_", ",_", "search", "Radius_", "=_", "0.3_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.3_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "project", "Point", "To", "Plane_", "(_", "point_", ",_", "origin_", ",_", "normal_", ")_", "for_", "point_", "in_", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "points_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points", "In", "Wall", "Frame_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp_", "=_", "np_", "._", "zeros_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", "._", "Transform", "Point_", "(_", "p_", ",_", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points", "In", "Wall", "Frame_", "._", "append_", "(_", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "pp_", ",_", "radius_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "points", "In", "Wall", "Frame_", ",_", "points", "In", "Wall", "Frame_", "[_", "1_", ":_", "]_", "+_", "[_", "points", "In", "Wall", "Frame_", "[_", "0_", "]_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Line_", "(_", "a_", ",_", "b_", ",_", "radius_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "drill", " ", "target", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "t_", ",_", "'", "drill", " ", "target", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refi", "t", "Wall", "Callbacks_", "._", "append_", "(_", "functools_", "._", "partial_", "(_", "refi", "t", "Dri", "ll", "Wall", "_", ",_", "aff", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "points_", "[_", "0_", "]_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p1", "y_", "=_", "points", "In", "Wall", "Frame_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "p1", "z_", "=_", "points", "In", "Wall", "Frame_", "[_", "0_", "]_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p2", "y_", "=_", "points", "In", "Wall", "Frame_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "p2", "z_", "=_", "points", "In", "Wall", "Frame_", "[_", "1_", "]_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p3", "y_", "=_", "points", "In", "Wall", "Frame_", "[_", "2_", "]_", "[_", "1_", "]_", ",_", "p3", "z_", "=_", "points", "In", "Wall", "Frame_", "[_", "2_", "]_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "drill", "\\u", "wall", "'_", ",_", "ot", "df", "\\u", "type_", "=_", "'", "drill", "\\u", "wall", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "refi", "t", "Wall", "_", "(_", "point1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.2_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "wall", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "func_", "in_", "refi", "t", "Wall", "Callbacks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", "(_", "point1_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "refi", "t", "Dri", "ll", "Wall", "_", "(_", "aff", "_", ",_", "point1_", ",_", "origin_", ",_", "normal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "aff", "_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target", "Origin_", "=_", "np_", "._", "array_", "(_", "t_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "projected", "Origin_", "=_", "project", "Point", "To", "Plane_", "(_", "target", "Origin_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "projected", "Origin_", "[_", "2_", "]_", "=_", "target", "Origin_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "projected", "Origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "._", "Set", "Matrix_", "(_", "t_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Gro", "und", "Hei", "ght", "Fro", "m", "Fee", "t_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rf", "oot_", "=_", "get", "Link", "Frame_", "(_", "dr", "car", "gs_", "._", "get", "Director", "Config_", "(_", ")_", "[_", "'", "right", "Foot", "Link", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "array_", "(_", "rf", "oot_", "._", "Get", "Position_", "(_", ")_", ")_", "[_", "2_", "]_", "-_", "0.07", "453", "42_", "\\u\\u\\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", "Translat", "ion", "Relative", "To", "Foot", "_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rf", "oot_", "=_", "get", "Link", "Frame_", "(_", "dr", "car", "gs_", "._", "get", "Director", "Config_", "(_", ")_", "[_", "'", "right", "Foot", "Link", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Dri", "ll", "Wall", "Constr", "aine", "d_", "(_", "right", "Ang", "le", "Location_", ",_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "Normal_", "=_", "np_", "._", "cross_", "(_", "point2_", "-_", "point1_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "Normal_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "expected", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "expected", "Normal_", ",_", "view", "Plan", "e", "Normal_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "Normal_", "*=_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.3_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.3_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "triangle", "Origin_", "=_", "project", "Point", "To", "Plane_", "(_", "point2_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "triangle", "Origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Dri", "ll", "Wall", "_", "(_", "right", "Ang", "le", "Location_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Dri", "ll", "Wall", "_", "(_", "right", "Ang", "le", "Location_", ",_", "triangle", "Pose", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recover", " ", "the", " ", "orig", "in", " ", "and", " ", "axes", " ", "from", " ", "the", " ", "pose", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "triangle", "Origin_", "=_", "triangle", "Pose", "_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "triangle", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.60", "96", " ", "=", " ", "24", " ", "*", " ", ".02", "5", "4", " ", "(", "m", " ", "=", " ", "feet", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0.30", "4", "8", " ", "=", " ", "1", "2", " ", "*", " ", ".02", "5", "4", " ", "(", "m", " ", "=", " ", "feet", ")_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Right_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "-_", "1.0_", ",_", "0.0_", "]_", ")_", "*_", "(_", "0.6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Up_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "*_", "(_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points", "In", "Wall", "Frame_", "=_", "np_", "._", "zeros_", "(_", "(_", "3_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "right", "Ang", "le", "Location_", "==_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "BOT", "TOM", "\\u", "LEFT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points", "In", "Wall", "Frame_", "[_", "1_", "]_", "=_", "edge", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points", "In", "Wall", "Frame_", "[_", "2_", "]_", "=_", "edge", "Right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "right", "Ang", "le", "Location_", "==_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "BOT", "TOM", "\\u", "RIGHT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points", "In", "Wall", "Frame_", "[_", "1_", "]_", "=_", "edge", "Up_", "#", " ", "edge", "Rig", "ht", " ", "+", "edge", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points", "In", "Wall", "Frame_", "[_", "2_", "]_", "=_", "-_", "edge", "Right_", "#", " ", "edge", "Right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "right", "Ang", "le", "Location_", "==_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "TOP", "\\u", "LEFT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points", "In", "Wall", "Frame_", "[_", "1_", "]_", "=_", "edge", "Right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points", "In", "Wall", "Frame_", "[_", "2_", "]_", "=_", "-_", "edge", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "right", "Ang", "le", "Location_", "==_", "DRI", "LL", "\\u", "TRIA", "NG", "LE", "\\u", "TOP", "\\u", "RIGHT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "points", "In", "Wall", "Frame_", "[_", "1_", "]_", "=_", "edge", "Right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points", "In", "Wall", "Frame_", "[_", "2_", "]_", "=_", "edge", "Right_", "-_", "edge", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "unexpected", " ", "value", " ", "for", " ", "right", " ", "angle", " ", "location", ":", " ", "'_", ",_", "+_", "right", "Ang", "le", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "center_", "=_", "points", "In", "Wall", "Frame_", "._", "sum_", "(_", "axis_", "=_", "0_", ")_", "/_", "3.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shrink", "Factor_", "=_", "1_", "#", "0.90", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shrink", "Points_", "=_", "(_", "points", "In", "Wall", "Frame_", "-_", "center_", ")_", "*_", "shrink", "Factor_", "+_", "center_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "points", "In", "Wall", "Frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Sphere", "_", "(_", "p_", ",_", "radius_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "points", "In", "Wall", "Frame_", ",_", "np_", "._", "vstack_", "(_", "(_", "points", "In", "Wall", "Frame_", "[_", "1_", ":_", "]_", ",_", "points", "In", "Wall", "Frame_", "[_", "0_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Line_", "(_", "a_", ",_", "b_", ",_", "radius_", "=_", "0.005_", ")_", "#", "01", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "shrink", "Points_", ",_", "np_", "._", "vstack_", "(_", "(_", "shrink", "Points_", "[_", "1_", ":_", "]_", ",_", "shrink", "Points_", "[_", "0_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Line_", "(_", "a_", ",_", "b_", ",_", "radius_", "=_", "0.005_", ")_", "#", "0.025", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "aff", "orda", "nce", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "wall", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "wall_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "wall", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "True_", ",_", "parent_", "=_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "triangle", "Pose", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "refi", "t", "Wall", "Callbacks_", "._", "append_", "(_", "functools_", "._", "partial_", "(_", "refi", "t", "Dri", "ll", "Wall", "_", ",_", "aff", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Obj_", "=_", "show", "Frame_", "(_", "triangle", "Pose", "_", ",_", "'", "wall", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.2_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "triangle", "Origin_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p1", "y_", "=_", "shrink", "Points_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "p1", "z_", "=_", "shrink", "Points_", "[_", "0_", "]_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p2", "y_", "=_", "shrink", "Points_", "[_", "1_", "]_", "[_", "1_", "]_", ",_", "p2", "z_", "=_", "shrink", "Points_", "[_", "1_", "]_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "p3", "y_", "=_", "shrink", "Points_", "[_", "2_", "]_", "[_", "1_", "]_", ",_", "p3", "z_", "=_", "shrink", "Points_", "[_", "2_", "]_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "drill", "\\u", "wall", "'_", ",_", "ot", "df", "\\u", "type_", "=_", "'", "drill", "\\u", "wall", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "rf", "oot", " ", "=", " ", "get", "Link", "Frame", "(", "dr", "car", "gs", ".", "get", "Director", "Config", "()[", "'", "right", "Foot", "Link", "'])", "\\", "10", ";", " ", " ", " ", " ", "tt", " ", "=", " ", "get", "Transform", "Fro", "m", "Axe", "s", "(", "xaxis", ",", " ", "yax", "is", ",", " ", "za", "xis", ")", "\\", "10", ";", " ", " ", " ", " ", "tt", ".", "Post", "Multiply", "()", "\\", "10", ";", " ", " ", " ", " ", "tt", ".", "Translate", "(", "rf", "oot", ".", "Get", "Position", "())", "\\", "10", ";", " ", " ", " ", " ", "show", "Frame", "(", "tt", ",", " ", "'", "rf", "oot", " ", "with", " ", "wall", " ", "orientation", "')", "\\", "10", ";", " ", " ", " ", " ", "aff", ".", "foot", "To", "Aff", "Transform", " ", "=", " ", "compute", "AT", "o", "B", "(", "tt", ",", " ", "triangle", "Pose", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "foot", "To", "Aff", " ", "=", " ", "list", "(", "aff", ".", "foot", "To", "Aff", "Transform", ".", "Get", "Position", "())", "\\", "10", ";", " ", " ", " ", " ", "tt", ".", "Transform", "Vector", "(", "foot", "To", "Aff", ",", " ", "foot", "To", "Aff", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "d", " ", "=", " ", "Deb", "ug", "Data", "()", "\\", "10", ";", " ", " ", " ", " ", "d", ".", "add", "Sphere", "(", "tt", ".", "Get", "Position", "()", ",", " ", "radi", "us", "=", "0.02", ")", "\\", "10", ";", " ", " ", " ", " ", "d", ".", "add", "Line", "(", "tt", ".", "Get", "Position", "()", ",", " ", "np", ".", "array", "(", "tt", ".", "Get", "Position", "())", " ", "+", " ", "np", ".", "array", "(", "foot", "To", "Aff", "))\\", "10", ";", " ", " ", " ", " ", "show", "Poly", "Data", "(", "d", ".", "get", "Poly", "Data", "()", ",", " ", "'", "rf", "oot", " ", "debug", "')", "\\", "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_", "get", "Dri", "ll", "Aff", "orda", "nce", "Params_", "(_", "origin_", ",_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ",_", "drill", "Type_", "=_", "\"", "dew", "alt", "\\u", "button", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "drill", "Type_", "==_", "\"", "dew", "alt", "\\u", "button", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "dict_", "(_", "origin_", "=_", "origin_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "x_", "=_", "0.007", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "y_", "=_", "-_", "0.03", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "z_", "=_", "-_", "0.06_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "roll_", "=_", "-_", "90.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "pitch_", "=_", "-_", "90.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "yaw_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "x_", "=_", "-_", "0.01_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "y_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "z_", "=_", "0.15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "roll_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "pitch_", "=_", "-_", "90_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "yaw_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "dew", "alt", "\\u", "button", "'_", ",_", "ot", "df", "\\u", "type_", "=_", "'", "dew", "alt", "\\u", "button", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "dict_", "(_", "origin_", "=_", "origin_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ",_", "xw", "idth_", "=_", "0.1_", ",_", "yw", "idth_", "=_", "0.1_", ",_", "zw", "idth_", "=_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "x_", "=_", "0.007", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "y_", "=_", "-_", "0.03", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "z_", "=_", "-_", "0.06_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "roll_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "pitch_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "yaw_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "x_", "=_", "0.18", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "y_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "z_", "=_", "0.13", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "roll_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "pitch_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bit", "\\u", "yaw_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "dew", "alt", "\\u", "barre", "l", "'_", ",_", "ot", "df", "\\u", "type_", "=_", "'", "dew", "alt", "\\u", "barre", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "params_", "\\u\\u\\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", "Dri", "ll", "Mesh_", "(_", "appl", "y", "Bit", "Offset_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "button_", "=_", "np_", "._", "array_", "(_", "[_", "0.007", "_", ",_", "-_", "0.03", "5_", ",_", "-_", "0.06_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Mesh_", "=_", "io", "Utils_", "._", "read", "Poly", "Data_", "(_", "os_", "._", "path_", "._", "join_", "(_", "app_", "._", "get", "DR", "CB", "ase_", "(_", ")_", ",_", "'", "software", "/", "model", "s", "/", "ot", "df", "/", "dew", "alt", "\\u", "button", ".", "obj", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "appl", "y", "Bit", "Offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "0.01_", ",_", "0.0_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Mesh_", "=_", "transform", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Poly", "Data_", "(_", "drill", "Mesh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "button_", ",_", "radius_", "=_", "0.005_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.15", "5_", "]_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.14", "_", "]_", ",_", "radius_", "=_", "0.001_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "shallow", "Copy_", "(_", "d_", "._", "get", "Poly", "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_", "def_", "get", "Dri", "ll", "Barr", "el", "Mesh_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "io", "Utils_", "._", "read", "Poly", "Data_", "(_", "os_", "._", "path_", "._", "join_", "(_", "app_", "._", "get", "DR", "CB", "ase_", "(_", ")_", ",_", "'", "software", "/", "model", "s", "/", "ot", "df", "/", "dew", "alt", ".", "ply", "'_", ")_", ",_", "compute", "Normal", "s_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Dri", "ll_", "(_", "point1_", ",_", "point2_", ",_", "point", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.2_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "table", "Points_", ",_", "'", "table", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.03_", ",_", "0.4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Sphere", "_", "(_", "search", "Region_", ",_", "point2_", ",_", "0.30", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Points_", "=_", "extract", "Large", "st", "Cluster_", "(_", "search", "Region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "To", "Top", "Point_", "=_", "np_", "._", "array_", "(_", "[_", "-_", "0.002", "904", "_", ",_", "-_", "0.010", "029", "_", ",_", "0.15", "318", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "point", "3_", "-_", "point2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "-_", "drill", "To", "Top", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "t_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "visible_", "=_", "False_", ")_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "get", "Dri", "ll", "Aff", "orda", "nce", "Params_", "(_", "origin_", ",_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\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_", "make", "Poly", "Data", "Fields_", "(_", "pd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mesh_", "=_", "compute", "Del", "au", "na", "y", "3", "D_", "(_", "pd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "mesh_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "origin_", ",_", "edges_", ",_", "wire", "frame_", "=_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "mesh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Length", "s_", "=_", "np_", "._", "array_", "(_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "[_", "edge_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "up", "ward", " ", "axis", " ", "for", " ", "z", " ", "direction_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dot", "\\u", "products_", "=_", "[_", "np_", "._", "dot_", "(_", "axe", "_", ",_", "za", "xis_", ")_", "for_", "axe", "_", "in_", "axes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "[_", "axes_", "[_", "i_", "]_", "for_", "i_", "in_", "np_", "._", "argsort_", "(_", "dot", "\\u", "products_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length", "s_", "=_", "[_", "edge", "Length", "s_", "[_", "i_", "]_", "for_", "i_", "in_", "np_", "._", "argsort_", "(_", "dot", "\\u", "products_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "box", "Center_", "=_", "compute", "Centro", "id_", "(_", "wire", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "axes_", "[_", "0_", "]_", ",_", "axes_", "[_", "1_", "]_", ",_", "axes_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "box", "Center_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pd_", "=_", "transform", "Poly", "Data_", "(_", "pd_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "frame_", "=_", "transform", "Poly", "Data_", "(_", "wire", "frame_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mesh_", "=_", "transform", "Poly", "Data_", "(_", "mesh_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Field", "Container_", "(_", "points_", "=_", "pd_", ",_", "box_", "=_", "wire", "frame_", ",_", "mesh_", "=_", "mesh_", ",_", "frame_", "=_", "t_", ",_", "dims_", "=_", "edge", "Length", "s_", ",_", "axes_", "=_", "axes_", ")_", "\\u\\u\\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_", "make", "Mo", "vable", "_", "(_", "obj_", ",_", "initial", "Transform_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Add", "s", " ", "a", " ", "child", " ", "frame", " ", "to", " ", "the", " ", "give", "n", " ", "Poly", "Data", "Item", ".", " ", " ", "If", " ", "initial", "Transform", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "give", "n", ",", " ", "then", " ", "an", " ", "orig", "in", " ", "frame", " ", "is", " ", "compute", "d", " ", "for", " ", "the", " ", "poly", "data", " ", "usi", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "center", " ", "and", " ", "orientation", " ", "of", " ", "the", " ", "orient", "ed", " ", "bound", "ing", " ", "of", " ", "the", " ", "poly", "data", ".", " ", " ", "The", " ", "poly", "data", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "transforme", "d", " ", "usi", "ng", " ", "the", " ", "inv", "erse", " ", "of", " ", "initial", "Transform", " ", "and", " ", "then", " ", "a", " ", "child", " ", "frame", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "assign", "ed", " ", "to", " ", "the", " ", "object", " ", "to", " ", "repos", "ition", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pd_", "=_", "obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "initial", "Transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "t_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "origin_", ",_", "edges_", ",_", "wire", "frame_", "=_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "pd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length", "s_", "=_", "np_", "._", "array_", "(_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "[_", "edge_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box", "Center_", "=_", "compute", "Centro", "id_", "(_", "wire", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "axes_", "[_", "0_", "]_", ",_", "axes_", "[_", "1_", "]_", ",_", "axes_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "box", "Center_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pd_", "=_", "transform", "Poly", "Data_", "(_", "pd_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Poly", "Data_", "(_", "pd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame_", "=_", "obj_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "._", "copy", "Frame_", "(_", "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 ", " _", "frame_", "=_", "vis_", "._", "show", "Frame_", "(_", "t_", ",_", "obj_", "._", "get", "Property_", "(_", "'", "Name", "'_", ")_", "+_", "'", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "scale_", "=_", "0.2_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Table_", "(_", "poly", "Data_", ",_", "search", "Point_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "NB", ":", " ", "If", " ", "you", " ", "wish", " ", "to", " ", "use", " ", "the", " ", "table", " ", "frame", " ", "use", " ", "segment", "Table", "And", "Frame", " ", "inst", "ead", " ", "\\", "10", ";", " ", " ", " ", " ", "###########", "######", "#", "\\", "10", ";", " ", " ", " ", " ", "Segme", "nt", " ", "a", " ", "horizon", "tal", " ", "table", " ", "surf", "ace", " ", "(", "perp", "endi", "cula", "r", " ", "to", " ", "+", "Z", ")", " ", "in", " ", "the", " ", "give", "n", " ", "poly", "Data", "\\", "10", ";", " ", " ", " ", " ", "Inp", "ut", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "poly", "Data", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "search", " ", "point", " ", "on", " ", "plane", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Output", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "poly", "Data", ",", " ", "table", "Point", "s", ",", " ", "orig", "in", ",", " ", "normal", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "poly", "Data", " ", "is", " ", "the", " ", "input", " ", "poly", "Data", " ", "with", " ", "a", " ", "new", " ", "'", "dist", "\\u", "to", "\\u", "plane", "'", " ", "attribute", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "Normal_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Normal", "Eps", "ilon", "_", "=_", "0.4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "expected", "Normal_", ",_", "search", "Origin_", "=_", "search", "Point_", ",_", "search", "Radius_", "=_", "0.3_", ",_", "angle", "Eps", "ilon", "_", "=_", "table", "Normal", "Eps", "ilon", "_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "table", "Points_", ",_", "search", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Point", "s", "Cluster", "s_", "=_", "extract", "Cluster", "s_", "(_", "table", "Points_", ",_", "min", "Cluster", "Size_", "=_", "10_", ",_", "cluster", "Tolerance", "_", "=_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Point", "s", "Cluster", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "x_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "table", "Point", "s", "Cluster", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "table", "Points_", ",_", "'", "table", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "table", "Points_", ",_", "'", "table", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "poly", "Data_", ",_", "table", "Points_", ",_", "origin_", ",_", "normal_", "\\u\\u\\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_", "filter", "Cluster", "Objects_", "(_", "clusters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cluster_", "in_", "clusters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "cluster_", "._", "axes_", "[_", "2_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", ")_", "<_", "0.5_", ":_", "\\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_", "cluster_", "._", "dims_", "[_", "2_", "]_", "<_", "0.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_", "result_", "._", "append_", "(_", "cluster_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Table", "Scene_", "(_", "poly", "Data_", ",_", "search", "Point_", ",_", "filter", "Clustering", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object", "Cluster", "s_", ",_", "table", "Data_", "=_", "segment", "Table", "Scen", "e", "Cluster", "s_", "(_", "poly", "Data_", ",_", "search", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clusters_", "=_", "[_", "make", "Poly", "Data", "Fields_", "(_", "cluster_", ")_", "for_", "cluster_", "in_", "object", "Cluster", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "[_", "cluster_", "for_", "cluster_", "in_", "clusters_", "if_", "cluster_", "is_", "not_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "addition", "al", " ", "frame", " ", "to", " ", "these", " ", "object", "s", " ", "whi", "ch", " ", "has", " ", "z", "-", "axis", " ", "aligned", " ", "up", "ward", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "rotated", " ", "to", " ", "have", " ", "the", " ", "x", "-", "axis", " ", "facing", " ", "awa", "y", " ", "from", " ", "the", " ", "robot_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "axes_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "table", "Data_", "._", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cluster_", "in_", "clusters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster", "\\u", "axes_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "cluster_", "._", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "cluster", "\\u", "axes_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "table", "\\u", "axes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orient", "ed", "Frame_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axe", "s", "And", "Origin_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ",_", "cluster_", "._", "frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster_", "._", "\\u", "add", "\\u", "fields_", "(_", "orient", "ed", "\\u", "frame_", "=_", "orient", "ed", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "filter", "Clustering", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clusters_", "=_", "filter", "Cluster", "Objects_", "(_", "clusters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Field", "Container_", "(_", "table_", "=_", "table", "Data_", ",_", "clusters_", "=_", "clusters_", ")_", "\\u\\u\\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_", "segment", "Table", "Scen", "e", "Cluster", "s_", "(_", "poly", "Data_", ",_", "search", "Point_", ",_", "cluster", "In", "XY_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Give", "n", " ", "a", " ", "point", " ", "cloud", " ", "of", " ", "a", " ", "table", " ", "with", " ", "some", " ", "object", "s", " ", "on", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "a", " ", "point", " ", "on", " ", "tha", "t", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "dete", "rmin", "e", " ", "the", " ", "plane", " ", "of", " ", "the", " ", "table", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "extract", " ", "cluster", "s", " ", "above", " ", "the", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Data_", ",_", "poly", "Data_", "=_", "segment", "Table", "And", "Frame_", "(_", "poly", "Data_", ",_", "search", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.02_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "replace", " ", "with", " ", "'", "all", " ", "points", " ", "above", " ", "the", " ", "table", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Sphere", "_", "(_", "search", "Region_", ",_", "table", "Data_", "._", "frame_", "._", "Get", "Position_", "(_", ")_", ",_", "0.5_", ")_", "#", " ", "was", " ", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "show", "Frame_", "(_", "table", "Data_", "._", "frame_", ",_", "'", "table", "Frame", "'_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "scale_", "=_", "0.15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "search", "Region", "'_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object", "Cluster", "s_", "=_", "extract", "Cluster", "s_", "(_", "search", "Region_", ",_", "cluster", "In", "XY_", ",_", "cluster", "Tolerance", "_", "=_", "0.02_", ",_", "min", "Cluster", "Size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "got", " ", "%", "d", " ", "cluster", "s", "'", " ", "%", " ", "len", "(", "object", "Cluster", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "c_", "in_", "enumerate_", "(_", "object", "Cluster", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"", "cluster", " ", "%", "d", "\"_", "%_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Poly", "Data_", "(_", "c_", ",_", "name_", ",_", "color_", "=_", "get", "Random", "Color_", "(_", ")_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "object", "Cluster", "s_", ",_", "table", "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_", "def_", "segment", "Table", "And", "Frame_", "(_", "poly", "Data_", ",_", "search", "Point_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Segme", "nt", " ", "a", " ", "table", " ", "usi", "ng", " ", "a", " ", "search", "Point", " ", "on", " ", "the", " ", "table", " ", "top", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "then", " ", "recover", " ", "its", " ", "coordinate", " ", "frame", ",", " ", "facing", " ", "awa", "y", " ", "from", " ", "the", " ", "robot", "\\", "10", ";", " ", " ", " ", " ", "Object", "s", "/", "points", " ", "on", " ", "the", " ", "table", " ", "are", " ", "ignore", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Inp", "ut", ":", " ", "poly", "Data", " ", "and", " ", "search", "Point", " ", "on", " ", "the", " ", "table", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Output", ":", " ", "Field", "Containe", "r", " ", "with", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "all", " ", "rele", "vent", " ", "deta", "il", "s", " ", "abo", "ut", " ", "the", " ", "table", " ", "(", "only", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "table", "Points_", ",_", "\\u_", ",_", "\\u_", "=_", "segment", "Table_", "(_", "poly", "Data_", ",_", "search", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Mesh_", "=_", "compute", "Del", "au", "na", "y", "3", "D_", "(_", "table", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Frame_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "robot", "Ya", "w_", "=_", "math_", "._", "atan2_", "(_", "view", "Direction_", "[_", "1_", "]_", ",_", "view", "Direction_", "[_", "0_", "]_", ")_", "*_", "180.0_", "/_", "np_", "._", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "view", "Frame_", "._", "Get", "Position_", "(_", ")_", ",_", "[_", "0_", ",_", "0_", ",_", "robot", "Ya", "w_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Function", " ", "return", "s", " ", "corn", "er", " ", "point", " ", "tha", "t", " ", "is", " ", "far", " ", "right", " ", "from", " ", "the", " ", "robot_", "\\u\\u\\uNL\\u\\u\\u_", "corn", "er", "Transform_", ",_", "rect", "Depth_", ",_", "rect", "Width_", ",_", "\\u_", "=_", "find", "Mini", "mum", "Bound", "ing", "Rectangle_", "(_", "table", "Points_", ",_", "link", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rect", "Height_", "=_", "0.02_", "#", " ", "arbitra", "ry", " ", "table", " ", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "recover", " ", "mid", " ", "point_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "corn", "er", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "\\u", "center_", "=_", "[_", "-_", "rect", "Depth_", "/_", "2_", ",_", "rect", "Width_", "/_", "2_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "table", "\\u", "center_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Concat", "enat", "e_", "(_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "require", "d", " ", "outputs_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Length", "s_", "=_", "[_", "rect", "Depth_", ",_", "rect", "Width_", ",_", "rect", "Height_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "XA", "xis_", ",_", "table", "YA", "xis_", ",_", "table", "ZA", "xis_", "=_", "transform", "Utils_", "._", "get", "Axe", "s", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "table", "XA", "xis_", ",_", "table", "YA", "xis_", ",_", "table", "ZA", "xis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf_", "=_", "vtk_", "._", "vtk", "Outline", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf_", "._", "Set", "Bounds_", "(_", "[_", "-_", "rect", "Depth_", "/_", "2_", ",_", "rect", "Depth_", "/_", "2_", ",_", "-_", "rect", "Width_", "/_", "2_", ",_", "rect", "Width_", "/_", "2_", ",_", "-_", "rect", "Height_", "/_", "2_", ",_", "rect", "Height_", "/_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "wf", ".", "Set", "Box", "Type", "To", "Orient", "ed", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cube", " ", "=[", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "0", ",", "1", ",", "1", ",", "0", ",", "0", ",", "0", ",", "1", ",", "1", ",", "0", ",", "1", ",", "0", ",", "1", ",", "1", ",", "1", ",", "1", ",", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wf", ".", "Set", "Corner", "s", "(", "cube", ")_", "\\u\\u\\uNL\\u\\u\\u_", "wire", "frame_", "=_", "wf_", "._", "Get", "Output_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "transform", "Poly", "Data_", "(_", "table", "Points_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "wire", "frame", " ", "=", " ", "transform", "Poly", "Data", "(", "wire", "frame", ",", " ", "t", ".", "Get", "Linea", "r", "Inv", "erse", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Mesh_", "=_", "transform", "Poly", "Data_", "(_", "table", "Mesh_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Field", "Container_", "(_", "points_", "=_", "table", "Points_", ",_", "box_", "=_", "wire", "frame_", ",_", "mesh_", "=_", "table", "Mesh_", ",_", "frame_", "=_", "t_", ",_", "dims_", "=_", "edge", "Length", "s_", ",_", "axes_", "=_", "axes_", ")_", ",_", "poly", "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_", "def_", "segment", "Dri", "ll", "Auto", "_", "(_", "point1_", ",_", "poly", "Data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "poly", "Data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expected", "Normal_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "expected", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.4_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.2_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "table", "Points_", ",_", "'", "table", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "table", "Points_", ",_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Point", "s", "Cluster", "s_", "=_", "extract", "Cluster", "s_", "(_", "table", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Point", "s", "Cluster", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "x_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "table", "Point", "s", "Cluster", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "table", "Points_", ",_", "'", "table", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.03_", ",_", "0.4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Sphere", "_", "(_", "search", "Region_", ",_", "point1_", ",_", "0.30", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Points_", "=_", "extract", "Large", "st", "Cluster_", "(_", "search", "Region_", ",_", "min", "Cluster", "Size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "drill", " ", "orientation", " ", "(", "rotati", "on", " ", "abo", "ut", " ", "z", " ", "axis", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "centroids_", "=_", "compute", "Centro", "ids_", "(_", "drill", "Points_", ",_", "axis_", "=_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "centroid", "s", "Poly", "Data_", "=_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "centroids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "centroid", "s", "Poly", "Data_", ",_", "'", "cluster", " ", "centroid", "s", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "To", "Top", "Point_", "=_", "np_", "._", "array_", "(_", "[_", "-_", "0.002", "904", "_", ",_", "-_", "0.010", "029", "_", ",_", "0.15", "318", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "centroids_", "[_", "0_", "]_", "-_", "centroids_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "this", " ", "hack", " ", "to", " ", "orient", " ", "the", " ", "drill", " ", "correct", "ly", ":_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "yaxis_", ",_", "-_", "xaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "-_", "drill", "To", "Top", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "centroids_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "t_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "get", "Dri", "ll", "Aff", "orda", "nce", "Params_", "(_", "origin_", ",_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\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_", "segment", "Dri", "ll", "Button_", "(_", "point1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "sense", "d", " ", "drill", " ", "button", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "0.5_", ",_", "0.5_", "]_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "no", " ", "orientation", ",", " ", "but", " ", "this", " ", "allow", "s", " ", "the", " ", "XY", "Z", " ", "point", " ", "to", " ", "be", " ", "queried", "_", "\\u\\u\\uNL\\u\\u\\u_", "point", "er", "Tip", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "point1_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "point", "er", "Tip", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Obj_", "=_", "update", "Frame_", "(_", "obj_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", ",_", "'", "sense", "d", " ", "drill", " ", "button", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "scale_", "=_", "0.2_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\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_", "segment", "Point", "er", "Tip_", "(_", "point1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "sense", "d", " ", "point", "er", " ", "tip", "'_", ",_", "color_", "=_", "[_", "0.5_", ",_", "0.5_", ",_", "0.0_", "]_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "no", " ", "orientation", ",", " ", "but", " ", "this", " ", "allow", "s", " ", "the", " ", "XY", "Z", " ", "point", " ", "to", " ", "be", " ", "queried", "_", "\\u\\u\\uNL\\u\\u\\u_", "point", "er", "Tip", "Frame_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "point1_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "point", "er", "Tip", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Obj_", "=_", "update", "Frame_", "(_", "obj_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", ",_", "'", "sense", "d", " ", "point", "er", " ", "tip", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ",_", "scale_", "=_", "0.2_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\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_", "fit", "Gro", "und", "Object_", "(_", "poly", "Data_", "=_", "None_", ",_", "expected", "Dimen", "sion", "s", "Min_", "=_", "[_", "0.2_", ",_", "0.02_", "]_", ",_", "expected", "Dimen", "sion", "s", "Max_", "=_", "[_", "1.3_", ",_", "0.1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remove", "Gro", "und", "Func_", "=_", "remove", "Gro", "und", "Simple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "poly", "Data_", "or_", "get", "Curr", "ent", "Revo", "luti", "on", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Points_", ",_", "scen", "e", "Points_", "=_", "remove", "Gro", "und", "Func_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", "=_", "0.02_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "0.03", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "scen", "e", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.05_", ",_", "0.2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "search", "Region_", ",_", "cluster", "Tolerance", "_", "=_", "0.07_", ",_", "min", "Cluster", "Size_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "candidates_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cluster", "Id_", ",_", "cluster_", "in_", "enumerate_", "(_", "clusters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "origin_", ",_", "edges_", ",_", "\\u_", "=_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length", "s_", "=_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "[_", ":_", "2_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "found_", "=_", "(_", "expected", "Dimen", "sion", "s", "Min_", "[_", "0_", "]_", "<=_", "edge", "Length", "s_", "[_", "0_", "]_", "<_", "expected", "Dimen", "sion", "s", "Max_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "expected", "Dimen", "sion", "s", "Min_", "[_", "1_", "]_", "<=_", "edge", "Length", "s_", "[_", "1_", "]_", "<_", "expected", "Dimen", "sion", "s", "Max_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "Poly", "Data_", "(_", "cluster_", ",_", "'", "candidate", " ", "cluster", " ", "%", "d", "'_", "%_", "cluster", "Id_", ",_", "color_", "=_", "[_", "1_", ",_", "1_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update", "Poly", "Data_", "(_", "cluster_", ",_", "'", "cluster", " ", "%", "d", "'_", "%_", "cluster", "Id_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "candidates_", "._", "append_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "candidates_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view", "Frame_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Origin_", "=_", "np_", "._", "array_", "(_", "view", "Frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "view", "Origin_", "-_", "compute", "Centro", "id_", "(_", "cluster_", ")_", ")_", "for_", "cluster_", "in_", "candidates_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "candidates_", "=_", "[_", "candidates_", "[_", "i_", "]_", "for_", "i_", "in_", "np_", "._", "argsort_", "(_", "dists_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cluster_", "=_", "candidates_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "make", "Poly", "Data", "Fields_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "vis_", "._", "show", "Cluster", "Objects_", "(_", "[_", "obj_", "]_", ",_", "parent_", "=_", "'", "segmentation", "'_", ")_", "[_", "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_", "find", "Horiz", "onta", "l", "Surf", "aces", "_", "(_", "poly", "Data_", ",_", "remove", "Gro", "und", "First_", "=_", "False_", ",_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", "=_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "Tolerance", "_", "=_", "0.025", "_", ",_", "min", "Cluster", "Size_", "=_", "150_", ",_", "distance", "To", "Plan", "e", "Threshold_", "=_", "0.002", "5_", ",_", "normal", "s", "Dot", "Up", "Range_", "=_", "[_", "0.95_", ",_", "1.0_", "]_", ",_", "show", "Cluster", "s_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "the", " ", "horizon", "tal", " ", "surfaces", ",", " ", "tune", "d", " ", "to", " ", "work", " ", "with", " ", "walking", " ", "terrain", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Z_", "=_", "[_", "0.0_", ",_", "2.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voxel", "Grid", "Lea", "f", "Size_", "=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "Flag_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "remove", "Gro", "und", "First_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ground", "Points_", ",_", "scen", "e", "Points_", "=_", "remove", "Gro", "und_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", "=_", "0.02_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "threshol", "d", "Points_", "(_", "scen", "e", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "search", "Z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "ground", "Points_", ",_", "'", "ground", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "verbo", "se", "Flag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scen", "e", "Points_", "=_", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "scen", "e", "Points_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "f_", "=_", "vtk_", "._", "vtk", "PC", "LN", "ormal", "Estimat", "ion_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Sear", "ch", "Radius_", "(_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "scen", "e", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "1_", ",_", "appl", "y", "Vo", "xel", "Grid_", "(_", "scen", "e", "Points_", ",_", "voxel", "Grid", "Lea", "f", "Size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dur", "ation", " ", "0.", "2", " ", "sec", " ", "for", " ", "V1", " ", "log", ":_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "shallow", "Copy_", "(_", "f_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normals_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "scen", "e", "Points_", ",_", "'", "normal", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal", "s", "Dot", "Up_", "=_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "normals_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "scen", "e", "Points_", ",_", "normal", "s", "Dot", "Up_", ",_", "'", "normal", "s", "\\u", "dot", "\\u", "up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "surfaces", "_", "=_", "threshol", "d", "Points_", "(_", "scen", "e", "Points_", ",_", "'", "normal", "s", "\\u", "dot", "\\u", "up", "'_", ",_", "normal", "s", "Dot", "Up", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "scen", "e", "Points_", ",_", "'", "scen", "e", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "normal", "s", "\\u", "dot", "\\u", "up", "'_", ",_", "visible_", "=_", "verbo", "se", "Flag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "surfaces", "_", ",_", "'", "surfaces", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "normal", "s", "\\u", "dot", "\\u", "up", "'_", ",_", "visible_", "=_", "verbo", "se", "Flag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "surfaces", "_", ",_", "cluster", "Tolerance", "_", "=_", "cluster", "Tolerance", "_", ",_", "min", "Cluster", "Size_", "=_", "min", "Cluster", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Cluster", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "s", "Large", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "surf", "ace", " ", "cluster", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "surf", "ace", " ", "cluster", "s", "'_", ",_", "parent", "Obj_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "cluster_", "in_", "enumerate_", "(_", "clusters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "Poly", "Data_", "(_", "cluster_", ",_", "'", "surf", "ace", " ", "cluster", " ", "%", "d", "'_", "%_", "i_", ",_", "parent_", "=_", "folder_", ",_", "color_", "=_", "get", "Random", "Color_", "(_", ")_", ",_", "visible_", "=_", "verbo", "se", "Flag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", ",_", "\\u_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "cluster_", ",_", "distance", "To", "Plan", "e", "Threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", "=_", "threshol", "d", "Points_", "(_", "plane", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "distance", "To", "Plan", "e", "Threshold_", ",_", "distance", "To", "Plan", "e", "Threshold_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "plane", "Points_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ">_", "min", "Cluster", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster", "s", "Large", "_", "._", "append_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "make", "Poly", "Data", "Fields_", "(_", "plane", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plane", "Cluster", "s_", "._", "append_", "(_", "obj_", ")_", "\\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_", "folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "surf", "ace", " ", "object", "s", "'_", ",_", "parent", "Obj_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "show", "Cluster", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vis_", "._", "show", "Cluster", "Objects_", "(_", "plane", "Cluster", "s_", ",_", "parent_", "=_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cluster", "s", "Large", "_", "\\u\\u\\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_", "fit", "Vertica", "l", "Posts", "_", "(_", "poly", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ground", "Points_", ",_", "scen", "e", "Points_", "=_", "remove", "Gro", "und_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "threshol", "d", "Points_", "(_", "scen", "e", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.1_", ",_", "4.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "scen", "e", "Points_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "scen", "e", "Points_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "scen", "e", "Points_", ",_", "leaf", "Size_", "=_", "0.03_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "scen", "e", "Points_", ",_", "cluster", "Tolerance", "_", "=_", "0.15_", ",_", "min", "Cluster", "Size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "Post", "Cluster_", "(_", "cluster_", ",_", "line", "Direction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "up_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Post", "Length_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Radius_", "=_", "0.3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle_", "=_", "math_", "._", "degrees_", "(_", "math_", "._", "acos", "_", "(_", "np_", "._", "dot_", "(_", "up_", ",_", "line", "Direction_", ")_", "/_", "(_", "np_", "._", "linalg_", "._", "norm_", "(_", "up_", ")_", "*_", "np_", "._", "linalg_", "._", "norm_", "(_", "line", "Direction_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "angle_", ">_", "15_", ":_", "\\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_", "origin_", ",_", "edges_", ",_", "\\u_", "=_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length", "s_", "=_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Length", "s_", "[_", "0_", "]_", "<_", "min", "Post", "Length_", ":_", "\\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_", "#", " ", "extract", " ", "top", " ", "half_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zv", "alues", "_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "cluster_", ",_", "'", "Point", "s", "'_", ")_", "[_", ":_", ",_", "2_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "cluster_", ",_", "zv", "alues", "_", ",_", "'", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "min", "Z_", "=_", "np_", "._", "min_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Z_", "=_", "np_", "._", "max_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cluster_", "=_", "threshol", "d", "Points_", "(_", "cluster_", ",_", "'", "z", "'_", ",_", "[_", "(_", "min", "Z_", "+_", "max", "Z_", ")_", "/_", "2.0_", ",_", "max", "Z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", ",_", "edges_", ",_", "\\u_", "=_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length", "s_", "=_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Length", "s_", "[_", "1_", "]_", ">_", "max", "Radius_", "or_", "edge", "Length", "s_", "[_", "2_", "]_", ">_", "max", "Radius_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Cylinder", "Aff", "orda", "nce_", "(_", "line", "Points_", ",_", "line", "Direction_", ",_", "line", "Origin_", ",_", "post", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "line", "Points_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts_", "-_", "line", "Origin_", ",_", "line", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "line", "Origin_", "+_", "line", "Direction_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "line", "Origin_", "+_", "line", "Direction_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "(_", "p1_", "+_", "p2_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "Length_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "p2_", "-_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Orig", "in", "And", "Normal_", "(_", "origin_", ",_", "line", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Cylinder", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "post", " ", "%", "d", "'_", "%_", "post", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uuid_", "=_", "new", "UUID_", "(_", ")_", ",_", "pose_", "=_", "pose_", ",_", "Radius_", "=_", "0.05_", ",_", "Length_", "=_", "float_", "(_", "line", "Length_", ")_", ",_", "Color_", "=_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "[_", "'", "Colli", "sion", " ", "Enable", "d", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reject", "Folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "nonp", "ost", " ", "cluster", "s", "'_", ",_", "parent", "Obj_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keep", "Folder_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "'", "post", " ", "cluster", "s", "'_", ",_", "parent", "Obj_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "cluster_", "in_", "enumerate_", "(_", "clusters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "Point_", ",_", "line", "Direction_", ",_", "line", "Points_", "=_", "appl", "y", "Line", "Fit_", "(_", "cluster_", ",_", "distance", "Threshold_", "=_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Post", "Cluster_", "(_", "cluster_", ",_", "line", "Direction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vis_", "._", "show", "Poly", "Data_", "(_", "cluster_", ",_", "'", "cluster", " ", "%", "d", "'_", "%_", "i_", ",_", "visible_", "=_", "False_", ",_", "color_", "=_", "get", "Random", "Color_", "(_", ")_", ",_", "alpha_", "=_", "0.5_", ",_", "parent_", "=_", "keep", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "Cylinder", "Aff", "orda", "nce_", "(_", "line", "Points_", ",_", "line", "Direction_", ",_", "line", "Point_", ",_", "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 ", " _", "vis_", "._", "show", "Poly", "Data_", "(_", "cluster_", ",_", "'", "cluster", " ", "%", "d", "'_", "%_", "i_", ",_", "visible_", "=_", "False_", ",_", "color_", "=_", "get", "Random", "Color_", "(_", ")_", ",_", "alpha_", "=_", "0.5_", ",_", "parent_", "=_", "reject", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "find", "And", "Fit", "Dri", "ll", "Barr", "el_", "(_", "poly", "Data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Fin", "d", " ", "the", " ", "horizon", "tal", " ", "surfaces", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "the", " ", "horizon", "tal", " ", "surfaces", ",", " ", "find", " ", "all", " ", "the", " ", "drill", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "poly", "Data_", "or_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ground", "Points_", ",_", "scen", "e", "Points_", "=_", "remove", "Gro", "und_", "(_", "poly", "Data_", ",_", "ground", "Thickness", "_", "=_", "0.02_", ",_", "scen", "e", "Hei", "ght", "Fro", "m", "Gro", "und_", "=_", "0.50", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scen", "e", "Points_", "=_", "threshol", "d", "Points_", "(_", "scen", "e", "Points_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.5_", ",_", "1.7", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "scen", "e", "Points_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", "=_", "0.10", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "vtk_", "._", "vtk", "PC", "LN", "ormal", "Estimat", "ion_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Sear", "ch", "Radius_", "(_", "normal", "Estimat", "ion", "Sear", "ch", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "scen", "e", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "e", "Points_", "=_", "shallow", "Copy_", "(_", "f_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normals_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "scen", "e", "Points_", ",_", "'", "normal", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal", "s", "Dot", "Up_", "=_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "normals_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "scen", "e", "Points_", ",_", "normal", "s", "Dot", "Up_", ",_", "'", "normal", "s", "\\u", "dot", "\\u", "up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "surfaces", "_", "=_", "threshol", "d", "Points_", "(_", "scen", "e", "Points_", ",_", "'", "normal", "s", "\\u", "dot", "\\u", "up", "'_", ",_", "[_", "0.95_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "ground", "Points_", ",_", "'", "ground", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "scen", "e", "Points_", ",_", "'", "scen", "e", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "normal", "s", "\\u", "dot", "\\u", "up", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "surfaces", "_", ",_", "'", "surfaces", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "surfaces", "_", ",_", "cluster", "Tolerance", "_", "=_", "0.15_", ",_", "min", "Cluster", "Size_", "=_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fit", "Results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Frame_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "forward", "Direction_", "=_", "np_", "._", "array_", "(_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Frame_", "._", "Transform", "Vector_", "(_", "forward", "Direction_", ",_", "forward", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "robot", "Origin_", "=_", "view", "Frame_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "robot", "Forward_", "=_", "forward", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "robot", " ", "orig", "in", ":'", ",", " ", "robot", "Origin_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "robot", " ", "forward", ":'", ",", " ", "robot", "Forward_", "\\u\\u\\uNL\\u\\u\\u_", "centroid_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "cluster", "Id_", ",_", "cluster_", "in_", "enumerate_", "(_", "clusters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster", "Obj_", "=_", "update", "Poly", "Data_", "(_", "cluster_", ",_", "'", "surf", "ace", " ", "cluster", " ", "%", "d", "'_", "%_", "cluster", "Id_", ",_", "color_", "=_", "[_", "1_", ",_", "1_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", ",_", "edges_", ",_", "\\u_", "=_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length", "s_", "=_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "[_", ":_", "2_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "Cluster_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "edge", "Length_", "in_", "edge", "Length", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "cluster", " ", "%", "d", " ", "edge", " ", "length", ":", " ", "%", "f", "'", " ", "%", " ", "(", "cluster", "Id", ",", " ", "edge", "Length", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "edge", "Length_", "<_", "0.35_", "or_", "edge", "Length_", ">_", "0.75_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip", "Cluster_", "=_", "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_", "skip", "Cluster_", ":_", "\\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_", "cluster", "Obj_", "._", "set", "Soli", "d", "Color_", "(_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "centroid_", "=_", "np_", "._", "average_", "(_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "cluster_", ",_", "'", "Point", "s", "'_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\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 ", " _", "drill", "Frame_", "=_", "segment", "Dri", "ll", "Barr", "el", "Frame_", "(_", "centroid_", ",_", "poly", "Data_", "=_", "scen", "e", "Points_", ",_", "forward", "Direction_", "=_", "robot", "Forward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "drill", "Frame_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fit", "Results_", "._", "append_", "(_", "(_", "cluster", "Obj_", ",_", "drill", "Frame_", ")_", ")_", "\\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_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "fit", " ", "drill", " ", "fail", "ed", " ", "for", " ", "cluster", ":'_", ",_", "cluster", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fit", "Results_", ":_", "\\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_", "sort", "Fitt", "ed", "Dri", "lls_", "(_", "fit", "Results_", ",_", "robot", "Origin_", ",_", "robot", "Forward_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "centroid_", "\\u\\u\\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_", "sort", "Fitt", "ed", "Dri", "lls_", "(_", "fit", "Results_", ",_", "robot", "Origin_", ",_", "robot", "Forward_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "angle", "To", "Fit", "Results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fit", "Result_", "in_", "fit", "Results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster_", ",_", "drill", "Frame_", "=_", "fit", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Origin_", "=_", "np_", "._", "array_", "(_", "drill", "Frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "To", "Dri", "ll_", "=_", "np_", "._", "abs_", "(_", "compute", "Signe", "d", "Ang", "le", "Bet", "ween", "Vectors_", "(_", "robot", "Forward_", ",_", "drill", "Origin_", "-_", "robot", "Origin_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "To", "Fit", "Results_", "._", "append_", "(_", "(_", "angle", "To", "Dri", "ll_", ",_", "cluster_", ",_", "drill", "Frame_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "angle", " ", "to", " ", "candidate", " ", "drill", ":'", ",", " ", "angle", "To", "Dri", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "angle", "To", "Fit", "Results_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "usi", "ng", " ", "drill", " ", "at", " ", "angle", ":'", ",", " ", "angle", "To", "Fit", "Result", "s", "[", "0", "][", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Barr", "el", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "fit", "Result_", "in_", "enumerate_", "(_", "angle", "To", "Fit", "Results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "angle", "To", "Dri", "ll_", ",_", "cluster_", ",_", "drill", "Frame_", "=_", "fit", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "drill", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "=_", "update", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Frame_", "=_", "update", "Frame_", "(_", "drill", "Frame_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "drill", "_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "drill", "Frame_", "._", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "dict_", "(_", "ot", "df", "\\u", "type_", "=_", "'", "dew", "alt", "\\u", "button", "'_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "dew", "alt", "\\u", "button", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "_", "._", "set", "Soli", "d", "Color_", "(_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cluster", ".", "set", "Proper", "ty", "('", "Vis", "ibl", "e", "',", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", " ", "candidate", "'_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "drill", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "add", "To", "Object", "Model_", "(_", "drill", "_", ",_", "parent", "Obj_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "compute", "Signe", "d", "Ang", "le", "Bet", "ween", "Vectors_", "(_", "v1_", ",_", "v2_", ",_", "perp", "endi", "cula", "r", "Vector_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "the", " ", "sign", "ed", " ", "angle", " ", "bet", "ween", " ", "two", " ", "vector", "s", " ", "in", " ", "3d", ",", " ", "give", "n", " ", "a", " ", "perp", "endi", "cula", "r", " ", "vector", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "dete", "rmin", "e", " ", "sign", ".", " ", " ", "Result", " ", "return", "ed", " ", "is", " ", "radian", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1_", "=_", "np_", "._", "array_", "(_", "v1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2_", "=_", "np_", "._", "array_", "(_", "v2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perp", "endi", "cula", "r", "Vector_", "=_", "np_", "._", "array_", "(_", "perp", "endi", "cula", "r", "Vector_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v1_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "v1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v2_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "v2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perp", "endi", "cula", "r", "Vector_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "perp", "endi", "cula", "r", "Vector_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "math_", "._", "atan2_", "(_", "np_", "._", "dot_", "(_", "perp", "endi", "cula", "r", "Vector_", ",_", "np_", "._", "cross_", "(_", "v1_", ",_", "v2_", ")_", ")_", ",_", "np_", "._", "dot_", "(_", "v1_", ",_", "v2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Dri", "ll", "Barr", "el", "Frame_", "(_", "point1_", ",_", "poly", "Data_", ",_", "forward", "Direction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "Cluster", "Sear", "ch", "Radius_", "=_", "0.4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Cluster", "Sear", "ch", "Radius_", "=_", "0.5_", "#", "0.3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "Normal_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "poly", "Data_", ",_", "plane", "\\u", "origin_", ",_", "plane", "\\u", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "perp", "endi", "cula", "r", "Axis_", "=_", "expected", "Normal_", ",_", "search", "Origin_", "=_", "point1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Radius_", "=_", "table", "Cluster", "Sear", "ch", "Radius_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.2_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "table", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "table", "Points_", ",_", "'", "table", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table", "Points_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "table", "Points_", ",_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Point", "s", "Cluster", "s_", "=_", "extract", "Cluster", "s_", "(_", "table", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Point", "s", "Cluster", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "x_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "table", "Point", "s", "Cluster", "s_", ":_", "\\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_", "table", "Points_", "=_", "table", "Point", "s", "Cluster", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "table", "Points_", ",_", "'", "table", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.02_", ",_", "0.3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "search", "Region_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "search", "Region_", "=_", "crop", "To", "Sphere", "_", "(_", "search", "Region_", ",_", "point1_", ",_", "drill", "Cluster", "Sear", "ch", "Radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "drill", "Point", "s", " ", "=", " ", "extract", "Large", "st", "Cluster", "(", "search", "Region", ",", " ", "min", "Cluster", "Size", "=", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "fit", "Dri", "ll", "Barr", "el_", "(_", "search", "Region_", ",_", "forward", "Direction_", ",_", "plane", "\\u", "origin_", ",_", "plane", "\\u", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Dri", "ll", "Barr", "el_", "(_", "point1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "forward", "Direction_", "=_", "-_", "np_", "._", "array_", "(_", "get", "Curr", "ent", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "segment", "Dri", "ll", "Barr", "el_", "(_", "point1_", ",_", "poly", "Data_", ",_", "forward", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "t_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Barr", "el", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Frame_", "=_", "show", "Frame_", "(_", "t_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Frame_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "aff", "_", ",_", "drill", "Frame_", "\\u\\u\\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_", "segment", "Dri", "ll", "Aligned", "With", "Table_", "(_", "point_", ",_", "poly", "Data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Ye", "t", " ", "Ano", "ther", " ", "Dri", "ll", " ", "Fitt", "ing", " ", "Algorit", "hm", " ", "[", "tm", "]", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "one", " ", "fits", " ", "the", " ", "button", " ", "drill", " ", "ass", "umi", "ng", " ", "its", " ", "on", " ", "the", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "aligned", " ", "with", " ", "the", " ", "table", " ", "frame", " ", "(", "bec", "aus", "e", " ", "the", " ", "button", " ", "drill", " ", "orientation", " ", "is", " ", "difficult", " ", "to", " ", "find", ")", "\\", "10", ";", " ", " ", " ", " ", "Table", " ", "must", " ", "have", " ", "long", " ", "side", " ", "facing", " ", "robot", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "poly", "Data_", "or_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "segment", " ", "the", " ", "table", " ", "and", " ", "recover", " ", "the", " ", "precise", " ", "up", " ", "direction", " ", "normal", ":_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data", "Out_", ",_", "table", "Points_", ",_", "origin_", ",_", "normal_", "=_", "segment", "Table_", "(_", "poly", "Data_", ",_", "point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "orig", "in", " ", "#", " ", "this", " ", "orig", "in", " ", "is", " ", "bun", "k_", "\\u\\u\\uNL\\u\\u\\u_", "#", "table", "Centro", "id", " ", "=", " ", "compute", "Centro", "id", "(", "table", "Point", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "bound", "ing", " ", "box", " ", "edges_", "\\u\\u\\uNL\\u\\u\\u_", "OB", "Bor", "igi", "n_", ",_", "edges_", ",_", "\\u_", "=_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "table", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "OB", "B", " ", "out", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "OB", "Bor", "igi", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "edges_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Length", "s_", "=_", "np_", "._", "array_", "(_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "[_", "edge_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge_", ")_", "for_", "edge_", "in_", "edges_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "edge", "Length", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "axes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "whi", "ch", " ", "direction", " ", "the", " ", "robot", " ", "is", " ", "facing", " ", "and", " ", "flip", " ", "x", "-", "axis", " ", "of", " ", "table", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "main", " ", "axes", "\",", " ", "axes", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "view", "Directi", "on", "\",", " ", "view", "Direction_", "\\u\\u\\uNL\\u\\u\\u_", "#", "dp", " ", "=", " ", "np", ".", "dot", "(", "axes", "[", "1", "],", " ", "view", "Directi", "on", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "dp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "axes_", "[_", "1_", "]_", ",_", "view", "Direction_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "flip", " ", "the", " ", "x", "-", "direction", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axes_", "[_", "1_", "]_", "=_", "-_", "axes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "the", " ", "x", "-", "axis", " ", "to", " ", "be", " ", "along", " ", "the", " ", "2n", "d", " ", "large", "st", " ", "edge_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xaxis_", "=_", "axes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "array_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "array_", "(_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table", "Orientation_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "table", "Transform", " ", "=", " ", "transform", "Ut", "il", "s", ".", "frame", "Fro", "m", "Position", "And", "RP", "Y", "(", " ", "table", "Centro", "id", " ", ",", " ", "table", "Orient", "ation", ".", "Get", "Orient", "ation", "()", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", "Frame", "(", "table", "Transform", ",", " ", "'", "table", " ", "frame", " ", "[", "z", " ", "up", ",", " ", "x", " ", "awa", "y", " ", "face", "]'", ",", " ", "parent", "=\"", "segmentation", "\",", " ", "visi", "ble", "=", "Tru", "e", ").", "add", "To", "View", "(", "app", ".", "get", "DR", "CV", "iew", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "segment", "Table", "Scene_", "(_", "poly", "Data_", ",_", "point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "vis", ".", "show", "Cluster", "Object", "s", "(", "data", ".", "cluster", "s", " ", "+", " ", "[", "data", ".", "table", "],", " ", "parent", "='", "segmentation", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "crud", "e", " ", "use", " ", "of", " ", "the", " ", "table", " ", "frame", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "frame", " ", "of", " ", "the", " ", "drill", " ", "on", " ", "the", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "#", "t2", " ", "=", " ", "transform", "Ut", "il", "s", ".", "frame", "Fro", "m", "Position", "And", "RP", "Y", "([", "0", ",", "0", ",", "0", "],", " ", "[", "180", ",", " ", "0", " ", ",", " ", "90", "]", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "drill", "Orient", "ation", "Transform", " ", "=", " ", "transform", "Ut", "il", "s", ".", "copy", "Frame", "(", " ", "om", ".", "find", "Object", "By", "Name", "('", "object", " ", "1", " ", "frame", "')", ".", "transform", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "drill", "Orient", "ation", "Transform", ".", "Pre", "Multiply", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "drill", "Orient", "ation", "Transform", ".", "Concat", "enat", "e", "(", "t2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "vis", ".", "update", "Frame", "(", "t", ",", " ", "'", "drill", "Orient", "ation", "Transform", "',", "visi", "ble", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "table", "\\u", "xaxis", ",", " ", "table", "\\u", "yax", "is", ",", " ", "table", "\\u", "za", "xis", " ", "=", " ", "transform", "Ut", "il", "s", ".", "get", "Axe", "s", "Fro", "m", "Transform", "(", " ", "data", ".", "table", ".", "frame", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "drill", "Orient", "ation", " ", "=", " ", "transform", "Ut", "il", "s", ".", "orientation", "Fro", "m", "Axe", "s", "(", " ", "table", "\\u", "yax", "is", ",", " ", "table", "\\u", "xaxis", ",", " ", " ", "-1", "*", "np", ".", "array", "(", " ", "table", "\\u", "za", "xis", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "data_", "._", "clusters_", "[_", "0_", "]_", "._", "frame_", "._", "Get", "Position_", "(_", ")_", ",_", "table", "Orientation_", "._", "Get", "Orientation_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "drill", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "drill", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "color_", "=_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "drill", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Obj_", "=_", "update", "Frame_", "(_", "drill", "Transform_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "scale_", "=_", "0.2_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "get", "Dri", "ll", "Aff", "orda", "nce", "Params_", "(_", "np_", "._", "array_", "(_", "drill", "Transform_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ",_", "drill", "Type_", "=_", "\"", "dew", "alt", "\\u", "button", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\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_", "segment", "Dri", "ll", "In", "Hand_", "(_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "distance", "To", "Line", "Threshold_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Distan", "ce", "To", "Line_", "(_", "poly", "Data_", ",_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "[_", "0.0_", ",_", "distance", "To", "Line", "Threshold_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Segment_", "=_", "p2_", "-_", "p1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "Length_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "line", "Segment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cropped", "_", ",_", "poly", "Data_", "=_", "crop", "To", "Plane_", "(_", "poly", "Data_", ",_", "p1_", ",_", "line", "Segment_", "/_", "line", "Length_", ",_", "[_", "-_", "0.03_", ",_", "line", "Length_", "+_", "0.03_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "cropped", "_", ",_", "'", "drill", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Points_", "=_", "cropped", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normal_", "=_", "line", "Segment_", "/_", "line", "Length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "centroids_", "=_", "compute", "Centro", "ids_", "(_", "drill", "Points_", ",_", "axis_", "=_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "centroid", "s", "Poly", "Data_", "=_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "centroids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "centroid", "s", "Poly", "Data_", ",_", "'", "cluster", " ", "centroid", "s", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "To", "Top", "Point_", "=_", "np_", "._", "array_", "(_", "[_", "-_", "0.002", "904", "_", ",_", "-_", "0.010", "029", "_", ",_", "0.15", "318", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "centroids_", "[_", "0_", "]_", "-_", "centroids_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "-_", "drill", "To", "Top", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "t_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "visible_", "=_", "False_", ")_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "get", "Dri", "ll", "Aff", "orda", "nce", "Params_", "(_", "np_", "._", "array_", "(_", "t_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Dri", "ll", "Aff", "orda", "nce_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "t_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "visible_", "=_", "False_", ")_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "get", "Dri", "ll", "Aff", "orda", "nce", "Params_", "(_", "np_", "._", "array_", "(_", "t_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "aff", "_", "\\u\\u\\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", "Link", "Frame_", "(_", "link", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "robot", "State", "Model_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "robot", " ", "state", " ", "model", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "robot", "State", "Model_", "=_", "robot", "State", "Model_", "or_", "get", "Vis", "ibl", "e", "Robot", "Model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "robot", "State", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "robot", "State", "Model_", "._", "model_", "._", "get", "Link", "To", "World_", "(_", "link", "Name_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Dri", "ll", "In", "Hand", "Offset_", "(_", "z", "Rotation_", "=_", "0.0_", ",_", "z", "Translation_", "=_", "0.0_", ",_", "x", "Translation_", "=_", "0.0_", ",_", "y", "Translation_", "=_", "0.0_", ",_", "flip_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "Offset_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Offset_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "Offset_", "._", "Rotate", "Y_", "(_", "180_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "drill", "Offset_", "._", "Rotate", "Z_", "(_", "z", "Rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Offset_", "._", "Rotate", "Y_", "(_", "-_", "90_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "drill", "Off", "set", ".", "Translate", "(", "0", ",", " ", "0.09", ",", " ", "z", "Translat", "ion", " ", "-", " ", "0.015", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "drill", "Off", "set", ".", "Translate", "(", "z", "Translat", "ion", " ", "-", " ", "0.015", ",", " ", "0.03", "5", " ", "+", " ", "x", "Translat", "ion", ",", " ", "0.", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Offset_", "._", "Translate", "_", "(_", "z", "Translation_", ",_", "x", "Translation_", ",_", "0.0_", "+_", "y", "Translation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "drill", "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_", "move", "Dri", "ll", "To", "Hand_", "(_", "drill", "Offset_", ",_", "hand_", "=_", "'", "right", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "drill", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "drill", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "_", "=_", "add", "Dri", "ll", "Aff", "orda", "nce_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "hand_", "in_", "(_", "'", "right", "'_", ",_", "'", "left", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Transform_", "=_", "drill", "_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "Base", "Link_", "=_", "get", "Link", "Frame_", "(_", "'%", "s", "\\u", "hand", "\\u", "face", "'_", "%_", "hand_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Transform_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Transform_", "._", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Transform_", "._", "Concat", "enat", "e_", "(_", "drill", "Offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Transform_", "._", "Concat", "enat", "e_", "(_", "right", "Base", "Link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "._", "\\u", "render", "All", "Views_", "(_", ")_", "\\u\\u\\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_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\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_", ",_", "number", "Of", "Points_", "=_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Time", "r", "Callback_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "Fp", "s_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "number", "Of", "Points_", "=_", "number", "Of", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annot", "ation", "Obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Lines_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "points_", "=_", "[_", "None_", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "number", "Of", "Points_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hover", "Pos_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annot", "ation", "Func_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Move", "Pos_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Move_", "(_", "self_", ",_", "display", "Point_", ",_", "modifiers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Move", "Pos_", "=_", "display", "Point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Press_", "(_", "self_", ",_", "display", "Point_", ",_", "modifiers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "mouse", " ", "press", ":'", ",", " ", "modifiers_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "modifiers", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "number", "Of", "Points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "points_", "[_", "i_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "points_", "[_", "i_", "]_", "=_", "self_", "._", "hover", "Pos_", "\\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_", "self_", "._", "points_", "[_", "-_", "1_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finish_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "self_", "._", "annot", "ation", "Obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "p_", "._", "copy_", "(_", ")_", "for_", "p_", "in_", "self_", "._", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "annot", "ation", "Func_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "annot", "ation", "Func_", "(_", "*_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remove", "View", "Picke", "r_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "Release_", "(_", "self_", ",_", "display", "Point_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "p_", "if_", "p_", "is_", "not_", "None_", "else_", "self_", "._", "hover", "Pos_", "for_", "p_", "in_", "self_", "._", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "draw", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "p_", "in_", "points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Sphere", "_", "(_", "p_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "draw", "Lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "draw", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "points_", ",_", "points_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "b_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "d_", "._", "add", "Line_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connect", " ", "end", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "points_", "[_", "-_", "1_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Line_", "(_", "points_", "[_", "0_", "]_", ",_", "points_", "[_", "-_", "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_", "self_", "._", "annot", "ation", "Obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "annot", "ation", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annot", "ation", "Obj_", "._", "set", "Property_", "(_", "'", "Color", "'_", ",_", "Qt", "Gui_", "._", "QC", "olor_", "(_", "0_", ",_", "255_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annot", "ation", "Obj_", "._", "actor_", "._", "Set", "Pick", "able_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Picke", "r_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tick_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "enabled_", ":_", "\\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_", "not_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "annot", "ation", "Func_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "hover", "Pos_", "=_", "pick", "Point_", "(_", "self_", "._", "last", "Move", "Pos_", ",_", "get", "Segmentation", "View_", "(_", ")_", ",_", "obj_", "=_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\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_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Time", "r", "Callback_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "Fp", "s_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "=_", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "renderer_", "=_", "view_", "._", "renderer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "=_", "vtk_", "._", "vtk", "Leader", "Act", "or", "2", "D_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "._", "Set", "Arrow", "Placem", "ent", "To", "None_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "._", "Get", "Position", "Coordinate_", "(_", ")_", "._", "Set", "Coordinat", "e", "System", "To", "Viewport", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "._", "Get", "Position", "2", "Coordinate_", "(_", ")_", "._", "Set", "Coordinat", "e", "System", "To", "Viewport", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "._", "Get", "Property_", "(_", ")_", "._", "Set", "Line", "Width_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "._", "Set", "Position_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "._", "Set", "Position", "2_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "p1_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p2_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annot", "ation", "Func_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "Move", "Pos_", "=_", "[_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "renderer_", "._", "Remove", "Act", "or", "2", "D_", "(_", "self_", "._", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Move_", "(_", "self_", ",_", "display", "Point_", ",_", "modifiers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "last", "Move", "Pos_", "=_", "display", "Point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Press_", "(_", "self_", ",_", "display", "Point_", ",_", "modifiers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "p1_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "p1_", "=_", "list_", "(_", "self_", "._", "last", "Move", "Pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "p1_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "renderer_", "._", "Add", "Act", "or", "2", "D_", "(_", "self_", "._", "line_", ")_", "\\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_", "._", "p2_", "=_", "self_", "._", "last", "Move", "Pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finish_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "renderer_", "._", "Remove", "Act", "or", "2", "D_", "(_", "self_", "._", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "annot", "ation", "Func_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "annot", "ation", "Func_", "(_", "self_", "._", "p1_", ",_", "self_", "._", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "Release_", "(_", "self_", ",_", "display", "Point_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Draw_", "(_", "Time", "r", "Callback_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tick_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "p1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "line_", "._", "Set", "Position_", "(_", "self_", "._", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "line_", "._", "Set", "Position", "2_", "(_", "self_", "._", "last", "Move", "Pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "view", "Picke", "rs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Picke", "rs_", "._", "append_", "(_", "picker_", ")_", "\\u\\u\\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_", "remove", "View", "Picke", "r_", "(_", "picker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "view", "Picke", "rs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Picke", "rs_", "._", "remove_", "(_", "picker_", ")_", "\\u\\u\\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_", "distance", "To", "Line_", "(_", "x0_", ",_", "x1_", ",_", "x2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numerator_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "np_", "._", "cross_", "(_", "(_", "x0_", "-_", "x1_", ")_", ",_", "(_", "x0_", "-_", "x2_", ")_", ")_", "**_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "denom_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "x2_", "-_", "x1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numerator_", "/_", "denom_", "\\u\\u\\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_", "label", "Distan", "ce", "To", "Line_", "(_", "poly", "Data_", ",_", "line", "Point", "1_", ",_", "line", "Point", "2_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x0_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", "=_", "np_", "._", "array_", "(_", "line", "Point", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "np_", "._", "array_", "(_", "line", "Point", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numerator_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "np_", "._", "cross_", "(_", "(_", "x0_", "-_", "x1_", ")_", ",_", "(_", "x0_", "-_", "x2_", ")_", ")_", "**_", "2_", ",_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "denom_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "x2_", "-_", "x1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "numerator_", "/_", "denom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "dists_", ",_", "result", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "poly", "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_", "def_", "label", "Distan", "ce", "To", "Point_", "(_", "poly", "Data_", ",_", "point_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "points_", "-_", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "points_", "**_", "2_", ",_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "dists_", ",_", "result", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "poly", "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_", "def_", "get", "Plan", "e", "Equation", "Fro", "m", "Poly", "Data_", "(_", "poly", "Data_", ",_", "expected", "Normal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "origin_", ",_", "normal_", ",_", "np_", "._", "hstack_", "(_", "(_", "normal_", ",_", "[_", "np_", "._", "dot_", "(_", "origin_", ",_", "normal_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Edge_", "(_", "poly", "Data_", ",_", "edge", "Axis_", ",_", "perp", "Axis_", ",_", "bin", "Width_", "=_", "0.03_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "edge", "Axis_", ",_", "result", "Array", "Name_", "=_", "'", "dist", "\\u", "along", "\\u", "edge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "perp", "Axis_", ",_", "result", "Array", "Name_", "=_", "'", "dist", "\\u", "perp", "\\u", "to", "\\u", "edge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "bins_", "=_", "bin", "By", "Scalar_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "along", "\\u", "edge", "'_", ",_", "bin", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "Labels_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "bin", "\\u", "labels", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist", "To", "Edge_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "perp", "\\u", "to", "\\u", "edge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Bins_", "=_", "len_", "(_", "bins_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "number", "Of", "Bins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bin", "Points_", "=_", "points_", "[_", "bin", "Labels_", "==_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "Dist", "s_", "=_", "dist", "To", "Edge_", "[_", "bin", "Labels_", "==_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "bin", "Dist", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "Points_", "._", "append_", "(_", "bin", "Points_", "[_", "bin", "Dist", "s_", "._", "argmax_", "(_", ")_", "]_", ")_", "\\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_", "np_", "._", "array_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Centro", "ids_", "(_", "poly", "Data_", ",_", "axis_", ",_", "bin", "Width_", "=_", "0.025", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "axis_", ",_", "result", "Array", "Name_", "=_", "'", "dist", "\\u", "along", "\\u", "axis", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "bins_", "=_", "bin", "By", "Scalar_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "along", "\\u", "axis", "'_", ",_", "bin", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "Labels_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "bin", "\\u", "labels", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Bins_", "=_", "len_", "(_", "bins_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "centroids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "number", "Of", "Bins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bin", "Points_", "=_", "points_", "[_", "bin", "Labels_", "==_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "bin", "Points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "centroids_", "._", "append_", "(_", "np_", "._", "average_", "(_", "bin", "Points_", ",_", "axis_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "array_", "(_", "centroids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Point", "Count", "s", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "axis_", ",_", "bin", "Width_", "=_", "0.025", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "axis_", ",_", "result", "Array", "Name_", "=_", "'", "dist", "\\u", "along", "\\u", "axis", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "bins_", "=_", "bin", "By", "Scalar_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "along", "\\u", "axis", "'_", ",_", "bin", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "Labels_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "bin", "\\u", "labels", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "number", "Of", "Bins_", "=_", "len_", "(_", "bins_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "Count_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "number", "Of", "Bins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bin", "Points_", "=_", "points_", "[_", "bin", "Labels_", "==_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "Count_", "._", "append_", "(_", "len_", "(_", "bin", "Points_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "np_", "._", "array_", "(_", "bin", "Count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bin", "By", "Scalar_", "(_", "lida", "r", "Data_", ",_", "scala", "r", "Array", "Name_", ",_", "bin", "Width_", ",_", "bin", "Label", "s", "Array", "Name_", "=_", "'", "bin", "\\u", "labels", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Get", "s", " ", "the", " ", "array", " ", "with", " ", "name", " ", "scala", "r", "Array", "Name", " ", "from", " ", "lida", "r", "Data", ".", "\\", "10", ";", " ", " ", " ", " ", "Compute", "s", " ", "bins", " ", "by", " ", "divi", "ding", " ", "the", " ", "scala", "r", " ", "array", " ", "int", "o", " ", "bins", " ", "of", " ", "size", " ", "bin", "Wid", "th", ".", "\\", "10", ";", " ", " ", " ", " ", "Add", "s", " ", "a", " ", "new", " ", "label", " ", "array", " ", "to", " ", "the", " ", "lida", "r", " ", "points", " ", "identify", "ing", " ", "whi", "ch", " ", "bin", " ", "the", " ", "point", " ", "belo", "ngs", " ", "to", ",", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "the", " ", "first", " ", "bin", " ", "is", " ", "label", "ed", " ", "with", " ", "0.", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "new", ",", " ", "label", "ed", " ", "lida", "r", " ", "data", " ", "and", " ", "the", " ", "bins", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "bins", " ", "are", " ", "an", " ", "array", " ", "where", " ", "each", " ", "value", " ", "represent", "s", " ", "a", " ", "bin", " ", "edge", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scalars", "_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "lida", "r", "Data_", ",_", "scala", "r", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bins_", "=_", "np_", "._", "arange_", "(_", "scalars", "_", "._", "min_", "(_", ")_", ",_", "scalars", "_", "._", "max_", "(_", ")_", "+_", "bin", "Width_", ",_", "bin", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "Labels_", "=_", "np_", "._", "digit", "ize_", "(_", "scalars", "_", ",_", "bins_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "len_", "(_", "bin", "Labels_", ")_", "==_", "len_", "(_", "scalars", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Data_", "=_", "shallow", "Copy_", "(_", "lida", "r", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "new", "Data_", ",_", "bin", "Labels_", ",_", "bin", "Label", "s", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "Data_", ",_", "bins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "Ob", "bs_", "(_", "poly", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labels", "Array", "Name_", "=_", "'", "cluster", "\\u", "labels", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "poly", "Data_", "._", "Get", "Point", "Data_", "(_", ")_", "._", "Get", "Array_", "(_", "labels", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "vtk_", "._", "vtk", "Annotate", "OB", "Bs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Inp", "ut", "Array", "To", "Process_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "vtk_", "._", "vtk", "Data", "Object_", "._", "FIE", "LD", "\\u", "ASSOC", "IAT", "ION", "\\u", "POINTS_", ",_", "labels", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Poly", "Data_", "(_", "f_", "._", "Get", "Output_", "(_", ")_", ",_", "'", "bbox", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Orient", "ed", "Bound", "ing", "Box_", "(_", "poly", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "orig", "in", ",", " ", "edge", "s", ",", " ", "and", " ", "outline", " ", "wire", "frame", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Points_", "=_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "labels", "Array", "Name_", "=_", "'", "bbox", "\\u", "labels", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "np_", "._", "ones_", "(_", "n", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk", "Num", "py_", "._", "add", "Num", "py", "To", "Vt", "k_", "(_", "poly", "Data_", ",_", "labels_", ",_", "labels", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "vtk_", "._", "vtk", "Annotate", "OB", "Bs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Inp", "ut", "Array", "To", "Process_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "vtk_", "._", "vtk", "Data", "Object_", "._", "FIE", "LD", "\\u", "ASSOC", "IAT", "ION", "\\u", "POINTS_", ",_", "labels", "Array", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Set", "Input_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "f_", "._", "Get", "Number", "Of", "Bound", "ing", "Boxes", "_", "(_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "np_", "._", "zeros_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "[_", "np_", "._", "zeros_", "(_", "3_", ")_", "for_", "i_", "in_", "xrange_", "(_", "3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "Get", "Bound", "ing", "Box", "Origin_", "(_", "0_", ",_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "Get", "Bound", "ing", "Box", "Edge_", "(_", "0_", ",_", "i_", ",_", "edges_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "origin_", ",_", "edges_", ",_", "shallow", "Copy_", "(_", "f_", "._", "Get", "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_", "def_", "segment", "Block", "By", "Annotation_", "(_", "block", "Dimensions_", ",_", "p1_", ",_", "p2_", ",_", "p3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segmentation", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segmentation", "Obj_", "._", "mapper_", "._", "Scala", "r", "Vis", "ibi", "lit", "y", "Off_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segmentation", "Obj_", "._", "set", "Property_", "(_", "'", "Point", " ", "Size", "'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segmentation", "Obj_", "._", "set", "Property_", "(_", "'", "Al", "pha", "'_", ",_", "0.8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "constraint", " ", "z", " ", "to", " ", "lie", " ", "in", " ", "plane_", "\\u\\u\\uNL\\u\\u\\u_", "#", "p1", "[", "2", "]", " ", "=", " ", "p2", "[", "2", "]", " ", "=", " ", "p3", "[", "2", "]", " ", "=", " ", "max", "(", "p1", "[", "2", "],", " ", "p2", "[", "2", "],", " ", "p3", "[", "2", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zed", "ge_", "=_", "p2_", "-_", "p1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "zed", "ge_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "zed", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "xw", "idt", "h", " ", "=", " ", "distance", "To", "Line", "(", "p3", ",", " ", "p1", ",", " ", "p2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expected", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "xw", "idth_", ",_", "yw", "idth_", "=_", "block", "Dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zw", "idth_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "zed", "ge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "p2_", "-_", "p1_", ",_", "p3_", "-_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "yaxis_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reo", "rien", "t", " ", "axes_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "yaxis_", ",_", "view", "Plan", "e", "Normal_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "p3_", "-_", "p1_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "right", " ", "hande", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "(_", "(_", "p1_", "+_", "p2_", ")_", "/_", "2.0_", ")_", "+_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", "+_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "origin_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", ",_", "origin_", "+_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", ",_", "origin_", "+_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", ",_", "origin_", "+_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "block", " ", "axes", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Color", "'_", ",_", "Qt", "Gui_", "._", "QC", "olor_", "(_", "255_", ",_", "255_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "annot", "ation", "'_", ")_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cube_", "=_", "vtk_", "._", "vtk", "Cub", "e", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "XL", "ength", "_", "(_", "xw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "YL", "ength", "_", "(_", "yw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "ZL", "ength", "_", "(_", "zw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "=_", "shallow", "Copy_", "(_", "cube_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "cube_", ",_", "'", "block", " ", "aff", "orda", "nce", "'_", ",_", "cls_", "=_", "Block", "Aff", "orda", "nce", "Item_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "origin_", ",_", "xw", "idth_", "=_", "xw", "idth_", ",_", "yw", "idth_", "=_", "yw", "idth_", ",_", "zw", "idth_", "=_", "zw", "idth_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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", "Boa", "rd", "Corner", "s_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axes_", "=_", "[_", "np_", "._", "array_", "(_", "params_", "[_", "axis_", "]_", ")_", "for_", "axis_", "in_", "[_", "'", "xaxis", "'_", ",_", "'", "yax", "is", "'_", ",_", "'", "za", "xis", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widths_", "=_", "[_", "np_", "._", "array_", "(_", "params_", "[_", "axis_", "]_", ")_", "/_", "2.0_", "for_", "axis_", "in_", "[_", "'", "xw", "idt", "h", "'_", ",_", "'", "yw", "idt", "h", "'_", ",_", "'", "zw", "idt", "h", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "[_", "axes_", "[_", "i_", "]_", "*_", "widths_", "[_", "i_", "]_", "for_", "i_", "in_", "xrange_", "(_", "3_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "params_", "[_", "'", "orig", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "+_", "edges_", "[_", "0_", "]_", "+_", "edges_", "[_", "1_", "]_", "+_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "-_", "edges_", "[_", "0_", "]_", "+_", "edges_", "[_", "1_", "]_", "+_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "-_", "edges_", "[_", "0_", "]_", "-_", "edges_", "[_", "1_", "]_", "+_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "+_", "edges_", "[_", "0_", "]_", "-_", "edges_", "[_", "1_", "]_", "+_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "+_", "edges_", "[_", "0_", "]_", "+_", "edges_", "[_", "1_", "]_", "-_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "-_", "edges_", "[_", "0_", "]_", "+_", "edges_", "[_", "1_", "]_", "-_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "-_", "edges_", "[_", "0_", "]_", "-_", "edges_", "[_", "1_", "]_", "-_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "+_", "edges_", "[_", "0_", "]_", "-_", "edges_", "[_", "1_", "]_", "-_", "edges_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Point", "Distan", "ces_", "(_", "target_", ",_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "array_", "(_", "[_", "np_", "._", "linalg_", "._", "norm_", "(_", "target_", "-_", "p_", ")_", "for_", "p_", "in_", "points_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Closes", "t", "Corner", "_", "(_", "aff", "_", ",_", "reference", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "corners_", "=_", "get", "Boa", "rd", "Corner", "s_", "(_", "aff", "_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "get", "Point", "Distan", "ces_", "(_", "np_", "._", "array_", "(_", "reference", "Frame_", "._", "Get", "Position_", "(_", ")_", ")_", ",_", "corners_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "corners_", "[_", "dists_", "._", "argmin_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Gro", "und", "Frame_", "(_", "aff", "_", ",_", "reference", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "Axis_", "=_", "[_", "0.0_", ",_", "-_", "1.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference", "Frame_", "._", "Transform", "Vector_", "(_", "ref", "Axis_", ",_", "ref", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "Axis_", "=_", "np_", "._", "array_", "(_", "ref", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "axes_", "=_", "[_", "np_", "._", "array_", "(_", "aff", "_", "._", "params_", "[_", "axis_", "]_", ")_", "for_", "axis_", "in_", "[_", "'", "xaxis", "'_", ",_", "'", "yax", "is", "'_", ",_", "'", "za", "xis", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis", "Projection", "s_", "=_", "np_", "._", "array_", "(_", "[_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "axis_", ",_", "ref", "Axis_", ")_", ")_", "for_", "axis_", "in_", "axes_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board", "Axis_", "=_", "axes_", "[_", "axis", "Projection", "s_", "._", "argmax_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "board", "Axis_", ",_", "ref", "Axis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "board", "Axis_", "=_", "-_", "board", "Axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xaxis_", "=_", "board", "Axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closest", "Corner", "_", "=_", "compute", "Closes", "t", "Corner", "_", "(_", "aff", "_", ",_", "reference", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Frame_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ground", "Frame_", "._", "Translate", "_", "(_", "closest", "Corner", "_", "[_", "0_", "]_", ",_", "closest", "Corner", "_", "[_", "1_", "]_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ground", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Corner", "Frame_", "(_", "aff", "_", ",_", "reference", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref", "Axis_", "=_", "[_", "0.0_", ",_", "-_", "1.0_", ",_", "0.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference", "Frame_", "._", "Transform", "Vector_", "(_", "ref", "Axis_", ",_", "ref", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "Axis_", "=_", "np_", "._", "array_", "(_", "ref", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "axes_", "=_", "[_", "np_", "._", "array_", "(_", "aff", "_", "._", "params_", "[_", "axis_", "]_", ")_", "for_", "axis_", "in_", "[_", "'", "xaxis", "'_", ",_", "'", "yax", "is", "'_", ",_", "'", "za", "xis", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Length", "s_", "=_", "[_", "edge", "Length_", "for_", "edge", "Length_", "in_", "[_", "'", "xw", "idt", "h", "'_", ",_", "'", "yw", "idt", "h", "'_", ",_", "'", "zw", "idt", "h", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "axis", "Projection", "s_", "=_", "np_", "._", "array_", "(_", "[_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "axis_", ",_", "ref", "Axis_", ")_", ")_", "for_", "axis_", "in_", "axes_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "board", "Axis_", "=_", "axes_", "[_", "axis", "Projection", "s_", "._", "argmax_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "board", "Axis_", ",_", "ref", "Axis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "board", "Axis_", "=_", "-_", "board", "Axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "long", "Axis_", "=_", "axes_", "[_", "np_", "._", "argmax_", "(_", "edge", "Length", "s_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "board", "Axis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "axes_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "closest", "Corner", "_", "=_", "compute", "Closes", "t", "Corner", "_", "(_", "aff", "_", ",_", "reference", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corn", "er", "Frame_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corn", "er", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corn", "er", "Frame_", "._", "Translate", "_", "(_", "closest", "Corner", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "corn", "er", "Frame_", "\\u\\u\\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_", "publi", "sh", "Tria", "d_", "(_", "transform_", ",_", "collection", "Id_", "=_", "1234_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "=_", "lcm", "vs_", "._", "obj", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xyz_", "=_", "transform_", "._", "Get", "Position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpy", "_", "=_", "transform", "Utils_", "._", "roll", "Pit", "ch", "Ya", "w", "Fro", "m", "Transform_", "(_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "o_", "._", "roll_", ",_", "o_", "._", "pitch_", ",_", "o_", "._", "yaw_", "=_", "rpy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "x_", ",_", "o_", "._", "y_", ",_", "o_", "._", "z_", "=_", "xyz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "id_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "lcm", "vs_", "._", "obj", "\\u", "collection", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "id_", "=_", "collection", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "name_", "=_", "'", "stance", "\\u", "tria", "ds", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "type_", "=_", "lcm", "vs_", "._", "obj", "\\u", "collection", "\\u", "t_", "._", "AXIS", "3", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "nob", "js_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "reset_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "objs_", "=_", "[_", "o_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lcm", "Utils_", "._", "publish_", "(_", "'", "OBJ", "\\u", "COLLECTION", "'_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Block", "Aff", "orda", "nce_", "(_", "origin_", ",_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ",_", "xw", "idth_", ",_", "yw", "idth_", ",_", "zw", "idth_", ",_", "name_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "Box", "Aff", "orda", "nce", "Item_", "(_", "name_", ",_", "view_", "=_", "app_", "._", "get", "Curr", "ent", "Render", "View_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Dimen", "sion", "s", "'_", ",_", "[_", "float_", "(_", "v_", ")_", "for_", "v_", "in_", "[_", "xw", "idth_", ",_", "yw", "idth_", ",_", "zw", "idth_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "om_", "._", "add", "To", "Object", "Model_", "(_", "obj_", ",_", "parent", "Obj_", "=_", "om_", "._", "get", "Or", "Creat", "e", "Container_", "(_", "parent_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "=_", "vis_", "._", "show", "Frame_", "(_", "t_", ",_", "name_", "+_", "'", " ", "frame", "'_", ",_", "scale_", "=_", "0.2_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "orda", "nce", "Manager_", "._", "register", "Aff", "orda", "nce_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Block", "By", "Top", "Plane_", "(_", "poly", "Data_", ",_", "block", "Dimensions_", ",_", "expected", "Normal_", ",_", "expected", "XA", "xis_", ",_", "edge", "Sign_", "=_", "1_", ",_", "name_", "=_", "'", "block", " ", "aff", "orda", "nce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", ",_", "plane", "Origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "0.05_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "line", "Direction_", ",_", "\\u_", "=_", "appl", "y", "Line", "Fit_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "line", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "expected", "XA", "xis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "right", " ", "hande", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "XA", "xis_", "=_", "np_", "._", "array_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Points_", "=_", "compute", "Edge_", "(_", "poly", "Data_", ",_", "za", "xis_", ",_", "xaxis_", "*_", "edge", "Sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Points_", "=_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "edge", "Points_", ",_", "'", "edge", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Point_", ",_", "line", "Direction_", ",_", "\\u_", "=_", "appl", "y", "Line", "Fit_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "line", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "expected", "XA", "xis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "right", " ", "hande", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "xaxis_", ",_", "result", "Array", "Name_", "=_", "'", "dist", "\\u", "along", "\\u", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts_", "-_", "line", "Point_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "line", "Point_", "+_", "za", "xis_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "line", "Point_", "+_", "za", "xis_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "project", "Point", "To", "Plane_", "(_", "p1_", ",_", "plane", "Origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "project", "Point", "To", "Plane_", "(_", "p2_", ",_", "plane", "Origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xw", "idth_", ",_", "yw", "idth_", "=_", "block", "Dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zw", "idth_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "p2_", "-_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "p1_", "-_", "edge", "Sign_", "*_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", "-_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", "+_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Sphere", "(", "line", "Point", ",", " ", "radi", "us", "=", "0.02", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "line", "Point", ",", " ", "line", "Point", " ", "+", " ", "yax", "is", "*", "yw", "idt", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "line", "Point", ",", " ", "line", "Point", " ", "+", " ", "xaxis", "*", "xw", "idt", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "line", "Point", ",", " ", "line", "Point", " ", "+", " ", "za", "xis", "*", "zw", "idt", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "origin_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "orig", "in", " ", "-", " ", "xaxis", "*", "xw", "idt", "h", "/", "2.0", ",", " ", "orig", "in", " ", "+", " ", "xaxis", "*", "xw", "idt", "h", "/", "2.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "orig", "in", " ", "-", " ", "yax", "is", "*", "yw", "idt", "h", "/", "2.0", ",", " ", "orig", "in", " ", "+", " ", "yax", "is", "*", "yw", "idt", "h", "/", "2.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "orig", "in", " ", "-", " ", "za", "xis", "*", "zw", "idt", "h", "/", "2.0", ",", " ", "orig", "in", " ", "+", " ", "za", "xis", "*", "zw", "idt", "h", "/", "2.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", ",_", "origin_", "+_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", ",_", "origin_", "+_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", ",_", "origin_", "+_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "obj", " ", "=", " ", "update", "Poly", "Data", "(", "d", ".", "get", "Poly", "Data", "()", ",", " ", "'", "block", " ", "axes", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "obj", ".", "set", "Proper", "ty", "('", "Color", "',", " ", "Qt", "Gui", ".", "QC", "olor", "(", "255", ",", " ", "255", ",", " ", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "obj", ".", "set", "Proper", "ty", "('", "Vis", "ibl", "e", "',", " ", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "create", "Block", "Aff", "orda", "nce_", "(_", "origin_", ",_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ",_", "xw", "idth_", ",_", "yw", "idth_", ",_", "zw", "idth_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Color", "'_", ",_", "[_", "222_", "/_", "255.0_", ",_", "184_", "/_", "255.0_", ",_", "135_", "/_", "255.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "Deb", "ris", "Gra", "sp", "Seed_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "compute", "Deb", "ris", "Stan", "ce", "Frame_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "Frame_", "(_", "t_", ",_", "'", "deb", "ris", " ", "stance", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "publi", "sh", "Callback_", "=_", "functools_", "._", "partial_", "(_", "publi", "sh", "Deb", "ris", "Stan", "ce", "Frame_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Deb", "ris", "Gra", "sp", "Seed_", "(_", "aff", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deb", "ris", "Reference", "Frame_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "deb", "ris", " ", "reference", " ", "frame", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "deb", "ris", "Reference", "Frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deb", "ris", "Reference", "Frame_", "=_", "deb", "ris", "Reference", "Frame_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "Corner", "Frame_", "=_", "compute", "Corner", "Frame_", "(_", "aff", "_", ",_", "deb", "ris", "Reference", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "Frame_", "(_", "aff", "Corner", "Frame_", ",_", "'", "board", " ", "corn", "er", " ", "frame", "'_", ",_", "parent_", "=_", "aff", "_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "Deb", "ris", "Stan", "ce", "Frame_", "(_", "aff", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deb", "ris", "Reference", "Frame_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "deb", "ris", " ", "reference", " ", "frame", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deb", "ris", "Wall", "Edge_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "deb", "ris", " ", "plane", " ", "edge", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "deb", "ris", "Reference", "Frame_", "and_", "deb", "ris", "Wall", "Edge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deb", "ris", "Reference", "Frame_", "=_", "deb", "ris", "Reference", "Frame_", "._", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "Gro", "und", "Frame_", "=_", "compute", "Gro", "und", "Frame_", "(_", "aff", "_", ",_", "deb", "ris", "Reference", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Frame_", "(_", "aff", "Gro", "und", "Frame_", ",_", "'", "board", " ", "ground", " ", "frame", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "Wall", "Edge_", "=_", "compute", "Gro", "und", "Frame_", "(_", "aff", "_", ",_", "deb", "ris", "Reference", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame", "Pos_", "=_", "np_", "._", "array_", "(_", "aff", "Gro", "und", "Frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", ",_", "p2_", "=_", "deb", "ris", "Wall", "Edge_", "._", "points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Axis_", "=_", "p2_", "-_", "p1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Axis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "edge", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "projected", "Pos_", "=_", "p1_", "+_", "edge", "Axis_", "*_", "np_", "._", "dot_", "(_", "frame", "Pos_", "-_", "p1_", ",_", "edge", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "Wall", "Frame_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "Wall", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "use", "Wall", "Frame", "For", "Rotation_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "use", "Wall", "Frame", "For", "Rotation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "Wall", "Frame_", "._", "Set", "Matrix_", "(_", "deb", "ris", "Reference", "Frame_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "Wall", "Frame_", "._", "Translate", "_", "(_", "projected", "Pos_", "-_", "np_", "._", "array_", "(_", "deb", "ris", "Reference", "Frame_", "._", "Get", "Position_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Width_", "=_", "0.20", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Off", "set", "X_", "=_", "-_", "0.35_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Off", "set", "Y_", "=_", "0.45_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Rotation_", "=_", "0.0_", "\\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 ", " _", "aff", "Wall", "Frame_", "._", "Set", "Matrix_", "(_", "aff", "Gro", "und", "Frame_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "Wall", "Frame_", "._", "Translate", "_", "(_", "projected", "Pos_", "-_", "frame", "Pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stance", "Width_", "=_", "0.20", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Off", "set", "X_", "=_", "-_", "0.35_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Off", "set", "Y_", "=_", "-_", "0.45_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stance", "Rotation_", "=_", "math_", "._", "pi_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stance", "Frame_", ",_", "\\u_", ",_", "\\u_", "=_", "get", "Foot", "Frame", "s", "Fro", "m", "Reference", "Frame_", "(_", "aff", "Wall", "Frame_", ",_", "stance", "Width_", ",_", "math_", "._", "degrees_", "(_", "stance", "Rotation_", ")_", ",_", "[_", "stance", "Off", "set", "X_", ",_", "stance", "Off", "set", "Y_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "stance", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publi", "sh", "Deb", "ris", "Stan", "ce", "Frame_", "(_", "aff", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "compute", "Deb", "ris", "Stan", "ce", "Frame_", "(_", "aff", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publi", "sh", "Tria", "d_", "(_", "frame_", ")_", "\\u\\u\\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_", "segment", "Block", "By", "Plan", "es_", "(_", "block", "Dimensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "planes_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "selecte", "d", " ", "plane", "s", "'_", ")_", "._", "children_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in1", "_", ",_", "normal", "1_", ",_", "plane", "1_", "=_", "get", "Plan", "e", "Equation", "Fro", "m", "Poly", "Data_", "(_", "planes_", "[_", "0_", "]_", "._", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "2_", ",_", "normal", "2_", ",_", "plane", "2_", "=_", "get", "Plan", "e", "Equation", "Fro", "m", "Poly", "Data_", "(_", "planes_", "[_", "1_", "]_", "._", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "normal", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "normal", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pts", "1_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "planes_", "[_", "0_", "]_", "._", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pts", "2_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "planes_", "[_", "1_", "]_", "._", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Point_", "=_", "np_", "._", "zeros_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "centroid", "2_", "=_", "np_", "._", "sum_", "(_", "pts", "2_", ",_", "axis_", "=_", "0_", ")_", "/_", "len_", "(_", "pts", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vtk_", "._", "vtk", "Plane_", "._", "Project", "Point_", "(_", "centroid", "2_", ",_", "orig", "in1", "_", ",_", "normal", "1_", ",_", "line", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts", "1_", "-_", "line", "Point_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "line", "Point_", "+_", "za", "xis_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "line", "Point_", "+_", "za", "xis_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xw", "idth_", ",_", "yw", "idth_", "=_", "block", "Dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zw", "idth_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "p2_", "-_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "p1_", "+_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", "+_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", "+_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "line", "Point_", ",_", "radius_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "origin_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", ",_", "origin_", "+_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", ",_", "origin_", "+_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", ",_", "origin_", "+_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "block", " ", "axes", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Color", "'_", ",_", "Qt", "Gui_", "._", "QC", "olor_", "(_", "255_", ",_", "255_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cube_", "=_", "vtk_", "._", "vtk", "Cub", "e", "Source_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "XL", "ength", "_", "(_", "xw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "YL", "ength", "_", "(_", "yw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Set", "ZL", "ength", "_", "(_", "zw", "idth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "=_", "shallow", "Copy_", "(_", "cube_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "cube_", ",_", "'", "block", " ", "aff", "orda", "nce", "'_", ",_", "cls_", "=_", "Block", "Aff", "orda", "nce", "Item_", ",_", "parent_", "=_", "'", "aff", "orda", "nce", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "origin_", "=_", "origin_", ",_", "xw", "idth_", "=_", "xw", "idth_", ",_", "yw", "idth_", "=_", "yw", "idth_", ",_", "zw", "idth_", "=_", "zw", "idth_", ",_", "xaxis_", "=_", "xaxis_", ",_", "yaxis_", "=_", "yaxis_", ",_", "za", "xis_", "=_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "estimate", "Point", "er", "Tip_", "(_", "robot", "Model_", ",_", "poly", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "robot", " ", "model", ",", " ", "use", "s", " ", "forward", " ", "kine", "matics", " ", "to", " ", "dete", "rmin", "e", " ", "a", " ", "point", "er", " ", "tip", "\\", "10", ";", " ", " ", " ", " ", "search", " ", "region", ",", " ", "then", " ", "doe", "s", " ", "a", " ", "rans", "ac", " ", "line", " ", "fit", " ", "in", " ", "the", " ", "search", " ", "region", " ", "to", " ", "find", "\\", "10", ";", " ", " ", " ", " ", "points", " ", "on", " ", "the", " ", "point", "er", ",", " ", "and", " ", "select", "s", " ", "the", " ", "maxim", "um", " ", "point", " ", "along", " ", "the", " ", "line", " ", "fit", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "the", " ", "point", "er", " ", "tip", ".", " ", " ", "Return", "s", " ", "the", " ", "point", "er", " ", "tip", " ", "xyz", " ", "on", " ", "success", " ", "and", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "on", " ", "fail", "ure", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "Frame_", "=_", "robot", "Model_", "._", "get", "Link", "Frame_", "(_", "'", "r", "\\u", "hand", "\\u", "force", "\\u", "torque", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "[_", "0.0_", ",_", "0.14", "_", ",_", "-_", "0.06_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "[_", "0.0_", ",_", "0.24", "_", ",_", "-_", "0.06_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pal", "m", "Frame_", "._", "Transform", "Point_", "(_", "p1_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pal", "m", "Frame_", "._", "Transform", "Point_", "(_", "p2_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "np_", "._", "array_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "np_", "._", "array_", "(_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "point", "er", " ", "line", "'_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "crop", "To", "Line", "Segment_", "(_", "poly", "Data_", ",_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "point", "er", " ", "search", " ", "region", " ", "is", " ", "empty", "'_", "\\u\\u\\uNL\\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_", "vis_", "._", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "cropped", " ", "to", " ", "point", "er", " ", "line", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Distan", "ce", "To", "Line_", "(_", "poly", "Data_", ",_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "[_", "0.0_", ",_", "0.07_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "point", "er", " ", "search", " ", "region", " ", "is", " ", "empty", "'_", "\\u\\u\\uNL\\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_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "distance", " ", "to", " ", "point", "er", " ", "line", "'_", ",_", "color", "By", "Name_", "=_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rans", "ac", "Distan", "ce", "Threshold_", "=_", "0.007", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "Origin_", ",_", "line", "Direction_", ",_", "poly", "Data_", "=_", "appl", "y", "Line", "Fit_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "rans", "ac", "Distan", "ce", "Threshold_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "line", " ", "fit", " ", "rans", "ac", "'_", ",_", "color", "By", "Name_", "=_", "'", "rans", "ac", "\\u", "labels", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Direction_", "=_", "np_", "._", "array_", "(_", "line", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "Direction_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "line", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "line", "Direction_", ",_", "(_", "p2_", "-_", "p1_", ")_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "Direction_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "rans", "ac", "\\u", "labels", "'_", ",_", "[_", "1.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "point", "er", " ", "rans", "ac", " ", "line", " ", "fit", " ", "fail", "ed", " ", "to", " ", "find", " ", "inli", "ers", "'_", "\\u\\u\\uNL\\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_", "obj_", "=_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "line", " ", "fit", " ", "points", "'_", ",_", "color", "By", "Name_", "=_", "'", "dist", "\\u", "along", "\\u", "line", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Point", " ", "Size", "'_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts_", "-_", "line", "Origin_", ",_", "line", "Direction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "line", "Origin_", "+_", "line", "Direction_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "line", "Origin_", "+_", "line", "Direction_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "d", ".", "add", "Sphere", "(", "p1", ",", " ", "radi", "us", "=", "0.005", ")_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "fit", " ", "point", "er", " ", "line", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "p2_", "\\u\\u\\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_", "start", "Bound", "ed", "Plan", "e", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Bound", "ed", "Plan", "e", "By", "Annotation_", ")_", "\\u\\u\\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_", "start", "Val", "ve", "Segmentation", "By", "Wall", "Plane_", "(_", "expected", "Val", "ve", "Radius_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Val", "ve", "By", "Wall", "Plane_", ",_", "expected", "Val", "ve", "Radius_", ")_", "\\u\\u\\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_", "start", "Val", "ve", "Segmentation", "Manu", "al_", "(_", "expected", "Val", "ve", "Radius_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Val", "ve_", ",_", "expected", "Val", "ve", "Radius_", ")_", "\\u\\u\\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_", "start", "Ref", "it", "Wall", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "refi", "t", "Wall", "_", "\\u\\u\\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_", "start", "Wy", "e", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Wy", "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_", "def_", "start", "Doo", "r", "Handle", "Segmentation", "_", "(_", "ot", "df", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Doo", "r", "Handle_", ",_", "ot", "df", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "Tru", "ss", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Tru", "ss_", ")_", "\\u\\u\\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_", "start", "Ho", "se", "No", "zzle", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Ho", "se", "No", "zzle", "_", ")_", "\\u\\u\\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_", "store", "Point_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "pick", "Point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "pick", "Point_", "=_", "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_", "def_", "get", "Pick", "Point_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "\\u", "pick", "Point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "pick", "Point_", "\\u\\u\\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_", "start", "Pick", "Point_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "store", "Point_", "\\u\\u\\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_", "start", "Select", "Tool", "Tip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "select", "Tool", "Tip_", "\\u\\u\\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_", "start", "Dri", "ll", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll_", ")_", "\\u\\u\\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_", "start", "Dri", "ll", "Auto", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll", "Auto", "_", ")_", "\\u\\u\\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_", "start", "Dri", "ll", "Butt", "on", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll", "Button_", ")_", "\\u\\u\\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_", "start", "Point", "er", "Tip", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Point", "er", "Tip_", ")_", "\\u\\u\\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_", "start", "Dri", "ll", "Auto", "Segmentation", "Aligned", "With", "Table_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll", "Aligned", "With", "Table_", ")_", "\\u\\u\\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_", "start", "Dri", "ll", "Barr", "el", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll", "Barr", "el_", ")_", "\\u\\u\\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_", "start", "Dri", "ll", "Wall", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll", "Wall", "_", ")_", "\\u\\u\\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_", "start", "Dri", "ll", "Wall", "Segmentation", "Constr", "aine", "d_", "(_", "right", "Ang", "le", "Location_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll", "Wall", "Constr", "aine", "d_", ",_", "right", "Ang", "le", "Location_", ")_", "\\u\\u\\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_", "start", "Dri", "ll", "In", "Hand", "Segmentation", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "draw", "Lines_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Dri", "ll", "In", "Hand_", ")_", "\\u\\u\\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_", "start", "Segme", "nt", "Deb", "ris", "Wall", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Deb", "ris", "Wall", "_", ")_", "\\u\\u\\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_", "start", "Segme", "nt", "Deb", "ris", "Wall", "Manu", "al_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picker_", "=_", "Point", "Picke", "r_", "(_", "number", "Of", "Points_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "View", "Picke", "r_", "(_", "picker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "picker_", "._", "annot", "ation", "Func_", "=_", "functools_", "._", "partial_", "(_", "segment", "Deb", "ris", "Wall", "Manu", "al_", ")_", "\\u\\u\\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_", "select", "Tool", "Tip_", "(_", "point1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "point1_", "\\u\\u\\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_", "segment", "Deb", "ris", "Wall", "Manu", "al_", "(_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p1_", ",_", "p2_", "=_", "point1_", ",_", "point2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "deb", "ris", " ", "plane", " ", "edge", "'_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Obj_", "._", "points_", "=_", "[_", "p1_", ",_", "p2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "p2_", "-_", "p1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Frame_", "(_", "t_", ",_", "'", "deb", "ris", " ", "plane", " ", "frame", "'_", ",_", "parent_", "=_", "edge", "Obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "Frame_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "Frame_", "._", "Set", "Matrix_", "(_", "t_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "Frame_", "._", "Translate", "_", "(_", "-_", "xaxis_", "+_", "yaxis_", "+_", "za", "xis_", "*_", "20.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Frame_", "(_", "ref", "Frame_", ",_", "'", "deb", "ris", " ", "reference", " ", "frame", "'_", ",_", "parent_", "=_", "edge", "Obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Deb", "ris", "Wall", "_", "(_", "point1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "input", "Obj_", "._", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "0.02_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "view", "Plan", "e", "Normal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.25_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.02_", ",_", "0.02_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "unbound", "ed", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "plane", "Points_", ",_", "leaf", "Size_", "=_", "0.03_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", "=_", "label", "Outl", "iers", "_", "(_", "plane", "Points_", ",_", "search", "Radius_", "=_", "0.06_", ",_", "neighbor", "s", "In", "Sear", "ch", "Radius_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "voxel", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "is", "\\u", "outlier", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "threshol", "d", "Points_", "(_", "plane", "Points_", ",_", "'", "is", "\\u", "outlier", "'_", ",_", "[_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "plane", "Points_", ",_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "plane", "Points_", ",_", "cluster", "Tolerance", "_", "=_", "0.10", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "x_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "clusters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Obj_", "=_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "deb", "ris", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "perp", "Axis_", "=_", "[_", "0_", ",_", "0_", ",_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perp", "Axis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "perp", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Axis_", "=_", "np_", "._", "cross_", "(_", "normal_", ",_", "perp", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Points_", "=_", "compute", "Edge_", "(_", "plane", "Points_", ",_", "edge", "Axis_", ",_", "perp", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Points_", "=_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "edge", "Points_", ",_", "'", "edge", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Point_", ",_", "line", "Direction_", ",_", "\\u_", "=_", "appl", "y", "Line", "Fit_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "bin", "Count", "s", " ", "=", " ", "compute", "Point", "Count", "s", "Al", "ong", "Axi", "s", "(", "plane", "Point", "s", ",", " ", "line", "Directi", "on", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "line", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "za", "xis_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "za", "xis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "plane", "Points_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts_", "-_", "line", "Point_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "line", "Point_", "+_", "xaxis_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "line", "Point_", "+_", "xaxis_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "project", "Point", "To", "Plane_", "(_", "p1_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "project", "Point", "To", "Plane_", "(_", "p2_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "deb", "ris", " ", "plane", " ", "edge", "'_", ",_", "parent_", "=_", "plane", "Obj_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Obj_", "._", "points_", "=_", "[_", "p1_", ",_", "p2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Frame_", "(_", "t_", ",_", "'", "deb", "ris", " ", "plane", " ", "frame", "'_", ",_", "parent_", "=_", "plane", "Obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "Frame_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "Frame_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "Frame_", "._", "Set", "Matrix_", "(_", "t_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "Frame_", "._", "Translate", "_", "(_", "-_", "xaxis_", "+_", "yaxis_", "+_", "za", "xis_", "*_", "20.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Frame_", "(_", "ref", "Frame_", ",_", "'", "deb", "ris", " ", "reference", " ", "frame", "'_", ",_", "parent_", "=_", "plane", "Obj_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Bound", "ed", "Plan", "e", "By", "Annotation_", "(_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "shallow", "Copy_", "(_", "input", "Obj_", "._", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Plan", "e", "Normal_", "=_", "np_", "._", "array_", "(_", "get", "Segmentation", "View_", "(_", ")_", "._", "camera_", "(_", ")_", "._", "Get", "View", "Plan", "e", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "0.015", "_", ",_", "expected", "Normal_", "=_", "view", "Plan", "e", "Normal_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "view", "Plan", "e", "Normal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.3_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.7_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.015", "_", ",_", "0.015", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "unbound", "ed", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "plane", "Points_", ",_", "leaf", "Size_", "=_", "0.03_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", "=_", "label", "Outl", "iers", "_", "(_", "plane", "Points_", ",_", "search", "Radius_", "=_", "0.06_", ",_", "neighbor", "s", "In", "Sear", "ch", "Radius_", "=_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "voxel", " ", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "is", "\\u", "outlier", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "threshol", "d", "Points_", "(_", "plane", "Points_", ",_", "'", "is", "\\u", "outlier", "'_", ",_", "[_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "label", "Distan", "ce", "To", "Point_", "(_", "plane", "Points_", ",_", "point1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "extract", "Cluster", "s_", "(_", "plane", "Points_", ",_", "cluster", "Tolerance", "_", "=_", "0.10", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "x_", ",_", "'", "distance", "\\u", "to", "\\u", "point", "'_", ")_", "._", "min_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plane", "Points_", "=_", "clusters_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "plane", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "perp", "Axis_", "=_", "point2_", "-_", "point1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perp", "Axis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "perp", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Axis_", "=_", "np_", "._", "cross_", "(_", "normal_", ",_", "perp", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Points_", "=_", "compute", "Edge_", "(_", "plane", "Points_", ",_", "edge", "Axis_", ",_", "perp", "Axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Points_", "=_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "edge", "Points_", ",_", "'", "edge", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Point_", ",_", "line", "Direction_", ",_", "\\u_", "=_", "appl", "y", "Line", "Fit_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "line", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "perp", "Axis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "right", " ", "hande", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "plane", "Points_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts_", "-_", "line", "Point_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "line", "Point_", "+_", "yaxis_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "line", "Point_", "+_", "yaxis_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "project", "Point", "To", "Plane_", "(_", "p1_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "project", "Point", "To", "Plane_", "(_", "p2_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "plane", " ", "edge", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "(_", "p1_", "+_", "p2_", ")_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Frame_", "(_", "t_", ",_", "'", "plane", " ", "edge", " ", "frame", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "perspective", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "saved", "Came", "ra", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "saved", "Came", "ra", "Params_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aff", "_", "=_", "get", "Default", "Aff", "orda", "nce", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aff", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "._", "set", "Property_", "(_", "'", "Al", "pha", "'_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "actor_", "._", "Set", "Pick", "able_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view_", "=_", "get", "Segmentation", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "view_", "._", "camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Parallel", "Projection", "Off_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Position_", "(_", "saved", "Came", "ra", "Params_", "[_", "'", "Position", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Foc", "al", "Point_", "(_", "saved", "Came", "ra", "Params_", "[_", "'", "Foc", "al", "Point", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "View", "Up_", "(_", "saved", "Came", "ra", "Params_", "[_", "'", "View", "Up", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "set", "Came", "ra", "Manipulat", "ion", "Style_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "Came", "ra", "Params_", "(_", "overwrite_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "saved", "Came", "ra", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "overwrite_", "or_", "(_", "saved", "Came", "ra", "Params_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "get", "Segmentation", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "view_", "._", "camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "Came", "ra", "Params_", "=_", "dict_", "(_", "Position_", "=_", "c_", "._", "Get", "Position_", "(_", ")_", ",_", "Foc", "al", "Point_", "=_", "c_", "._", "Get", "Foc", "al", "Point_", "(_", ")_", ",_", "View", "Up_", "=_", "c_", "._", "Get", "View", "Up_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "Default", "Aff", "orda", "nce", "Object_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "om_", "._", "get", "Activ", "e", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "obj_", "in_", "om_", "._", "get", "Objects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Vis", "ibl", "e", "Robot", "Model_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "om_", "._", "get", "Objects_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "robot", "ur", "df_", "._", "Robot", "Model", "Item_", ")_", "and_", "obj_", "._", "get", "Property_", "(_", "'", "Vis", "ibl", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ortho", "X_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "get", "Default", "Aff", "orda", "nce", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "aff", "_", ":_", "\\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_", "save", "Came", "ra", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Property_", "(_", "'", "Al", "pha", "'_", ",_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "._", "actor_", "._", "Set", "Pick", "able_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "get", "Segmentation", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "view_", "._", "camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Parallel", "Projection", "On_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "aff", "_", "._", "params_", "[_", "'", "orig", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Direction_", "=_", "aff", "_", "._", "params_", "[_", "'", "xaxis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Up_", "=_", "-_", "aff", "_", "._", "params_", "[_", "'", "yax", "is", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Distance_", "=_", "aff", "_", "._", "params_", "[_", "'", "xw", "idt", "h", "'_", "]_", "*_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "aff", "_", "._", "params_", "[_", "'", "zw", "idt", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "Set", "Foc", "al", "Point_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Position_", "(_", "origin_", "-_", "view", "Direction_", "*_", "view", "Distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "View", "Up_", "(_", "view", "Up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Parallel", "Scale_", "(_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "._", "set", "Act", "or", "Manipulat", "ion", "Style_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "render_", "(_", ")_", "\\u\\u\\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_", "ortho", "Y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "get", "Default", "Aff", "orda", "nce", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "aff", "_", ":_", "\\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_", "save", "Came", "ra", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Property_", "(_", "'", "Al", "pha", "'_", ",_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "._", "actor_", "._", "Set", "Pick", "able_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "get", "Segmentation", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "view_", "._", "camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Parallel", "Projection", "On_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "aff", "_", "._", "params_", "[_", "'", "orig", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Direction_", "=_", "aff", "_", "._", "params_", "[_", "'", "yax", "is", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Up_", "=_", "-_", "aff", "_", "._", "params_", "[_", "'", "xaxis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Distance_", "=_", "aff", "_", "._", "params_", "[_", "'", "yw", "idt", "h", "'_", "]_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "aff", "_", "._", "params_", "[_", "'", "zw", "idt", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "Set", "Foc", "al", "Point_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Position_", "(_", "origin_", "-_", "view", "Direction_", "*_", "view", "Distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "View", "Up_", "(_", "view", "Up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Parallel", "Scale_", "(_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "._", "set", "Act", "or", "Manipulat", "ion", "Style_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "render_", "(_", ")_", "\\u\\u\\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_", "ortho", "Z_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff", "_", "=_", "get", "Default", "Aff", "orda", "nce", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "aff", "_", ":_", "\\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_", "save", "Came", "ra", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "set", "Property_", "(_", "'", "Al", "pha", "'_", ",_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "._", "actor_", "._", "Set", "Pick", "able_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "get", "Segmentation", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "view_", "._", "camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Parallel", "Projection", "On_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "aff", "_", "._", "params_", "[_", "'", "orig", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Direction_", "=_", "aff", "_", "._", "params_", "[_", "'", "za", "xis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Up_", "=_", "-_", "aff", "_", "._", "params_", "[_", "'", "yax", "is", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Distance_", "=_", "aff", "_", "._", "params_", "[_", "'", "zw", "idt", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "aff", "_", "._", "params_", "[_", "'", "yw", "idt", "h", "'_", "]_", "*_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "Set", "Foc", "al", "Point_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Position_", "(_", "origin_", "-_", "view", "Direction_", "*_", "view", "Distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "View", "Up_", "(_", "view", "Up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "Set", "Parallel", "Scale_", "(_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "._", "set", "Act", "or", "Manipulat", "ion", "Style_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "render_", "(_", ")_", "\\u\\u\\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_", "zoom", "To", "Display", "Point_", "(_", "display", "Point_", ",_", "bound", "s", "Radius_", "=_", "0.5_", ",_", "view_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picked", "Point_", "=_", "pick", "Point_", "(_", "display", "Point_", ",_", "get", "Segmentation", "View_", "(_", ")_", ",_", "obj_", "=_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "picked", "Point_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view_", "=_", "view_", "or_", "app_", "._", "get", "Curr", "ent", "Render", "View_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "world", "Pt", "1_", ",_", "world", "Pt", "2_", "=_", "get", "Ray", "Fro", "m", "Display", "Point_", "(_", "get", "Segmentation", "View_", "(_", ")_", ",_", "display", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diagonal_", "=_", "np_", "._", "array_", "(_", "[_", "bound", "s", "Radius_", ",_", "bound", "s", "Radius_", ",_", "bound", "s", "Radius_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bounds_", "=_", "np_", "._", "hstack_", "(_", "[_", "picked", "Point_", "-_", "diagonal_", ",_", "picked", "Point_", "+_", "diagonal_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bounds_", "=_", "[_", "bounds_", "[_", "0_", "]_", ",_", "bounds_", "[_", "3_", "]_", ",_", "bounds_", "[_", "1_", "]_", ",_", "bounds_", "[_", "4_", "]_", ",_", "bounds_", "[_", "2_", "]_", ",_", "bounds_", "[_", "5_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "renderer_", "(_", ")_", "._", "Reset", "Camera_", "(_", "bounds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "camera_", "(_", ")_", "._", "Set", "Foc", "al", "Point_", "(_", "picked", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "Point", "s", "Al", "ong", "Click", "Ray", "_", "(_", "position_", ",_", "ray_", ",_", "poly", "Data_", "=_", "None_", ",_", "distance", "To", "Line", "Threshold_", "=_", "0.025", "_", ",_", "near", "est", "To", "Camera_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "segmentation", "Obj", " ", "=", " ", "om", ".", "find", "Object", "By", "Name", "('", "point", "cloud", " ", "snapshot", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "poly", "Data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "get", "Curr", "ent", "Revo", "luti", "on", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "poly", "Data_", "or_", "not_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "poly", "Data_", "=_", "label", "Distan", "ce", "To", "Line_", "(_", "poly", "Data_", ",_", "position_", ",_", "position_", "+_", "ray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extract", " ", "points", " ", "near", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "[_", "0.0_", ",_", "distance", "To", "Line", "Threshold_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "ray_", ",_", "origin_", "=_", "position_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "along", "\\u", "line", "'_", ",_", "[_", "0.20", "_", ",_", "1e6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\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_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "ray", " ", "points", "'_", ",_", "color", "By", "Name_", "=_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "near", "est", "To", "Camera_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dists_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "along", "\\u", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dists_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intersect", "ion", "Point_", "=_", "points_", "[_", "dists_", "._", "argmin_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "intersect", "ion", "Point_", ",_", "radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "position_", ",_", "intersect", "ion", "Point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "intersect", "ing", " ", "ray", "'_", ",_", "visible_", "=_", "False_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Get", "Property_", "(_", ")_", "._", "Set", "Line", "Width_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d2_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "of", "\\u", "ray_", "=_", "position_", "+_", "2_", "*_", "ray_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "._", "add", "Line_", "(_", "position_", ",_", "end", "\\u", "of", "\\u", "ray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj2_", "=_", "update", "Poly", "Data_", "(_", "d2_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "came", "ra", " ", "ray", "'_", ",_", "visible_", "=_", "False_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj2_", "._", "actor_", "._", "Get", "Property_", "(_", ")_", "._", "Set", "Line", "Width_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "intersect", "ion", "Point_", "\\u\\u\\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_", "segment", "Dri", "ll", "Wall", "Fro", "m", "Tag_", "(_", "position_", ",_", "ray_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fix", " ", "the", " ", "drill", " ", "wall", " ", "relative", " ", "to", " ", "a", " ", "ray", " ", "intersect", "ed", " ", "with", " ", "the", " ", "wall", "\\", "10", ";", " ", " ", " ", " ", "Des", "c", ":", " ", "give", "n", " ", "a", " ", "position", " ", "and", " ", "a", " ", "ray", " ", "(", "typical", "ly", " ", "derive", "d", " ", "from", " ", "a", " ", "came", "ra", " ", "pixel", ")", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "tha", "t", " ", "point", " ", "to", " ", "dete", "rmin", "e", " ", "a", " ", "position", " ", "for", " ", "the", " ", "Dri", "ll", " ", "Wall", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "use", "s", " ", "a", " ", "hard", " ", "code", "d", " ", "offset", " ", "bet", "ween", " ", "the", " ", "position", " ", "on", " ", "the", " ", "wall", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "produce", " ", "the", " ", "drill", " ", "cutt", "ing", " ", "orig", "in", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "input", "Obj", " ", "=", " ", "om", ".", "find", "Object", "By", "Name", "('", "point", "cloud", " ", "snapshot", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "poly", "Data", " ", "=", " ", "shallow", "Copy", "(", "input", "Obj", ".", "poly", "Data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "get", "Curr", "ent", "Revo", "luti", "on", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "poly", "Data_", "is_", "None_", ")_", ":_", "#", " ", "no", " ", "data", " ", "ye", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "no", " ", "LI", "DAR", " ", "data", " ", "ye", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "point1_", "=_", "extract", "Point", "s", "Al", "ong", "Click", "Ray", "_", "(_", "position_", ",_", "ray_", ",_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "view", " ", "direction", " ", "is", " ", "out", ":_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "-_", "1_", "*_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data", "Out_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "view", "Direction_", ",_", "search", "Origin_", "=_", "point1_", ",_", "search", "Radius_", "=_", "0.3_", ",_", "angle", "Eps", "ilon", "_", "=_", "0.3_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "project", " ", "the", " ", "lida", "r", " ", "point", " ", "onto", " ", "the", " ", "plane", " ", "(", "older", ",", " ", "varian", "ce", " ", "is", " ", ">", "1c", "m", " ", "with", " ", "robot", " ", "2m", " ", "awa", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "intersect", "ion", "\\u", "point", " ", "=", " ", "project", "Point", "To", "Plan", "e", "(", "point", "1", ",", " ", "orig", "in", ",", " ", "normal", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "intersect", " ", "the", " ", "ray", " ", "with", " ", "the", " ", "plane", " ", "(", "varian", "ce", " ", "was", " ", "abo", "ut", " ", "4", "mm", " ", "with", " ", "robot", " ", "2m", " ", "awa", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "intersect", "ion", "\\u", "point_", "=_", "intersect", "Line", "With", "Plane_", "(_", "position_", ",_", "ray_", ",_", "origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "a", " ", "frame", ":_", "\\u\\u\\uNL\\u\\u\\u_", "xaxis_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "intersect", "ion", "\\u", "point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t2_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0.6_", ",_", "-_", "0.25_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "._", "Concat", "enat", "e_", "(_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right", "Ang", "le", "Location_", "=_", "'", "bottom", " ", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Dri", "ll", "Wall", "_", "(_", "right", "Ang", "le", "Location_", ",_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "wall", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "t_", ",_", "'", "wall", " ", "fit", " ", "tag", "'_", ",_", "parent_", "=_", "wall_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "intersect", "ion", "\\u", "point_", ",_", "radius_", "=_", "0.002", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "intersect", "ion", "'_", ",_", "parent_", "=_", "wall_", ",_", "visible_", "=_", "False_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ")_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "actor_", "._", "Get", "Property_", "(_", ")_", "._", "Set", "Line", "Width_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Dri", "ll", "Wall", "Fro", "m", "Wall", "Center_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "drill", " ", "wall", " ", "target", " ", "as", " ", "an", " ", "offset", " ", "from", " ", "the", " ", "center", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "full", " ", "wall", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "valve", " ", "wall", " ", "and", " ", "its", " ", "center_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hard", "code", "d", " ", "position", " ", "to", " ", "target", " ", "frame", " ", "from", " ", "center", " ", "of", " ", "wall_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "con", "inci", "des", " ", "with", " ", "the", " ", "distance", " ", "from", " ", "the", " ", "apr", "il", " ", "tag", " ", "to", " ", "this", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Frame_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "find", "Wall", "Center_", "(_", "poly", "Data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "Frame_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "-_", "0.07_", ",_", "-_", "0.32", "76_", ",_", "0_", "]_", ",_", "[_", "180_", ",_", "-_", "90_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "Frame_", "._", "Concat", "enat", "e_", "(_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right", "Ang", "le", "Location_", "=_", "'", "bottom", " ", "left", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Dri", "ll", "Wall", "_", "(_", "right", "Ang", "le", "Location_", ",_", "wall", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "wall", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "wall", "Frame_", ",_", "'", "wall", " ", "fit", " ", "lida", "r", "'_", ",_", "parent_", "=_", "wall_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "Far", "Rig", "ht", "Corner", "_", "(_", "poly", "Data_", ",_", "link", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "With", "in", " ", "a", " ", "point", " ", "cloud", " ", "find", " ", "the", " ", "point", " ", "to", " ", "the", " ", "far", " ", "right", " ", "from", " ", "the", " ", "link", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "input", " ", "is", " ", "the", " ", "4", " ", "corners", " ", "of", " ", "a", " ", "minim", "um", " ", "bound", "ing", " ", "box", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diagonal", "Transform_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "link", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diagonal", "Transform_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diagonal", "Transform_", "._", "Concat", "enat", "e_", "(_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "45_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "diagonal", "Transform_", ",_", "'", "diagonal", " ", "frame", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Origin_", "=_", "diagonal", "Transform_", "._", "Transform", "Point_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "X_", "=_", "diagonal", "Transform_", "._", "Transform", "Vector_", "(_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Y_", "=_", "diagonal", "Transform_", "._", "Transform", "Vector_", "(_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Z_", "=_", "diagonal", "Transform_", "._", "Transform", "Vector_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "view", "Y_", ",_", "origin_", "=_", "view", "Origin_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "foot", "\\u", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "corn", "er", "Point", "s", "'_", ",_", "parent_", "=_", "'", "segmentation", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "far", "Rig", "ht", "Index_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "along", "\\u", "foot", "\\u", "y", "'_", ")_", "._", "argmin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "points_", "[_", "far", "Rig", "ht", "Index_", ",_", ":_", "]_", "\\u\\u\\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", "Mini", "mum", "Bound", "ing", "Rectangle_", "(_", "poly", "Data_", ",_", "link", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "minim", "um", " ", "bound", "ing", " ", "rectangle", " ", "of", " ", "a", " ", "rectangular", " ", "point", " ", "cloud", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "input", " ", "is", " ", "assume", "d", " ", "to", " ", "be", " ", "a", " ", "rectangular", " ", "point", " ", "cloud", " ", "e", ".", "g", ".", " ", "the", " ", "top", " ", "of", " ", "a", " ", "block", " ", "or", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "transform", " ", "of", " ", "far", " ", "right", " ", "corn", "er", " ", "(", "pointi", "ng", " ", "awa", "y", " ", "from", " ", "robot", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Origina", "ll", "y", " ", "Fro", "m", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "db", "worth", "/", "minim", "um", "-", "area", "-", "bound", "ing", "-", "rectangle_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "0.02_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "2", "DA", "s", "Poly", "Data_", "(_", "xy", "\\u", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "a", " ", "2", "D", " ", "nump", "y", " ", "array", " ", "to", " ", "a", " ", "3", "D", " ", "poly", "data", " ", "by", " ", "appendi", "ng", " ", "z", "=", "0", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "np_", "._", "vstack_", "(_", "(_", "xy", "\\u", "points_", "._", "T_", ",_", "np_", "._", "zeros_", "(_", "xy", "\\u", "points_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d2_", "=_", "d_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "d2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xy", "\\u", "points_", "=_", "pts_", "[_", ":_", ",_", "[_", "0_", ",_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "get", "2", "DA", "s", "Poly", "Data_", "(_", "xy", "\\u", "points_", ")_", ",_", "'", "xy", "\\u", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hull", "\\u", "points_", "=_", "qh", "ull", "\\u", "2d_", "._", "qh", "ull", "2", "D_", "(_", "xy", "\\u", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "get", "2", "DA", "s", "Poly", "Data_", "(_", "hull", "\\u", "points_", ")_", ",_", "'", "hull", "\\u", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Revers", "e", " ", "order", " ", "of", " ", "points", ",", " ", "to", " ", "match", " ", "output", " ", "from", " ", "other", " ", "qh", "ull", " ", "implementation", "s_", "\\u\\u\\uNL\\u\\u\\u_", "hull", "\\u", "points_", "=_", "hull", "\\u", "points_", "[_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "Conve", "x", " ", "hull", " ", "points", ":", " ", "\\\\", "n", "',", " ", "hull", "\\u", "points", ",", " ", "\"\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "minim", "um", " ", "area", " ", "bound", "ing", " ", "rectangle_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rot", "\\u", "angle_", ",_", "rect", "Area_", ",_", "rect", "Depth_", ",_", "rect", "Width_", ",_", "center", "\\u", "point_", ",_", "corn", "er", "\\u", "points", "\\u", "ground_", ")_", "=_", "min", "\\u", "bound", "ing", "\\u", "rect_", "._", "min", "Bound", "ing", "Rect_", "(_", "hull", "\\u", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "get", "2", "DA", "s", "Poly", "Data_", "(_", "corn", "er", "\\u", "points", "\\u", "ground_", ")_", ",_", "'", "corn", "er", "\\u", "points", "\\u", "ground", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data", "Centro", "id_", "=_", "compute", "Centro", "id_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corn", "er", "Points_", "=_", "np_", "._", "vstack_", "(_", "(_", "corn", "er", "\\u", "points", "\\u", "ground_", "._", "T_", ",_", "poly", "Data", "Centro", "id_", "[_", "2_", "]_", "*_", "np_", "._", "ones_", "(_", "corn", "er", "\\u", "points", "\\u", "ground_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corn", "er", "Poly", "Data_", "=_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "corn", "er", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "frame", " ", "at", " ", "the", " ", "far", " ", "right", " ", "point", " ", "-", " ", "whi", "ch", " ", "points", " ", "awa", "y", " ", "from", " ", "the", " ", "robot_", "\\u\\u\\uNL\\u\\u\\u_", "far", "Rig", "ht", "Corner", "_", "=_", "find", "Far", "Rig", "ht", "Corner", "_", "(_", "corn", "er", "Poly", "Data_", ",_", "link", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Frame_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "vis", ".", "show", "Frame", "(", "view", "Frame", ",", " ", "\"", "view", "Frame", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "robot", "Ya", "w_", "=_", "math_", "._", "atan2_", "(_", "view", "Direction_", "[_", "1_", "]_", ",_", "view", "Direction_", "[_", "0_", "]_", ")_", "*_", "180.0_", "/_", "np_", "._", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "Angle_", "=_", "rot", "\\u", "angle_", "*_", "(_", "180_", "/_", "math_", "._", "pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "robot", "Ya", "w", " ", " ", " ", "\",", " ", "robot", "Ya", "w_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "block", "Ang", "le", " ", "\",", " ", "block", "Angle_", "\\u\\u\\uNL\\u\\u\\u_", "block", "Ang", "le", "All_", "=_", "np_", "._", "array_", "(_", "[_", "block", "Angle_", ",_", "block", "Angle_", "+_", "90_", ",_", "block", "Angle_", "+_", "180_", ",_", "block", "Angle_", "+_", "270_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "block", "Ang", "le", "All_", "-_", "robot", "Ya", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "values_", "[_", "i_", "]_", ">_", "180_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "i_", "]_", "=_", "values_", "[_", "i_", "]_", "-_", "360_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "=_", "abs_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "idx_", "=_", "np_", "._", "argmin_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "min", "\\u", "idx_", "==_", "1_", ")_", "or_", "(_", "min", "\\u", "idx_", "==_", "3_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "flip", " ", "rect", "Dep", "th", " ", "and", " ", "rect", "Wid", "th", " ", "as", " ", "angle", " ", "is", " ", "not", " ", "awa", "y", " ", "from", " ", "robot", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "rect", "Width_", ";_", "rect", "Width_", "=_", "rect", "Depth_", ";_", "rect", "Depth_", "=_", "temp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "best", " ", "angle", "\",", " ", "block", "Ang", "le", "All", "[", "min", "\\u", "idx", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rot", "\\u", "angle_", "=_", "block", "Ang", "le", "All_", "[_", "min", "\\u", "idx_", "]_", "*_", "math_", "._", "pi_", "/_", "180.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "corn", "er", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "far", "Rig", "ht", "Corner", "_", ",_", "[_", "0_", ",_", "0_", ",_", "np_", "._", "rad", "2de", "g_", "(_", "rot", "\\u", "angle_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "._", "show", "Frame_", "(_", "corn", "er", "Transform_", ",_", "\"", "corn", "er", "Transform", "\"_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Mini", "mum", " ", "area", " ", "bound", "ing", " ", "box", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Rot", "ation", " ", "angle", ":\"", ",", " ", "rot", "\\u", "angle", ",", " ", "\"", "rad", " ", " ", "(\"", ",", " ", "rot", "\\u", "angle", "*(", "180", "/", "math", ".", "pi", "),", " ", "\"", "deg", " ", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "rect", "Dep", "th", ":\"", ",", " ", "rect", "Dep", "th", ",", " ", "\"", " ", "rect", "Wid", "th", ":\"", ",", " ", "rect", "Wid", "th", ",", " ", "\"", " ", " ", "Area", ":\"", ",", " ", "rect", "Area_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Center", " ", "point", ":", " ", "\\\\", "n", "\",", " ", "center", "\\u", "point", " ", "#", " ", "nump", "y", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Corner", " ", "points", ":", " ", "\\\\", "n", "\",", " ", "corn", "er", "Point", "s", ",", " ", "\"\\\\", "n", "\"", " ", " ", "#", " ", "nump", "y", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "corn", "er", "Transform_", ",_", "rect", "Depth_", ",_", "rect", "Width_",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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 ]
Unused import
Cairnarvon/uptime/doc/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# uptime documentation build configuration file, created by\n# sphinx-quickstart on Sun Jan 20 05:05:56 2013.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.append(os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['sphinx.ext.autodoc']\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'uptime'\ncopyright = u'2013, Koen Crolla'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '3.0'\n# The full version, including alpha/beta/rc tags.\nrelease = '3.0.1'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of documents that shouldn't be included in the build.\n#unused_docs = []\n\n# List of directories, relative to source directory, that shouldn't be searched\n# for source files.\nexclude_trees = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. Major themes that come with\n# Sphinx are currently 'default' and 'sphinxdoc'.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_use_modindex = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# If nonempty, this is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = ''\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'uptimedoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\n# The paper size ('letter' or 'a4').\n#latex_paper_size = 'letter'\n\n# The font size ('10pt', '11pt' or '12pt').\n#latex_font_size = '10pt'\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'uptime.tex', u'uptime Documentation',\n u'Koen Crolla', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# Additional stuff for the LaTeX preamble.\n#latex_preamble = ''\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_use_modindex = True\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upti", "me", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Sun", " ", "Jan", " ", "20", " ", "05", ":", "05", ":", "56", " ", "2013", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "append", "(", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "upti", "me", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2013", ",", " ", "Ko", "en", " ", "Cro", "lla", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "3.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "3.0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "document", "s", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "include", "d", " ", "in", " ", "the", " ", "build", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "unu", "sed", "\\u", "docs", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "director", "ies", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "searche", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "trees_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "Maj", "or", " ", "themes", " ", "tha", "t", " ", "come", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sph", "inx", " ", "are", " ", "currentl", "y", " ", "'", "default", "'", " ", "and", " ", "'", "sphinx", "doc", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "modi", "nde", "x", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "none", "mpty", ",", " ", "this", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "upti", "med", "oc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "'", " ", "or", " ", "'", "a4", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "pape", "r", "\\u", "size", " ", "=", " ", "'", "letter", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "font", "\\u", "size", " ", "=", " ", "'", "10", "pt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "upti", "me", ".", "tex", "'_", ",_", "u", "'", "upti", "me", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Ko", "en", " ", "Cro", "lla", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "preamble", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "modi", "nde", "x", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Imprecise assert
charanpald/APGL/apgl/graph/test/MatrixGraphTest.py
[ { "content": " def testSubgraph(self):\n numVertices = 10\n numFeatures = 3\n vList = VertexList(numVertices, numFeatures)\n vertices = numpy.random.rand(numVertices, numFeatures)\n vList.setVertices(vertices)\n\n graph = self.GraphType(vList)\n graph.addEdge(0, 1)\n graph.addEdge(0, 2)\n graph.addEdge(0, 3)\n graph.addEdge(2, 1)\n graph.addEdge(2, 5)\n graph.addEdge(2, 6)\n graph.addEdge(6, 9)\n\n subgraph = graph.subgraph([0,1,2,3])\n\n self.assertEquals(subgraph.getNumVertices(), 4)\n self.assertEquals(subgraph.getVertexList().getNumFeatures(), numFeatures)\n self.assertTrue((subgraph.getVertexList().getVertices(list(range(0, 4))) == vertices[list(range(0,4)), :]).all())\n self.assertEquals(subgraph.getNumEdges(), 4)\n self.assertTrue(subgraph.getEdge(0, 1) == 1)\n self.assertTrue(subgraph.getEdge(0, 2) == 1)\n self.assertTrue(subgraph.getEdge(0, 3) == 1)\n self.assertTrue(subgraph.getEdge(2, 1) == 1)\n\n subgraph = graph.subgraph([1,2,5,6])\n self.assertEquals(subgraph.getNumVertices(), 4)\n self.assertEquals(subgraph.getVertexList().getNumFeatures(), numFeatures)\n self.assertEquals(subgraph.getNumEdges(), 3)\n self.assertTrue((subgraph.getVertexList().getVertices([0,1,2,3]) == vertices[[1,2,5,6], :]).all())\n self.assertTrue(subgraph.getEdge(0, 1) == 1)\n self.assertTrue(subgraph.getEdge(1, 2) == 1)\n self.assertTrue(subgraph.getEdge(1, 3) == 1)\n\n\n #Test case of directed graph\n numVertices = 10\n numFeatures = 3\n vList = VertexList(numVertices, numFeatures)\n vertices = numpy.random.rand(numVertices, numFeatures)\n vList.setVertices(vertices)\n\n graph = self.GraphType(vList, False)\n graph.addEdge(0, 1)\n graph.addEdge(0, 2)\n graph.addEdge(0, 3)\n graph.addEdge(2, 1)\n graph.addEdge(2, 5)\n graph.addEdge(2, 6)\n graph.addEdge(6, 9)\n\n subgraph = graph.subgraph([0,1,2,3])\n\n self.assertEquals(subgraph.isUndirected(), False)\n self.assertEquals(subgraph.getNumVertices(), 4)\n self.assertEquals(subgraph.getVertexList().getNumFeatures(), numFeatures)\n self.assertTrue((subgraph.getVertexList().getVertices(list(range(0, 4))) == vertices[list(range(0,4)), :]).all())\n self.assertEquals(subgraph.getNumEdges(), 4)\n self.assertTrue(subgraph.getEdge(0, 1) == 1)\n self.assertTrue(subgraph.getEdge(0, 2) == 1)\n self.assertTrue(subgraph.getEdge(0, 3) == 1)\n self.assertTrue(subgraph.getEdge(2, 1) == 1)\n\n subgraph = graph.subgraph([1,2,5,6])\n self.assertEquals(subgraph.getNumVertices(), 4)\n self.assertEquals(subgraph.getVertexList().getNumFeatures(), numFeatures)\n self.assertEquals(subgraph.getNumEdges(), 3)\n self.assertTrue((subgraph.getVertexList().getVertices([0,1,2,3]) == vertices[[1,2,5,6], :]).all())\n self.assertTrue(subgraph.getEdge(1, 0) == 1)\n self.assertTrue(subgraph.getEdge(1, 2) == 1)\n self.assertTrue(subgraph.getEdge(1, 3) == 1)\n\n subgraph = graph.subgraph([])", "metadata": "root.MatrixGraphTest.testSubgraph", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 607 }, { "content": " def testEgoGraph(self):\n numVertices = 6\n numFeatures = 3\n vList = VertexList(numVertices, numFeatures)\n\n graph = self.GraphType(vList, True)\n graph.addEdge(0, 1)\n graph.addEdge(0, 2)\n graph.addEdge(0, 3)\n graph.addEdge(2, 1)\n graph.addEdge(2, 3)\n graph.addEdge(4, 1)\n\n egoGraph = graph.egoGraph(0)\n\n self.assertTrue(egoGraph.getNumVertices() == 4)\n self.assertTrue(egoGraph.getNumEdges() == 5)\n self.assertEquals(egoGraph.getEdge(0,1), 1)\n self.assertEquals(egoGraph.getEdge(0,2), 1)\n self.assertEquals(egoGraph.getEdge(0,3), 1)\n self.assertEquals(egoGraph.getEdge(2,1), 1)\n self.assertEquals(egoGraph.getEdge(2,3), 1)\n\n egoGraph = graph.egoGraph(4)\n\n self.assertTrue(egoGraph.getNumVertices() == 2)\n self.assertTrue(egoGraph.getNumEdges() == 1)\n self.assertEquals(egoGraph.getEdge(1,0), 1)\n\n egoGraph = graph.egoGraph(3)\n\n self.assertTrue(egoGraph.getNumVertices() == 3)\n self.assertTrue(egoGraph.getNumEdges() == 3)\n self.assertEquals(egoGraph.getEdge(0,2), 1)\n self.assertEquals(egoGraph.getEdge(0,1), 1)\n self.assertEquals(egoGraph.getEdge(2,1), 1)\n\n\n egoGraph = graph.egoGraph(5)\n self.assertTrue(egoGraph.getNumVertices() == 1)\n self.assertTrue(egoGraph.getNumEdges() == 0)", "metadata": "root.MatrixGraphTest.testEgoGraph", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1068 }, { "content": " def testRemoveAllEdges(self):\n numVertices = 6\n numFeatures = 3\n vList = VertexList(numVertices, numFeatures)\n\n graph = self.GraphType(vList, True)\n graph.addEdge(0, 1)\n graph.addEdge(0, 2)\n graph.addEdge(0, 3)\n graph.addEdge(2, 1)\n graph.addEdge(2, 3)\n graph.addEdge(4, 1)\n\n self.assertEquals(graph.getNumEdges(), 6)\n\n graph.removeAllEdges()\n self.assertTrue(graph.getEdge(0,1) == None)\n self.assertEquals(graph.getNumEdges(), 0)", "metadata": "root.MatrixGraphTest.testRemoveAllEdges", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1113 }, { "content": " def testGetNumDirEdges(self):\n numVertices = 10\n numFeatures = 1\n\n vList = VertexList(numVertices, numFeatures)\n graph = self.GraphType(vList)\n graph.addEdge(0, 1, 0.1)\n graph.addEdge(1, 2, 0.1)\n\n self.assertTrue(graph.getNumDirEdges() == 4)\n graph.addEdge(1, 1)\n self.assertTrue(graph.getNumDirEdges() == 5)\n\n graph = self.GraphType(vList, False)\n graph.addEdge(0, 1)\n graph.addEdge(1, 2)\n\n self.assertTrue(graph.getNumDirEdges() == 2)\n graph.addEdge(1, 1)\n self.assertTrue(graph.getNumDirEdges() == 3)", "metadata": "root.MatrixGraphTest.testGetNumDirEdges", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1295 }, { "content": " def testFromNetworkXGraph(self):\n try:\n import networkx\n except ImportError as error:\n logging.debug(error)\n return\n\n nxGraph = networkx.Graph()\n nxGraph.graph[\"VListType\"] = GeneralVertexList\n #nxGraph.graph[\"numFeatures\"] = 2\n #nxGraph.add_node(0)\n nxGraph.add_edge(0, 1)\n nxGraph.add_edge(1, 2)\n nxGraph.add_edge(1, 3)\n\n graph = self.GraphType.fromNetworkXGraph(nxGraph)\n\n self.assertTrue(graph.getNumVertices() == 4)\n self.assertTrue(graph.isUndirected() == True)\n self.assertTrue(graph.getNumEdges() == 3)\n self.assertTrue(graph.getEdge(0, 1) == 1)\n self.assertTrue(graph.getEdge(1, 2) == 1)\n self.assertTrue(graph.getEdge(1, 3) == 1)\n\n #Try directed graphs\n nxGraph = networkx.DiGraph()\n nxGraph.graph[\"VListType\"] = GeneralVertexList\n #nxGraph.add_node(0)\n nxGraph.add_edge(0, 1)\n nxGraph.add_edge(1, 2)\n nxGraph.add_edge(1, 3)\n\n graph = self.GraphType.fromNetworkXGraph(nxGraph)\n\n self.assertTrue(graph.getNumVertices() == 4)\n self.assertTrue(graph.isUndirected() == False)\n self.assertTrue(graph.getNumEdges() == 3)\n self.assertTrue(graph.getEdge(0, 1) == 1)\n self.assertTrue(graph.getEdge(1, 2) == 1)\n self.assertTrue(graph.getEdge(1, 3) == 1)\n\n #Using a multigraph should fail\n nxGraph = networkx.MultiGraph()\n self.assertRaises(ValueError, self.GraphType.fromNetworkXGraph, nxGraph)\n\n #Test node labels\n nxGraph = networkx.DiGraph()\n nxGraph.graph[\"VListType\"] = GeneralVertexList\n nxGraph.add_node(\"a\", label=\"abc\")\n nxGraph.add_node(\"b\", label=\"i\")\n nxGraph.add_node(\"c\", label=\"am\")\n nxGraph.add_node(\"d\", label=\"here\")\n nxGraph.add_edge(\"a\", \"b\")\n nxGraph.add_edge(\"b\", \"c\")\n nxGraph.add_edge(\"b\", \"d\")\n\n graph = self.GraphType.fromNetworkXGraph(nxGraph)\n\n nodeDict = {}\n for i in range(len(nxGraph.nodes())):\n nodeDict[nxGraph.nodes()[i]] = i\n\n self.assertTrue(graph.getNumVertices() == 4)\n self.assertTrue(graph.isUndirected() == False)\n self.assertTrue(graph.getNumEdges() == 3)\n self.assertTrue(graph.getEdge(nodeDict[\"a\"], nodeDict[\"b\"]) == 1)\n self.assertTrue(graph.getEdge(nodeDict[\"b\"], nodeDict[\"c\"]) == 1)\n self.assertTrue(graph.getEdge(nodeDict[\"b\"], nodeDict[\"d\"]) == 1)\n\n self.assertTrue(graph.getVertex(0) == \"abc\")\n self.assertTrue(graph.getVertex(1) == \"am\")\n self.assertTrue(graph.getVertex(2) == \"i\")\n self.assertTrue(graph.getVertex(3) == \"here\")\n\n #Test in conjunction with toNetworkXGraph\n numVertices = 10\n numFeatures = 2 \n vList = VertexList(numVertices, numFeatures)\n vList.setVertices(numpy.random.rand(numVertices, numFeatures))\n\n graph = self.GraphType(vList)\n graph.addEdge(0, 1)\n graph.addEdge(0, 5)\n graph.addEdge(2, 5)\n graph.addEdge(3, 4)\n\n nxGraph = graph.toNetworkXGraph()\n graph2 = self.GraphType.fromNetworkXGraph(nxGraph)\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(graph.getVertexList().getVertices(list(range(numVertices))) -graph2.getVertexList().getVertices(list(range(numVertices)))) < tol)\n self.assertEquals(graph.getNumEdges(), graph2.getNumEdges())\n \n for i in range(numVertices):\n for j in range(numVertices):\n self.assertEquals(graph.getEdge(i, j), graph2.getEdge(i, j))\n\n #Use a GeneralVertexList\n numVertices = 10\n vList = GeneralVertexList(numVertices)\n for i in range(numVertices):\n vList.setVertex(i, \"s\" + str(i))\n\n graph = self.GraphType(vList)\n graph.addEdge(0, 1)\n graph.addEdge(0, 5)\n graph.addEdge(2, 5)\n graph.addEdge(3, 4)\n\n nxGraph = graph.toNetworkXGraph()\n graph2 = self.GraphType.fromNetworkXGraph(nxGraph)\n\n for i in range(numVertices):\n self.assertEquals(graph.getVertex(i), graph2.getVertex(i))\n \n self.assertEquals(graph.getNumEdges(), graph2.getNumEdges())\n \n for i in range(numVertices):\n for j in range(numVertices):\n self.assertEquals(graph.getEdge(i, j), graph2.getEdge(i, j))", "metadata": "root.MatrixGraphTest.testFromNetworkXGraph", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1423 }, { "content": " def testLoad(self):\n try:\n numVertices = 10\n numFeatures = 1\n vList = VertexList(numVertices, numFeatures)\n vList.setVertices(numpy.random.rand(numVertices, numFeatures))\n\n graph = self.GraphType(vList, True)\n graph.addEdge(0, 1, 0.1)\n graph.addEdge(1, 2, 0.2)\n graph.addEdge(1, 3, 0.3)\n\n tempDir = PathDefaults.getTempDir()\n tempFile = tempDir + \"testGraph\"\n\n graph.save(tempFile)\n\n dataDir = PathDefaults.getDataDir()\n os.chdir(dataDir)\n currentPath = os.getcwd()\n graph2 = self.GraphType.load(tempFile)\n\n #Make sure save doesn't change the path\n self.assertEquals(os.getcwd(), currentPath)\n\n self.assertEquals(graph.getNumVertices(), graph.getNumVertices())\n self.assertEquals(graph.getNumEdges(), graph.getNumEdges())\n self.assertTrue(graph2.isUndirected() == True)\n self.assertTrue((graph.getVertexList().getVertices(list(range(numVertices))) == graph2.getVertexList().getVertices(list(range(numVertices)))).all())\n self.assertTrue((graph.getAllEdges() == graph2.getAllEdges()).all())\n self.assertTrue(graph2.getEdge(0, 1) == 0.1)\n self.assertTrue(graph2.getEdge(1, 2) == 0.2)\n self.assertTrue(graph2.getEdge(1, 3) == 0.3)\n\n #Test if loading of old-style graph files works\n testDir = PathDefaults.getDataDir() + \"test/\"\n graphFilename = testDir + \"fd\"\n\n graph = self.GraphType.load(graphFilename)\n\n self.assertEquals(graph.getEdge(1, 1), 1)\n self.assertEquals(graph.getEdge(2, 2), 1)\n self.assertEquals(graph.getNumVertices(), 10)\n except IOError as e:\n logging.warn(e)\n pass\n except OSError as e:\n logging.warn(e)\n pass", "metadata": "root.MatrixGraphTest.testLoad", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1625 }, { "content": " def testMaxEigenvector(self):\n tol = 10**-6\n numVertices = 5\n numFeatures = 0\n vList = VertexList(numVertices, numFeatures)\n\n graph = self.GraphType(vList, False)\n graph.addEdge(0, 1)\n graph.addEdge(1, 2, 0.1)\n graph.addEdge(2, 0)\n\n v = graph.maxEigenvector()\n\n W = graph.getWeightMatrix()\n lmbda, U = numpy.linalg.eig(W)\n i = numpy.argmax(lmbda)\n\n self.assertTrue(numpy.linalg.norm(U[:, i] - v) < tol)", "metadata": "root.MatrixGraphTest.testMaxEigenvector", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1675 }, { "content": " def testToNetworkXGraph(self):\n try:\n import networkx\n except ImportError as error:\n logging.debug(error)\n return\n\n numVertices = 10\n numFeatures = 3\n vList = VertexList(numVertices, numFeatures)\n\n graph = self.GraphType(vList)\n graph.addEdge(5, 1, 4)\n graph.addEdge(5, 2, 2)\n graph.addEdge(2, 7, 4)\n graph.addEdge(1, 9, 6)\n\n graph2 = self.GraphType(vList, False)\n graph2.addEdge(5, 1, 4)\n graph2.addEdge(5, 2, 2)\n graph2.addEdge(2, 7, 4)\n graph2.addEdge(1, 9, 6)\n networkXGraph = graph.toNetworkXGraph()\n\n self.assertEquals(networkXGraph.get_edge_data(5, 1), {'value' : 4.0})\n self.assertEquals(networkXGraph.get_edge_data(5, 2), {'value' : 2.0})\n self.assertEquals(networkXGraph.get_edge_data(2, 7), {'value' : 4.0})\n self.assertEquals(networkXGraph.get_edge_data(1, 9), {'value' : 6.0})\n self.assertEquals(networkXGraph.get_edge_data(9, 1), {'value' : 6.0})\n\n vertexIndexList = []\n\n for i in networkXGraph.__iter__():\n vertexIndexList.append(i)\n\n vertexIndexList.sort()\n self.assertTrue(vertexIndexList == list(range(numVertices)))\n self.assertTrue(networkXGraph.edges() == [(1, 9), (1, 5), (2, 5), (2, 7)])\n self.assertTrue(type(networkXGraph) == networkx.Graph)\n\n #Now we test the case where we have a directed graph\n networkXGraph = graph2.toNetworkXGraph()\n\n self.assertEquals(networkXGraph.get_edge_data(5, 1), {'value' : 4.0})\n self.assertEquals(networkXGraph.get_edge_data(5, 2), {'value' : 2.0})\n self.assertEquals(networkXGraph.get_edge_data(2, 7), {'value' : 4.0})\n self.assertEquals(networkXGraph.get_edge_data(1, 9), {'value' : 6.0})\n self.assertFalse(networkXGraph.has_edge(9, 1))\n\n vertexIndexList = []\n\n for i in networkXGraph.__iter__():\n vertexIndexList.append(i)\n\n vertexIndexList.sort()\n self.assertTrue(vertexIndexList == list(range(numVertices)))\n self.assertTrue(networkXGraph.edges() == [(1, 9), (2, 7), (5, 1), (5, 2)])\n self.assertTrue(type(networkXGraph) == networkx.DiGraph)\n\n #Test a graph with no edges\n numVertices = 10\n numFeatures = 3\n vList = VertexList(numVertices, numFeatures)\n vList.setVertices(numpy.random.rand(numVertices, numFeatures))\n\n graph = self.GraphType(vList)\n networkXGraph = graph.toNetworkXGraph()\n\n self.assertTrue(networkXGraph.order() == numVertices)\n self.assertTrue(networkXGraph.size() == 0)\n\n self.assertTrue((networkXGraph.nodes(data=True)[0][1]['label'] ==graph.getVertex(0)).all())", "metadata": "root.MatrixGraphTest.testToNetworkXGraph", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1821 }, { "content": " def testTriangleSequence(self):\n tol = 10**-6\n numVertices = 5\n numFeatures = 0\n vList = VertexList(numVertices, numFeatures)\n\n graph = self.GraphType(vList, True)\n\n seq = graph.triangleSequence()\n self.assertTrue(numpy.linalg.norm(seq - numpy.array([0, 0, 0, 0, 0])) < tol)\n\n graph.addEdge(0, 1)\n graph.addEdge(0, 2, 0.1)\n graph.addEdge(1, 2)\n\n seq = graph.triangleSequence()\n self.assertTrue(numpy.linalg.norm(seq - numpy.array([2, 2, 2, 0, 0])) < tol)\n\n graph.addEdge(2, 3)\n graph.addEdge(3, 0, -0.3)\n\n seq = graph.triangleSequence()\n self.assertTrue(numpy.linalg.norm(seq - numpy.array([4, 2, 4, 2, 0])) < tol)\n\n graph.removeAllEdges()\n graph.addEdge(0, 0)\n seq = graph.triangleSequence()\n self.assertTrue(numpy.linalg.norm(seq - numpy.array([0, 0, 0, 0, 0])) < tol)\n\n #Test on directed graphs\n graph = self.GraphType(vList, False)\n graph.addEdge(0, 1)\n graph.addEdge(1, 2, 0.1)\n graph.addEdge(2, 0)\n\n seq = graph.triangleSequence()\n self.assertTrue(numpy.linalg.norm(seq - numpy.array([1, 1, 1, 0, 0])) < tol)\n\n graph.addEdge(0, 3)\n graph.addEdge(3, 4, 0.1)\n graph.addEdge(4, 0)\n\n seq = graph.triangleSequence()\n self.assertTrue(numpy.linalg.norm(seq - numpy.array([2, 1, 1, 1, 1])) < tol)", "metadata": "root.MatrixGraphTest.testTriangleSequence", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 1894 }, { "content": " def testNormalisedLaplacianSym(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = self.GraphType(vList)\n graph.addEdge(0, 1)\n graph.addEdge(0, 2)\n graph.addEdge(0, 9)\n graph.addEdge(1, 1)\n graph.addEdge(1, 5)\n\n L = graph.normalisedLaplacianSym()\n\n W = graph.getWeightMatrix()\n L2 = numpy.zeros((numVertices, numVertices))\n d = graph.outDegreeSequence()\n\n for i in range(numVertices):\n for j in range(numVertices):\n if d[i] != 0 and d[j]!= 0:\n Wij = W[i, j]/(numpy.sqrt(d[i]*d[j]))\n else:\n Wij = 0\n\n if i == j:\n L2[i, j] = 1 - Wij\n else:\n L2[i, j] = -Wij\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L2 - L) < tol)", "metadata": "root.MatrixGraphTest.testNormalisedLaplacianSym", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 2088 }, { "content": " def testNormalisedLaplacianRw(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = self.GraphType(vList)\n graph.addEdge(0, 1)\n graph.addEdge(0, 2)\n graph.addEdge(0, 9)\n graph.addEdge(1, 1)\n graph.addEdge(1, 5)\n\n L = graph.normalisedLaplacianRw()\n\n W = graph.getWeightMatrix()\n L2 = numpy.zeros((numVertices, numVertices))\n d = graph.outDegreeSequence()\n\n for i in range(numVertices):\n for j in range(numVertices):\n if d[i] != 0 and d[j]!= 0:\n Wij = W[i, j]/(d[i])\n else:\n Wij = 0\n\n if i == j:\n L2[i, j] = 1 - Wij\n else:\n L2[i, j] = -Wij\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L2 - L) < tol)", "metadata": "root.MatrixGraphTest.testNormalisedLaplacianRw", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 2121 }, { "content": " def testAdjacencyList(self):\n numVertices = 5\n numFeatures = 0\n vList = VertexList(numVertices, numFeatures)\n graph = self.GraphType(vList, True)\n graph.addEdge(0, 1, 0.1)\n graph.addEdge(1, 2, 0.2)\n graph.addEdge(3, 0, 0.3)\n graph.addEdge(4, 1, 0.4)\n\n L, W = graph.adjacencyList()\n\n for i in range(numVertices):\n self.assertTrue((L[i]==numpy.sort(graph.neighbours(i))).all())\n\n self.assertTrue(W[0][0] == 0.1)\n self.assertTrue(W[0][1] == 0.3)\n self.assertTrue(W[4][0] == 0.4)\n\n #Now use just adjacencies \n L, W = graph.adjacencyList(False)\n\n for i in range(numVertices):\n self.assertTrue((L[i]==numpy.sort(graph.neighbours(i))).all())\n\n self.assertTrue(W[0][0] == 1)\n self.assertTrue(W[0][1] == 1)\n self.assertTrue(W[4][0] == 1)", "metadata": "root.MatrixGraphTest.testAdjacencyList", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 2232 }, { "content": " def testToIGraph(self):\n try:\n import igraph\n except ImportError as error:\n logging.debug(error)\n return\n\n numVertices = 7\n graph = self.GraphType(GeneralVertexList(numVertices))\n graph.addEdge(1, 1, 0.1)\n graph.addEdge(1, 3, 0.5)\n graph.addEdge(1, 5, 0.5)\n graph.addEdge(3, 5, 0.5)\n graph.addEdge(5, 6, 0.1)\n\n graph.setVertex(1, \"a\")\n graph.setVertex(2, \"b\")\n graph.setVertex(3, \"c\")\n\n igraph = graph.toIGraph()\n\n self.assertEquals(len(igraph.vs), graph.getNumVertices())\n self.assertEquals(len(igraph.es), graph.getNumEdges())\n\n self.assertEquals(igraph.vs[\"label\"][1], \"a\")\n self.assertEquals(igraph.vs[\"label\"][2], \"b\")\n self.assertEquals(igraph.vs[\"label\"][3], \"c\")\n\n edges = igraph.get_edgelist()\n\n i = 0 \n for e in edges:\n self.assertTrue(graph.getEdge(e[0], e[1]) == igraph.es[i][\"value\"])\n i += 1 ", "metadata": "root.MatrixGraphTest.testToIGraph", "header": "['class', 'MatrixGraphTest', '(', ')', ':', '___EOS___']", "index": 2286 } ]
[ { "span": "self.assertTrue(subgraph.getEdge(0, 1) == 1)", "start_line": 629, "start_column": 8, "end_line": 629, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(0, 2) == 1)", "start_line": 630, "start_column": 8, "end_line": 630, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(0, 3) == 1)", "start_line": 631, "start_column": 8, "end_line": 631, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(2, 1) == 1)", "start_line": 632, "start_column": 8, "end_line": 632, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(0, 1) == 1)", "start_line": 639, "start_column": 8, "end_line": 639, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(1, 2) == 1)", "start_line": 640, "start_column": 8, "end_line": 640, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(1, 3) == 1)", "start_line": 641, "start_column": 8, "end_line": 641, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(0, 1) == 1)", "start_line": 667, "start_column": 8, "end_line": 667, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(0, 2) == 1)", "start_line": 668, "start_column": 8, "end_line": 668, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(0, 3) == 1)", "start_line": 669, "start_column": 8, "end_line": 669, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(2, 1) == 1)", "start_line": 670, "start_column": 8, "end_line": 670, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(1, 0) == 1)", "start_line": 677, "start_column": 8, "end_line": 677, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(1, 2) == 1)", "start_line": 678, "start_column": 8, "end_line": 678, "end_column": 52 }, { "span": "self.assertTrue(subgraph.getEdge(1, 3) == 1)", "start_line": 679, "start_column": 8, "end_line": 679, "end_column": 52 }, { "span": "self.assertTrue(egoGraph.getNumVertices() == 4)", "start_line": 1083, "start_column": 8, "end_line": 1083, "end_column": 55 }, { "span": "self.assertTrue(egoGraph.getNumEdges() == 5)", "start_line": 1084, "start_column": 8, "end_line": 1084, "end_column": 52 }, { "span": "self.assertTrue(egoGraph.getNumVertices() == 2)", "start_line": 1093, "start_column": 8, "end_line": 1093, "end_column": 55 }, { "span": "self.assertTrue(egoGraph.getNumEdges() == 1)", "start_line": 1094, "start_column": 8, "end_line": 1094, "end_column": 52 }, { "span": "self.assertTrue(egoGraph.getNumVertices() == 3)", "start_line": 1099, "start_column": 8, "end_line": 1099, "end_column": 55 }, { "span": "self.assertTrue(egoGraph.getNumEdges() == 3)", "start_line": 1100, "start_column": 8, "end_line": 1100, "end_column": 52 }, { "span": "self.assertTrue(egoGraph.getNumVertices() == 1)", "start_line": 1107, "start_column": 8, "end_line": 1107, "end_column": 55 }, { "span": "self.assertTrue(egoGraph.getNumEdges() == 0)", "start_line": 1108, "start_column": 8, "end_line": 1108, "end_column": 52 }, { "span": "self.assertTrue(graph.getEdge(0,1) == None)", "start_line": 1129, "start_column": 8, "end_line": 1129, "end_column": 51 }, { "span": "self.assertTrue(graph.getNumDirEdges() == 4)", "start_line": 1304, "start_column": 8, "end_line": 1304, "end_column": 52 }, { "span": "self.assertTrue(graph.getNumDirEdges() == 5)", "start_line": 1306, "start_column": 8, "end_line": 1306, "end_column": 52 }, { "span": "self.assertTrue(graph.getNumDirEdges() == 2)", "start_line": 1312, "start_column": 8, "end_line": 1312, "end_column": 52 }, { "span": "self.assertTrue(graph.getNumDirEdges() == 3)", "start_line": 1314, "start_column": 8, "end_line": 1314, "end_column": 52 }, { "span": "self.assertTrue(graph.getNumVertices() == 4)", "start_line": 1440, "start_column": 8, "end_line": 1440, "end_column": 52 }, { "span": "self.assertTrue(graph.isUndirected() == True)", "start_line": 1441, "start_column": 8, "end_line": 1441, "end_column": 53 }, { "span": "self.assertTrue(graph.getNumEdges() == 3)", "start_line": 1442, "start_column": 8, "end_line": 1442, "end_column": 49 }, { "span": "self.assertTrue(graph.getEdge(0, 1) == 1)", "start_line": 1443, "start_column": 8, "end_line": 1443, "end_column": 49 }, { "span": "self.assertTrue(graph.getEdge(1, 2) == 1)", "start_line": 1444, "start_column": 8, "end_line": 1444, "end_column": 49 }, { "span": "self.assertTrue(graph.getEdge(1, 3) == 1)", "start_line": 1445, "start_column": 8, "end_line": 1445, "end_column": 49 }, { "span": "self.assertTrue(graph.getNumVertices() == 4)", "start_line": 1457, "start_column": 8, "end_line": 1457, "end_column": 52 }, { "span": "self.assertTrue(graph.isUndirected() == False)", "start_line": 1458, "start_column": 8, "end_line": 1458, "end_column": 54 }, { "span": "self.assertTrue(graph.getNumEdges() == 3)", "start_line": 1459, "start_column": 8, "end_line": 1459, "end_column": 49 }, { "span": "self.assertTrue(graph.getEdge(0, 1) == 1)", "start_line": 1460, "start_column": 8, "end_line": 1460, "end_column": 49 }, { "span": "self.assertTrue(graph.getEdge(1, 2) == 1)", "start_line": 1461, "start_column": 8, "end_line": 1461, "end_column": 49 }, { "span": "self.assertTrue(graph.getEdge(1, 3) == 1)", "start_line": 1462, "start_column": 8, "end_line": 1462, "end_column": 49 }, { "span": "self.assertTrue(graph.getNumVertices() == 4)", "start_line": 1485, "start_column": 8, "end_line": 1485, "end_column": 52 }, { "span": "self.assertTrue(graph.isUndirected() == False)", "start_line": 1486, "start_column": 8, "end_line": 1486, "end_column": 54 }, { "span": "self.assertTrue(graph.getNumEdges() == 3)", "start_line": 1487, "start_column": 8, "end_line": 1487, "end_column": 49 }, { "span": "self.assertTrue(graph.getEdge(nodeDict[\"a\"], nodeDict[\"b\"]) == 1)", "start_line": 1488, "start_column": 8, "end_line": 1488, "end_column": 73 }, { "span": "self.assertTrue(graph.getEdge(nodeDict[\"b\"], nodeDict[\"c\"]) == 1)", "start_line": 1489, "start_column": 8, "end_line": 1489, "end_column": 73 }, { "span": "self.assertTrue(graph.getEdge(nodeDict[\"b\"], nodeDict[\"d\"]) == 1)", "start_line": 1490, "start_column": 8, "end_line": 1490, "end_column": 73 }, { "span": "self.assertTrue(graph.getVertex(0) == \"abc\")", "start_line": 1492, "start_column": 8, "end_line": 1492, "end_column": 52 }, { "span": "self.assertTrue(graph.getVertex(1) == \"am\")", "start_line": 1493, "start_column": 8, "end_line": 1493, "end_column": 51 }, { "span": "self.assertTrue(graph.getVertex(2) == \"i\")", "start_line": 1494, "start_column": 8, "end_line": 1494, "end_column": 50 }, { "span": "self.assertTrue(graph.getVertex(3) == \"here\")", "start_line": 1495, "start_column": 8, "end_line": 1495, "end_column": 53 }, { "span": "self.assertTrue(numpy.linalg.norm(graph.getVertexList().getVertices(list(range(numVertices))) -graph2.getVertexList().getVertices(list(range(numVertices)))) < tol)", "start_line": 1513, "start_column": 8, "end_line": 1513, "end_column": 171 }, { "span": "self.assertTrue(graph2.isUndirected() == True)", "start_line": 1652, "start_column": 12, "end_line": 1652, "end_column": 58 }, { "span": "self.assertTrue(graph2.getEdge(0, 1) == 0.1)", "start_line": 1655, "start_column": 12, "end_line": 1655, "end_column": 56 }, { "span": "self.assertTrue(graph2.getEdge(1, 2) == 0.2)", "start_line": 1656, "start_column": 12, "end_line": 1656, "end_column": 56 }, { "span": "self.assertTrue(graph2.getEdge(1, 3) == 0.3)", "start_line": 1657, "start_column": 12, "end_line": 1657, "end_column": 56 }, { "span": "self.assertTrue(numpy.linalg.norm(U[:, i] - v) < tol)", "start_line": 1692, "start_column": 8, "end_line": 1692, "end_column": 61 }, { "span": "self.assertTrue(vertexIndexList == list(range(numVertices)))", "start_line": 1857, "start_column": 8, "end_line": 1857, "end_column": 68 }, { "span": "self.assertTrue(networkXGraph.edges() == [(1, 9), (1, 5), (2, 5), (2, 7)])", "start_line": 1858, "start_column": 8, "end_line": 1858, "end_column": 82 }, { "span": "self.assertTrue(type(networkXGraph) == networkx.Graph)", "start_line": 1859, "start_column": 8, "end_line": 1859, "end_column": 62 }, { "span": "self.assertTrue(vertexIndexList == list(range(numVertices)))", "start_line": 1876, "start_column": 8, "end_line": 1876, "end_column": 68 }, { "span": "self.assertTrue(networkXGraph.edges() == [(1, 9), (2, 7), (5, 1), (5, 2)])", "start_line": 1877, "start_column": 8, "end_line": 1877, "end_column": 82 }, { "span": "self.assertTrue(type(networkXGraph) == networkx.DiGraph)", "start_line": 1878, "start_column": 8, "end_line": 1878, "end_column": 64 }, { "span": "self.assertTrue(networkXGraph.order() == numVertices)", "start_line": 1889, "start_column": 8, "end_line": 1889, "end_column": 61 }, { "span": "self.assertTrue(networkXGraph.size() == 0)", "start_line": 1890, "start_column": 8, "end_line": 1890, "end_column": 50 }, { "span": "self.assertTrue(numpy.linalg.norm(seq - numpy.array([0, 0, 0, 0, 0])) < tol)", "start_line": 1903, "start_column": 8, "end_line": 1903, "end_column": 84 }, { "span": "self.assertTrue(numpy.linalg.norm(seq - numpy.array([2, 2, 2, 0, 0])) < tol)", "start_line": 1910, "start_column": 8, "end_line": 1910, "end_column": 84 }, { "span": "self.assertTrue(numpy.linalg.norm(seq - numpy.array([4, 2, 4, 2, 0])) < tol)", "start_line": 1916, "start_column": 8, "end_line": 1916, "end_column": 84 }, { "span": "self.assertTrue(numpy.linalg.norm(seq - numpy.array([0, 0, 0, 0, 0])) < tol)", "start_line": 1921, "start_column": 8, "end_line": 1921, "end_column": 84 }, { "span": "self.assertTrue(numpy.linalg.norm(seq - numpy.array([1, 1, 1, 0, 0])) < tol)", "start_line": 1930, "start_column": 8, "end_line": 1930, "end_column": 84 }, { "span": "self.assertTrue(numpy.linalg.norm(seq - numpy.array([2, 1, 1, 1, 1])) < tol)", "start_line": 1937, "start_column": 8, "end_line": 1937, "end_column": 84 }, { "span": "self.assertTrue(numpy.linalg.norm(L2 - L) < tol)", "start_line": 2119, "start_column": 8, "end_line": 2119, "end_column": 56 }, { "span": "self.assertTrue(numpy.linalg.norm(L2 - L) < tol)", "start_line": 2152, "start_column": 8, "end_line": 2152, "end_column": 56 }, { "span": "self.assertTrue(W[0][0] == 0.1)", "start_line": 2247, "start_column": 8, "end_line": 2247, "end_column": 39 }, { "span": "self.assertTrue(W[0][1] == 0.3)", "start_line": 2248, "start_column": 8, "end_line": 2248, "end_column": 39 }, { "span": "self.assertTrue(W[4][0] == 0.4)", "start_line": 2249, "start_column": 8, "end_line": 2249, "end_column": 39 }, { "span": "self.assertTrue(W[0][0] == 1)", "start_line": 2257, "start_column": 8, "end_line": 2257, "end_column": 37 }, { "span": "self.assertTrue(W[0][1] == 1)", "start_line": 2258, "start_column": 8, "end_line": 2258, "end_column": 37 }, { "span": "self.assertTrue(W[4][0] == 1)", "start_line": 2259, "start_column": 8, "end_line": 2259, "end_column": 37 }, { "span": "self.assertTrue(graph.getEdge(e[0], e[1]) == igraph.es[i][\"value\"])", "start_line": 2318, "start_column": 12, "end_line": 2318, "end_column": 79 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Sub", "graph_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertices_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "._", "set", "Vertices_", "(_", "vertices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "6_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subgraph_", "=_", "graph_", "._", "subgraph_", "(_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Vertices_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Num", "Features_", "(_", ")_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "list_", "(_", "range_", "(_", "0_", ",_", "4_", ")_", ")_", ")_", "==_", "vertices_", "[_", "list_", "(_", "range_", "(_", "0_", ",_", "4_", ")_", ")_", ",_", ":_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "0_", ",_", "2_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "0_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "2_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subgraph_", "=_", "graph_", "._", "subgraph_", "(_", "[_", "1_", ",_", "2_", ",_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Vertices_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Num", "Features_", "(_", ")_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "==_", "vertices_", "[_", "[_", "1_", ",_", "2_", ",_", "5_", ",_", "6_", "]_", ",_", ":_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "1_", ",_", "2_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "1_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "case", " ", "of", " ", "direct", "ed", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertices_", "=_", "numpy_", "._", "random_", "._", "rand_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "._", "set", "Vertices_", "(_", "vertices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "6_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subgraph_", "=_", "graph_", "._", "subgraph_", "(_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "is", "Und", "irect", "ed_", "(_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Vertices_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Num", "Features_", "(_", ")_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "list_", "(_", "range_", "(_", "0_", ",_", "4_", ")_", ")_", ")_", "==_", "vertices_", "[_", "list_", "(_", "range_", "(_", "0_", ",_", "4_", ")_", ")_", ",_", ":_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "0_", ",_", "2_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "0_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "2_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subgraph_", "=_", "graph_", "._", "subgraph_", "(_", "[_", "1_", ",_", "2_", ",_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Vertices_", "(_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Num", "Features_", "(_", ")_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subgraph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "subgraph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "==_", "vertices_", "[_", "[_", "1_", ",_", "2_", ",_", "5_", ",_", "6_", "]_", ",_", ":_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "1_", ",_", "0_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "1_", ",_", "2_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "subgraph_", "._", "get", "Edge_", "(_", "1_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subgraph_", "=_", "graph_", "._", "subgraph_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Eg", "o", "Graph_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "4_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ego", "Graph_", "=_", "graph_", "._", "ego", "Graph_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Vertices_", "(_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Edges_", "(_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "0_", ",_", "2_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "0_", ",_", "3_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "2_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "2_", ",_", "3_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ego", "Graph_", "=_", "graph_", "._", "ego", "Graph_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Vertices_", "(_", ")_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Edges_", "(_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "1_", ",_", "0_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ego", "Graph_", "=_", "graph_", "._", "ego", "Graph_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Vertices_", "(_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Edges_", "(_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "0_", ",_", "2_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ego", "Graph_", "._", "get", "Edge_", "(_", "2_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ego", "Graph_", "=_", "graph_", "._", "ego", "Graph_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Vertices_", "(_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ego", "Graph_", "._", "get", "Num", "Edges_", "(_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Remove", "All", "Edges_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "4_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "remove", "All", "Edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Num", "Dir", "Edges_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Dir", "Edges_", "(_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Dir", "Edges_", "(_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Dir", "Edges_", "(_", ")_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Dir", "Edges_", "(_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Fro", "m", "Network", "XG", "raph_", "(_", "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 ", " _", "import_", "networkx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "error_", ")_", "\\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_", "nx", "Graph_", "=_", "networkx_", "._", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "graph_", "[_", "\"", "VL", "ist", "Type", "\"_", "]_", "=_", "General", "Vertex", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "nx", "Graph", ".", "graph", "[\"", "num", "Feature", "s", "\"]", " ", "=", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", "nx", "Graph", ".", "add", "\\u", "node", "(", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "1_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "._", "from", "Network", "XG", "raph_", "(_", "nx", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Vertices_", "(_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "is", "Und", "irect", "ed_", "(_", ")_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "1_", ",_", "2_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "1_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Tr", "y", " ", "direct", "ed", " ", "graphs_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "Graph_", "=_", "networkx_", "._", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "graph_", "[_", "\"", "VL", "ist", "Type", "\"_", "]_", "=_", "General", "Vertex", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "nx", "Graph", ".", "add", "\\u", "node", "(", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "1_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "._", "from", "Network", "XG", "raph_", "(_", "nx", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Vertices_", "(_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "is", "Und", "irect", "ed_", "(_", ")_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "1_", ",_", "2_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "1_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Us", "ing", " ", "a", " ", "multi", "graph", " ", "shou", "ld", " ", "fail_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "Graph_", "=_", "networkx_", "._", "Multi", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "Graph", "Type_", "._", "from", "Network", "XG", "raph_", ",_", "nx", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "node", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "Graph_", "=_", "networkx_", "._", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "graph_", "[_", "\"", "VL", "ist", "Type", "\"_", "]_", "=_", "General", "Vertex", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "node_", "(_", "\"", "a", "\"_", ",_", "label_", "=_", "\"", "abc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "node_", "(_", "\"", "b", "\"_", ",_", "label_", "=_", "\"", "i", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "node_", "(_", "\"", "c", "\"_", ",_", "label_", "=_", "\"", "am", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "node_", "(_", "\"", "d", "\"_", ",_", "label_", "=_", "\"", "here", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "\"", "a", "\"_", ",_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "\"", "b", "\"_", ",_", "\"", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx", "Graph_", "._", "add", "\\u", "edge_", "(_", "\"", "b", "\"_", ",_", "\"", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "._", "from", "Network", "XG", "raph_", "(_", "nx", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node", "Dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "nx", "Graph_", "._", "nodes_", "(_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "Dict_", "[_", "nx", "Graph_", "._", "nodes_", "(_", ")_", "[_", "i_", "]_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Vertices_", "(_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "is", "Und", "irect", "ed_", "(_", ")_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "node", "Dict_", "[_", "\"", "a", "\"_", "]_", ",_", "node", "Dict_", "[_", "\"", "b", "\"_", "]_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "node", "Dict_", "[_", "\"", "b", "\"_", "]_", ",_", "node", "Dict_", "[_", "\"", "c", "\"_", "]_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "node", "Dict_", "[_", "\"", "b", "\"_", "]_", ",_", "node", "Dict_", "[_", "\"", "d", "\"_", "]_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Vertex_", "(_", "0_", ")_", "==_", "\"", "abc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Vertex_", "(_", "1_", ")_", "==_", "\"", "am", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Vertex_", "(_", "2_", ")_", "==_", "\"", "i", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Vertex_", "(_", "3_", ")_", "==_", "\"", "here", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "in", " ", "conjunction", " ", "with", " ", "to", "Network", "XG", "raph_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "._", "set", "Vertices_", "(_", "numpy_", "._", "random_", "._", "rand_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "Graph_", "=_", "graph_", "._", "to", "Network", "XG", "raph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "2_", "=_", "self_", "._", "Graph", "Type_", "._", "from", "Network", "XG", "raph_", "(_", "nx", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "graph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "list_", "(_", "range_", "(_", "num", "Vertices_", ")_", ")_", ")_", "-_", "graph", "2_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "list_", "(_", "range_", "(_", "num", "Vertices_", ")_", ")_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "graph", "2_", "._", "get", "Num", "Edges_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Edge_", "(_", "i_", ",_", "j_", ")_", ",_", "graph", "2_", "._", "get", "Edge_", "(_", "i_", ",_", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Us", "e", " ", "a", " ", "General", "Vertex", "List_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "General", "Vertex", "List_", "(_", "num", "Vertices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v", "List_", "._", "set", "Vertex_", "(_", "i_", ",_", "\"", "s", "\"_", "+_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nx", "Graph_", "=_", "graph_", "._", "to", "Network", "XG", "raph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "2_", "=_", "self_", "._", "Graph", "Type_", "._", "from", "Network", "XG", "raph_", "(_", "nx", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Vertex_", "(_", "i_", ")_", ",_", "graph", "2_", "._", "get", "Vertex_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "graph", "2_", "._", "get", "Num", "Edges_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Edge_", "(_", "i_", ",_", "j_", ")_", ",_", "graph", "2_", "._", "get", "Edge_", "(_", "i_", ",_", "j_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "._", "set", "Vertices_", "(_", "numpy_", "._", "random_", "._", "rand_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "3_", ",_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "Dir_", "=_", "Path", "Defaults_", "._", "get", "Temp", "Dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "File_", "=_", "temp", "Dir_", "+_", "\"", "test", "Graph", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "save_", "(_", "temp", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data", "Dir_", "=_", "Path", "Defaults_", "._", "get", "Data", "Dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "data", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "Path_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "2_", "=_", "self_", "._", "Graph", "Type_", "._", "load_", "(_", "temp", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Make", " ", "sure", " ", "save", " ", "doe", "sn", "'", "t", " ", "change", " ", "the", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "os_", "._", "getcwd_", "(_", ")_", ",_", "current", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Vertices_", "(_", ")_", ",_", "graph_", "._", "get", "Num", "Vertices_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph", "2_", "._", "is", "Und", "irect", "ed_", "(_", ")_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "graph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "list_", "(_", "range_", "(_", "num", "Vertices_", ")_", ")_", ")_", "==_", "graph", "2_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Vertices_", "(_", "list_", "(_", "range_", "(_", "num", "Vertices_", ")_", ")_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "graph_", "._", "get", "All", "Edges_", "(_", ")_", "==_", "graph", "2_", "._", "get", "All", "Edges_", "(_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph", "2_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph", "2_", "._", "get", "Edge_", "(_", "1_", ",_", "2_", ")_", "==_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph", "2_", "._", "get", "Edge_", "(_", "1_", ",_", "3_", ")_", "==_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "if", " ", "load", "ing", " ", "of", " ", "old", "-", "style", " ", "graph", " ", "files", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Dir_", "=_", "Path", "Defaults_", "._", "get", "Data", "Dir_", "(_", ")_", "+_", "\"", "test", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "Filename_", "=_", "test", "Dir_", "+_", "\"", "fd", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "._", "load_", "(_", "graph", "Filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Edge_", "(_", "1_", ",_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Edge_", "(_", "2_", ",_", "2_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Vertices_", "(_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "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", "Max", "Eigen", "vector_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Vertices_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "=_", "graph_", "._", "max", "Eigen", "vector_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lmb", "da_", ",_", "U_", "=_", "numpy_", "._", "linalg_", "._", "eig_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "numpy_", "._", "argmax_", "(_", "lmb", "da_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "U_", "[_", ":_", ",_", "i_", "]_", "-_", "v_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "To", "Network", "XG", "raph_", "(_", "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 ", " _", "import_", "networkx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "error_", ")_", "\\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_", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "5_", ",_", "1_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "5_", ",_", "2_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "7_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "9_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph", "2_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "2_", "._", "add", "Edge_", "(_", "5_", ",_", "1_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "2_", "._", "add", "Edge_", "(_", "5_", ",_", "2_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "2_", "._", "add", "Edge_", "(_", "2_", ",_", "7_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "2_", "._", "add", "Edge_", "(_", "1_", ",_", "9_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "XG", "raph_", "=_", "graph_", "._", "to", "Network", "XG", "raph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "5_", ",_", "1_", ")_", ",_", "{_", "'", "value", "'_", ":_", "4.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "5_", ",_", "2_", ")_", ",_", "{_", "'", "value", "'_", ":_", "2.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "2_", ",_", "7_", ")_", ",_", "{_", "'", "value", "'_", ":_", "4.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "1_", ",_", "9_", ")_", ",_", "{_", "'", "value", "'_", ":_", "6.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "9_", ",_", "1_", ")_", ",_", "{_", "'", "value", "'_", ":_", "6.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vertex", "Index", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "network", "XG", "raph_", "._", "\\u\\u", "iter\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vertex", "Index", "List_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vertex", "Index", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "vertex", "Index", "List_", "==_", "list_", "(_", "range_", "(_", "num", "Vertices_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "network", "XG", "raph_", "._", "edges_", "(_", ")_", "==_", "[_", "(_", "1_", ",_", "9_", ")_", ",_", "(_", "1_", ",_", "5_", ")_", ",_", "(_", "2_", ",_", "5_", ")_", ",_", "(_", "2_", ",_", "7_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "type_", "(_", "network", "XG", "raph_", ")_", "==_", "networkx_", "._", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "No", "w", " ", "we", " ", "test", " ", "the", " ", "case", " ", "where", " ", "we", " ", "have", " ", "a", " ", "direct", "ed", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "network", "XG", "raph_", "=_", "graph", "2_", "._", "to", "Network", "XG", "raph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "5_", ",_", "1_", ")_", ",_", "{_", "'", "value", "'_", ":_", "4.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "5_", ",_", "2_", ")_", ",_", "{_", "'", "value", "'_", ":_", "2.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "2_", ",_", "7_", ")_", ",_", "{_", "'", "value", "'_", ":_", "4.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "network", "XG", "raph_", "._", "get", "\\u", "edge", "\\u", "data_", "(_", "1_", ",_", "9_", ")_", ",_", "{_", "'", "value", "'_", ":_", "6.0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "network", "XG", "raph_", "._", "has", "\\u", "edge_", "(_", "9_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vertex", "Index", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "network", "XG", "raph_", "._", "\\u\\u", "iter\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vertex", "Index", "List_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vertex", "Index", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "vertex", "Index", "List_", "==_", "list_", "(_", "range_", "(_", "num", "Vertices_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "network", "XG", "raph_", "._", "edges_", "(_", ")_", "==_", "[_", "(_", "1_", ",_", "9_", ")_", ",_", "(_", "2_", ",_", "7_", ")_", ",_", "(_", "5_", ",_", "1_", ")_", ",_", "(_", "5_", ",_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "type_", "(_", "network", "XG", "raph_", ")_", "==_", "networkx_", "._", "Di", "Graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "a", " ", "graph", " ", "with", " ", "no", " ", "edges_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "._", "set", "Vertices_", "(_", "numpy_", "._", "random_", "._", "rand_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "XG", "raph_", "=_", "graph_", "._", "to", "Network", "XG", "raph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "network", "XG", "raph_", "._", "order_", "(_", ")_", "==_", "num", "Vertices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "network", "XG", "raph_", "._", "size_", "(_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "network", "XG", "raph_", "._", "nodes_", "(_", "data_", "=_", "True_", ")_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "'", "label", "'_", "]_", "==_", "graph_", "._", "get", "Vertex_", "(_", "0_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Triangle", "Sequence_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Vertices_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seq_", "=_", "graph_", "._", "triangle", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "seq_", "-_", "numpy_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seq_", "=_", "graph_", "._", "triangle", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "seq_", "-_", "numpy_", "._", "array_", "(_", "[_", "2_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", "]_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "0_", ",_", "-_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seq_", "=_", "graph_", "._", "triangle", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "seq_", "-_", "numpy_", "._", "array_", "(_", "[_", "4_", ",_", "2_", ",_", "4_", ",_", "2_", ",_", "0_", "]_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "remove", "All", "Edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq_", "=_", "graph_", "._", "triangle", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "seq_", "-_", "numpy_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "on", " ", "direct", "ed", " ", "graphs_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "2_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seq_", "=_", "graph_", "._", "triangle", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "seq_", "-_", "numpy_", "._", "array_", "(_", "[_", "1_", ",_", "1_", ",_", "1_", ",_", "0_", ",_", "0_", "]_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "4_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "4_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seq_", "=_", "graph_", "._", "triangle", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "seq_", "-_", "numpy_", "._", "array_", "(_", "[_", "2_", ",_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", "]_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Normal", "ise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L_", "=_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L2_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "num", "Vertices_", ",_", "num", "Vertices_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "graph_", "._", "out", "Deg", "ree", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "d_", "[_", "i_", "]_", "!=_", "0_", "and_", "d_", "[_", "j_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Wi", "j_", "=_", "W_", "[_", "i_", ",_", "j_", "]_", "/_", "(_", "numpy_", "._", "sqrt_", "(_", "d_", "[_", "i_", "]_", "*_", "d_", "[_", "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 ", " ", "_", "Wi", "j_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "==_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "L2_", "[_", "i_", ",_", "j_", "]_", "=_", "1_", "-_", "Wi", "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 ", " ", "_", "L2_", "[_", "i_", ",_", "j_", "]_", "=_", "-_", "Wi", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L2_", "-_", "L_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Normal", "ise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L_", "=_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Rw", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L2_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "num", "Vertices_", ",_", "num", "Vertices_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "graph_", "._", "out", "Deg", "ree", "Sequence_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "d_", "[_", "i_", "]_", "!=_", "0_", "and_", "d_", "[_", "j_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Wi", "j_", "=_", "W_", "[_", "i_", ",_", "j_", "]_", "/_", "(_", "d_", "[_", "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 ", " ", "_", "Wi", "j_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "==_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "L2_", "[_", "i_", ",_", "j_", "]_", "=_", "1_", "-_", "Wi", "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 ", " ", "_", "L2_", "[_", "i_", ",_", "j_", "]_", "=_", "-_", "Wi", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L2_", "-_", "L_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Adj", "acen", "cy", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "v", "List_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "0_", ",_", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "2_", ",_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "0_", ",_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "4_", ",_", "1_", ",_", "0.4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L_", ",_", "W_", "=_", "graph_", "._", "adjacency", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "(_", "L_", "[_", "i_", "]_", "==_", "numpy_", "._", "sort_", "(_", "graph_", "._", "neighbours_", "(_", "i_", ")_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "W_", "[_", "0_", "]_", "[_", "0_", "]_", "==_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "W_", "[_", "0_", "]_", "[_", "1_", "]_", "==_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "W_", "[_", "4_", "]_", "[_", "0_", "]_", "==_", "0.4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "No", "w", " ", "use", " ", "just", " ", "adj", "acen", "cies", " _", "\\u\\u\\uNL\\u\\u\\u_", "L_", ",_", "W_", "=_", "graph_", "._", "adjacency", "List_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "Vertices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "(_", "L_", "[_", "i_", "]_", "==_", "numpy_", "._", "sort_", "(_", "graph_", "._", "neighbours_", "(_", "i_", ")_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "W_", "[_", "0_", "]_", "[_", "0_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "W_", "[_", "0_", "]_", "[_", "1_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "W_", "[_", "4_", "]_", "[_", "0_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Matrix", "Graph", "Test_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "To", "IG", "raph_", "(_", "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 ", " _", "import_", "igra", "ph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "error_", ")_", "\\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_", "num", "Vertices_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "self_", "._", "Graph", "Type_", "(_", "General", "Vertex", "List_", "(_", "num", "Vertices_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "3_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "1_", ",_", "5_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "3_", ",_", "5_", ",_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "5_", ",_", "6_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "set", "Vertex_", "(_", "1_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "set", "Vertex_", "(_", "2_", ",_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "set", "Vertex_", "(_", "3_", ",_", "\"", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "igra", "ph_", "=_", "graph_", "._", "to", "IG", "raph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "igra", "ph_", "._", "vs_", ")_", ",_", "graph_", "._", "get", "Num", "Vertices_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "igra", "ph_", "._", "es_", ")_", ",_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "igra", "ph_", "._", "vs_", "[_", "\"", "label", "\"_", "]_", "[_", "1_", "]_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "igra", "ph_", "._", "vs_", "[_", "\"", "label", "\"_", "]_", "[_", "2_", "]_", ",_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "igra", "ph_", "._", "vs_", "[_", "\"", "label", "\"_", "]_", "[_", "3_", "]_", ",_", "\"", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edges_", "=_", "igra", "ph_", "._", "get", "\\u", "edgelist", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "e_", "[_", "0_", "]_", ",_", "e_", "[_", "1_", "]_", ")_", "==_", "igra", "ph_", "._", "es_", "[_", "i_", "]_", "[_", "\"", "value", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
Unused local variable
VisTrails/VisTrails/vistrails/core/interpreter/cached.py
[ { "content": " def setup_pipeline(self, pipeline, **kwargs):\n \"\"\"setup_pipeline(controller, pipeline, locator, currentVersion,\n view, aliases, **kwargs)\n Matches a pipeline with the persistent pipeline and creates\n instances of modules that aren't in the cache.\n \"\"\"\n def fetch(name, default):\n return kwargs.pop(name, default)\n controller = fetch('controller', None)\n locator = fetch('locator', None)\n current_version = fetch('current_version', None)\n view = fetch('view', DummyView())\n vistrail_variables = fetch('vistrail_variables', None)\n aliases = fetch('aliases', None)\n params = fetch('params', None)\n extra_info = fetch('extra_info', None)\n logger = fetch('logger', DummyLogController)\n sinks = fetch('sinks', None)\n reason = fetch('reason', None)\n actions = fetch('actions', None)\n done_summon_hooks = fetch('done_summon_hooks', [])\n module_executed_hook = fetch('module_executed_hook', [])\n stop_on_error = fetch('stop_on_error', True)\n parent_exec = fetch('parent_exec', None)\n job_monitor = fetch('job_monitor', None)\n\n reg = get_module_registry()\n\n if len(kwargs) > 0:\n raise VistrailsInternalError('Wrong parameters passed '\n 'to setup_pipeline: %s' % kwargs)\n\n def create_null():\n \"\"\"Creates a Null value\"\"\"\n getter = reg.get_descriptor_by_name\n descriptor = getter(basic_pkg, 'Null')\n return descriptor.module()\n \n def create_constant(param, module):\n \"\"\"Creates a Constant from a parameter spec\"\"\"\n getter = reg.get_descriptor_by_name\n desc = getter(param.identifier, param.type, param.namespace)\n constant = desc.module()\n constant.id = module.id\n# if param.evaluatedStrValue:\n# constant.setValue(param.evaluatedStrValue)\n if param.strValue != '':\n constant.setValue(param.strValue)\n else:\n constant.setValue(\n constant.translate_to_string(constant.default_value))\n return constant\n\n ### BEGIN METHOD ###\n\n# if self.debugger:\n# self.debugger.update()\n to_delete = []\n errors = {}\n\n if controller is not None:\n # Controller is none for sub_modules\n controller.validate(pipeline)\n else:\n pipeline.validate()\n\n self.resolve_aliases(pipeline, aliases)\n if vistrail_variables:\n self.resolve_variables(vistrail_variables, pipeline)\n\n self.update_params(pipeline, params)\n \n (tmp_to_persistent_module_map,\n conn_map,\n module_added_set,\n conn_added_set) = self.add_to_persistent_pipeline(pipeline)\n\n # Create the new objects\n for i in module_added_set:\n persistent_id = tmp_to_persistent_module_map[i]\n module = self._persistent_pipeline.modules[persistent_id]\n obj = self._objects[persistent_id] = module.summon()\n obj.interpreter = self\n obj.id = persistent_id\n obj.signature = module._signature\n \n # Checking if output should be stored\n if module.has_annotation_with_key('annotate_output'):\n annotate_output = module.get_annotation_by_key('annotate_output')\n #print annotate_output\n if annotate_output:\n obj.annotate_output = True\n\n for f in module.functions:\n connector = None\n if len(f.params) == 0:\n connector = ModuleConnector(create_null(), 'value',\n f.get_spec('output'))\n elif len(f.params) == 1:\n p = f.params[0]\n try:\n constant = create_constant(p, module)\n connector = ModuleConnector(constant, 'value',\n f.get_spec('output'))\n except Exception, e:\n debug.unexpected_exception(e)\n err = ModuleError(\n module,\n \"Uncaught exception creating Constant from \"\n \"%r: %s\" % (\n p.strValue,\n debug.format_exception(e)))\n errors[i] = err\n to_delete.append(obj.id)\n else:\n tupleModule = vistrails.core.interpreter.base.InternalTuple()\n tupleModule.length = len(f.params)\n for (j,p) in enumerate(f.params):\n try:\n constant = create_constant(p, module)\n constant.update()\n connector = ModuleConnector(constant, 'value',\n f.get_spec('output'))\n tupleModule.set_input_port(j, connector)\n except Exception, e:\n debug.unexpected_exception(e)\n err = ModuleError(\n module,\n \"Uncaught exception creating Constant \"\n \"from %r: %s\" % (\n p.strValue,\n debug.format_exception(e)))\n errors[i] = err\n to_delete.append(obj.id)\n connector = ModuleConnector(tupleModule, 'value',\n f.get_spec('output'))\n if connector:\n obj.set_input_port(f.name, connector, is_method=True)\n\n # Create the new connections\n for i in conn_added_set:\n persistent_id = conn_map[i]\n conn = self._persistent_pipeline.connections[persistent_id]\n src = self._objects[conn.sourceId]\n dst = self._objects[conn.destinationId]\n self.make_connection(conn, src, dst)\n\n if self.done_summon_hook:\n self.done_summon_hook(self._persistent_pipeline, self._objects)\n for callable_ in done_summon_hooks:\n callable_(self._persistent_pipeline, self._objects)\n\n tmp_id_to_module_map = {}\n for i, j in tmp_to_persistent_module_map.iteritems():\n tmp_id_to_module_map[i] = self._objects[j]\n return (tmp_id_to_module_map, tmp_to_persistent_module_map.inverse,\n module_added_set, conn_added_set, to_delete, errors)", "metadata": "root.CachedInterpreter.setup_pipeline", "header": "['class', 'CachedInterpreter', '(', 'vistrails', '.', 'core', '.', 'interpreter', '.', 'base', '.', 'BaseInterpreter', ')', ':', '___EOS___']", "index": 279 }, { "content": " def execute_pipeline(self, pipeline, tmp_id_to_module_map, \n persistent_to_tmp_id_map, **kwargs):\n def fetch(name, default):\n return kwargs.pop(name, default)\n controller = fetch('controller', None)\n locator = fetch('locator', None)\n current_version = fetch('current_version', None)\n view = fetch('view', DummyView())\n vistrail_variables = fetch('vistrail_variables', None)\n aliases = fetch('aliases', None)\n params = fetch('params', None)\n extra_info = fetch('extra_info', None)\n logger = fetch('logger', DummyLogController)\n sinks = fetch('sinks', None)\n reason = fetch('reason', None)\n actions = fetch('actions', None)\n module_executed_hook = fetch('module_executed_hook', [])\n done_summon_hooks = fetch('done_summon_hooks', [])\n clean_pipeline = fetch('clean_pipeline', False)\n stop_on_error = fetch('stop_on_error', True)\n parent_exec = fetch('parent_exec', None)\n job_monitor = fetch('job_monitor', None)\n\n if len(kwargs) > 0:\n raise VistrailsInternalError('Wrong parameters passed '\n 'to execute_pipeline: %s' % kwargs)\n\n # LOGGING SETUP\n def get_remapped_id(id):\n return persistent_to_tmp_id_map[id]\n\n logging_obj = ViewUpdatingLogController(\n logger=logger,\n view=view,\n remap_id=get_remapped_id,\n ids=pipeline.modules.keys(),\n module_executed_hook=module_executed_hook)\n\n # PARAMETER CHANGES SETUP\n parameter_changes = []\n def change_parameter(obj, name, value):\n parameter_changes.append((get_remapped_id(obj.id),\n name, value))\n def make_change_parameter(obj):\n return lambda *args: change_parameter(obj, *args)\n\n # Update **all** modules in the current pipeline\n for i, obj in tmp_id_to_module_map.iteritems():\n obj.in_pipeline = True # set flag to indicate in pipeline\n obj.logging = logging_obj\n obj.change_parameter = make_change_parameter(obj)\n \n # Update object pipeline information\n obj.moduleInfo['locator'] = locator\n obj.moduleInfo['version'] = current_version\n obj.moduleInfo['moduleId'] = i\n obj.moduleInfo['pipeline'] = pipeline\n obj.moduleInfo['controller'] = controller\n # extract job monitor from controller if this is the top level\n if controller:\n obj.moduleInfo['job_monitor'] = controller.jobMonitor\n else:\n obj.moduleInfo['job_monitor'] = job_monitor\n\n if extra_info is not None:\n obj.moduleInfo['extra_info'] = extra_info\n if reason is not None:\n obj.moduleInfo['reason'] = reason\n if actions is not None:\n obj.moduleInfo['actions'] = actions\n\n ## Checking 'sinks' from kwargs to resolve only requested sinks\n # Note that we accept any module in 'sinks', even if it's not actually\n # a sink in the graph\n if sinks is not None:\n persistent_sinks = [tmp_id_to_module_map[sink]\n for sink in sinks\n if sink in tmp_id_to_module_map]\n else:\n persistent_sinks = [tmp_id_to_module_map[sink]\n for sink in pipeline.graph.sinks()]\n\n self._streams.append(Generator.generators)\n Generator.generators = []\n\n # Update new sinks\n for obj in persistent_sinks:\n abort = False\n try:\n obj.update()\n continue\n except ModuleWasSuspended:\n continue\n except ModuleHadError:\n pass\n except AbortExecution:\n break\n except ModuleSuspended, ms:\n ms.module.logging.end_update(ms.module, ms,\n was_suspended=True)\n continue\n except ModuleErrors, mes:\n for me in mes.module_errors:\n me.module.logging.end_update(me.module, me)\n logging_obj.signalError(me.module, me)\n abort = abort or me.abort\n except ModuleError, me:\n me.module.logging.end_update(me.module, me, me.errorTrace)\n logging_obj.signalError(me.module, me)\n abort = me.abort\n except ModuleBreakpoint, mb:\n mb.module.logging.end_update(mb.module)\n logging_obj.signalError(mb.module, mb)\n abort = True\n if stop_on_error or abort:\n break\n\n # execute all generators until inputs are exhausted\n # this makes sure branching and multiple sinks are executed correctly\n if not logging_obj.errors and not logging_obj.suspended and \\\n Generator.generators:\n result = True\n abort = False\n while result is not None:\n try:\n for m in Generator.generators:\n result = m.generator.next()\n continue\n except AbortExecution:\n break\n except ModuleErrors, mes:\n for me in mes.module_errors:\n me.module.logging.end_update(me.module, me)\n logging_obj.signalError(me.module, me)\n abort = abort or me.abort\n except ModuleError, me:\n me.module.logging.end_update(me.module, me, me.errorTrace)\n logging_obj.signalError(me.module, me)\n abort = me.abort\n except ModuleBreakpoint, mb:\n mb.module.logging.end_update(mb.module)\n logging_obj.signalError(mb.module, mb)\n abort = True\n except Exception, e:\n debug.unexpected_exception(e)\n debug.critical(\"Exception running generators: %s\" % e,\n debug.format_exc())\n abort = True\n if stop_on_error or abort:\n break\n\n Generator.generators = self._streams.pop()\n\n if self.done_update_hook:\n self.done_update_hook(self._persistent_pipeline, self._objects)\n \n # objs, errs, and execs are mappings that use the local ids as keys,\n # as opposed to the persistent ids.\n # They are thus ideal to external consumption.\n objs = {}\n # dict([(i, self._objects[tmp_to_persistent_module_map[i]])\n # for i in tmp_to_persistent_module_map.keys()])\n errs = {}\n execs = {}\n suspends = {}\n caches = {}\n\n to_delete = []\n for (tmp_id, obj) in tmp_id_to_module_map.iteritems():\n if clean_pipeline:\n to_delete.append(obj.id)\n objs[tmp_id] = obj\n if obj.id in logging_obj.errors:\n errs[tmp_id] = logging_obj.errors[obj.id]\n if not clean_pipeline:\n to_delete.append(obj.id)\n executed = False\n if obj.id in logging_obj.executed:\n execs[tmp_id] = logging_obj.executed[obj.id]\n executed = True\n if obj.id in logging_obj.suspended:\n suspends[tmp_id] = logging_obj.suspended[obj.id]\n if not clean_pipeline:\n to_delete.append(obj.id)\n executed = True\n if obj.id in logging_obj.cached:\n caches[tmp_id] = logging_obj.cached[obj.id]\n executed = True\n if not executed:\n # these modules didn't execute\n execs[tmp_id] = False\n\n return (to_delete, objs, errs, execs, suspends, caches, parameter_changes)", "metadata": "root.CachedInterpreter.execute_pipeline", "header": "['class', 'CachedInterpreter', '(', 'vistrails', '.', 'core', '.', 'interpreter', '.', 'base', '.', 'BaseInterpreter', ')', ':', '___EOS___']", "index": 437 }, { "content": " def execute(self, pipeline, **kwargs):\n \"\"\"execute(pipeline, **kwargs):\n\n kwargs:\n controller = fetch('controller', None)\n locator = fetch('locator', None)\n current_version = fetch('current_version', None)\n view = fetch('view', DummyView())\n aliases = fetch('aliases', None)\n params = fetch('params', None)\n extra_info = fetch('extra_info', None)\n logger = fetch('logger', DummyLogController)\n reason = fetch('reason', None)\n actions = fetch('actions', None)\n done_summon_hooks = fetch('done_summon_hooks', [])\n module_executed_hook = fetch('module_executed_hook', [])\n job_monitor = fetch('job_monitor', None)\n\n Executes a pipeline using caching. Caching works by reusing\n pipelines directly. This means that there exists one global\n pipeline whose parts get executed over and over again.\n\n This function returns a triple of dictionaries (objs, errs, execs).\n\n objs is a mapping from local ids (the ids in the pipeline) to\n objects **in the persistent pipeline**. Notice, these are not\n the objects inside the passed pipeline, but the objects they\n were mapped to in the persistent pipeline.\n\n errs is a dictionary from local ids to error messages of modules\n that might have returns errors.\n\n execs is a dictionary from local ids to boolean values indicating\n whether they were executed or not.\n\n If modules have no error associated with but were not executed, it\n means they were cached.\"\"\"\n\n # Setup named arguments. We don't use named parameters so\n # that positional parameter calls fail earlier\n new_kwargs = {}\n def fetch(name, default):\n new_kwargs[name] = r = kwargs.pop(name, default)\n return r\n controller = fetch('controller', None)\n locator = fetch('locator', None)\n current_version = fetch('current_version', None)\n view = fetch('view', DummyView())\n vistrail_variables = fetch('vistrail_variables', None)\n aliases = fetch('aliases', None)\n params = fetch('params', None)\n extra_info = fetch('extra_info', None)\n logger = fetch('logger', DummyLogController)\n sinks = fetch('sinks', None)\n reason = fetch('reason', None)\n actions = fetch('actions', None)\n done_summon_hooks = fetch('done_summon_hooks', [])\n module_executed_hook = fetch('module_executed_hook', [])\n stop_on_error = fetch('stop_on_error', True)\n parent_exec = fetch('parent_exec', None)\n job_monitor = fetch('job_monitor', None)\n\n if len(kwargs) > 0:\n raise VistrailsInternalError('Wrong parameters passed '\n 'to execute: %s' % kwargs)\n self.clean_non_cacheable_modules()\n\n\n# if controller is not None:\n# vistrail = controller.vistrail\n# (pipeline, module_remap) = \\\n# core.db.io.expand_workflow(vistrail, pipeline)\n# new_kwargs['module_remap'] = module_remap\n# else:\n# vistrail = None\n\n if controller is not None:\n vistrail = controller.vistrail\n else:\n vistrail = None\n\n logger = logger.start_workflow_execution(\n parent_exec,\n vistrail, pipeline, current_version)\n new_kwargs['logger'] = logger\n self.annotate_workflow_execution(logger, reason, aliases, params)\n\n res = self.setup_pipeline(pipeline, **new_kwargs)\n modules_added = res[2]\n conns_added = res[3]\n to_delete = res[4]\n errors = res[5]\n if len(errors) == 0:\n res = self.execute_pipeline(pipeline, *(res[:2]), **new_kwargs)\n else:\n res = (to_delete, res[0], errors, {}, {}, {}, [])\n for (i, error) in errors.iteritems():\n view.set_module_error(i, error.msg, error.errorTrace)\n self.finalize_pipeline(pipeline, *(res[:-1]), **new_kwargs)\n\n result = InstanceObject(objects=res[1],\n errors=res[2],\n executed=res[3],\n suspended=res[4],\n parameter_changes=res[6],\n modules_added=modules_added,\n conns_added=conns_added)\n\n logger.finish_workflow_execution(result.errors, suspended=result.suspended)\n\n return result", "metadata": "root.CachedInterpreter.execute", "header": "['class', 'CachedInterpreter', '(', 'vistrails', '.', 'core', '.', 'interpreter', '.', 'base', '.', 'BaseInterpreter', ')', ':', '___EOS___']", "index": 657 }, { "content": " @staticmethod\n def cleanup():\n if CachedInterpreter.__instance:\n CachedInterpreter.__instance.clear()\n objs = gc.collect()", "metadata": "root.CachedInterpreter.cleanup", "header": "['class', 'CachedInterpreter', '(', 'vistrails', '.', 'core', '.', 'interpreter', '.', 'base', '.', 'BaseInterpreter', ')', ':', '___EOS___']", "index": 877 }, { "content": " @staticmethod\n def flush():\n if CachedInterpreter.__instance:\n CachedInterpreter.__instance.clear()\n CachedInterpreter.__instance.create()\n objs = gc.collect()", "metadata": "root.CachedInterpreter.flush", "header": "['class', 'CachedInterpreter', '(', 'vistrails', '.', 'core', '.', 'interpreter', '.', 'base', '.', 'BaseInterpreter', ')', ':', '___EOS___']", "index": 883 } ]
[ { "span": "locator ", "start_line": 288, "start_column": 8, "end_line": 288, "end_column": 15 }, { "span": "current_version ", "start_line": 289, "start_column": 8, "end_line": 289, "end_column": 23 }, { "span": "view ", "start_line": 290, "start_column": 8, "end_line": 290, "end_column": 12 }, { "span": "extra_info ", "start_line": 294, "start_column": 8, "end_line": 294, "end_column": 18 }, { "span": "logger ", "start_line": 295, "start_column": 8, "end_line": 295, "end_column": 14 }, { "span": "sinks ", "start_line": 296, "start_column": 8, "end_line": 296, "end_column": 13 }, { "span": "reason ", "start_line": 297, "start_column": 8, "end_line": 297, "end_column": 14 }, { "span": "actions ", "start_line": 298, "start_column": 8, "end_line": 298, "end_column": 15 }, { "span": "module_executed_hook ", "start_line": 300, "start_column": 8, "end_line": 300, "end_column": 28 }, { "span": "stop_on_error ", "start_line": 301, "start_column": 8, "end_line": 301, "end_column": 21 }, { "span": "parent_exec ", "start_line": 302, "start_column": 8, "end_line": 302, "end_column": 19 }, { "span": "job_monitor ", "start_line": 303, "start_column": 8, "end_line": 303, "end_column": 19 }, { "span": "vistrail_variables ", "start_line": 445, "start_column": 8, "end_line": 445, "end_column": 26 }, { "span": "aliases ", "start_line": 446, "start_column": 8, "end_line": 446, "end_column": 15 }, { "span": "params ", "start_line": 447, "start_column": 8, "end_line": 447, "end_column": 14 }, { "span": "done_summon_hooks ", "start_line": 454, "start_column": 8, "end_line": 454, "end_column": 25 }, { "span": "parent_exec ", "start_line": 457, "start_column": 8, "end_line": 457, "end_column": 19 }, { "span": "locator ", "start_line": 702, "start_column": 8, "end_line": 702, "end_column": 15 }, { "span": "vistrail_variables ", "start_line": 705, "start_column": 8, "end_line": 705, "end_column": 26 }, { "span": "extra_info ", "start_line": 708, "start_column": 8, "end_line": 708, "end_column": 18 }, { "span": "sinks ", "start_line": 710, "start_column": 8, "end_line": 710, "end_column": 13 }, { "span": "actions ", "start_line": 712, "start_column": 8, "end_line": 712, "end_column": 15 }, { "span": "done_summon_hooks ", "start_line": 713, "start_column": 8, "end_line": 713, "end_column": 25 }, { "span": "module_executed_hook ", "start_line": 714, "start_column": 8, "end_line": 714, "end_column": 28 }, { "span": "stop_on_error ", "start_line": 715, "start_column": 8, "end_line": 715, "end_column": 21 }, { "span": "job_monitor ", "start_line": 717, "start_column": 8, "end_line": 717, "end_column": 19 }, { "span": "objs ", "start_line": 881, "start_column": 8, "end_line": 881, "end_column": 12 }, { "span": "objs ", "start_line": 888, "start_column": 8, "end_line": 888, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Cache", "d", "Interpreter_", "(_", "vist", "rail", "s_", "._", "core_", "._", "interpreter_", "._", "base_", "._", "Base", "Interpreter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "pipeline_", "(_", "self_", ",_", "pipeline_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "setup", "\\u", "pipeline", "(", "controlle", "r", ",", " ", "pipeline", ",", " ", "locator", ",", " ", "current", "Version", ",", "\\", "10", ";", " ", " ", " ", " ", "view", ",", " ", "alias", "es", ",", " ", "**", "kwarg", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "Match", "es", " ", "a", " ", "pipeline", " ", "with", " ", "the", " ", "persiste", "nt", " ", "pipeline", " ", "and", " ", "create", "s", "\\", "10", ";", " ", " ", " ", " ", "instance", "s", " ", "of", " ", "module", "s", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "in", " ", "the", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fetch_", "(_", "name_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "kwargs_", "._", "pop_", "(_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "controller_", "=_", "fetch_", "(_", "'", "controlle", "r", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locator_", "=_", "fetch_", "(_", "'", "locator", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "version_", "=_", "fetch_", "(_", "'", "current", "\\u", "version", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "fetch_", "(_", "'", "view", "'_", ",_", "Du", "mm", "y", "View_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vist", "rail", "\\u", "variables_", "=_", "fetch_", "(_", "'", "vist", "rail", "\\u", "variab", "les", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aliases_", "=_", "fetch_", "(_", "'", "alias", "es", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "fetch_", "(_", "'", "params", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "info_", "=_", "fetch_", "(_", "'", "extra", "\\u", "info", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "fetch_", "(_", "'", "logg", "er", "'_", ",_", "Du", "mm", "y", "Log", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sink", "s_", "=_", "fetch_", "(_", "'", "sink", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reason_", "=_", "fetch_", "(_", "'", "reason", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "fetch_", "(_", "'", "action", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "summ", "on", "\\u", "hooks_", "=_", "fetch_", "(_", "'", "don", "e\\u", "summ", "on", "\\u", "hook", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "executed", "\\u", "hook_", "=_", "fetch_", "(_", "'", "module", "\\u", "executed", "\\u", "hook", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "\\u", "on", "\\u", "error_", "=_", "fetch_", "(_", "'", "stop", "\\u", "on", "\\u", "error", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "exec_", "=_", "fetch_", "(_", "'", "parent", "\\u", "exec", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "monitor_", "=_", "fetch_", "(_", "'", "job", "\\u", "monit", "or", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "=_", "get", "\\u", "module", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "kwargs_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Vis", "trail", "s", "Intern", "al", "Error_", "(_", "'", "Wro", "ng", " ", "parameter", "s", " ", "pass", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "setup", "\\u", "pipeline", ":", " ", "%", "s", "'_", "%_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "null_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "Null", " ", "value", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "reg_", "._", "get", "\\u", "descrip", "tor", "\\u", "by", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "descriptor_", "=_", "getter_", "(_", "basic", "\\u", "pkg_", ",_", "'", "Null", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "descriptor_", "._", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "constant_", "(_", "param_", ",_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "Const", "ant", " ", "from", " ", "a", " ", "parameter", " ", "spec", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getter_", "=_", "reg_", "._", "get", "\\u", "descrip", "tor", "\\u", "by", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "getter_", "(_", "param_", "._", "identifier_", ",_", "param_", "._", "type_", ",_", "param_", "._", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constant_", "=_", "desc_", "._", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constant_", "._", "id_", "=_", "module_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "param", ".", "evaluate", "d", "Str", "Value", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "constant", ".", "set", "Value", "(", "param", ".", "evaluate", "d", "Str", "Value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "param_", "._", "str", "Value_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constant_", "._", "set", "Value_", "(_", "param_", "._", "str", "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 ", " _", "constant_", "._", "set", "Value_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "constant_", "._", "translat", "e\\u", "to", "\\u", "string_", "(_", "constant_", "._", "default", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "BEGIN", " ", "METH", "OD", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "self", ".", "debugg", "er", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "debugg", "er", ".", "update", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "\\u", "delete_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "controller_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Controlle", "r", " ", "is", " ", "none", " ", "for", " ", "sub\\u", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "controller_", "._", "validate_", "(_", "pipeline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pipeline_", "._", "validate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "resolve", "\\u", "aliases_", "(_", "pipeline_", ",_", "aliases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "vist", "rail", "\\u", "variables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "resolve", "\\u", "variables_", "(_", "vist", "rail", "\\u", "variables_", ",_", "pipeline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "update", "\\u", "params_", "(_", "pipeline_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "adde", "d\\u", "set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "\\u", "adde", "d\\u", "set_", ")_", "=_", "self_", "._", "add", "\\u", "to", "\\u", "persiste", "nt", "\\u", "pipeline_", "(_", "pipeline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "new", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "module", "\\u", "adde", "d\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "persiste", "nt", "\\u", "id_", "=_", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "self_", "._", "\\u", "persiste", "nt", "\\u", "pipeline_", "._", "modules_", "[_", "persiste", "nt", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "self_", "._", "\\u", "objects_", "[_", "persiste", "nt", "\\u", "id_", "]_", "=_", "module_", "._", "summ", "on_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "interpreter_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "id_", "=_", "persiste", "nt", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "signature_", "=_", "module_", "._", "\\u", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", "ing", " ", "if", " ", "output", " ", "shou", "ld", " ", "be", " ", "stored_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "module_", "._", "has", "\\u", "annot", "ation", "\\u", "with", "\\u", "key_", "(_", "'", "annot", "ate", "\\u", "output", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "output_", "=_", "module_", "._", "get", "\\u", "annot", "ation", "\\u", "by", "\\u", "key_", "(_", "'", "annot", "ate", "\\u", "output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "annot", "ate", "\\u", "output_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "annot", "ate", "\\u", "output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obj_", "._", "annot", "ate", "\\u", "output_", "=_", "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_", "for_", "f_", "in_", "module_", "._", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connector_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "f_", "._", "params_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "connector_", "=_", "Modul", "e", "Connector_", "(_", "create", "\\u", "null_", "(_", ")_", ",_", "'", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "get", "\\u", "spec_", "(_", "'", "output", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "f_", "._", "params_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "p_", "=_", "f_", "._", "params_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "constant_", "=_", "create", "\\u", "constant_", "(_", "p_", ",_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connector_", "=_", "Modul", "e", "Connector_", "(_", "constant_", ",_", "'", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "get", "\\u", "spec_", "(_", "'", "output", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "debug_", "._", "unexpected", "\\u", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "Modul", "e", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Unc", "aug", "ht", " ", "exception", " ", "creati", "ng", " ", "Const", "ant", " ", "from", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "r", ":", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "str", "Value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "._", "format\\u", "exception_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "[_", "i_", "]_", "=_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tuple", "Module_", "=_", "vist", "rail", "s_", "._", "core_", "._", "interpreter_", "._", "base_", "._", "Intern", "al", "Tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Module_", "._", "length_", "=_", "len_", "(_", "f_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "j_", ",_", "p_", ")_", "in_", "enumerate_", "(_", "f_", "._", "params_", ")_", ":_", "\\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 ", " ", " _", "constant_", "=_", "create", "\\u", "constant_", "(_", "p_", ",_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constant_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connector_", "=_", "Modul", "e", "Connector_", "(_", "constant_", ",_", "'", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "get", "\\u", "spec_", "(_", "'", "output", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tuple", "Module_", "._", "set\\u", "input", "\\u", "port_", "(_", "j_", ",_", "connector_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "debug_", "._", "unexpected", "\\u", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "Modul", "e", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "module_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Unc", "aug", "ht", " ", "exception", " ", "creati", "ng", " ", "Const", "ant", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "from", " ", "%", "r", ":", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "str", "Value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "._", "format\\u", "exception_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "[_", "i_", "]_", "=_", "err_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "connector_", "=_", "Modul", "e", "Connector_", "(_", "tuple", "Module_", ",_", "'", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "get", "\\u", "spec_", "(_", "'", "output", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "connector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obj_", "._", "set\\u", "input", "\\u", "port_", "(_", "f_", "._", "name_", ",_", "connector_", ",_", "is", "\\u", "method_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "new", " ", "connections_", "\\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_", "i_", "in_", "conn", "\\u", "adde", "d\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "persiste", "nt", "\\u", "id_", "=_", "conn", "\\u", "map_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "self_", "._", "\\u", "persiste", "nt", "\\u", "pipeline_", "._", "connections_", "[_", "persiste", "nt", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "self_", "._", "\\u", "objects_", "[_", "conn_", "._", "source", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "self_", "._", "\\u", "objects_", "[_", "conn_", "._", "destinat", "ion", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "make", "\\u", "connection_", "(_", "conn_", ",_", "src_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "don", "e\\u", "summ", "on", "\\u", "hook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "don", "e\\u", "summ", "on", "\\u", "hook_", "(_", "self_", "._", "\\u", "persiste", "nt", "\\u", "pipeline_", ",_", "self_", "._", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "callable\\u", "_", "in_", "don", "e\\u", "summ", "on", "\\u", "hooks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callable\\u", "_", "(_", "self_", "._", "\\u", "persiste", "nt", "\\u", "pipeline_", ",_", "self_", "._", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "j_", "in_", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "[_", "i_", "]_", "=_", "self_", "._", "\\u", "objects_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", ",_", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map_", "._", "inverse_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "adde", "d\\u", "set_", ",_", "conn", "\\u", "adde", "d\\u", "set_", ",_", "to", "\\u", "delete_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cache", "d", "Interpreter_", "(_", "vist", "rail", "s_", "._", "core_", "._", "interpreter_", "._", "base_", "._", "Base", "Interpreter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "\\u", "pipeline_", "(_", "self_", ",_", "pipeline_", ",_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "persiste", "nt", "\\u", "to", "\\u", "tmp", "\\u", "id", "\\u", "map_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fetch_", "(_", "name_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "kwargs_", "._", "pop_", "(_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "controller_", "=_", "fetch_", "(_", "'", "controlle", "r", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locator_", "=_", "fetch_", "(_", "'", "locator", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "version_", "=_", "fetch_", "(_", "'", "current", "\\u", "version", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "fetch_", "(_", "'", "view", "'_", ",_", "Du", "mm", "y", "View_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vist", "rail", "\\u", "variables_", "=_", "fetch_", "(_", "'", "vist", "rail", "\\u", "variab", "les", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aliases_", "=_", "fetch_", "(_", "'", "alias", "es", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "fetch_", "(_", "'", "params", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "info_", "=_", "fetch_", "(_", "'", "extra", "\\u", "info", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "fetch_", "(_", "'", "logg", "er", "'_", ",_", "Du", "mm", "y", "Log", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sink", "s_", "=_", "fetch_", "(_", "'", "sink", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reason_", "=_", "fetch_", "(_", "'", "reason", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "fetch_", "(_", "'", "action", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "executed", "\\u", "hook_", "=_", "fetch_", "(_", "'", "module", "\\u", "executed", "\\u", "hook", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "summ", "on", "\\u", "hooks_", "=_", "fetch_", "(_", "'", "don", "e\\u", "summ", "on", "\\u", "hook", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "\\u", "pipeline_", "=_", "fetch_", "(_", "'", "clean", "\\u", "pipeline", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "\\u", "on", "\\u", "error_", "=_", "fetch_", "(_", "'", "stop", "\\u", "on", "\\u", "error", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "exec_", "=_", "fetch_", "(_", "'", "parent", "\\u", "exec", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "monitor_", "=_", "fetch_", "(_", "'", "job", "\\u", "monit", "or", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "kwargs_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Vis", "trail", "s", "Intern", "al", "Error_", "(_", "'", "Wro", "ng", " ", "parameter", "s", " ", "pass", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "execute", "\\u", "pipeline", ":", " ", "%", "s", "'_", "%_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOGGING", " ", "SETUP", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "remap", "ped", "\\u", "id_", "(_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "persiste", "nt", "\\u", "to", "\\u", "tmp", "\\u", "id", "\\u", "map_", "[_", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "=_", "View", "Up", "dati", "ng", "Log", "Controller_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remap", "\\u", "id_", "=_", "get", "\\u", "remap", "ped", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ids_", "=_", "pipeline_", "._", "modules_", "._", "keys_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "executed", "\\u", "hook_", "=_", "module", "\\u", "executed", "\\u", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PARAMETER", " ", "CHANGE", "S", " ", "SETUP", "_", "\\u\\u\\uNL\\u\\u\\u_", "parameter", "\\u", "changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "change", "\\u", "parameter_", "(_", "obj_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter", "\\u", "changes_", "._", "append_", "(_", "(_", "get", "\\u", "remap", "ped", "\\u", "id_", "(_", "obj_", "._", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "change", "\\u", "parameter_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lambda_", "*_", "args_", ":_", "change", "\\u", "parameter_", "(_", "obj_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "**", "all", "**", " ", "module", "s", " ", "in", " ", "the", " ", "current", " ", "pipeline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "obj_", "in_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "in", "\\u", "pipeline_", "=_", "True_", "#", " ", "set", " ", "flag", " ", "to", " ", "indicat", "e", " ", "in", " ", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "logging_", "=_", "logg", "ing", "\\u", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "change", "\\u", "parameter_", "=_", "make", "\\u", "change", "\\u", "parameter_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "object", " ", "pipeline", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "locator", "'_", "]_", "=_", "locator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "version", "'_", "]_", "=_", "current", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "module", "Id", "'_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "pipeline", "'_", "]_", "=_", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "controlle", "r", "'_", "]_", "=_", "controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "extract", " ", "job", " ", "monit", "or", " ", "from", " ", "controlle", "r", " ", "if", " ", "this", " ", "is", " ", "the", " ", "top", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "controller_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "job", "\\u", "monit", "or", "'_", "]_", "=_", "controller_", "._", "job", "Monitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "job", "\\u", "monit", "or", "'_", "]_", "=_", "job", "\\u", "monitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "info_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "extra", "\\u", "info", "'_", "]_", "=_", "extra", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reason_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "reason", "'_", "]_", "=_", "reason_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "actions_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "action", "s", "'_", "]_", "=_", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Check", "ing", " ", "'", "sink", "s", "'", " ", "from", " ", "kwarg", "s", " ", "to", " ", "resolve", " ", "only", " ", "request", "ed", " ", "sink", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "accept", " ", "any", " ", "module", " ", "in", " ", "'", "sink", "s", "',", " ", "even", " ", "if", " ", "it", "'", "s", " ", "not", " ", "actual", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "sink", " ", "in", " ", "the", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sink", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "persiste", "nt", "\\u", "sink", "s_", "=_", "[_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "[_", "sink_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sink_", "in_", "sink", "s_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sink_", "in_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "persiste", "nt", "\\u", "sink", "s_", "=_", "[_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "[_", "sink_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sink_", "in_", "pipeline_", "._", "graph_", "._", "sink", "s_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "streams_", "._", "append_", "(_", "Generator_", "._", "generators_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Generator_", "._", "generators_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "new", " ", "sink", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "persiste", "nt", "\\u", "sink", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Wa", "s", "Suspend", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Had", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Abo", "rt", "Execution_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Suspend", "ed_", ",_", "ms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "ms_", "._", "module_", ",_", "ms_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "was", "\\u", "suspended", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Errors_", ",_", "mes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "me_", "in_", "mes_", "._", "module", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "abort_", "or_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Error_", ",_", "me_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ",_", "me_", "._", "error", "Trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Breakpoint", "_", ",_", "mb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mb_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "mb_", "._", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "mb_", "._", "module_", ",_", "mb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stop", "\\u", "on", "\\u", "error_", "or_", "abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "execute", " ", "all", " ", "generat", "ors", " ", "unti", "l", " ", "inputs", " ", "are", " ", "exhaust", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "make", "s", " ", "sure", " ", "branch", "ing", " ", "and", " ", "multiple", " ", "sink", "s", " ", "are", " ", "executed", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "logg", "ing", "\\u", "obj_", "._", "errors_", "and_", "not_", "logg", "ing", "\\u", "obj_", "._", "suspended", "_", "and_", "Generator_", "._", "generators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "result_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "m_", "in_", "Generator_", "._", "generators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "=_", "m_", "._", "generator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Abo", "rt", "Execution_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Errors_", ",_", "mes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "me_", "in_", "mes_", "._", "module", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "abort_", "or_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Error_", ",_", "me_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ",_", "me_", "._", "error", "Trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Breakpoint", "_", ",_", "mb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mb_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "mb_", "._", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "mb_", "._", "module_", ",_", "mb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "debug_", "._", "unexpected", "\\u", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "._", "critical_", "(_", "\"", "Except", "ion", " ", "runn", "ing", " ", "generat", "ors", ":", " ", "%", "s", "\"_", "%_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stop", "\\u", "on", "\\u", "error_", "or_", "abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Generator_", "._", "generators_", "=_", "self_", "._", "\\u", "streams_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "don", "e\\u", "update", "\\u", "hook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "don", "e\\u", "update", "\\u", "hook_", "(_", "self_", "._", "\\u", "persiste", "nt", "\\u", "pipeline_", ",_", "self_", "._", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "objs", ",", " ", "err", "s", ",", " ", "and", " ", "exec", "s", " ", "are", " ", "mapping", "s", " ", "tha", "t", " ", "use", " ", "the", " ", "local", " ", "ids", " ", "as", " ", "keys", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "oppo", "sed", " ", "to", " ", "the", " ", "persiste", "nt", " ", "ids", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "y", " ", "are", " ", "thu", "s", " ", "ideal", " ", "to", " ", "external", " ", "consum", "ption", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dict", "([(", "i", ",", " ", "self", ".\\u", "object", "s", "[", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map", "[", "i", "]])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "for", " ", "i", " ", "in", " ", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map", ".", "keys", "()]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "errs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suspend", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "caches_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "delete_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "tmp", "\\u", "id_", ",_", "obj_", ")_", "in_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "clean", "\\u", "pipeline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "[_", "tmp", "\\u", "id_", "]_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errs_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "errors_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "clean", "\\u", "pipeline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "executed", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "executed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec", "s_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "executed", "_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "suspended", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suspend", "s_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "suspended", "_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "clean", "\\u", "pipeline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "executed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "cached_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caches_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "cached_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "executed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "these", " ", "module", "s", " ", "did", "n", "'", "t", " ", "execute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec", "s_", "[_", "tmp", "\\u", "id_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "to", "\\u", "delete_", ",_", "objs_", ",_", "errs_", ",_", "exec", "s_", ",_", "suspend", "s_", ",_", "caches_", ",_", "parameter", "\\u", "changes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cache", "d", "Interpreter_", "(_", "vist", "rail", "s_", "._", "core_", "._", "interpreter_", "._", "base_", "._", "Base", "Interpreter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "pipeline_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "execute", "(", "pipeline", ",", " ", "**", "kwarg", "s", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "kwarg", "s", ":", "\\", "10", ";", " ", " ", "controlle", "r", " ", "=", " ", "fetch", "('", "controlle", "r", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "locator", " ", "=", " ", "fetch", "('", "locator", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "current", "\\u", "version", " ", "=", " ", "fetch", "('", "current", "\\u", "version", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "view", " ", "=", " ", "fetch", "('", "view", "',", " ", "Du", "mm", "y", "View", "())", "\\", "10", ";", " ", " ", "alias", "es", " ", "=", " ", "fetch", "('", "alias", "es", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "params", " ", "=", " ", "fetch", "('", "params", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "extra", "\\u", "info", " ", "=", " ", "fetch", "('", "extra", "\\u", "info", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "logg", "er", " ", "=", " ", "fetch", "('", "logg", "er", "',", " ", "Du", "mm", "y", "Log", "Controlle", "r", ")", "\\", "10", ";", " ", " ", "reason", " ", "=", " ", "fetch", "('", "reason", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "action", "s", " ", "=", " ", "fetch", "('", "action", "s", "',", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", "don", "e\\u", "summ", "on", "\\u", "hook", "s", " ", "=", " ", "fetch", "('", "don", "e\\u", "summ", "on", "\\u", "hook", "s", "',", " ", "[]", ")", "\\", "10", ";", " ", " ", "module", "\\u", "executed", "\\u", "hook", " ", "=", " ", "fetch", "('", "module", "\\u", "executed", "\\u", "hook", "',", " ", "[]", ")", "\\", "10", ";", " ", " ", "job", "\\u", "monit", "or", " ", "=", " ", "fetch", "('", "job", "\\u", "monit", "or", "',", " ", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Execut", "es", " ", "a", " ", "pipeline", " ", "usi", "ng", " ", "caching", ".", " ", "Caching", " ", "works", " ", "by", " ", "reus", "ing", "\\", "10", ";", " ", " ", " ", " ", "pipeline", "s", " ", "direct", "ly", ".", " ", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "there", " ", "exist", "s", " ", "one", " ", "global", "\\", "10", ";", " ", " ", " ", " ", "pipeline", " ", "who", "se", " ", "part", "s", " ", "get", " ", "executed", " ", "over", " ", "and", " ", "over", " ", "again", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "return", "s", " ", "a", " ", "triple", " ", "of", " ", "dictionar", "ies", " ", "(", "objs", ",", " ", "err", "s", ",", " ", "exec", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "objs", " ", "is", " ", "a", " ", "mapping", " ", "from", " ", "local", " ", "ids", " ", "(", "the", " ", "ids", " ", "in", " ", "the", " ", "pipeline", ")", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "object", "s", " ", "**", "in", " ", "the", " ", "persiste", "nt", " ", "pipeline", "**", ".", " ", "Noti", "ce", ",", " ", "these", " ", "are", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "object", "s", " ", "insi", "de", " ", "the", " ", "pass", "ed", " ", "pipeline", ",", " ", "but", " ", "the", " ", "object", "s", " ", "the", "y", "\\", "10", ";", " ", " ", " ", " ", "wer", "e", " ", "mapp", "ed", " ", "to", " ", "in", " ", "the", " ", "persiste", "nt", " ", "pipeline", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "err", "s", " ", "is", " ", "a", " ", "dictionar", "y", " ", "from", " ", "local", " ", "ids", " ", "to", " ", "error", " ", "message", "s", " ", "of", " ", "module", "s", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "mig", "ht", " ", "have", " ", "return", "s", " ", "error", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "exec", "s", " ", "is", " ", "a", " ", "dictionar", "y", " ", "from", " ", "local", " ", "ids", " ", "to", " ", "boolean", " ", "values", " ", "indicati", "ng", "\\", "10", ";", " ", " ", " ", " ", "whe", "ther", " ", "the", "y", " ", "wer", "e", " ", "executed", " ", "or", " ", "not", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "module", "s", " ", "have", " ", "no", " ", "error", " ", "associate", "d", " ", "with", " ", "but", " ", "wer", "e", " ", "not", " ", "executed", ",", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "means", " ", "the", "y", " ", "wer", "e", " ", "cache", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "named", " ", "argu", "ment", "s", ".", " ", "We", " ", "don", "'", "t", " ", "use", " ", "named", " ", "parameter", "s", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "positional", " ", "parameter", " ", "calls", " ", "fail", " ", "ear", "lie", "r_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fetch_", "(_", "name_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "kwargs_", "[_", "name_", "]_", "=_", "r_", "=_", "kwargs_", "._", "pop_", "(_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "controller_", "=_", "fetch_", "(_", "'", "controlle", "r", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locator_", "=_", "fetch_", "(_", "'", "locator", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "version_", "=_", "fetch_", "(_", "'", "current", "\\u", "version", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "fetch_", "(_", "'", "view", "'_", ",_", "Du", "mm", "y", "View_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vist", "rail", "\\u", "variables_", "=_", "fetch_", "(_", "'", "vist", "rail", "\\u", "variab", "les", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aliases_", "=_", "fetch_", "(_", "'", "alias", "es", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "fetch_", "(_", "'", "params", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "info_", "=_", "fetch_", "(_", "'", "extra", "\\u", "info", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "fetch_", "(_", "'", "logg", "er", "'_", ",_", "Du", "mm", "y", "Log", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sink", "s_", "=_", "fetch_", "(_", "'", "sink", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reason_", "=_", "fetch_", "(_", "'", "reason", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "fetch_", "(_", "'", "action", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "summ", "on", "\\u", "hooks_", "=_", "fetch_", "(_", "'", "don", "e\\u", "summ", "on", "\\u", "hook", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "executed", "\\u", "hook_", "=_", "fetch_", "(_", "'", "module", "\\u", "executed", "\\u", "hook", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "\\u", "on", "\\u", "error_", "=_", "fetch_", "(_", "'", "stop", "\\u", "on", "\\u", "error", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "exec_", "=_", "fetch_", "(_", "'", "parent", "\\u", "exec", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "monitor_", "=_", "fetch_", "(_", "'", "job", "\\u", "monit", "or", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "kwargs_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Vis", "trail", "s", "Intern", "al", "Error_", "(_", "'", "Wro", "ng", " ", "parameter", "s", " ", "pass", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "execute", ":", " ", "%", "s", "'_", "%_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "clean", "\\u", "non", "\\u", "cache", "able", "\\u", "modules_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "controlle", "r", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "vist", "rail", " ", "=", " ", "controlle", "r", ".", "vist", "rail", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "(", "pipeline", ",", " ", "module", "\\u", "remap", ")", " ", "=", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "core", ".", "db", ".", "io", ".", "expand", "\\u", "workf", "low", "(", "vist", "rail", ",", " ", "pipeline", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "new", "\\u", "kwarg", "s", "['", "module", "\\u", "remap", "']", " ", "=", " ", "module", "\\u", "remap", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "vist", "rail", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "controller_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vist", "rail", "_", "=_", "controller_", "._", "vist", "rail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vist", "rail", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "=_", "logger_", "._", "start", "\\u", "workf", "low", "\\u", "execution_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u", "exec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vist", "rail", "_", ",_", "pipeline_", ",_", "current", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "kwargs_", "[_", "'", "logg", "er", "'_", "]_", "=_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annot", "ate", "\\u", "workf", "low", "\\u", "execution_", "(_", "logger_", ",_", "reason_", ",_", "aliases_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "setup", "\\u", "pipeline_", "(_", "pipeline_", ",_", "**_", "new", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "s", "\\u", "added_", "=_", "res_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn", "s", "\\u", "added_", "=_", "res_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "delete_", "=_", "res_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "res_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "errors_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "execute", "\\u", "pipeline_", "(_", "pipeline_", ",_", "*_", "(_", "res_", "[_", ":_", "2_", "]_", ")_", ",_", "**_", "new", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "(_", "to", "\\u", "delete_", ",_", "res_", "[_", "0_", "]_", ",_", "errors_", ",_", "{_", "}_", ",_", "{_", "}_", ",_", "{_", "}_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "i_", ",_", "error_", ")_", "in_", "errors_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "._", "set\\u", "module", "\\u", "error_", "(_", "i_", ",_", "error_", "._", "msg_", ",_", "error_", "._", "error", "Trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "finalize", "\\u", "pipeline_", "(_", "pipeline_", ",_", "*_", "(_", "res_", "[_", ":_", "-_", "1_", "]_", ")_", ",_", "**_", "new", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Insta", "nce", "Object_", "(_", "objects_", "=_", "res_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "=_", "res_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "executed", "_", "=_", "res_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suspended", "_", "=_", "res_", "[_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameter", "\\u", "changes_", "=_", "res_", "[_", "6_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "s", "\\u", "added_", "=_", "module", "s", "\\u", "added_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "s", "\\u", "added_", "=_", "conn", "s", "\\u", "added_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "finish", "\\u", "workf", "low", "\\u", "execution_", "(_", "result_", "._", "errors_", ",_", "suspended", "_", "=_", "result_", "._", "suspended", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cache", "d", "Interpreter_", "(_", "vist", "rail", "s_", "._", "core_", "._", "interpreter_", "._", "base_", "._", "Base", "Interpreter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cleanup_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Cache", "d", "Interpreter_", "._", "\\u\\u", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cache", "d", "Interpreter_", "._", "\\u\\u", "instance_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "=_", "gc_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cache", "d", "Interpreter_", "(_", "vist", "rail", "s_", "._", "core_", "._", "interpreter_", "._", "base_", "._", "Base", "Interpreter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "flush_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Cache", "d", "Interpreter_", "._", "\\u\\u", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cache", "d", "Interpreter_", "._", "\\u\\u", "instance_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cache", "d", "Interpreter_", "._", "\\u\\u", "instance_", "._", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "=_", "gc_", "._", "collect_", "(_", ")_", "\\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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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, 0, 1, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
PaloAltoNetworks/SplunkforPaloAltoNetworks/bin/retrieveWildFireReport.py
[ { "content": "# ##########################################\n# Version 1.0\n# Author: Brian Torres-Gil\n#\n# About this script:\n# Triggered when a WildFire syslog indicates a file has been analyzed by WildFire.\n# This script retrieves the WildFire data relating to that syslog from the WildFire\n# cloud service API.\n#\n# Script's actions and warning messages are logged in $SPLUNK_HOME/var/log/splunk/python.log\n############################################\n############################################\n# How to Use this script\n# The script must be provided 3 things to retrieve an WildFire log from the cloud:\n# 1. An API Key. This is found at https://wildfire.paloaltonetworks.com\n# under 'My Account'.\n# 2. The Serial Number of the device that produced the alert. This is in the syslog.\n# 3. The ID of the report. This is in the syslog.\n###########################################\n###########################################\n\n# if you want to go through a proxy, e.g., HTTP_PROXY={squid:'2.2.2.2'}\nHTTP_PROXY = {}\n\n#########################################################\n# Do NOT modify anything below this line unless you are\n# certain of the ramifications of the changes\n#########################################################\n\nimport sys\nimport os\nimport urllib # for urllib.urlencode()\nimport urllib2 # make http requests to PAN firewall\nimport traceback\nimport argparse\n\nlibpath = os.path.dirname(os.path.abspath(__file__))\nsys.path[:0] = [os.path.join(libpath, 'lib')]\nimport common\nimport environment\n\nlogger = common.logging.getLogger().getChild('retrieveWildFireReport')\n#logger.setLevel(common.logging.INFO)\n\nif environment.run_by_splunk():\n try:\n import splunk.Intersplunk # so you can interact with Splunk\n import splunk.entity as entity # for splunk config info\n except Exception as e:\n # Handle exception to produce logs to python.log\n logger.error(\"Error during import\")\n logger.error(traceback.format_exc())\n raise e\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n if environment.run_by_splunk():\n main_splunk()\n else:\n main_cli()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_cli_args():\n \"\"\"Used if this script is run from the CLI\n\n This function is not used if script run from Splunk searchbar\n \"\"\"\n # Setup the argument parser\n parser = argparse.ArgumentParser(description=\"Download a Wildfire Report using the Wildfire API\")\n #parser.add_argument('-v', '--verbose', action='store_true', help=\"Verbose\")\n parser.add_argument('apikey', help=\"API Key from https://wildfire.paloaltonetworks.com\")\n parser.add_argument('serial', help=\"Serial number of the device which produced the WildFire syslog\")\n parser.add_argument('reportid', help=\"ID of the report in the WildFire cloud\")\n options = parser.parse_args()\n return options", "metadata": "root.get_cli_args", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def createOpener():\n \"\"\"Create a generic opener for http\n\n This is particularly helpful when there is a proxy server in line\n \"\"\"\n # Thanks to: http://www.decalage.info/en/python/urllib2noproxy\n proxy_handler = urllib2.ProxyHandler(HTTP_PROXY)\n opener = urllib2.build_opener(proxy_handler)\n urllib2.install_opener(opener)\n return opener", "metadata": "root.createOpener", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def retrieveWildFireData(apikey, serial, reportid):\n # Create a urllib2 opener\n opener = createOpener()\n # URL for WildFire cloud API\n wfUrl = 'https://wildfire.paloaltonetworks.com/publicapi/report'\n # Prepare the variables as POST data\n post_data = urllib.urlencode({\n 'apikey': apikey,\n 'device_id': serial,\n 'report_id': reportid,\n })\n # Create a request object\n wfReq = urllib2.Request(wfUrl)\n # Make the request to the WildFire cloud\n result = opener.open(wfReq, post_data)\n return result", "metadata": "root.retrieveWildFireData", "header": "['module', '___EOS___']", "index": 81 }, { "content": "def main_cli():\n # Get command line arguments\n options = get_cli_args()\n #debug = options.verbose\n #logger = common.logging.getLogger()\n #common.logging.basicConfig(level=common.logging.INFO)\n #if debug:\n # logger.setLevel(common.logging.DEBUG)\n # logger.info(\"Verbose logging enabled\")\n # Grab WildFire data\n data = retrieveWildFireData(options.apikey, options.serial, options.reportid)\n # Parse XML for fields\n print data.read()\n sys.exit(0)", "metadata": "root.main_cli", "header": "['module', '___EOS___']", "index": 99 }, { "content": "def main_splunk():\n # Get arguments passed to command on Splunk searchbar\n args, kwargs = splunk.Intersplunk.getKeywordsAndOptions()\n\n debug = common.check_debug(kwargs)\n\n # Setup the logger. $SPLUNK_HOME/var/log/splunk/python.log\n logger = common.logging.getLogger()\n if debug:\n logger.setLevel(common.logging.DEBUG)\n\n # Results contains the data from the search results and settings contains\n # the sessionKey that we can use to talk to splunk\n logger.debug(\"Getting search results and settings from Splunk\")\n results, unused1, settings = splunk.Intersplunk.getOrganizedResults()\n\n # Get the sessionKey\n sessionKey = settings['sessionKey']\n # If there are logs to act on, get the Panorama user and password from Splunk using the sessionKey\n if len(results) < 0:\n logger.debug(\"No search results. Nothing to do.\")\n splunk.Intersplunk.outputResults(results)\n sys.exit(0)\n\n logger.debug(\"Getting Wildfire APIKey from encrypted store\")\n wf_apikey = common.get_wildfire_apikey(sessionKey)\n\n # Get a wildfire report for each row\n logger.debug(\"Getting Wildfire reports for %s search results\" % len(results))\n for idx, result in enumerate(results):\n # Check to see if the result has the necessary fields\n if 'serial_number' in result and 'report_id' in result:\n logger.debug(\"Getting Wildfire report for result # %s with report_id: %s\" % (idx, result['report_id']))\n try:\n # Get the report\n wfReportXml = retrieveWildFireData(wf_apikey, result['serial_number'],\n result['report_id']).read().strip()\n # Add the report id to the XML for correlation to the original WildFire log from the firewall\n wfReportXml = wfReportXml.replace(\"</version>\", \"</version>\\n<id>\" + result['report_id'] + \"</id>\", 1)\n result['wildfire_report'] = wfReportXml\n except:\n logger.warn(\"Error retrieving WildFire report for report id: %s\" % result['report_id'])\n # Log the result row in case of an exception\n logger.info(\"Log with error: %s\" % result)\n stack = traceback.format_exc()\n # Log the stack information\n logger.warn(stack)\n else:\n logger.debug(\"Required fields missing from result # %s.\"\n \"Expected the following fields: serial_number, report_id\" % idx)\n # output the complete results sent back to splunk\n splunk.Intersplunk.outputResults(results)", "metadata": "root.main_splunk", "header": "['module', '___EOS___']", "index": 115 } ]
[ { "span": "import splunk.entity as entity ", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Version", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "Brian", " ", "Tor", "res", "-", "Gi", "l_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abo", "ut", " ", "this", " ", "script", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Trigger", "ed", " ", "whe", "n", " ", "a", " ", "Wild", "Fire", " ", "syslo", "g", " ", "indicat", "es", " ", "a", " ", "file", " ", "has", " ", "bee", "n", " ", "analyze", "d", " ", "by", " ", "Wild", "Fire", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Thi", "s", " ", "script", " ", "retrieve", "s", " ", "the", " ", "Wild", "Fire", " ", "data", " ", "relati", "ng", " ", "to", " ", "tha", "t", " ", "syslo", "g", " ", "from", " ", "the", " ", "Wild", "Fire", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "cloud", " ", "service", " ", "API", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Script", "'", "s", " ", "action", "s", " ", "and", " ", "warn", "ing", " ", "message", "s", " ", "are", " ", "logged", " ", "in", " ", "$", "SPL", "UNK", "\\u", "HOM", "E", "/", "var", "/", "log", "/", "splu", "nk", "/", "python", ".", "log_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "Us", "e", " ", "this", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "script", " ", "must", " ", "be", " ", "provided", " ", "3", " ", "thing", "s", " ", "to", " ", "retrieve", " ", "an", " ", "Wild", "Fire", " ", "log", " ", "from", " ", "the", " ", "cloud", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", " ", "An", " ", "API", " ", "Key", ".", " ", "Thi", "s", " ", "is", " ", "found", " ", "at", " ", "https", "://", "wild", "fire", ".", "pal", "oa", "lto", "network", "s", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "under", " ", "'", "My", " ", "Account", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", " ", "The", " ", "Ser", "ial", " ", "Number", " ", "of", " ", "the", " ", "device", " ", "tha", "t", " ", "produce", "d", " ", "the", " ", "alert", ".", " ", "Thi", "s", " ", "is", " ", "in", " ", "the", " ", "syslo", "g", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ".", " ", " ", "The", " ", "ID", " ", "of", " ", "the", " ", "report", ".", " ", "Thi", "s", " ", "is", " ", "in", " ", "the", " ", "syslo", "g", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "you", " ", "want", " ", "to", " ", "go", " ", "through", " ", "a", " ", "proxy", ",", " ", "e", ".", "g", ".,", " ", "HTTP", "\\u", "PROX", "Y", "={", "squi", "d", ":'", "2.2", ".2", ".2", "'}", "_", "\\u\\u\\uNL\\u\\u\\u_", "HTTP", "\\u", "PROX", "Y_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "NOT", " ", "modif", "y", " ", "anyt", "hing", " ", "belo", "w", " ", "this", " ", "line", " ", "unl", "ess", " ", "you", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cert", "ain", " ", "of", " ", "the", " ", "ram", "ificatio", "ns", " ", "of", " ", "the", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\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_", "urllib_", "#", " ", "for", " ", "url", "lib", ".", "url", "encode", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "#", " ", "make", " ", "http", " ", "request", "s", " ", "to", " ", "PAN", " ", "firewall_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "libpa", "th_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "[_", ":_", "0_", "]_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "libpa", "th_", ",_", "'", "lib", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "common_", "._", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "get", "Child_", "(_", "'", "retrieve", "Wild", "Fire", "Report", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "set", "Leve", "l", "(", "common", ".", "logg", "ing", ".", "INFO", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "environment_", "._", "run", "\\u", "by", "\\u", "splu", "nk_", "(_", ")_", ":_", "\\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_", "splu", "nk_", "._", "Inter", "splu", "nk_", "#", " ", "so", " ", "you", " ", "can", " ", "interact", " ", "with", " ", "Spl", "unk", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "splu", "nk_", "._", "entity_", "as_", "entity_", "#", " ", "for", " ", "splu", "nk", " ", "config", " ", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "exception", " ", "to", " ", "produce", " ", "logs", " ", "to", " ", "python", ".", "log_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Error", " ", "dur", "ing", " ", "import", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "environment_", "._", "run", "\\u", "by", "\\u", "splu", "nk_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "\\u", "splu", "nk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main", "\\u", "cli_", "(_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cli", "\\u", "args_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "ed", " ", "if", " ", "this", " ", "script", " ", "is", " ", "run", " ", "from", " ", "the", " ", "CLI", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "is", " ", "not", " ", "used", " ", "if", " ", "script", " ", "run", " ", "from", " ", "Spl", "unk", " ", "search", "bar", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "the", " ", "argu", "ment", " ", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "Down", "load", " ", "a", " ", "Wild", "fire", " ", "Report", " ", "usi", "ng", " ", "the", " ", "Wild", "fire", " ", "API", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "parser", ".", "add", "\\u", "argu", "ment", "('", "-", "v", "',", " ", "'--", "verbo", "se", "',", " ", "action", "='", "store", "\\u", "true", "',", " ", "help", "=\"", "Verbos", "e", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "api", "key", "'_", ",_", "help_", "=_", "\"", "API", " ", "Key", " ", "from", " ", "https", "://", "wild", "fire", ".", "pal", "oa", "lto", "network", "s", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "serial", "'_", ",_", "help_", "=_", "\"", "Ser", "ial", " ", "number", " ", "of", " ", "the", " ", "device", " ", "whi", "ch", " ", "produce", "d", " ", "the", " ", "Wild", "Fire", " ", "syslo", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "report", "id", "'_", ",_", "help_", "=_", "\"", "ID", " ", "of", " ", "the", " ", "report", " ", "in", " ", "the", " ", "Wild", "Fire", " ", "cloud", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Open", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "gener", "ic", " ", "opene", "r", " ", "for", " ", "http", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "partic", "ular", "ly", " ", "help", "ful", " ", "whe", "n", " ", "there", " ", "is", " ", "a", " ", "proxy", " ", "server", " ", "in", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thanks", " ", "to", ":", " ", "http", "://", "www", ".", "deca", "lag", "e", ".", "info", "/", "en", "/", "python", "/", "url", "lib", "2n", "opr", "oxy", "_", "\\u\\u\\uNL\\u\\u\\u_", "proxy", "\\u", "handler_", "=_", "urllib2_", "._", "Pro", "xy", "Handler_", "(_", "HTTP", "\\u", "PROX", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opener_", "=_", "urllib2_", "._", "build", "\\u", "opener_", "(_", "proxy", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urllib2_", "._", "install", "\\u", "opener_", "(_", "opener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "opener_", "\\u\\u\\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_", "retrieve", "Wild", "Fire", "Data_", "(_", "apikey_", ",_", "serial_", ",_", "report", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "url", "lib", "2", " ", "opener_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opener_", "=_", "create", "Open", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "URL", " ", "for", " ", "Wild", "Fire", " ", "cloud", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "wf", "Url_", "=_", "'", "https", "://", "wild", "fire", ".", "pal", "oa", "lto", "network", "s", ".", "com", "/", "public", "api", "/", "report", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prepare", " ", "the", " ", "variab", "les", " ", "as", " ", "POST", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "data_", "=_", "urllib_", "._", "urlencode_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "api", "key", "'_", ":_", "apikey_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "device", "\\u", "id", "'_", ":_", "serial_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "report", "\\u", "id", "'_", ":_", "report", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "request", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "wf", "Req_", "=_", "urllib2_", "._", "Request_", "(_", "wf", "Url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "the", " ", "request", " ", "to", " ", "the", " ", "Wild", "Fire", " ", "cloud_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "opener_", "._", "open_", "(_", "wf", "Req_", ",_", "post", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main", "\\u", "cli_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "command", " ", "line", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "get", "\\u", "cli", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "debug", " ", "=", " ", "options", ".", "verbose_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", " ", "=", " ", "common", ".", "logg", "ing", ".", "get", "Log", "ger", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "common", ".", "logg", "ing", ".", "basic", "Config", "(", "level", "=", "common", ".", "logg", "ing", ".", "INFO", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "debug", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "logg", "er", ".", "set", "Leve", "l", "(", "common", ".", "logg", "ing", ".", "DEBU", "G", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "logg", "er", ".", "info", "(\"", "Verbos", "e", " ", "logg", "ing", " ", "enable", "d", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "Wild", "Fire", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "retrieve", "Wild", "Fire", "Data_", "(_", "options_", "._", "apikey_", ",_", "options_", "._", "serial_", ",_", "options_", "._", "report", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "XML", " ", "for", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "data_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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_", "main", "\\u", "splu", "nk_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "argu", "ment", "s", " ", "pass", "ed", " ", "to", " ", "command", " ", "on", " ", "Spl", "unk", " ", "search", "bar_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", ",_", "kwargs_", "=_", "splu", "nk_", "._", "Inter", "splu", "nk_", "._", "get", "Key", "words", "And", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "common_", "._", "check", "\\u", "debug_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "the", " ", "logg", "er", ".", " ", "$", "SPL", "UNK", "\\u", "HOM", "E", "/", "var", "/", "log", "/", "splu", "nk", "/", "python", ".", "log_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "common_", "._", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "set", "Level_", "(_", "common_", "._", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Result", "s", " ", "contain", "s", " ", "the", " ", "data", " ", "from", " ", "the", " ", "search", " ", "results", " ", "and", " ", "settings", " ", "contains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "session", "Key", " ", "tha", "t", " ", "we", " ", "can", " ", "use", " ", "to", " ", "talk", " ", "to", " ", "splu", "nk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Get", "ting", " ", "search", " ", "results", " ", "and", " ", "settings", " ", "from", " ", "Spl", "unk", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", ",_", "unu", "sed", "1_", ",_", "settings_", "=_", "splu", "nk_", "._", "Inter", "splu", "nk_", "._", "get", "Organiz", "ed", "Results_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "session", "Key_", "\\u\\u\\uNL\\u\\u\\u_", "session", "Key_", "=_", "settings_", "[_", "'", "session", "Key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "logs", " ", "to", " ", "act", " ", "on", ",", " ", "get", " ", "the", " ", "Pan", "ora", "ma", " ", "user", " ", "and", " ", "password", " ", "from", " ", "Spl", "unk", " ", "usi", "ng", " ", "the", " ", "session", "Key_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "No", " ", "search", " ", "results", ".", " ", " ", "Not", "hing", " ", "to", " ", "do", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splu", "nk_", "._", "Inter", "splu", "nk_", "._", "output", "Results_", "(_", "results_", ")_", "\\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_", "logger_", "._", "debug_", "(_", "\"", "Get", "ting", " ", "Wild", "fire", " ", "API", "Key", " ", "from", " ", "encrypt", "ed", " ", "store", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wf", "\\u", "apikey_", "=_", "common_", "._", "get", "\\u", "wild", "fire", "\\u", "apikey_", "(_", "session", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "wild", "fire", " ", "report", " ", "for", " ", "each", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Get", "ting", " ", "Wild", "fire", " ", "report", "s", " ", "for", " ", "%", "s", " ", "search", " ", "results", "\"_", "%_", "len_", "(_", "results_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "result_", "in_", "enumerate_", "(_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "result", " ", "has", " ", "the", " ", "necessar", "y", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "serial", "\\u", "number", "'_", "in_", "result_", "and_", "'", "report", "\\u", "id", "'_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "Get", "ting", " ", "Wild", "fire", " ", "report", " ", "for", " ", "result", " ", "#", " ", "%", "s", " ", "with", " ", "report", "\\u", "id", ":", " ", "%", "s", "\"_", "%_", "(_", "idx_", ",_", "result_", "[_", "'", "report", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wf", "Report", "Xml_", "=_", "retrieve", "Wild", "Fire", "Data_", "(_", "wf", "\\u", "apikey_", ",_", "result_", "[_", "'", "serial", "\\u", "number", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "report", "\\u", "id", "'_", "]_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "report", " ", "id", " ", "to", " ", "the", " ", "XML", " ", "for", " ", "correlation", " ", "to", " ", "the", " ", "original", " ", "Wild", "Fire", " ", "log", " ", "from", " ", "the", " ", "firewall_", "\\u\\u\\uNL\\u\\u\\u_", "wf", "Report", "Xml_", "=_", "wf", "Report", "Xml_", "._", "replace_", "(_", "\"<", "/", "version", ">\"_", ",_", "\"<", "/", "version", ">\\\\", "n", "<", "id", ">\"_", "+_", "result_", "[_", "'", "report", "\\u", "id", "'_", "]_", "+_", "\"<", "/", "id", ">\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "wild", "fire", "\\u", "report", "'_", "]_", "=_", "wf", "Report", "Xml_", "\\u\\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_", "._", "warn_", "(_", "\"", "Error", " ", "retrie", "ving", " ", "Wild", "Fire", " ", "report", " ", "for", " ", "report", " ", "id", ":", " ", "%", "s", "\"_", "%_", "result_", "[_", "'", "report", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Log", " ", "the", " ", "result", " ", "row", " ", "in", " ", "case", " ", "of", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Log", " ", "with", " ", "error", ":", " ", "%", "s", "\"_", "%_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stack_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Log", " ", "the", " ", "stack", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "warn_", "(_", "stack_", ")_", "\\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 ", " _", "logger_", "._", "debug_", "(_", "\"", "Requ", "ired", " ", "fields", " ", "missi", "ng", " ", "from", " ", "result", " ", "#", " ", "%", "s", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Expect", "ed", " ", "the", " ", "follow", "ing", " ", "fields", ":", " ", "serial", "\\u", "number", ",", " ", "report", "\\u", "id", "\"_", "%_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "output", " ", "the", " ", "complete", " ", "results", " ", "sent", " ", "back", " ", "to", " ", "splu", "nk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "splu", "nk_", "._", "Inter", "splu", "nk_", "._", "output", "Results_", "(_", "results_", ")_", "\\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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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 ]
Unused import
neurodata/ndstore/stats/imghist.py
[ { "content": "# Copyright 2015 Open Connectome Project (http://openconnecto.me)\n# \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n# http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport sys\nimport os\nimport numpy as np\nimport urllib, urllib2\nimport cStringIO\nfrom contextlib import closing\nimport zlib\n\nsys.path += [os.path.abspath('../django')]\nimport OCP.settings\nos.environ['DJANGO_SETTINGS_MODULE'] = 'OCP.settings'\nfrom django.conf import settings\n\nimport django\ndjango.setup()\n\nfrom cube import Cube\nimport ocpcarest\nimport ocplib\nimport ocpcaproj\nimport ocpcadb\n\n\"\"\" Determine a histogram from an image stack \"\"\"\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ImgHist():\n \"\"\" Get the histogram for an image dataset by getting individual histograms for cube aligned cutouts, then summing \"\"\" \n \n", "metadata": "root.ImgHist", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def __init__(self, token, channel, res, bits):\n self.token = token\n self.channel = channel\n self.res = int(res)\n self.numbins = 2**int(bits)", "metadata": "root.ImgHist.__init__", "header": "['class', 'ImgHist', '(', ')', ':', '___EOS___']", "index": 42 }, { "content": " def getHist(self):\n\n with closing (ocpcaproj.OCPCAProjectsDB()) as projdb:\n proj = projdb.loadToken(self.token)\n \n with closing (ocpcadb.OCPCADB(proj)) as db:\n ch = proj.getChannelObj(self.channel)\n\n # Get the source database sizes\n [[ximagesz, yimagesz, zimagesz], timerange] = proj.datasetcfg.imageSize(self.res)\n [xcubedim, ycubedim, zcubedim] = cubedim = proj.datasetcfg.getCubeDims()[self.res]\n [xoffset, yoffset, zoffset] = proj.datasetcfg.getOffset()[self.res]\n\n # Set the limits for iteration on the number of cubes in each dimension\n xlimit = (ximagesz-1) / xcubedim + 1\n ylimit = (yimagesz-1) / ycubedim + 1\n zlimit = (zimagesz-1) / zcubedim + 1\n\n hist_sum = np.zeros(self.numbins, dtype=np.uint32) \n \n # sum the histograms \n for z in range(zlimit):\n for y in range(ylimit):\n for x in range(xlimit):\n\n # cutout the data for the cube \n data = db.cutout(ch, [ x*xcubedim, y*ycubedim, z*zcubedim], cubedim, self.res ).data\n \n # compute the histogram and store it \n (hist, bins) = np.histogram(data[data > 0], bins=self.numbins, range=(0,self.numbins))\n hist_sum = np.add( hist_sum, hist )\n print \"Processed cube {} {} {}\".format(x,y,z)\n \n return (hist_sum, bins)", "metadata": "root.ImgHist.getHist", "header": "['class', 'ImgHist', '(', ')', ':', '___EOS___']", "index": 48 } ]
[ { "span": "import argparse", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 15 }, { "span": "import urllib, urllib2", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 22 }, { "span": "import cStringIO", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 16 }, { "span": "import zlib", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 11 }, { "span": "import OCP.settings", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 19 }, { "span": "from django.conf import settings", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 32 }, { "span": "from cube import Cube", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 21 }, { "span": "import ocpcarest", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 16 }, { "span": "import ocplib", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Open", " ", "Connect", "ome", " ", "Project", " ", "(", "http", "://", "openco", "nnect", "o", ".", "me", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", ",_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "closing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "+=_", "[_", "os_", "._", "path_", "._", "abspath_", "(_", "'../", "django", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "OC", "P_", "._", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", "=_", "'", "OC", "P", ".", "settings", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "django_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cube_", "import_", "Cube_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "oc", "pca", "rest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "oc", "pli", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "oc", "pcap", "roj", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "oc", "pca", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Det", "erm", "ine", " ", "a", " ", "histo", "gram", " ", "from", " ", "an", " ", "image", " ", "stack", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Im", "g", "Hist_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "histo", "gram", " ", "for", " ", "an", " ", "image", " ", "dataset", " ", "by", " ", "getti", "ng", " ", "individual", " ", "histograms", " ", "for", " ", "cube", " ", "aligned", " ", "cuto", "uts", ",", " ", "then", " ", "summ", "ing", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Im", "g", "Hist_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "token_", ",_", "channel_", ",_", "res_", ",_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "token_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "channel_", "=_", "channel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res_", "=_", "int_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "numb", "ins_", "=_", "2_", "**_", "int_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Im", "g", "Hist_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Hist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "closing_", "(_", "oc", "pcap", "roj", "_", "._", "OC", "PCA", "Project", "s", "DB_", "(_", ")_", ")_", "as_", "proj", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proj_", "=_", "proj", "db_", "._", "load", "Token_", "(_", "self_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "closing_", "(_", "oc", "pca", "db_", "._", "OC", "PCA", "DB_", "(_", "proj_", ")_", ")_", "as_", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ch_", "=_", "proj_", "._", "get", "Chan", "nel", "Obj_", "(_", "self_", "._", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "source", " ", "databa", "se", " ", "sizes_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "xim", "age", "sz_", ",_", "yi", "mage", "sz_", ",_", "zim", "age", "sz_", "]_", ",_", "timer", "ange_", "]_", "=_", "proj_", "._", "dataset", "cfg_", "._", "image", "Size_", "(_", "self_", "._", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "xc", "ube", "dim_", ",_", "yc", "ube", "dim_", ",_", "zc", "ube", "dim_", "]_", "=_", "cube", "dim_", "=_", "proj_", "._", "dataset", "cfg_", "._", "get", "Cub", "e", "Dims", "_", "(_", ")_", "[_", "self_", "._", "res_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "xoff", "set_", ",_", "yoff", "set_", ",_", "zo", "ffset", "_", "]_", "=_", "proj_", "._", "dataset", "cfg_", "._", "get", "Offset_", "(_", ")_", "[_", "self_", "._", "res_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "limit", "s", " ", "for", " ", "iterati", "on", " ", "on", " ", "the", " ", "number", " ", "of", " ", "cubes", " ", "in", " ", "each", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "xlim", "it_", "=_", "(_", "xim", "age", "sz_", "-_", "1_", ")_", "/_", "xc", "ube", "dim_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylim", "it_", "=_", "(_", "yi", "mage", "sz_", "-_", "1_", ")_", "/_", "yc", "ube", "dim_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zli", "mit_", "=_", "(_", "zim", "age", "sz_", "-_", "1_", ")_", "/_", "zc", "ube", "dim_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hist", "\\u", "sum_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "numb", "ins_", ",_", "dtype_", "=_", "np_", "._", "uint32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sum", " ", "the", " ", "histograms", " _", "\\u\\u\\uNL\\u\\u\\u_", "for_", "z_", "in_", "range_", "(_", "zli", "mit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "y_", "in_", "range_", "(_", "ylim", "it_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "xlim", "it_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cuto", "ut", " ", "the", " ", "data", " ", "for", " ", "the", " ", "cube", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "db_", "._", "cuto", "ut_", "(_", "ch_", ",_", "[_", "x_", "*_", "xc", "ube", "dim_", ",_", "y_", "*_", "yc", "ube", "dim_", ",_", "z_", "*_", "zc", "ube", "dim_", "]_", ",_", "cube", "dim_", ",_", "self_", "._", "res_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compute", " ", "the", " ", "histo", "gram", " ", "and", " ", "store", " ", "it", " _", "\\u\\u\\uNL\\u\\u\\u_", "(_", "hist_", ",_", "bins_", ")_", "=_", "np_", "._", "histogram_", "(_", "data_", "[_", "data_", ">_", "0_", "]_", ",_", "bins_", "=_", "self_", "._", "numb", "ins_", ",_", "range_", "=_", "(_", "0_", ",_", "self_", "._", "numb", "ins_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist", "\\u", "sum_", "=_", "np_", "._", "add_", "(_", "hist", "\\u", "sum_", ",_", "hist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Processe", "d", " ", "cube", " ", "{}", " ", "{}", " ", "{}\"_", "._", "format_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "\\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_", "(_", "hist", "\\u", "sum_", ",_", "bins_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
`__eq__` not overridden when adding attributes
eevee/sanpera/sanpera/color.py
[ { "content": "class BaseColor(object):\n \"\"\"Represents a color.\n\n Colors have some amount of color data (determined by the colorspace, but\n generally three channels' worth), an opacity, and an arbitrary number of\n other user-defined channels. Channels' values are floats ranging from 0.0\n to 1.0.\n\n Particular colorspaces, and conversions between them, are implemented as\n subclasses of this class.\n\n All colors are immutable. Convenience methods exist to make simple\n modifications, which will return a new color.\n \"\"\"\n\n # TODO maybe i should just store the opacity like IM does, and only convert\n # when exposing to python :| and call it alpha.\n\n COLOR_WHEEL = [\n \"red\", \"orange\", \"yellow\", \"chartreuse\",\n \"green\", \"seafoam\", \"cyan\", \"azure\",\n \"blue\", \"violet\", \"magenta\", \"rose\",\n ]\n\n\n\n # TODO call me alpha\n\n # TODO does this work??\n\n ### Conversions\n\n\n\n ### Constructors\n\n\n\n\n\n\n\n ### Special methods\n\n", "metadata": "root.BaseColor", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def __init__(self):\n raise TypeError(\"Can't instantiate BaseColor; use a subclass or other constructor\")", "metadata": "root.BaseColor.__init__", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " @property\n def description(self):\n \"\"\"Return a human-friendly description of this color as a string.\"\"\"\n hslself = self.hsl()\n\n # Do lightness first, because it can short-circuit for near-black\n # and near-white\n l = hslself.lightness\n if l <= 0:\n return \"black\"\n elif l < 0.025:\n return \"blackish\"\n elif l < 0.1:\n shade = \"very dark\"\n elif l < 0.2:\n shade = \"kinda dark\"\n elif l < 0.3:\n shade = \"dark\"\n elif l < 0.4:\n shade = \"\"\n elif l < 0.6:\n shade = \"bright\"\n elif l < 0.7:\n shade = \"powder\"\n elif l < 0.8:\n shade = \"pastel\"\n elif l < 0.9:\n shade = \"light\"\n elif l < 0.975:\n shade = \"pale\"\n elif l < 1:\n return \"whitish\"\n else:\n return \"white\"\n\n # Saturation, another potential short-circuit, and another\n # adjective to be stuck on a color name\n s = hslself.saturation\n if s < 0.015:\n if shade:\n return shade + \" gray\"\n else:\n return \"gray\"\n elif s < 0.05:\n sat = \"grayish\"\n elif s < 0.15:\n sat = \"very dim\"\n elif s < 0.25:\n sat = \"dim\"\n elif s < 0.4:\n sat = \"dusty\"\n elif s < 0.6:\n sat = \"\"\n elif s < 0.75:\n sat = \"deep\"\n elif s < 0.85:\n sat = \"bold\"\n elif s < 0.95:\n sat = \"intense\"\n else:\n sat = \"pure\"\n\n # Compute the hue description. Find the name from the list of\n # colors above, treating each as the *middle* of a section, and\n # treat colors roughly halfway between X and Y as \"X-Y\"\n h = hslself.hue\n colors = len(self.COLOR_WHEEL)\n wheel_position = (h * colors + 0.5 / colors) % colors\n wheel_index = int(wheel_position)\n\n hue = self.COLOR_WHEEL[wheel_index]\n if wheel_position - wheel_index > 0.5:\n hue += \"-\" + self.COLOR_WHEEL[(wheel_index + 1) % colors]\n\n color = hue\n if sat:\n color = sat + \" \" + color\n if shade:\n color = shade + \" \" + color\n\n # TODO opacity description?\n return color", "metadata": "root.BaseColor.description", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " @property\n def opacity(self):\n return self._opacity", "metadata": "root.BaseColor.opacity", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 137 }, { "content": " @property\n def extra_channels(self):\n return self._extra_channels", "metadata": "root.BaseColor.extra_channels", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def rgb(self):\n raise NotImplementedError", "metadata": "root.BaseColor.rgb", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": " def hsl(self):\n raise NotImplementedError", "metadata": "root.BaseColor.hsl", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 151 }, { "content": " @classmethod\n def parse(cls, name):\n \"\"\"Parse a color specification.\n\n Supports a whole buncha formats.\n \"\"\"\n # TODO i don't like that this is tied to imagemagick's implementation.\n # would rather do most of the parsing myself, well-define what those\n # formats *are*, and use some other mechanism to expose the list of\n # builtin color names. (maybe several lists, even.)\n # TODO also this always returns RGB anyway.\n\n pixel = ffi.new(\"PixelPacket *\")\n\n with magick_try() as exc:\n success = lib.QueryColorDatabase(name.encode('ascii'), pixel, exc.ptr)\n if not success:\n raise ValueError(\"Can't find a color named {0!r}\".format(name))\n\n return cls._from_pixel(pixel)", "metadata": "root.BaseColor.parse", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 156 }, { "content": " @classmethod\n def coerce(cls, value):\n if isinstance(value, cls):\n # Already an object; do nothing\n return value\n\n # Probably a name; parse it\n return cls.parse(value)", "metadata": "root.BaseColor.coerce", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 177 }, { "content": " @classmethod\n def _from_pixel(cls, pixel):\n \"\"\"Create a color from a PixelPacket.\"\"\"\n array = ffi.new(\"double[]\", 4)\n lib.sanpera_pixel_to_doubles(pixel, array)\n\n # Okay, yes, this isn't much of a classmethod. TODO?\n return RGBColor._from_c_array(array)", "metadata": "root.BaseColor._from_pixel", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 186 }, { "content": " def _populate_pixel(self, pixel):\n \"\"\"Copy values to a PixelPacket.\"\"\"\n rgb = self.rgb()\n lib.sanpera_pixel_from_doubles(pixel, rgb._array)\n # TODO extra channels?", "metadata": "root.BaseColor._populate_pixel", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 195 }, { "content": " def _populate_magick_pixel(self, pixel):\n \"\"\"Copy values to a MagickPixelPacket.\"\"\"\n rgb = self.rgb()\n lib.sanpera_magick_pixel_from_doubles(pixel, rgb._array)\n # TODO extra channels?\n # TODO imagemagick code uses:\n # SetMagickPixelPacket(image,start_color,(IndexPacket *) NULL, ptr)\n # ... why the IndexPacket? should i be using that?", "metadata": "root.BaseColor._populate_magick_pixel", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 201 }, { "content": " def __eq__(self, other):\n if not isinstance(other, BaseColor):\n return NotImplemented\n\n left = self.rgb()\n right = other.rgb()\n\n # TODO should all alpha=0 colors be equal?\n return (\n left._red == right._red and\n left._green == right._green and\n left._blue == right._blue and\n left._opacity == right._opacity)", "metadata": "root.BaseColor.__eq__", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": " def __ne__(self, other):\n return not self.__eq__(other)", "metadata": "root.BaseColor.__ne__", "header": "['class', 'BaseColor', '(', 'object', ')', ':', '___EOS___']", "index": 227 }, { "content": "class RGBColor(BaseColor):\n\n\n\n\n\n\n\n\n # TODO are these even useful without cython? they're just python doubles\n # now. (nice to stay immutable, but other ways to do that)\n\n\n\n\n", "metadata": "root.RGBColor", "header": "['module', '___EOS___']", "index": 231 }, { "content": " def __init__(self, red, green, blue, opacity=1.0, _array=None):\n self._red = red\n self._green = green\n self._blue = blue\n self._opacity = opacity\n self._extra_channels = ()\n\n if _array is None:\n self._array = ffi.new(\"double[]\", [red, green, blue, opacity])\n else:\n self._array = _array", "metadata": "root.RGBColor.__init__", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 232 }, { "content": " @classmethod\n def _from_c_array(cls, array):\n return cls(*array, _array=array)", "metadata": "root.RGBColor._from_c_array", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 244 }, { "content": " def __repr__(self):\n return \"<RGBColor {0:0.3f} red, {1:0.3f} green, {2:0.3f} blue ({3}) {4:0.1f}% opacity>\".format(\n self._red, self._green, self._blue, self.description, self._opacity * 100)", "metadata": "root.RGBColor.__repr__", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 248 }, { "content": " def __mul__(self, factor):\n # TODO does this semantic make sense? it's just what IM's fx syntax\n # does\n # TODO this is only defined for RGB. move it to base and just make it\n # convert to RGB, then back to the original class...?\n\n # TODO extra channels??\n return RGBColor(\n self._red * factor,\n self._green * factor,\n self._blue * factor,\n self._opacity)", "metadata": "root.RGBColor.__mul__", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 252 }, { "content": " def __rmul__(self, factor):\n return self.__mul__(factor)", "metadata": "root.RGBColor.__rmul__", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 265 }, { "content": " def __add__(self, other):\n # TODO this is also what IM's fx syntax does; maybe a little less\n # sensible than multiplication even.\n # TODO type check\n # TODO extra channels\n return RGBColor(\n self._red + other,\n self._green + other,\n self._blue + other,\n self._opacity)", "metadata": "root.RGBColor.__add__", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 268 }, { "content": " def __sub__(self, other):\n return self + (-other)", "metadata": "root.RGBColor.__sub__", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 279 }, { "content": " def clamped(self):\n return RGBColor(\n _clamp(self._red),\n _clamp(self._green),\n _clamp(self._blue),\n _clamp(self._opacity))\n # TODO every color type\n # TODO extra channels (clamp them??)", "metadata": "root.RGBColor.clamped", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 282 }, { "content": " @property\n def red(self):\n return self._red", "metadata": "root.RGBColor.red", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 293 }, { "content": " @property\n def green(self):\n return self._green", "metadata": "root.RGBColor.green", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 297 }, { "content": " @property\n def blue(self):\n return self._blue", "metadata": "root.RGBColor.blue", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 301 }, { "content": " @property\n def alpha(self):\n return self._opacity", "metadata": "root.RGBColor.alpha", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 305 }, { "content": " def rgb(self):\n return self", "metadata": "root.RGBColor.rgb", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 309 }, { "content": " def hsl(self):\n hue, light, sat = colorsys.rgb_to_hls(\n _clamp(self._red), _clamp(self._green), _clamp(self._blue))\n # TODO extra channels\n return HSLColor(hue, sat, light, self._opacity)", "metadata": "root.RGBColor.hsl", "header": "['class', 'RGBColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 312 }, { "content": "class CMYKColor(BaseColor):\n", "metadata": "root.CMYKColor", "header": "['module', '___EOS___']", "index": 319 }, { "content": " def __init__(self, cyan, magenta, yellow, black, alpha=1.0):\n self.cyan = cyan\n self.magenta = magenta\n self.yellow = yellow\n self.black = black\n self.alpha = alpha", "metadata": "root.CMYKColor.__init__", "header": "['class', 'CMYKColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 320 }, { "content": " def rgb(self):\n return RGBColor(\n 1 - self.cyan - self.black,\n 1 - self.magenta - self.black,\n 1 - self.yellow - self.black,\n self.alpha)", "metadata": "root.CMYKColor.rgb", "header": "['class', 'CMYKColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 327 }, { "content": "class HSLColor(BaseColor):\n\n\n\n\n\n", "metadata": "root.HSLColor", "header": "['module', '___EOS___']", "index": 335 }, { "content": " def __init__(self, hue, saturation, lightness, opacity=1.0):\n if hue == 1.0:\n hue = 0.0\n\n self._hue = hue\n self._saturation = saturation\n self._lightness = lightness\n self._opacity = opacity\n self._extra_channels = ()", "metadata": "root.HSLColor.__init__", "header": "['class', 'HSLColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 336 }, { "content": " def __repr__(self):\n return \"<HSLColor {0:0.3f} hue, {1:0.3f} sat, {2:0.3f} light ({3}) {4:0.1f}% opacity>\".format(\n self._hue, self._saturation, self._lightness, self.description, self._opacity * 100)", "metadata": "root.HSLColor.__repr__", "header": "['class', 'HSLColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 346 }, { "content": " @property\n def hue(self):\n return self._hue", "metadata": "root.HSLColor.hue", "header": "['class', 'HSLColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 350 }, { "content": " @property\n def saturation(self):\n return self._saturation", "metadata": "root.HSLColor.saturation", "header": "['class', 'HSLColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 354 }, { "content": " @property\n def lightness(self):\n return self._lightness", "metadata": "root.HSLColor.lightness", "header": "['class', 'HSLColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 358 }, { "content": " def rgb(self):\n r, g, b = colorsys.hls_to_rgb(self._hue, self._lightness, self._saturation)\n # TODO extra channels\n return RGBColor(r, g, b, self._opacity)", "metadata": "root.HSLColor.rgb", "header": "['class', 'HSLColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 362 }, { "content": " def hsl(self):\n return self", "metadata": "root.HSLColor.hsl", "header": "['class', 'HSLColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 367 }, { "content": "class GrayColor(BaseColor):\n\n", "metadata": "root.GrayColor", "header": "['module', '___EOS___']", "index": 371 }, { "content": " def __init__(self, value, alpha=1.0):\n self.value = value\n self.alpha = alpha", "metadata": "root.GrayColor.__init__", "header": "['class', 'GrayColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 372 }, { "content": " def rgb(self):\n return RGBColor(self.value, self.value, self.value, self.alpha)", "metadata": "root.GrayColor.rgb", "header": "['class', 'GrayColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 376 }, { "content": " def hsl(self):\n return HSLColor(0, 0, self.value, self.alpha)", "metadata": "root.GrayColor.hsl", "header": "['class', 'GrayColor', '(', 'BaseColor', ')', ':', '___EOS___']", "index": 379 } ]
[ { "span": "class RGBColor(BaseColor):", "start_line": 231, "start_column": 0, "end_line": 231, "end_column": 26 }, { "span": "class CMYKColor(BaseColor):", "start_line": 319, "start_column": 0, "end_line": 319, "end_column": 27 }, { "span": "class HSLColor(BaseColor):", "start_line": 335, "start_column": 0, "end_line": 335, "end_column": 26 }, { "span": "class GrayColor(BaseColor):", "start_line": 371, "start_column": 0, "end_line": 371, "end_column": 27 } ]
[ { "span": "def __eq__(self, other):", "start_line": 213, "start_column": 4, "end_line": 213, "end_column": 28 }, { "span": "self._red ", "start_line": 233, "start_column": 8, "end_line": 233, "end_column": 17 }, { "span": "self._green ", "start_line": 234, "start_column": 8, "end_line": 234, "end_column": 19 }, { "span": "self._blue ", "start_line": 235, "start_column": 8, "end_line": 235, "end_column": 18 }, { "span": "self._opacity ", "start_line": 236, "start_column": 8, "end_line": 236, "end_column": 21 }, { "span": "self._extra_channels ", "start_line": 237, "start_column": 8, "end_line": 237, "end_column": 28 }, { "span": "self._array ", "start_line": 240, "start_column": 12, "end_line": 240, "end_column": 23 }, { "span": "self._array ", "start_line": 242, "start_column": 12, "end_line": 242, "end_column": 23 }, { "span": "self.cyan ", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 17 }, { "span": "self.magenta ", "start_line": 322, "start_column": 8, "end_line": 322, "end_column": 20 }, { "span": "self.yellow ", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 19 }, { "span": "self.black ", "start_line": 324, "start_column": 8, "end_line": 324, "end_column": 18 }, { "span": "self.alpha ", "start_line": 325, "start_column": 8, "end_line": 325, "end_column": 18 }, { "span": "self._hue ", "start_line": 340, "start_column": 8, "end_line": 340, "end_column": 17 }, { "span": "self._saturation ", "start_line": 341, "start_column": 8, "end_line": 341, "end_column": 24 }, { "span": "self._lightness ", "start_line": 342, "start_column": 8, "end_line": 342, "end_column": 23 }, { "span": "self._opacity ", "start_line": 343, "start_column": 8, "end_line": 343, "end_column": 21 }, { "span": "self._extra_channels ", "start_line": 344, "start_column": 8, "end_line": 344, "end_column": 28 }, { "span": "self.value ", "start_line": 373, "start_column": 8, "end_line": 373, "end_column": 18 }, { "span": "self.alpha ", "start_line": 374, "start_column": 8, "end_line": 374, "end_column": 18 } ]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "a", " ", "color", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Color", "s", " ", "have", " ", "some", " ", "amo", "unt", " ", "of", " ", "color", " ", "data", " ", "(", "dete", "rmin", "ed", " ", "by", " ", "the", " ", "colors", "pace", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "genera", "ll", "y", " ", "three", " ", "channel", "s", "'", " ", "worth", "),", " ", "an", " ", "opa", "city", ",", " ", "and", " ", "an", " ", "arbitra", "ry", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "user", "-", "defin", "ed", " ", "channel", "s", ".", " ", " ", "Chan", "nels", "'", " ", "values", " ", "are", " ", "float", "s", " ", "rang", "ing", " ", "from", " ", "0.", "0", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "1.0", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parti", "cula", "r", " ", "colors", "paces", ",", " ", "and", " ", "conversions", " ", "bet", "ween", " ", "them", ",", " ", "are", " ", "implemented", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "subclasses", " ", "of", " ", "this", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "colors", " ", "are", " ", "immutable", ".", " ", " ", "Conve", "nie", "nce", " ", "method", "s", " ", "exist", " ", "to", " ", "make", " ", "simple", "\\", "10", ";", " ", " ", " ", " ", "modification", "s", ",", " ", "whi", "ch", " ", "will", " ", "return", " ", "a", " ", "new", " ", "color", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "may", "be", " ", "i", " ", "shou", "ld", " ", "just", " ", "store", " ", "the", " ", "opa", "city", " ", "like", " ", "IM", " ", "doe", "s", ",", " ", "and", " ", "only", " ", "convert_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "expos", "ing", " ", "to", " ", "python", " ", " ", ":|", " ", " ", "and", " ", "call", " ", "it", " ", "alpha", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COLOR", "\\u", "WHE", "EL_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "red", "\"_", ",_", "\"", "orange", "\"_", ",_", "\"", "yell", "ow", "\"_", ",_", "\"", "chart", "reus", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "green", "\"_", ",_", "\"", "sea", "foa", "m", "\"_", ",_", "\"", "cya", "n", "\"_", ",_", "\"", "azu", "re", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "blue", "\"_", ",_", "\"", "violet", "\"_", ",_", "\"", "mage", "nta", "\"_", ",_", "\"", "rose", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "call", " ", "me", " ", "alpha_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "doe", "s", " ", "this", " ", "work", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Conversion", "s_", "\\u\\u\\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_", "###", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Special", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Can", "'", "t", " ", "instantiate", " ", "Base", "Color", ";", " ", "use", " ", "a", " ", "subclass", " ", "or", " ", "other", " ", "construct", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "human", "-", "frie", "ndl", "y", " ", "description", " ", "of", " ", "this", " ", "color", " ", "as", " ", "a", " ", "string", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hs", "lse", "lf_", "=_", "self_", "._", "hs", "l_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "light", "ness", " ", "first", ",", " ", "bec", "aus", "e", " ", "it", " ", "can", " ", "short", "-", "circuit", " ", "for", " ", "near", "-", "black_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "near", "-", "white_", "\\u\\u\\uNL\\u\\u\\u_", "l_", "=_", "hs", "lse", "lf_", "._", "light", "ness_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "l_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "black", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.025", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "black", "ish", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "very", " ", "dark", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "kind", "a", " ", "dark", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "dark", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "bright", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "pow", "der", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "paste", "l", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "light", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "0.97", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shade", "_", "=_", "\"", "pale", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "l_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "whi", "tis", "h", "\"_", "\\u\\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_", "\"", "white", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Satur", "ation", ",", " ", "anot", "her", " ", "potenti", "al", " ", "short", "-", "circuit", ",", " ", "and", " ", "anot", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adj", "ective", " ", "to", " ", "be", " ", "stu", "ck", " ", "on", " ", "a", " ", "color", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "hs", "lse", "lf_", "._", "saturation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "<_", "0.015", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "shade", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "shade", "_", "+_", "\"", " ", "gray", "\"_", "\\u\\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_", "\"", "gray", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.05_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "gray", "ish", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.15_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "very", " ", "dim", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.25_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "dim", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "dust", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.75_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "deep", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.85_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "bold", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "<_", "0.95_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "inten", "se", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sat_", "=_", "\"", "pure", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "the", " ", "hue", " ", "description", ".", " ", " ", "Fin", "d", " ", "the", " ", "name", " ", "from", " ", "the", " ", "list", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "colors", " ", "above", ",", " ", "treat", "ing", " ", "each", " ", "as", " ", "the", " ", "*", "middle", "*", " ", "of", " ", "a", " ", "section", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "treat", " ", "colors", " ", "rough", "ly", " ", "half", "way", " ", "bet", "ween", " ", "X", " ", "and", " ", "Y", " ", "as", " ", "\"", "X", "-", "Y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h_", "=_", "hs", "lse", "lf_", "._", "hue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "len_", "(_", "self_", "._", "COLOR", "\\u", "WHE", "EL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wheel", "\\u", "position_", "=_", "(_", "h_", "*_", "colors_", "+_", "0.5_", "/_", "colors_", ")_", "%_", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wheel", "\\u", "index_", "=_", "int_", "(_", "wheel", "\\u", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hue_", "=_", "self_", "._", "COLOR", "\\u", "WHE", "EL_", "[_", "wheel", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wheel", "\\u", "position_", "-_", "wheel", "\\u", "index_", ">_", "0.5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hue_", "+=_", "\"-\"_", "+_", "self_", "._", "COLOR", "\\u", "WHE", "EL_", "[_", "(_", "wheel", "\\u", "index_", "+_", "1_", ")_", "%_", "colors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "color_", "=_", "hue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sat_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "sat_", "+_", "\"", " ", "\"_", "+_", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shade", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "shade", "_", "+_", "\"", " ", "\"_", "+_", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "opa", "city", " ", "description", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "opacity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "opacity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "extra", "\\u", "channels_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "extra", "\\u", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hs", "l_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parse_", "(_", "cls_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "a", " ", "color", " ", "specifica", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Supp", "orts", " ", "a", " ", "whole", " ", "bunch", "a", " ", "formats", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "i", " ", "don", "'", "t", " ", "like", " ", "tha", "t", " ", "this", " ", "is", " ", "tied", " ", "to", " ", "imagem", "agi", "ck", "'", "s", " ", "implementation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wou", "ld", " ", "rat", "her", " ", "do", " ", "most", " ", "of", " ", "the", " ", "pars", "ing", " ", "mysel", "f", ",", " ", "well", "-", "defin", "e", " ", "what", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "formats", " ", "*", "are", "*", ",", " ", "and", " ", "use", " ", "some", " ", "other", " ", "mechanism", " ", "to", " ", "expos", "e", " ", "the", " ", "list", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lti", "n", " ", "color", " ", "names", ".", " ", " ", "(", "may", "be", " ", "sever", "al", " ", "lists", ",", " ", "even", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "als", "o", " ", "this", " ", "alw", "ay", "s", " ", "return", "s", " ", "RGB", " ", "anyway", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pixel_", "=_", "ffi_", "._", "new_", "(_", "\"", "Pix", "el", "Packe", "t", " ", "*\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "magic", "k", "\\u", "try_", "(_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "lib_", "._", "Query", "Color", "Database_", "(_", "name_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", ",_", "pixel_", ",_", "exc_", "._", "ptr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Can", "'", "t", " ", "find", " ", "a", " ", "color", " ", "named", " ", "{", "0", "!", "r", "}\"_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "\\u", "from", "\\u", "pixel_", "(_", "pixel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "coerce", "_", "(_", "cls_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "read", "y", " ", "an", " ", "object", ";", " ", "do", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prob", "abl", "y", " ", "a", " ", "name", ";", " ", "parse", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "parse_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "from", "\\u", "pixel_", "(_", "cls_", ",_", "pixel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "color", " ", "from", " ", "a", " ", "Pix", "el", "Packe", "t", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array_", "=_", "ffi_", "._", "new_", "(_", "\"", "double", "[]\"_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "._", "san", "per", "a", "\\u", "pixel", "\\u", "to", "\\u", "double", "s_", "(_", "pixel_", ",_", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ok", "ay", ",", " ", "ye", "s", ",", " ", "this", " ", "isn", "'", "t", " ", "muc", "h", " ", "of", " ", "a", " ", "class", "method", ".", " ", " ", "TOD", "O", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "RGB", "Color_", "._", "\\u", "from", "\\u", "c\\u", "array_", "(_", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "populate", "\\u", "pixel_", "(_", "self_", ",_", "pixel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", " ", "values", " ", "to", " ", "a", " ", "Pix", "el", "Packe", "t", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rgb_", "=_", "self_", "._", "rgb_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "._", "san", "per", "a", "\\u", "pixel", "\\u", "from", "\\u", "double", "s_", "(_", "pixel_", ",_", "rgb_", "._", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "extra", " ", "channel", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "populate", "\\u", "magic", "k", "\\u", "pixel_", "(_", "self_", ",_", "pixel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", " ", "values", " ", "to", " ", "a", " ", "Mag", "ick", "Pix", "el", "Packe", "t", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rgb_", "=_", "self_", "._", "rgb_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "._", "san", "per", "a", "\\u", "magic", "k", "\\u", "pixel", "\\u", "from", "\\u", "double", "s_", "(_", "pixel_", ",_", "rgb_", "._", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "extra", " ", "channel", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "imagem", "agi", "ck", " ", "code", " ", "use", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "Mag", "ick", "Pix", "el", "Packe", "t", "(", "image", ",", "start", "\\u", "color", ",(", "Index", "Packe", "t", " ", "*)", " ", "NULL", ",", " ", "ptr", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", " ", "wh", "y", " ", "the", " ", "Index", "Packe", "t", "?", " ", " ", "shou", "ld", " ", "i", " ", "be", " ", "usi", "ng", " ", "tha", "t", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "other_", ",_", "Base", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "left_", "=_", "self_", "._", "rgb_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "other_", "._", "rgb_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "shou", "ld", " ", "all", " ", "alpha", "=", "0", " ", "colors", " ", "be", " ", "equal", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "left_", "._", "\\u", "red_", "==_", "right_", "._", "\\u", "red_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "left_", "._", "\\u", "green_", "==_", "right_", "._", "\\u", "green_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "left_", "._", "\\u", "blue_", "==_", "right_", "._", "\\u", "blue_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "left_", "._", "\\u", "opacity_", "==_", "right_", "._", "\\u", "opacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "are", " ", "these", " ", "even", " ", "usef", "ul", " ", "with", "out", " ", "cython", "?", " ", " ", "the", "y", "'", "re", " ", "just", " ", "python", " ", "double", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", ".", " ", " ", "(", "nice", " ", "to", " ", "stay", " ", "immutable", ",", " ", "but", " ", "other", " ", "way", "s", " ", "to", " ", "do", " ", "tha", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", ",_", "red_", ",_", "green_", ",_", "blue_", ",_", "opacity_", "=_", "1.0_", ",_", "\\u", "array_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "red_", "=_", "red_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "green_", "=_", "green_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "blue_", "=_", "blue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "opacity_", "=_", "opacity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "extra", "\\u", "channels_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "array_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "array_", "=_", "ffi_", "._", "new_", "(_", "\"", "double", "[]\"_", ",_", "[_", "red_", ",_", "green_", ",_", "blue_", ",_", "opacity_", "]_", ")_", "\\u\\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", "array_", "=_", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "from", "\\u", "c\\u", "array_", "(_", "cls_", ",_", "array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "*_", "array_", ",_", "\\u", "array_", "=_", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "\"<", "RGB", "Color", " ", "{", "0", ":", "0.", "3f", "}", " ", "red", ",", " ", "{", "1", ":", "0.", "3f", "}", " ", "green", ",", " ", "{", "2", ":", "0.", "3f", "}", " ", "blue", " ", "({", "3", "})", " ", "{", "4", ":", "0.", "1f", "}%", " ", "opa", "city", ">\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "red_", ",_", "self_", "._", "\\u", "green_", ",_", "self_", "._", "\\u", "blue_", ",_", "self_", "._", "description_", ",_", "self_", "._", "\\u", "opacity_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "factor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "doe", "s", " ", "this", " ", "sema", "ntic", " ", "make", " ", "sense", "?", " ", " ", "it", "'", "s", " ", "just", " ", "what", " ", "IM", "'", "s", " ", "fx", " ", "syntax_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "this", " ", "is", " ", "only", " ", "defin", "ed", " ", "for", " ", "RGB", ".", " ", " ", "move", " ", "it", " ", "to", " ", "base", " ", "and", " ", "just", " ", "make", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "to", " ", "RGB", ",", " ", "then", " ", "back", " ", "to", " ", "the", " ", "original", " ", "class", "...", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "extra", " ", "channel", "s", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "RGB", "Color_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "red_", "*_", "factor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "green_", "*_", "factor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "blue_", "*_", "factor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "opacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "rm", "ul", "\\u\\u_", "(_", "self_", ",_", "factor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "mul\\u\\u_", "(_", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "this", " ", "is", " ", "als", "o", " ", "what", " ", "IM", "'", "s", " ", "fx", " ", "synta", "x", " ", "doe", "s", ";", " ", "may", "be", " ", "a", " ", "litt", "le", " ", "less_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sensi", "ble", " ", "than", " ", "multiplication", " ", "even", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "type", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "extra", " ", "channels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "RGB", "Color_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "red_", "+_", "other_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "green_", "+_", "other_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "blue_", "+_", "other_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "opacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "+_", "(_", "-_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clamp", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "RGB", "Color_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "clamp", "_", "(_", "self_", "._", "\\u", "red_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "clamp", "_", "(_", "self_", "._", "\\u", "green_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "clamp", "_", "(_", "self_", "._", "\\u", "blue_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "clamp", "_", "(_", "self_", "._", "\\u", "opacity_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "every", " ", "color", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "extra", " ", "channel", "s", " ", "(", "clamp", " ", "them", "??", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "red_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "red_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "green_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "green_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "blue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "blue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "alpha_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "opacity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hs", "l_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hue_", ",_", "light_", ",_", "sat_", "=_", "colors", "ys_", "._", "rgb", "\\u", "to", "\\u", "hls", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "clamp", "_", "(_", "self_", "._", "\\u", "red_", ")_", ",_", "\\u", "clamp", "_", "(_", "self_", "._", "\\u", "green_", ")_", ",_", "\\u", "clamp", "_", "(_", "self_", "._", "\\u", "blue_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "extra", " ", "channels_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "HS", "LC", "olor_", "(_", "hue_", ",_", "sat_", ",_", "light_", ",_", "self_", "._", "\\u", "opacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "CM", "YK", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "CM", "YK", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", ",_", "cya", "n_", ",_", "mage", "nta", "_", ",_", "yellow_", ",_", "black_", ",_", "alpha_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cya", "n_", "=_", "cya", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mage", "nta", "_", "=_", "mage", "nta", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "yellow_", "=_", "yellow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "black_", "=_", "black_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "alpha_", "=_", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CM", "YK", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "RGB", "Color_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "-_", "self_", "._", "cya", "n_", "-_", "self_", "._", "black_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "-_", "self_", "._", "mage", "nta", "_", "-_", "self_", "._", "black_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", "-_", "self_", "._", "yellow_", "-_", "self_", "._", "black_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "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_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\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_", ",_", "hue_", ",_", "saturation", "_", ",_", "light", "ness_", ",_", "opacity_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hue_", "==_", "1.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hue_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "hue_", "=_", "hue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "saturation", "_", "=_", "saturation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "light", "ness_", "=_", "light", "ness_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "opacity_", "=_", "opacity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "extra", "\\u", "channels_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "\"<", "HS", "LC", "olor", " ", "{", "0", ":", "0.", "3f", "}", " ", "hue", ",", " ", "{", "1", ":", "0.", "3f", "}", " ", "sat", ",", " ", "{", "2", ":", "0.", "3f", "}", " ", "light", " ", "({", "3", "})", " ", "{", "4", ":", "0.", "1f", "}%", " ", "opa", "city", ">\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "hue_", ",_", "self_", "._", "\\u", "saturation", "_", ",_", "self_", "._", "\\u", "light", "ness_", ",_", "self_", "._", "description_", ",_", "self_", "._", "\\u", "opacity_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "hue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "hue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "saturation", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "saturation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "light", "ness_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "light", "ness_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", ",_", "g_", ",_", "b_", "=_", "colors", "ys_", "._", "hls", "\\u", "to", "\\u", "rgb_", "(_", "self_", "._", "\\u", "hue_", ",_", "self_", "._", "\\u", "light", "ness_", ",_", "self_", "._", "\\u", "saturation", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "extra", " ", "channels_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "RGB", "Color_", "(_", "r_", ",_", "g_", ",_", "b_", ",_", "self_", "._", "\\u", "opacity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HS", "LC", "olor_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hs", "l_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Gra", "y", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", "Gra", "y", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\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_", ",_", "value_", ",_", "alpha_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "alpha_", "=_", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gra", "y", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "RGB", "Color_", "(_", "self_", "._", "value_", ",_", "self_", "._", "value_", ",_", "self_", "._", "value_", ",_", "self_", "._", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gra", "y", "Color_", "(_", "Base", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hs", "l_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "HS", "LC", "olor_", "(_", "0_", ",_", "0_", ",_", "self_", "._", "value_", ",_", "self_", "._", "alpha_", ")_" ]
[ 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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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 3, 1, 1, 2, 2, 2, 3, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_derivatives.py
[ { "content": " def test_nested_2Darray_gradient_sub(self):\n\n # This tests the\n top = Assembly()\n top.add('nest', Assembly())\n top.add('driver', SimpleDriver())\n top.nest.add('comp', ArrayComp2D())\n\n top.driver.workflow.add(['nest'])\n top.nest.driver.workflow.add(['comp'])\n top.nest.create_passthrough('comp.x')\n top.nest.create_passthrough('comp.y')\n\n top.driver.add_parameter('nest.x[0][0]', low=-100, high=100)\n top.driver.add_objective('nest.y[0][1]')\n\n # Force_fd on the assy\n options = top.nest.driver.gradient_options\n options.force_fd = True\n\n top.run()\n J = top.driver.calc_gradient()\n\n self.assertTrue('x[0][0]' in top.nest._system.vec['u']._info)\n\n assert_rel_error(self, J[0][0], 4.0, .000001)", "metadata": "root.Testcase_derivatives.test_nested_2Darray_gradient_sub", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2104 }, { "content": " def test_nondifferentiable_blocks(self):\n\n self.top = set_as_top(Assembly())\n\n exp1 = ['y1 = 2.0*x1**2',\n 'y2 = 3.0*x1']\n deriv1 = ['dy1_dx1 = 4.0*x1',\n 'dy2_dx1 = 3.0']\n\n exp2 = ['y1 = 0.5*x1']\n deriv2 = ['dy1_dx1 = 0.5']\n\n exp3 = ['y1 = 3.5*x1']\n deriv3 = ['dy1_dx1 = 3.5']\n\n exp4 = ['y1 = x1 + 2.0*x2',\n 'y2 = 3.0*x1',\n 'y3 = x1*x2']\n deriv4 = ['dy1_dx1 = 1.0',\n 'dy1_dx2 = 2.0',\n 'dy2_dx1 = 3.0',\n 'dy2_dx2 = 0.0',\n 'dy3_dx1 = x2',\n 'dy3_dx2 = x1']\n\n exp5 = ['y1 = x1 + 3.0*x2 + 2.0*x3']\n deriv5 = ['dy1_dx1 = 1.0',\n 'dy1_dx2 = 3.0',\n 'dy1_dx3 = 2.0']\n\n self.top.add('comp1', ExecComp(exp1))\n self.top.add('comp2', ExecComp(exp2))\n self.top.add('comp3', ExecComp(exp3))\n self.top.add('comp4', ExecCompWithDerivatives(exp4, deriv4))\n self.top.add('comp5', ExecComp(exp5))\n\n self.top.driver.workflow.add(['comp1', 'comp2', 'comp3', 'comp4', 'comp5'])\n\n self.top.connect('comp1.y1', 'comp2.x1')\n self.top.connect('comp1.y2', 'comp3.x1')\n self.top.connect('comp2.y1', 'comp4.x1')\n self.top.connect('comp3.y1', 'comp4.x2')\n self.top.connect('comp4.y1', 'comp5.x1')\n self.top.connect('comp4.y2', 'comp5.x2')\n self.top.connect('comp4.y3', 'comp5.x3')\n\n # Case 1 - differentiable (comp4)\n\n self.top.comp1.x1 = 2.0\n self.top.run()\n\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n comp_list = simple_node_iter(self.top.driver.workflow._system.subsystems()[1]._nodes)\n self.assertTrue(len(comp_list) == 3)\n self.assertTrue('comp1' in comp_list)\n self.assertTrue('comp2' in comp_list)\n self.assertTrue('comp3' in comp_list)\n comp_list = simple_node_iter(self.top.driver.workflow._system.subsystems()[3]._nodes)\n self.assertTrue(len(comp_list) == 1)\n self.assertTrue('comp5' in comp_list)\n\n # Case 2 - differentiable (none)\n\n self.top.replace('comp4', ExecComp(exp4))\n\n self.top.comp1.x1 = 2.0\n self.top.run()\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n comp_list = simple_node_iter(self.top.driver.workflow._system.subsystems()[1]._nodes)\n self.assertTrue(len(comp_list) == 5)\n self.assertTrue('comp1' in comp_list)\n self.assertTrue('comp2' in comp_list)\n self.assertTrue('comp3' in comp_list)\n self.assertTrue('comp4' in comp_list)\n self.assertTrue('comp5' in comp_list)\n\n\n # Piggyback testing of the is_variable_local function -- make sure it\n # pokes through opaque systems.\n system = self.top.driver.workflow._system\n self.assertTrue(system.is_variable_local('comp2.y1') is True)\n\n # Case 3 - differentiable (comp5)\n\n self.top.replace('comp5', ExecCompWithDerivatives(exp5, deriv5))\n\n self.top.comp1.x1 = 2.0\n self.top.run()\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n comp_list = simple_node_iter(self.top.driver.workflow._system.subsystems()[1]._nodes)\n self.assertTrue(len(comp_list) == 4)\n self.assertTrue('comp1' in comp_list)\n self.assertTrue('comp2' in comp_list)\n self.assertTrue('comp3' in comp_list)\n self.assertTrue('comp4' in comp_list)\n\n # Case 4 - differentiable (comp1, comp3, comp5)\n\n self.top.replace('comp1', ExecCompWithDerivatives(exp1, deriv1))\n self.top.replace('comp3', ExecCompWithDerivatives(exp3, deriv3))\n\n self.top.comp1.x1 = 2.0\n self.top.run()\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='forward')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='adjoint')\n\n assert_rel_error(self, J[0, 0], 313.0, .001)\n\n comp_list = simple_node_iter(self.top.driver.workflow._system.subsystems()[3]._nodes)\n self.assertTrue(len(comp_list) == 2)\n self.assertTrue('comp2' in comp_list)\n self.assertTrue('comp4' in comp_list)\n\n\n # Put everything in a single pseudo-assy, and run fd.\n J = self.top.driver.calc_gradient(inputs=['comp1.x1'],\n outputs=['comp5.y1'],\n mode='fd')\n assert_rel_error(self, J[0, 0], 313.0, .001)", "metadata": "root.Testcase_derivatives.test_nondifferentiable_blocks", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2519 }, { "content": " def test_paramgroup_with_scaler(self):\n\n top = set_as_top(Assembly())\n top.add('comp1', GComp_noD())\n top.add('driver', SimpleDriver())\n top.driver.workflow.add(['comp1'])\n\n top.driver.add_parameter(['comp1.x1', 'comp1.x2'], low=-100, high=100, scaler=2.0)\n top.driver.add_objective('comp1.y1')\n top.run()\n\n J = top.driver.calc_gradient(mode='forward')\n assert_rel_error(self, J[0, 0], 12.0*2.0, .001)\n\n # Piggyback testing of the is_variable_local function -- make sure it\n # pokes through opaque systems.\n system = top.driver.workflow._system\n self.assertTrue(system.is_variable_local('comp1.x1') is True)\n self.assertTrue(system.is_variable_local('comp1.x2') is True)", "metadata": "root.Testcase_derivatives.test_paramgroup_with_scaler", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2878 }, { "content": " def test_missing_derivs_assume_zero(self):\n self.top = set_as_top(Assembly())\n\n self.top.add('driver', SimpleDriver())\n self.top.add('dis2', SimpleCompMissingDeriv())\n self.top.dis2.missing_deriv_policy = 'assume_zero'\n\n self.top.driver.add_objective('(dis2.y)**2')\n self.top.driver.add_parameter('dis2.x', low=-10.0, high=10.0)\n self.top.driver.add_constraint('dis2.miss_out < 24.0')\n\n self.top.run()\n\n J = self.top.driver.calc_gradient(mode='forward')\n assert_rel_error(self, J[0, 0], 24.0, .001)\n assert_rel_error(self, J[1, 0], 0.0, .001)\n\n # This will error unless we ignore missing derivs\n derivs = self.top.check_gradient(name='dis2', stream=None)\n self.assertTrue('dis2.y / dis2.x' in derivs[2])\n\n self.top.driver.run_iteration()\n J = self.top.driver.calc_gradient(inputs=['dis2.miss_in'],\n mode='fd')\n assert_rel_error(self, J[0, 0], 0.0, .001)\n assert_rel_error(self, J[1, 0], 0.0, .001)", "metadata": "root.Testcase_derivatives.test_missing_derivs_assume_zero", "header": "['class', 'Testcase_derivatives', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2932 } ]
[ { "span": "self.assertTrue('x[0][0]' in top.nest._system.vec['u']._info)", "start_line": 2127, "start_column": 8, "end_line": 2127, "end_column": 69 }, { "span": "self.assertTrue(len(comp_list) == 3)", "start_line": 2583, "start_column": 8, "end_line": 2583, "end_column": 44 }, { "span": "self.assertTrue('comp1' in comp_list)", "start_line": 2584, "start_column": 8, "end_line": 2584, "end_column": 45 }, { "span": "self.assertTrue('comp2' in comp_list)", "start_line": 2585, "start_column": 8, "end_line": 2585, "end_column": 45 }, { "span": "self.assertTrue('comp3' in comp_list)", "start_line": 2586, "start_column": 8, "end_line": 2586, "end_column": 45 }, { "span": "self.assertTrue(len(comp_list) == 1)", "start_line": 2588, "start_column": 8, "end_line": 2588, "end_column": 44 }, { "span": "self.assertTrue('comp5' in comp_list)", "start_line": 2589, "start_column": 8, "end_line": 2589, "end_column": 45 }, { "span": "self.assertTrue(len(comp_list) == 5)", "start_line": 2610, "start_column": 8, "end_line": 2610, "end_column": 44 }, { "span": "self.assertTrue('comp1' in comp_list)", "start_line": 2611, "start_column": 8, "end_line": 2611, "end_column": 45 }, { "span": "self.assertTrue('comp2' in comp_list)", "start_line": 2612, "start_column": 8, "end_line": 2612, "end_column": 45 }, { "span": "self.assertTrue('comp3' in comp_list)", "start_line": 2613, "start_column": 8, "end_line": 2613, "end_column": 45 }, { "span": "self.assertTrue('comp4' in comp_list)", "start_line": 2614, "start_column": 8, "end_line": 2614, "end_column": 45 }, { "span": "self.assertTrue('comp5' in comp_list)", "start_line": 2615, "start_column": 8, "end_line": 2615, "end_column": 45 }, { "span": "self.assertTrue(system.is_variable_local('comp2.y1') is True)", "start_line": 2621, "start_column": 8, "end_line": 2621, "end_column": 69 }, { "span": "self.assertTrue(len(comp_list) == 4)", "start_line": 2642, "start_column": 8, "end_line": 2642, "end_column": 44 }, { "span": "self.assertTrue('comp1' in comp_list)", "start_line": 2643, "start_column": 8, "end_line": 2643, "end_column": 45 }, { "span": "self.assertTrue('comp2' in comp_list)", "start_line": 2644, "start_column": 8, "end_line": 2644, "end_column": 45 }, { "span": "self.assertTrue('comp3' in comp_list)", "start_line": 2645, "start_column": 8, "end_line": 2645, "end_column": 45 }, { "span": "self.assertTrue('comp4' in comp_list)", "start_line": 2646, "start_column": 8, "end_line": 2646, "end_column": 45 }, { "span": "self.assertTrue(len(comp_list) == 2)", "start_line": 2668, "start_column": 8, "end_line": 2668, "end_column": 44 }, { "span": "self.assertTrue('comp2' in comp_list)", "start_line": 2669, "start_column": 8, "end_line": 2669, "end_column": 45 }, { "span": "self.assertTrue('comp4' in comp_list)", "start_line": 2670, "start_column": 8, "end_line": 2670, "end_column": 45 }, { "span": "self.assertTrue(system.is_variable_local('comp1.x1') is True)", "start_line": 2895, "start_column": 8, "end_line": 2895, "end_column": 69 }, { "span": "self.assertTrue(system.is_variable_local('comp1.x2') is True)", "start_line": 2896, "start_column": 8, "end_line": 2896, "end_column": 69 }, { "span": "self.assertTrue('dis2.y / dis2.x' in derivs[2])", "start_line": 2951, "start_column": 8, "end_line": 2951, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nest", "ed", "\\u", "2", "Dar", "ray", "\\u", "gradi", "ent", "\\u", "sub_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "tests", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "Asse", "mbly", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "nest", "'_", ",_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "add_", "(_", "'", "comp", "'_", ",_", "Array", "Comp", "2", "D_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "nest", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "nest_", "._", "create", "\\u", "passthrough", "_", "(_", "'", "comp", ".", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "nest", ".", "x", "[", "0", "][", "0", "]'_", ",_", "low_", "=_", "-_", "100_", ",_", "high_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'", "nest", ".", "y", "[", "0", "][", "1", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Force", "\\u", "fd", " ", "on", " ", "the", " ", "ass", "y_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "top_", "._", "nest_", "._", "driver_", "._", "gradi", "ent", "\\u", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "force", "\\u", "fd_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "x", "[", "0", "][", "0", "]'_", "in_", "top_", "._", "nest_", "._", "\\u", "system_", "._", "vec_", "[_", "'", "u", "'_", "]_", "._", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "4.0_", ",_", ".0000", "01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nond", "iff", "eren", "tia", "ble", "\\u", "blocks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "1_", "=_", "[_", "'", "y1", " ", "=", " ", "2.0", "*", "x1", "**", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "y2", " ", "=", " ", "3.0", "*", "x1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deriv", "1_", "=_", "[_", "'", "dy", "1", "\\u", "dx", "1", " ", "=", " ", "4.0", "*", "x1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "2", "\\u", "dx", "1", " ", "=", " ", "3.0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "2_", "=_", "[_", "'", "y1", " ", "=", " ", "0.", "5", "*", "x1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deriv", "2_", "=_", "[_", "'", "dy", "1", "\\u", "dx", "1", " ", "=", " ", "0.", "5", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "3_", "=_", "[_", "'", "y1", " ", "=", " ", "3.5", "*", "x1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deriv", "3_", "=_", "[_", "'", "dy", "1", "\\u", "dx", "1", " ", "=", " ", "3.5", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "4_", "=_", "[_", "'", "y1", " ", "=", " ", "x1", " ", "+", " ", "2.0", "*", "x2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "y2", " ", "=", " ", "3.0", "*", "x1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "y", "3", " ", "=", " ", "x1", "*", "x2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deriv", "4_", "=_", "[_", "'", "dy", "1", "\\u", "dx", "1", " ", "=", " ", "1.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "1", "\\u", "dx", "2", " ", "=", " ", "2.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "2", "\\u", "dx", "1", " ", "=", " ", "3.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "2", "\\u", "dx", "2", " ", "=", " ", "0.", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "3", "\\u", "dx", "1", " ", "=", " ", "x2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "3", "\\u", "dx", "2", " ", "=", " ", "x1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "5_", "=_", "[_", "'", "y1", " ", "=", " ", "x1", " ", "+", " ", "3.0", "*", "x2", " ", "+", " ", "2.0", "*", "x3", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deriv", "5_", "=_", "[_", "'", "dy", "1", "\\u", "dx", "1", " ", "=", " ", "1.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "1", "\\u", "dx", "2", " ", "=", " ", "3.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dy", "1", "\\u", "dx", "3", " ", "=", " ", "2.0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "comp", "1", "'_", ",_", "Exe", "c", "Comp_", "(_", "exp", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "comp", "2", "'_", ",_", "Exe", "c", "Comp_", "(_", "exp", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "comp", "3", "'_", ",_", "Exe", "c", "Comp_", "(_", "exp", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "comp", "4", "'_", ",_", "Exe", "c", "Comp", "With", "Derivati", "ves_", "(_", "exp", "4_", ",_", "deriv", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "comp", "5", "'_", ",_", "Exe", "c", "Comp_", "(_", "exp", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "1", "'_", ",_", "'", "comp", "2", "'_", ",_", "'", "comp", "3", "'_", ",_", "'", "comp", "4", "'_", ",_", "'", "comp", "5", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y1", "'_", ",_", "'", "comp", "2", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "connect_", "(_", "'", "comp", "1", ".", "y2", "'_", ",_", "'", "comp", "3", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "connect_", "(_", "'", "comp", "2", ".", "y1", "'_", ",_", "'", "comp", "4", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "connect_", "(_", "'", "comp", "3", ".", "y1", "'_", ",_", "'", "comp", "4", ".", "x2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "connect_", "(_", "'", "comp", "4", ".", "y1", "'_", ",_", "'", "comp", "5", ".", "x1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "connect_", "(_", "'", "comp", "4", ".", "y2", "'_", ",_", "'", "comp", "5", ".", "x2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "connect_", "(_", "'", "comp", "4", ".", "y", "3", "'_", ",_", "'", "comp", "5", ".", "x3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Case", " ", "1", " ", "-", " ", "different", "iable", " ", "(", "comp", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "comp", "1_", "._", "x1_", "=_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comp", "\\u", "list_", "=_", "simple", "\\u", "node", "\\u", "iter_", "(_", "self_", "._", "top_", "._", "driver_", "._", "workflow_", "._", "\\u", "system_", "._", "subsystem", "s_", "(_", ")_", "[_", "1_", "]_", "._", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "comp", "\\u", "list_", ")_", "==_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "1", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "2", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "3", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp", "\\u", "list_", "=_", "simple", "\\u", "node", "\\u", "iter_", "(_", "self_", "._", "top_", "._", "driver_", "._", "workflow_", "._", "\\u", "system_", "._", "subsystem", "s_", "(_", ")_", "[_", "3_", "]_", "._", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "comp", "\\u", "list_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "5", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Case", " ", "2", " ", "-", " ", "different", "iable", " ", "(", "none", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "replace_", "(_", "'", "comp", "4", "'_", ",_", "Exe", "c", "Comp_", "(_", "exp", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "comp", "1_", "._", "x1_", "=_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comp", "\\u", "list_", "=_", "simple", "\\u", "node", "\\u", "iter_", "(_", "self_", "._", "top_", "._", "driver_", "._", "workflow_", "._", "\\u", "system_", "._", "subsystem", "s_", "(_", ")_", "[_", "1_", "]_", "._", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "comp", "\\u", "list_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "1", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "2", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "3", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "4", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "5", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pi", "gg", "yb", "ack", " ", "testi", "ng", " ", "of", " ", "the", " ", "is", "\\u", "variab", "le", "\\u", "local", " ", "function", " ", "--", " ", "make", " ", "sure", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "poke", "s", " ", "through", " ", "opaque", " ", "system", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "self_", "._", "top_", "._", "driver_", "._", "workflow_", "._", "\\u", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "system_", "._", "is", "\\u", "variab", "le", "\\u", "local_", "(_", "'", "comp", "2", ".", "y1", "'_", ")_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Case", " ", "3", " ", "-", " ", "different", "iable", " ", "(", "comp", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "replace_", "(_", "'", "comp", "5", "'_", ",_", "Exe", "c", "Comp", "With", "Derivati", "ves_", "(_", "exp", "5_", ",_", "deriv", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "comp", "1_", "._", "x1_", "=_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comp", "\\u", "list_", "=_", "simple", "\\u", "node", "\\u", "iter_", "(_", "self_", "._", "top_", "._", "driver_", "._", "workflow_", "._", "\\u", "system_", "._", "subsystem", "s_", "(_", ")_", "[_", "1_", "]_", "._", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "comp", "\\u", "list_", ")_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "1", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "2", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "3", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "4", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Case", " ", "4", " ", "-", " ", "different", "iable", " ", "(", "comp", "1", ",", " ", "comp", "3", ",", " ", "comp", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "replace_", "(_", "'", "comp", "1", "'_", ",_", "Exe", "c", "Comp", "With", "Derivati", "ves_", "(_", "exp", "1_", ",_", "deriv", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "replace_", "(_", "'", "comp", "3", "'_", ",_", "Exe", "c", "Comp", "With", "Derivati", "ves_", "(_", "exp", "3_", ",_", "deriv", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "comp", "1_", "._", "x1_", "=_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "adjoint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comp", "\\u", "list_", "=_", "simple", "\\u", "node", "\\u", "iter_", "(_", "self_", "._", "top_", "._", "driver_", "._", "workflow_", "._", "\\u", "system_", "._", "subsystem", "s_", "(_", ")_", "[_", "3_", "]_", "._", "\\u", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "comp", "\\u", "list_", ")_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "2", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "comp", "4", "'_", "in_", "comp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "every", "thing", " ", "in", " ", "a", " ", "single", " ", "pseudo", "-", "ass", "y", ",", " ", "and", " ", "run", " ", "fd", "._", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "comp", "1", ".", "x1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outputs_", "=_", "[_", "'", "comp", "5", ".", "y1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "fd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "313", ".0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "param", "group", "\\u", "with", "\\u", "scaler_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "comp", "1", "'_", ",_", "GC", "omp", "\\u", "no", "D_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "workflow_", "._", "add_", "(_", "[_", "'", "comp", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "[_", "'", "comp", "1", ".", "x1", "'_", ",_", "'", "comp", "1", ".", "x2", "'_", "]_", ",_", "low_", "=_", "-_", "100_", ",_", "high_", "=_", "100_", ",_", "scaler_", "=_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'", "comp", "1", ".", "y1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "12.0_", "*_", "2.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pi", "gg", "yb", "ack", " ", "testi", "ng", " ", "of", " ", "the", " ", "is", "\\u", "variab", "le", "\\u", "local", " ", "function", " ", "--", " ", "make", " ", "sure", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "poke", "s", " ", "through", " ", "opaque", " ", "system", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "system_", "=_", "top_", "._", "driver_", "._", "workflow_", "._", "\\u", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "system_", "._", "is", "\\u", "variab", "le", "\\u", "local_", "(_", "'", "comp", "1", ".", "x1", "'_", ")_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "system_", "._", "is", "\\u", "variab", "le", "\\u", "local_", "(_", "'", "comp", "1", ".", "x2", "'_", ")_", "is_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "case", "\\u", "derivatives", "_", "(_", "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", "missi", "ng", "\\u", "deriv", "s", "\\u", "assume", "\\u", "zero_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "top_", "=_", "set\\u", "as", "\\u", "top_", "(_", "Asse", "mbly", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "driver", "'_", ",_", "Simple", "Driver_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "add_", "(_", "'", "dis", "2", "'_", ",_", "Simple", "Comp", "Missing", "Der", "iv_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "dis", "2_", "._", "missi", "ng", "\\u", "deriv", "\\u", "policy_", "=_", "'", "assume", "\\u", "zero", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "objective_", "(_", "'(", "dis", "2", ".", "y", ")**", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "parameter_", "(_", "'", "dis", "2", ".", "x", "'_", ",_", "low_", "=_", "-_", "10.0_", ",_", "high_", "=_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "add", "\\u", "constraint_", "(_", "'", "dis", "2", ".", "miss", "\\u", "out", " ", "<", " ", "24.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "mode_", "=_", "'", "forward", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "24.0", "_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "error", " ", "unl", "ess", " ", "we", " ", "ignore", " ", "missi", "ng", " ", "deriv", "s_", "\\u\\u\\uNL\\u\\u\\u_", "deriv", "s_", "=_", "self_", "._", "top_", "._", "check", "\\u", "gradient_", "(_", "name_", "=_", "'", "dis", "2", "'_", ",_", "stream_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "dis", "2", ".", "y", " ", "/", " ", "dis", "2", ".", "x", "'_", "in_", "deriv", "s_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "top_", "._", "driver_", "._", "run", "\\u", "iteration_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "J_", "=_", "self_", "._", "top_", "._", "driver_", "._", "calc", "\\u", "gradient_", "(_", "inputs_", "=_", "[_", "'", "dis", "2", ".", "miss", "\\u", "in", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "fd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "0_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "rel", "\\u", "error_", "(_", "self_", ",_", "J_", "[_", "1_", ",_", "0_", "]_", ",_", "0.0_", ",_", ".00", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
wecatch/app-turbo/turbo/test/app_test.py
[ { "content": "from __future__ import absolute_import, division, print_function, with_statement\n\nimport socket\nimport os\nimport signal\nimport sys\nimport random\nimport time\nimport threading\nimport logging\nimport requests\nimport multiprocessing\nimport time\nfrom bson.objectid import ObjectId\n\nfrom turbo.test.util import unittest\n\nfrom turbo import app\nfrom turbo.conf import app_config\nfrom turbo import register\n\napp_config.app_name = 'app_test'\napp_config.web_application_setting = {\n 'xsrf_cookies': False,\n 'cookie_secret': 'adasfd' \n}\n\n#logger = logging.getLogger()\n\n\n\n\n\nPID = None\nURL = None\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HomeHandler(app.BaseHandler):\n\n\n", "metadata": "root.HomeHandler", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def get(self):\n assert self.is_ajax() == False\n self.write('get')", "metadata": "root.HomeHandler.get", "header": "['class', 'HomeHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 32 }, { "content": " def post(self):\n self.write('post')", "metadata": "root.HomeHandler.post", "header": "['class', 'HomeHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 36 }, { "content": " def put(self):\n self.write('put')", "metadata": "root.HomeHandler.put", "header": "['class', 'HomeHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 39 }, { "content": "class ApiHandler(app.BaseHandler):\n\n _get_required_params = [\n ('skip', int, 0),\n ('limit', int, 20),\n ]\n\n _get_params = {\n 'need': [\n ('action', None),\n ],\n 'option': [\n ('who', basestring, 'python'),\n ('bool', bool, False),\n ('int', int, 0),\n ('float', float, 0),\n ('objectid', ObjectId, None),\n ('list', list, []),\n ]\n }\n\n _post_required_params = [\n ('skip', int, 0),\n ('limit', int, 20),\n ]\n\n _post_params = {\n 'need': [\n ('who', basestring),\n ],\n }\n\n\n\n\n\n", "metadata": "root.ApiHandler", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def GET(self):\n self._params = self.parameter\n\n assert self._params['skip'] == 0\n assert self._params['limit'] == 20\n assert self._params['who'] == 'python'\n assert self._params['action'] is None\n assert self._params['list'] == []\n assert self.is_ajax() == True\n\n self._data = {\n 'value': self._params['who']\n }", "metadata": "root.ApiHandler.GET", "header": "['class', 'ApiHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 75 }, { "content": " def POST(self):\n self._params = self.parameter\n print(self._params)\n\n assert self._params['skip'] == 0\n assert self._params['limit'] == 10\n\n self._data = {\n 'value': self._params['who']\n }", "metadata": "root.ApiHandler.POST", "header": "['class', 'ApiHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 89 }, { "content": " def PUT(self):\n self._data = {\n 'api': {\n 'put': 'value'\n }\n }", "metadata": "root.ApiHandler.PUT", "header": "['class', 'ApiHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 101 }, { "content": " def DELETE(self):\n raise Exception('value error')", "metadata": "root.ApiHandler.DELETE", "header": "['class', 'ApiHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 108 }, { "content": " def wo_json(self, data):\n self.write(self.json_encode(data, indent=4))", "metadata": "root.ApiHandler.wo_json", "header": "['class', 'ApiHandler', '(', 'app', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 111 }, { "content": "def run_server(port):\n register.register_url('/', HomeHandler)\n register.register_url('', HomeHandler)\n register.register_url('/api', ApiHandler)\n app.start(port)", "metadata": "root.run_server", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def is_used(port):\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n if sock.connect_ex(('localhost', port)) == 0:\n return True\n\n return False", "metadata": "root.is_used", "header": "['module', '___EOS___']", "index": 124 }, { "content": "def setUpModule():\n port = 8888\n while True:\n if not is_used(port):\n break\n port += 1\n \n server = multiprocessing.Process(target=run_server, args=(port,))\n server.start()\n global PID, URL\n URL = 'http://localhost:%s'%port\n PID = server.pid", "metadata": "root.setUpModule", "header": "['module', '___EOS___']", "index": 132 }, { "content": "def tearDownModule():\n os.kill(PID, signal.SIGKILL)", "metadata": "root.tearDownModule", "header": "['module', '___EOS___']", "index": 146 }, { "content": "class AppTest(unittest.TestCase):\n\n\n\n\n\n\n\n", "metadata": "root.AppTest", "header": "['module', '___EOS___']", "index": 150 }, { "content": " def setUp(self):\n global URL \n self.home_url = URL \n self.api_url = URL + '/api'", "metadata": "root.AppTest.setUp", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_get(self):\n resp = requests.get(self.home_url)\n self.assertEqual(resp.status_code, 200)", "metadata": "root.AppTest.test_get", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 157 }, { "content": " def test_post(self):\n resp = requests.post(self.home_url)\n self.assertEqual(resp.status_code, 200)", "metadata": "root.AppTest.test_post", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 161 }, { "content": " def test_get_api(self):\n resp = requests.get(self.api_url, headers={'X-Requested-With': 'XMLHttpRequest'})\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(resp.json()['res']['value'], 'python')", "metadata": "root.AppTest.test_get_api", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 165 }, { "content": " def test_delete_api(self):\n resp = requests.delete(self.api_url, headers={'X-Requested-With': 'XMLHttpRequest'})\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(resp.json()['msg'], 'Unknown Error')", "metadata": "root.AppTest.test_delete_api", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 170 }, { "content": " def test_post_api(self):\n resp = requests.post(self.api_url, headers={'X-Requested-With': 'XMLHttpRequest'}, data={'limit': 10, 'who': 'ruby'})\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(resp.json()['res']['value'], 'ruby')", "metadata": "root.AppTest.test_post_api", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 175 }, { "content": " def test_404(self):\n resp = requests.get(self.home_url+'/hello')\n self.assertTrue(resp.content.find('404') != -1)", "metadata": "root.AppTest.test_404", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 180 }, { "content": " def test_context(self):\n \"\"\"TODO\"\"\"\n pass", "metadata": "root.AppTest.test_context", "header": "['class', 'AppTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 184 } ]
[ { "span": "import sys", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 10 }, { "span": "import random", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 13 }, { "span": "import time", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 11 }, { "span": "import threading", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 16 }, { "span": "import logging", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 14 }, { "span": "import time", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\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_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "._", "objectid", "_", "import_", "Object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "turb", "o_", "._", "test_", "._", "util_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "turb", "o_", "import_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "turb", "o_", "._", "conf_", "import_", "app", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "turb", "o_", "import_", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "config_", "._", "app", "\\u", "name_", "=_", "'", "app", "\\u", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "config_", "._", "web", "\\u", "applica", "tion", "\\u", "setting_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xsrf", "\\u", "cookie", "s", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cookie", "\\u", "secret", "'_", ":_", "'", "ada", "sf", "d", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", " ", "=", " ", "logg", "ing", ".", "get", "Log", "ger", "()", "_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "PID_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "URL_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Home", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Home", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "is", "\\u", "ajax_", "(_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "'", "get", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Home", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "'", "post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Home", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "'", "put", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Ap", "i", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "get", "\\u", "require", "d\\u", "params_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "skip", "'_", ",_", "int_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "limit", "'_", ",_", "int_", ",_", "20_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "get", "\\u", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "need", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "action", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "option", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "who", "'_", ",_", "basestring_", ",_", "'", "python", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "bool", "'_", ",_", "bool_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "int", "'_", ",_", "int_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "float", "'_", ",_", "float_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "objectid", "'_", ",_", "Object", "Id_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "list", "'_", ",_", "list_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "post", "\\u", "require", "d\\u", "params_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "skip", "'_", ",_", "int_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "limit", "'_", ",_", "int_", ",_", "20_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "post", "\\u", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "need", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "who", "'_", ",_", "basestring_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "GET_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "params_", "=_", "self_", "._", "parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "\\u", "params_", "[_", "'", "skip", "'_", "]_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "params_", "[_", "'", "limit", "'_", "]_", "==_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "params_", "[_", "'", "who", "'_", "]_", "==_", "'", "python", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "params_", "[_", "'", "action", "'_", "]_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "params_", "[_", "'", "list", "'_", "]_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "is", "\\u", "ajax_", "(_", ")_", "==_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "self_", "._", "\\u", "params_", "[_", "'", "who", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "POST_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "params_", "=_", "self_", "._", "parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "self_", "._", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "self_", "._", "\\u", "params_", "[_", "'", "skip", "'_", "]_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "\\u", "params_", "[_", "'", "limit", "'_", "]_", "==_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "self_", "._", "\\u", "params_", "[_", "'", "who", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "PUT_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "api", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "put", "'_", ":_", "'", "value", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "DELETE_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "value", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Handler_", "(_", "app_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wo", "\\u", "json_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "self_", "._", "json", "\\u", "encode_", "(_", "data_", ",_", "indent_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run", "\\u", "server_", "(_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "register_", "._", "register", "\\u", "url_", "(_", "'/'_", ",_", "Home", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "register", "\\u", "url_", "(_", "''_", ",_", "Home", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "register", "\\u", "url_", "(_", "'/", "api", "'_", ",_", "Ap", "i", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "start_", "(_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "used_", "(_", "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_", "if_", "sock_", "._", "connect", "\\u", "ex_", "(_", "(_", "'", "local", "host", "'_", ",_", "port_", ")_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up", "Module_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "8888", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "\\u", "used_", "(_", "port_", ")_", ":_", "\\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_", "port_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "=_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "run", "\\u", "server_", ",_", "args_", "=_", "(_", "port_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "PID_", ",_", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "URL_", "=_", "'", "http", "://", "local", "host", ":", "%", "s", "'_", "%_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PID_", "=_", "server_", "._", "pid_", "\\u\\u\\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_", "tear", "Down", "Module_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "kill_", "(_", "PID_", ",_", "signal_", "._", "SIG", "KILL", "_", ")_", "\\u\\u\\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_", "App", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "App", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "home", "\\u", "url_", "=_", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "api", "\\u", "url_", "=_", "URL_", "+_", "'/", "api", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "requests_", "._", "get_", "(_", "self_", "._", "home", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "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", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "requests_", "._", "post_", "(_", "self_", "._", "home", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "api_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "requests_", "._", "get_", "(_", "self_", "._", "api", "\\u", "url_", ",_", "headers_", "=_", "{_", "'", "X", "-", "Requeste", "d", "-", "With", "'_", ":_", "'", "XML", "Http", "Request", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "json_", "(_", ")_", "[_", "'", "res", "'_", "]_", "[_", "'", "value", "'_", "]_", ",_", "'", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "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", "delete", "\\u", "api_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "requests_", "._", "delete_", "(_", "self_", "._", "api", "\\u", "url_", ",_", "headers_", "=_", "{_", "'", "X", "-", "Requeste", "d", "-", "With", "'_", ":_", "'", "XML", "Http", "Request", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "json_", "(_", ")_", "[_", "'", "msg", "'_", "]_", ",_", "'", "Un", "know", "n", " ", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "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", "post", "\\u", "api_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "requests_", "._", "post_", "(_", "self_", "._", "api", "\\u", "url_", ",_", "headers_", "=_", "{_", "'", "X", "-", "Requeste", "d", "-", "With", "'_", ":_", "'", "XML", "Http", "Request", "'_", "}_", ",_", "data_", "=_", "{_", "'", "limit", "'_", ":_", "10_", ",_", "'", "who", "'_", ":_", "'", "rub", "y", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "json_", "(_", ")_", "[_", "'", "res", "'_", "]_", "[_", "'", "value", "'_", "]_", ",_", "'", "rub", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "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", "404_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "requests_", "._", "get_", "(_", "self_", "._", "home", "\\u", "url_", "+_", "'/", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "resp_", "._", "content_", "._", "find_", "(_", "'", "404", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "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", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "TOD", "O", "\"\"\"_", "\\u\\u\\uNEWLINE\\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, 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 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 ]
Unused import
kuri65536/python-for-android/python-modules/twisted/twisted/conch/checkers.py
[ { "content": "# -*- test-case-name: twisted.conch.test.test_checkers -*-\n# Copyright (c) 2001-2010 Twisted Matrix Laboratories.\n# See LICENSE for details.\n\n\"\"\"\nProvide L{ICredentialsChecker} implementations to be used in Conch protocols.\n\"\"\"\n\nimport os, base64, binascii, errno\ntry:\n import pwd\nexcept ImportError:\n pwd = None\nelse:\n import crypt\n\ntry:\n # get this from http://www.twistedmatrix.com/users/z3p/files/pyshadow-0.2.tar.gz\n import shadow\nexcept:\n shadow = None\n\ntry:\n from twisted.cred import pamauth\nexcept ImportError:\n pamauth = None\n\nfrom zope.interface import implements, providedBy\n\nfrom twisted.conch import error\nfrom twisted.conch.ssh import keys\nfrom twisted.cred.checkers import ICredentialsChecker\nfrom twisted.cred.credentials import IUsernamePassword, ISSHPrivateKey\nfrom twisted.cred.error import UnauthorizedLogin, UnhandledCredentials\nfrom twisted.internet import defer\nfrom twisted.python import failure, reflect, log\nfrom twisted.python.util import runAsEffectiveUser\nfrom twisted.python.filepath import FilePath\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def verifyCryptedPassword(crypted, pw):\n if crypted[0] == '$': # md5_crypt encrypted\n salt = '$1$' + crypted.split('$')[2]\n else:\n salt = crypted[:2]\n return crypt.crypt(pw, salt) == crypted", "metadata": "root.verifyCryptedPassword", "header": "['module', '___EOS___']", "index": 40 }, { "content": "class UNIXPasswordDatabase:\n credentialInterfaces = IUsernamePassword,\n implements(ICredentialsChecker)\n", "metadata": "root.UNIXPasswordDatabase", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def requestAvatarId(self, credentials):\n if pwd:\n try:\n cryptedPass = pwd.getpwnam(credentials.username)[1]\n except KeyError:\n return defer.fail(UnauthorizedLogin(\"invalid username\"))\n else:\n if cryptedPass not in ['*', 'x'] and \\\n verifyCryptedPassword(cryptedPass, credentials.password):\n return defer.succeed(credentials.username)\n if shadow:\n gid = os.getegid()\n uid = os.geteuid()\n os.setegid(0)\n os.seteuid(0)\n try:\n shadowPass = shadow.getspnam(credentials.username)[1]\n except KeyError:\n os.setegid(gid)\n os.seteuid(uid)\n return defer.fail(UnauthorizedLogin(\"invalid username\"))\n os.setegid(gid)\n os.seteuid(uid)\n if verifyCryptedPassword(shadowPass, credentials.password):\n return defer.succeed(credentials.username)\n return defer.fail(UnauthorizedLogin(\"invalid password\"))\n\n return defer.fail(UnauthorizedLogin(\"unable to verify password\"))", "metadata": "root.UNIXPasswordDatabase.requestAvatarId", "header": "['class', 'UNIXPasswordDatabase', ':', '___EOS___']", "index": 51 }, { "content": "class SSHPublicKeyDatabase:\n \"\"\"\n Checker that authenticates SSH public keys, based on public keys listed in\n authorized_keys and authorized_keys2 files in user .ssh/ directories.\n \"\"\"\n\n credentialInterfaces = ISSHPrivateKey,\n implements(ICredentialsChecker)\n\n\n\n\n\n\n", "metadata": "root.SSHPublicKeyDatabase", "header": "['module', '___EOS___']", "index": 81 }, { "content": " def requestAvatarId(self, credentials):\n d = defer.maybeDeferred(self.checkKey, credentials)\n d.addCallback(self._cbRequestAvatarId, credentials)\n d.addErrback(self._ebRequestAvatarId)\n return d", "metadata": "root.SSHPublicKeyDatabase.requestAvatarId", "header": "['class', 'SSHPublicKeyDatabase', ':', '___EOS___']", "index": 90 }, { "content": " def _cbRequestAvatarId(self, validKey, credentials):\n \"\"\"\n Check whether the credentials themselves are valid, now that we know\n if the key matches the user.\n\n @param validKey: A boolean indicating whether or not the public key\n matches a key in the user's authorized_keys file.\n\n @param credentials: The credentials offered by the user.\n @type credentials: L{ISSHPrivateKey} provider\n\n @raise UnauthorizedLogin: (as a failure) if the key does not match the\n user in C{credentials}. Also raised if the user provides an invalid\n signature.\n\n @raise ValidPublicKey: (as a failure) if the key matches the user but\n the credentials do not include a signature. See\n L{error.ValidPublicKey} for more information.\n\n @return: The user's username, if authentication was successful.\n \"\"\"\n if not validKey:\n return failure.Failure(UnauthorizedLogin(\"invalid key\"))\n if not credentials.signature:\n return failure.Failure(error.ValidPublicKey())\n else:\n try:\n pubKey = keys.Key.fromString(credentials.blob)\n if pubKey.verify(credentials.signature, credentials.sigData):\n return credentials.username\n except: # any error should be treated as a failed login\n log.err()\n return failure.Failure(UnauthorizedLogin('error while verifying key'))\n return failure.Failure(UnauthorizedLogin(\"unable to verify key\"))", "metadata": "root.SSHPublicKeyDatabase._cbRequestAvatarId", "header": "['class', 'SSHPublicKeyDatabase', ':', '___EOS___']", "index": 96 }, { "content": " def getAuthorizedKeysFiles(self, credentials):\n \"\"\"\n Return a list of L{FilePath} instances for I{authorized_keys} files\n which might contain information about authorized keys for the given\n credentials.\n\n On OpenSSH servers, the default location of the file containing the\n list of authorized public keys is\n U{$HOME/.ssh/authorized_keys<http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config>}.\n\n I{$HOME/.ssh/authorized_keys2} is also returned, though it has been\n U{deprecated by OpenSSH since\n 2001<http://marc.info/?m=100508718416162>}.\n\n @return: A list of L{FilePath} instances to files with the authorized keys.\n \"\"\"\n pwent = pwd.getpwnam(credentials.username)\n root = FilePath(pwent.pw_dir).child('.ssh')\n files = ['authorized_keys', 'authorized_keys2']\n return [root.child(f) for f in files]", "metadata": "root.SSHPublicKeyDatabase.getAuthorizedKeysFiles", "header": "['class', 'SSHPublicKeyDatabase', ':', '___EOS___']", "index": 132 }, { "content": " def checkKey(self, credentials):\n \"\"\"\n Retrieve files containing authorized keys and check against user\n credentials.\n \"\"\"\n uid, gid = os.geteuid(), os.getegid()\n ouid, ogid = pwd.getpwnam(credentials.username)[2:4]\n for filepath in self.getAuthorizedKeysFiles(credentials):\n if not filepath.exists():\n continue\n try:\n lines = filepath.open()\n except IOError, e:\n if e.errno == errno.EACCES:\n lines = runAsEffectiveUser(ouid, ogid, filepath.open)\n else:\n raise\n for l in lines:\n l2 = l.split()\n if len(l2) < 2:\n continue\n try:\n if base64.decodestring(l2[1]) == credentials.blob:\n return True\n except binascii.Error:\n continue\n return False", "metadata": "root.SSHPublicKeyDatabase.checkKey", "header": "['class', 'SSHPublicKeyDatabase', ':', '___EOS___']", "index": 154 }, { "content": " def _ebRequestAvatarId(self, f):\n if not f.check(UnauthorizedLogin):\n log.msg(f)\n return failure.Failure(UnauthorizedLogin(\"unable to get avatar id\"))\n return f", "metadata": "root.SSHPublicKeyDatabase._ebRequestAvatarId", "header": "['class', 'SSHPublicKeyDatabase', ':', '___EOS___']", "index": 182 }, { "content": "class SSHProtocolChecker:\n \"\"\"\n SSHProtocolChecker is a checker that requires multiple authentications\n to succeed. To add a checker, call my registerChecker method with\n the checker and the interface.\n\n After each successful authenticate, I call my areDone method with the\n avatar id. To get a list of the successful credentials for an avatar id,\n use C{SSHProcotolChecker.successfulCredentials[avatarId]}. If L{areDone}\n returns True, the authentication has succeeded.\n \"\"\"\n\n implements(ICredentialsChecker)\n\n\n\n credentialInterfaces = property(get_credentialInterfaces)\n\n\n\n", "metadata": "root.SSHProtocolChecker", "header": "['module', '___EOS___']", "index": 189 }, { "content": " def __init__(self):\n self.checkers = {}\n self.successfulCredentials = {}", "metadata": "root.SSHProtocolChecker.__init__", "header": "['class', 'SSHProtocolChecker', ':', '___EOS___']", "index": 203 }, { "content": " def get_credentialInterfaces(self):\n return self.checkers.keys()", "metadata": "root.SSHProtocolChecker.get_credentialInterfaces", "header": "['class', 'SSHProtocolChecker', ':', '___EOS___']", "index": 207 }, { "content": " def registerChecker(self, checker, *credentialInterfaces):\n if not credentialInterfaces:\n credentialInterfaces = checker.credentialInterfaces\n for credentialInterface in credentialInterfaces:\n self.checkers[credentialInterface] = checker", "metadata": "root.SSHProtocolChecker.registerChecker", "header": "['class', 'SSHProtocolChecker', ':', '___EOS___']", "index": 212 }, { "content": " def requestAvatarId(self, credentials):\n \"\"\"\n Part of the L{ICredentialsChecker} interface. Called by a portal with\n some credentials to check if they'll authenticate a user. We check the\n interfaces that the credentials provide against our list of acceptable\n checkers. If one of them matches, we ask that checker to verify the\n credentials. If they're valid, we call our L{_cbGoodAuthentication}\n method to continue.\n\n @param credentials: the credentials the L{Portal} wants us to verify\n \"\"\"\n ifac = providedBy(credentials)\n for i in ifac:\n c = self.checkers.get(i)\n if c is not None:\n d = defer.maybeDeferred(c.requestAvatarId, credentials)\n return d.addCallback(self._cbGoodAuthentication,\n credentials)\n return defer.fail(UnhandledCredentials(\"No checker for %s\" % \\\n ', '.join(map(reflect.qual, ifac))))", "metadata": "root.SSHProtocolChecker.requestAvatarId", "header": "['class', 'SSHProtocolChecker', ':', '___EOS___']", "index": 218 }, { "content": " def _cbGoodAuthentication(self, avatarId, credentials):\n \"\"\"\n Called if a checker has verified the credentials. We call our\n L{areDone} method to see if the whole of the successful authentications\n are enough. If they are, we return the avatar ID returned by the first\n checker.\n \"\"\"\n if avatarId not in self.successfulCredentials:\n self.successfulCredentials[avatarId] = []\n self.successfulCredentials[avatarId].append(credentials)\n if self.areDone(avatarId):\n del self.successfulCredentials[avatarId]\n return avatarId\n else:\n raise error.NotEnoughAuthentication()", "metadata": "root.SSHProtocolChecker._cbGoodAuthentication", "header": "['class', 'SSHProtocolChecker', ':', '___EOS___']", "index": 239 }, { "content": " def areDone(self, avatarId):\n \"\"\"\n Override to determine if the authentication is finished for a given\n avatarId.\n\n @param avatarId: the avatar returned by the first checker. For\n this checker to function correctly, all the checkers must\n return the same avatar ID.\n \"\"\"\n return True", "metadata": "root.SSHProtocolChecker.areDone", "header": "['class', 'SSHProtocolChecker', ':', '___EOS___']", "index": 255 } ]
[ { "span": "from twisted.cred import pamauth", "start_line": 23, "start_column": 4, "end_line": 23, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "test", "-", "case", "-", "name", ":", " ", "twist", "ed", ".", "conc", "h", ".", "test", ".", "test\\u", "checkers", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "1", "-", "2010", " ", "Twi", "sted", " ", "Matrix", " ", "Labo", "rator", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Prov", "ide", " ", "L", "{", "IC", "rede", "nti", "als", "Check", "er", "}", " ", "implementation", "s", " ", "to", " ", "be", " ", "used", " ", "in", " ", "Conc", "h", " ", "protoc", "ols", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "base64_", ",_", "binascii_", ",_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pwd_", "\\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 ", " _", "pwd_", "=_", "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 ", " _", "import_", "crypt_", "\\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_", "#", " ", "get", " ", "this", " ", "from", " ", "http", "://", "www", ".", "twist", "edm", "atrix", ".", "com", "/", "users", "/", "z3", "p", "/", "files", "/", "pys", "had", "ow", "-0", ".2", ".", "tar", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "shadow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shadow_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "twisted_", "._", "cred_", "import_", "pam", "auth_", "\\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 ", " _", "pam", "auth_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "zope_", "._", "interface_", "import_", "implements_", ",_", "provided", "By_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "conc", "h_", "import_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "conc", "h_", "._", "ssh_", "import_", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "cred_", "._", "checkers", "_", "import_", "IC", "rede", "nti", "als", "Checker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "cred_", "._", "credentials_", "import_", "IU", "ser", "name", "Password_", ",_", "ISS", "HP", "riv", "ate", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "cred_", "._", "error_", "import_", "Una", "uthor", "ize", "d", "Login_", ",_", "Unh", "andle", "d", "Credentials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "defer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "import_", "failure_", ",_", "reflect", "_", ",_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "._", "util_", "import_", "run", "As", "Effe", "ctive", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "._", "filepath_", "import_", "File", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "verify", "Crypt", "ed", "Password_", "(_", "crypt", "ed_", ",_", "pw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "crypt", "ed_", "[_", "0_", "]_", "==_", "'$'_", ":_", "#", " ", "md5", "\\u", "crypt", " ", "encrypted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "=_", "'$", "1", "$'_", "+_", "crypt", "ed_", "._", "split_", "(_", "'$'_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "salt_", "=_", "crypt", "ed_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "crypt_", "._", "crypt_", "(_", "pw_", ",_", "salt_", ")_", "==_", "crypt", "ed_", "\\u\\u\\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_", "UNIX", "Passw", "ord", "Database_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cred", "ential", "Interface", "s_", "=_", "IU", "ser", "name", "Password_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "implements_", "(_", "IC", "rede", "nti", "als", "Checker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "UNIX", "Passw", "ord", "Database_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "request", "Ava", "tar", "Id_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pwd_", ":_", "\\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 ", " _", "crypt", "ed", "Pass_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "credentials_", "._", "username_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "defer_", "._", "fail_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "\"", "invalid", " ", "user", "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 ", " _", "if_", "crypt", "ed", "Pass_", "not_", "in_", "[_", "'*'_", ",_", "'", "x", "'_", "]_", "and_", "verify", "Crypt", "ed", "Password_", "(_", "crypt", "ed", "Pass_", ",_", "credentials_", "._", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "defer_", "._", "succeed_", "(_", "credentials_", "._", "username_", ")_", "\\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_", "shadow_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gid_", "=_", "os_", "._", "gete", "gid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "os_", "._", "gete", "uid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "sete", "gid_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "sete", "uid_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shadow", "Pass_", "=_", "shadow_", "._", "gets", "pn", "am_", "(_", "credentials_", "._", "username_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "sete", "gid_", "(_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "sete", "uid_", "(_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "defer_", "._", "fail_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "\"", "invalid", " ", "user", "name", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "sete", "gid_", "(_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "sete", "uid_", "(_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verify", "Crypt", "ed", "Password_", "(_", "shadow", "Pass_", ",_", "credentials_", "._", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "defer_", "._", "succeed_", "(_", "credentials_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "defer_", "._", "fail_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "\"", "invalid", " ", "password", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "defer_", "._", "fail_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "\"", "una", "ble", " ", "to", " ", "verify", " ", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SSH", "Public", "Key", "Database_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "er", " ", "tha", "t", " ", "authenticat", "es", " ", "SSH", " ", "public", " ", "keys", ",", " ", "based", " ", "on", " ", "public", " ", "keys", " ", "liste", "d", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "authoriz", "ed", "\\u", "keys", " ", "and", " ", "authoriz", "ed", "\\u", "keys", "2", " ", "files", " ", "in", " ", "user", " ", ".", "ssh", "/", " ", "director", "ies", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cred", "ential", "Interface", "s_", "=_", "ISS", "HP", "riv", "ate", "Key_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "implements_", "(_", "IC", "rede", "nti", "als", "Checker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "SSH", "Public", "Key", "Database_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "request", "Ava", "tar", "Id_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "defer_", "._", "may", "be", "Deferred_", "(_", "self_", "._", "check", "Key_", ",_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "self_", "._", "\\u", "cb", "Request", "Ava", "tar", "Id_", ",_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Errback_", "(_", "self_", "._", "\\u", "eb", "Request", "Ava", "tar", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Public", "Key", "Database_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cb", "Request", "Ava", "tar", "Id_", "(_", "self_", ",_", "valid", "Key_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "whe", "ther", " ", "the", " ", "cred", "ential", "s", " ", "them", "sel", "ves", " ", "are", " ", "valid", ",", " ", "now", " ", "tha", "t", " ", "we", " ", "know", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "key", " ", "matche", "s", " ", "the", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "valid", "Key", ":", " ", "A", " ", "boolean", " ", "indicati", "ng", " ", "whe", "ther", " ", "or", " ", "not", " ", "the", " ", "public", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "matche", "s", " ", "a", " ", "key", " ", "in", " ", "the", " ", "user", "'", "s", " ", "authoriz", "ed", "\\u", "keys", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "cred", "ential", "s", ":", " ", "The", " ", "cred", "ential", "s", " ", "offered", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "cred", "ential", "s", ":", " ", "L", "{", "ISS", "HP", "riv", "ate", "Key", "}", " ", "provide", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", " ", "Una", "uthor", "ize", "d", "Logi", "n", ":", " ", "(", "as", " ", "a", " ", "fail", "ure", ")", " ", "if", " ", "the", " ", "key", " ", "doe", "s", " ", "not", " ", "match", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", " ", "in", " ", "C", "{", "cred", "ential", "s", "}.", " ", "Al", "so", " ", "raise", "d", " ", "if", " ", "the", " ", "user", " ", "provide", "s", " ", "an", " ", "invalid", "\\", "10", ";", " ", " ", " ", " ", "signa", "ture", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", " ", "Valid", "Public", "Key", ":", " ", "(", "as", " ", "a", " ", "fail", "ure", ")", " ", "if", " ", "the", " ", "key", " ", "matche", "s", " ", "the", " ", "user", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "cred", "ential", "s", " ", "do", " ", "not", " ", "include", " ", "a", " ", "signa", "ture", ".", " ", "See", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "error", ".", "Valid", "Public", "Key", "}", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "The", " ", "user", "'", "s", " ", "user", "name", ",", " ", "if", " ", "authenticat", "ion", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "valid", "Key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "failure_", "._", "Failure_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "\"", "invalid", " ", "key", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "credentials_", "._", "signature_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "failure_", "._", "Failure_", "(_", "error_", "._", "Valid", "Public", "Key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pub", "Key_", "=_", "keys_", "._", "Key_", "._", "from", "String_", "(_", "credentials_", "._", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pub", "Key_", "._", "verify_", "(_", "credentials_", "._", "signature_", ",_", "credentials_", "._", "sig", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "credentials_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "#", " ", "any", " ", "error", " ", "shou", "ld", " ", "be", " ", "treat", "ed", " ", "as", " ", "a", " ", "fail", "ed", " ", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "failure_", "._", "Failure_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "'", "error", " ", "whi", "le", " ", "verify", "ing", " ", "key", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "failure_", "._", "Failure_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "\"", "una", "ble", " ", "to", " ", "verify", " ", "key", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Public", "Key", "Database_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Authorized", "Keys", "Files_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "L", "{", "File", "Path", "}", " ", "instance", "s", " ", "for", " ", "I", "{", "authoriz", "ed", "\\u", "keys", "}", " ", "files", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "mig", "ht", " ", "contain", " ", "informati", "on", " ", "abo", "ut", " ", "authoriz", "ed", " ", "keys", " ", "for", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "cred", "ential", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", " ", "Open", "SSH", " ", "server", "s", ",", " ", "the", " ", "default", " ", "location", " ", "of", " ", "the", " ", "file", " ", "contain", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "authoriz", "ed", " ", "public", " ", "keys", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "U", "{$", "HOM", "E", "/.", "ssh", "/", "authoriz", "ed", "\\u", "keys", "<", "http", "://", "www", ".", "openb", "sd", ".", "org", "/", "cgi", "-", "bin", "/", "man", ".", "cgi", "?", "query", "=", "ssh", "d\\u", "config", ">}", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "I", "{$", "HOM", "E", "/.", "ssh", "/", "authoriz", "ed", "\\u", "keys", "2", "}", " ", "is", " ", "als", "o", " ", "return", "ed", ",", " ", "tho", "ugh", " ", "it", " ", "has", " ", "bee", "n", "\\", "10", ";", " ", " ", " ", " ", "U", "{", "depre", "cated", " ", "by", " ", "Open", "SSH", " ", "sinc", "e", "\\", "10", ";", " ", " ", " ", " ", "200", "1", "<", "http", "://", "marc", ".", "info", "/?", "m", "=", "1005", "087", "184", "161", "6", "2", ">}", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "A", " ", "list", " ", "of", " ", "L", "{", "File", "Path", "}", " ", "instance", "s", " ", "to", " ", "files", " ", "with", " ", "the", " ", "authoriz", "ed", " ", "keys", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pw", "ent_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "credentials_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "File", "Path_", "(_", "pw", "ent_", "._", "pw", "\\u", "dir_", ")_", "._", "child_", "(_", "'.", "ssh", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "[_", "'", "authoriz", "ed", "\\u", "keys", "'_", ",_", "'", "authoriz", "ed", "\\u", "keys", "2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "root_", "._", "child_", "(_", "f_", ")_", "for_", "f_", "in_", "files_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Public", "Key", "Database_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Key_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "files", " ", "contain", "ing", " ", "authoriz", "ed", " ", "keys", " ", "and", " ", "check", " ", "against", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "cred", "ential", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", ",_", "gid_", "=_", "os_", "._", "gete", "uid_", "(_", ")_", ",_", "os_", "._", "gete", "gid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ou", "id_", ",_", "ogi", "d_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "credentials_", "._", "username_", ")_", "[_", "2_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filepath_", "in_", "self_", "._", "get", "Authorized", "Keys", "Files_", "(_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "filepath_", "._", "exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "filepath_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "==_", "errno_", "._", "EAC", "CES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "=_", "run", "As", "Effe", "ctive", "User_", "(_", "ou", "id_", ",_", "ogi", "d_", ",_", "filepath_", "._", "open_", ")_", "\\u\\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_", "for_", "l_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l2_", "=_", "l_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "l2_", ")_", "<_", "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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "base64_", "._", "decode", "string_", "(_", "l2_", "[_", "1_", "]_", ")_", "==_", "credentials_", "._", "blob_", ":_", "\\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_", "except_", "binascii_", "._", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Public", "Key", "Database_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "eb", "Request", "Ava", "tar", "Id_", "(_", "self_", ",_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "f_", "._", "check_", "(_", "Una", "uthor", "ize", "d", "Login_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "msg_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "failure_", "._", "Failure_", "(_", "Una", "uthor", "ize", "d", "Login_", "(_", "\"", "una", "ble", " ", "to", " ", "get", " ", "avat", "ar", " ", "id", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SSH", "Proto", "col", "Checker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SSH", "Proto", "col", "Check", "er", " ", "is", " ", "a", " ", "checke", "r", " ", "tha", "t", " ", "require", "s", " ", "multiple", " ", "authenticat", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "succe", "ed", ".", " ", " ", "To", " ", "add", " ", "a", " ", "checke", "r", ",", " ", "call", " ", "my", " ", "register", "Check", "er", " ", "method", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "checke", "r", " ", "and", " ", "the", " ", "interface", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "each", " ", "success", "ful", " ", "authenticat", "e", ",", " ", "I", " ", "call", " ", "my", " ", "are", "Don", "e", " ", "method", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "avat", "ar", " ", "id", ".", " ", " ", "To", " ", "get", " ", "a", " ", "list", " ", "of", " ", "the", " ", "success", "ful", " ", "cred", "ential", "s", " ", "for", " ", "an", " ", "avat", "ar", " ", "id", ",", "\\", "10", ";", " ", " ", " ", " ", "use", " ", "C", "{", "SSH", "Proc", "oto", "l", "Check", "er", ".", "success", "ful", "Cred", "ential", "s", "[", "avat", "ar", "Id", "]}", ".", " ", " ", "If", " ", "L", "{", "are", "Don", "e", "}", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "Tru", "e", ",", " ", "the", " ", "authenticat", "ion", " ", "has", " ", "succe", "eded", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "implements_", "(_", "IC", "rede", "nti", "als", "Checker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "cred", "ential", "Interface", "s_", "=_", "property_", "(_", "get", "\\u", "cred", "ential", "Interface", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Proto", "col", "Checker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "checkers", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "success", "ful", "Credentials_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Proto", "col", "Checker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cred", "ential", "Interface", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "checkers", "_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Proto", "col", "Checker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "register", "Checker_", "(_", "self_", ",_", "checker_", ",_", "*_", "cred", "ential", "Interface", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "cred", "ential", "Interface", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cred", "ential", "Interface", "s_", "=_", "checker_", "._", "cred", "ential", "Interface", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cred", "ential", "Interface_", "in_", "cred", "ential", "Interface", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "checkers", "_", "[_", "cred", "ential", "Interface_", "]_", "=_", "checker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Proto", "col", "Checker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request", "Ava", "tar", "Id_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Part", " ", "of", " ", "the", " ", "L", "{", "IC", "rede", "nti", "als", "Check", "er", "}", " ", "interface", ".", " ", " ", "Call", "ed", " ", "by", " ", "a", " ", "portal", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "some", " ", "cred", "ential", "s", " ", "to", " ", "check", " ", "if", " ", "the", "y", "'", "ll", " ", "authenticat", "e", " ", "a", " ", "user", ".", " ", " ", "We", " ", "check", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "interface", "s", " ", "tha", "t", " ", "the", " ", "cred", "ential", "s", " ", "provide", " ", "against", " ", "our", " ", "list", " ", "of", " ", "acceptabl", "e", "\\", "10", ";", " ", " ", " ", " ", "checkers", ".", " ", " ", "If", " ", "one", " ", "of", " ", "them", " ", "matche", "s", ",", " ", "we", " ", "ask", " ", "tha", "t", " ", "checke", "r", " ", "to", " ", "verify", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "cred", "ential", "s", ".", " ", " ", "If", " ", "the", "y", "'", "re", " ", "valid", ",", " ", "we", " ", "call", " ", "our", " ", "L", "{\\u", "cb", "Good", "Auth", "entica", "tion", "}", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "to", " ", "continue", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "cred", "ential", "s", ":", " ", "the", " ", "cred", "ential", "s", " ", "the", " ", "L", "{", "Porta", "l", "}", " ", "want", "s", " ", "us", " ", "to", " ", "verify", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ifa", "c_", "=_", "provided", "By_", "(_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "ifa", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "checkers", "_", "._", "get_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "defer_", "._", "may", "be", "Deferred_", "(_", "c_", "._", "request", "Ava", "tar", "Id_", ",_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "._", "add", "Callback_", "(_", "self_", "._", "\\u", "cb", "Good", "Authentication_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "defer_", "._", "fail_", "(_", "Unh", "andle", "d", "Credentials_", "(_", "\"", "No", " ", "checke", "r", " ", "for", " ", "%", "s", "\"_", "%_", "',", " ", "'_", "._", "join_", "(_", "map_", "(_", "reflect", "_", "._", "qual_", ",_", "ifa", "c_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Proto", "col", "Checker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cb", "Good", "Authentication_", "(_", "self_", ",_", "avat", "ar", "Id_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "if", " ", "a", " ", "checke", "r", " ", "has", " ", "verifie", "d", " ", "the", " ", "cred", "ential", "s", ".", " ", " ", "We", " ", "call", " ", "our", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "are", "Don", "e", "}", " ", "method", " ", "to", " ", "see", " ", "if", " ", "the", " ", "whole", " ", "of", " ", "the", " ", "success", "ful", " ", "authenticat", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "eno", "ugh", ".", " ", " ", "If", " ", "the", "y", " ", "are", ",", " ", "we", " ", "return", " ", "the", " ", "avat", "ar", " ", "ID", " ", "return", "ed", " ", "by", " ", "the", " ", "first", "\\", "10", ";", " ", " ", " ", " ", "checke", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "avat", "ar", "Id_", "not_", "in_", "self_", "._", "success", "ful", "Credentials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "success", "ful", "Credentials_", "[_", "avat", "ar", "Id_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "success", "ful", "Credentials_", "[_", "avat", "ar", "Id_", "]_", "._", "append_", "(_", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "are", "Done_", "(_", "avat", "ar", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "success", "ful", "Credentials_", "[_", "avat", "ar", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "avat", "ar", "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 ", " _", "raise_", "error_", "._", "Not", "En", "ou", "gh", "Authentication_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Proto", "col", "Checker_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "are", "Done_", "(_", "self_", ",_", "avat", "ar", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Override", " ", "to", " ", "dete", "rmin", "e", " ", "if", " ", "the", " ", "authenticat", "ion", " ", "is", " ", "finish", "ed", " ", "for", " ", "a", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "avat", "ar", "Id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "avat", "ar", "Id", ":", " ", "the", " ", "avat", "ar", " ", "return", "ed", " ", "by", " ", "the", " ", "first", " ", "checke", "r", ".", " ", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "checke", "r", " ", "to", " ", "function", " ", "correct", "ly", ",", " ", "all", " ", "the", " ", "checkers", " ", "must", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "the", " ", "same", " ", "avat", "ar", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Signature mismatch in overriding method
RobotLocomotion/director/src/python/director/affordanceitems.py
[ { "content": "class AffordanceItem(PolyDataItem):\n\n COPY_MODE_ALL = 0 # copies all properties from affordance descriptions\n COPY_MODE_SKIP_LOCAL = 1 # skips properties that should keep local values such as visibility\n LOCAL_PROPERTY_NAMES = ('Visible')\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AffordanceItem", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, name, polyData, view):\n PolyDataItem.__init__(self, name, polyData, view)\n self.params = {}\n self.addProperty('uuid', newUUID(), attributes=om.PropertyAttributes(hidden=True))\n self.addProperty('Collision Enabled', True)\n self.addProperty('Origin', [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0], attributes=om.PropertyAttributes(hidden=True))\n self.addProperty('Camera Texture Enabled', False)\n\n self.properties.setPropertyIndex('Collision Enabled', 0)\n self.setProperty('Icon', om.Icons.Hammer)", "metadata": "root.AffordanceItem.__init__", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 24 }, { "content": " def getPose(self):\n childFrame = self.getChildFrame()\n t = childFrame.transform if childFrame else vtk.vtkTransform()\n return transformUtils.poseFromTransform(t)", "metadata": "root.AffordanceItem.getPose", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 35 }, { "content": " def getDescription(self):\n d = OrderedDict()\n d['classname'] = type(self).__name__\n d.update(self.properties._properties)\n d['pose'] = self.getPose()\n return d", "metadata": "root.AffordanceItem.getDescription", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 40 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n PolyDataItem._onPropertyChanged(self, propertySet, propertyName)\n if propertyName == 'Origin':\n self.updateGeometryFromProperties()", "metadata": "root.AffordanceItem._onPropertyChanged", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 47 }, { "content": " def updateGeometryFromProperties():\n pass", "metadata": "root.AffordanceItem.updateGeometryFromProperties", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 52 }, { "content": " def setPolyData(self, polyData):\n\n if polyData.GetNumberOfPoints():\n originPose = self.getProperty('Origin')\n pos, quat = originPose[:3], originPose[3:]\n t = transformUtils.transformFromPose(pos, quat)\n polyData = filterUtils.transformPolyData(polyData, t.GetLinearInverse())\n PolyDataItem.setPolyData(self, polyData)", "metadata": "root.AffordanceItem.setPolyData", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 55 }, { "content": " def repositionFromDescription(self, desc):\n position, quat = desc['pose']\n t = transformUtils.transformFromPose(position, quat)\n self.getChildFrame().copyFrame(t)", "metadata": "root.AffordanceItem.repositionFromDescription", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 64 }, { "content": " def loadDescription(self, desc, copyMode=COPY_MODE_ALL):\n self.syncProperties(desc, copyMode)\n self.repositionFromDescription(desc)\n self._renderAllViews()", "metadata": "root.AffordanceItem.loadDescription", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 69 }, { "content": " def syncProperties(self, desc, copyMode=COPY_MODE_ALL):\n for propertyName, propertyValue in desc.iteritems():\n if copyMode == self.COPY_MODE_SKIP_LOCAL:\n if propertyName in self.LOCAL_PROPERTY_NAMES:\n continue\n\n if self.hasProperty(propertyName) and (self.getProperty(propertyName) != propertyValue):\n #print 'syncing property %s: %r' % (propertyName, propertyValue)\n self.setProperty(propertyName, propertyValue)", "metadata": "root.AffordanceItem.syncProperties", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 74 }, { "content": " def onRemoveFromObjectModel(self):\n PolyDataItem.onRemoveFromObjectModel(self)", "metadata": "root.AffordanceItem.onRemoveFromObjectModel", "header": "['class', 'AffordanceItem', '(', 'PolyDataItem', ')', ':', '___EOS___']", "index": 84 }, { "content": "class BoxAffordanceItem(AffordanceItem):\n\n\n", "metadata": "root.BoxAffordanceItem", "header": "['module', '___EOS___']", "index": 88 }, { "content": " def __init__(self, name, view):\n AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)\n self.addProperty('Dimensions', [0.25, 0.25, 0.25], attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.addProperty('Subdivisions', 0, attributes=om.PropertyAttributes(minimum=0, maximum=1000))\n self.properties.setPropertyIndex('Dimensions', 0)\n self.properties.setPropertyIndex('Subdivisions', 1)\n self.updateGeometryFromProperties()", "metadata": "root.BoxAffordanceItem.__init__", "header": "['class', 'BoxAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 90 }, { "content": " def updateGeometryFromProperties(self):\n d = DebugData()\n d.addCube(self.getProperty('Dimensions'), (0,0,0), subdivisions=self.getProperty('Subdivisions'))\n self.setPolyData(d.getPolyData())", "metadata": "root.BoxAffordanceItem.updateGeometryFromProperties", "header": "['class', 'BoxAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 98 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n AffordanceItem._onPropertyChanged(self, propertySet, propertyName)\n\n if propertyName in ('Dimensions', 'Subdivisions'):\n self.updateGeometryFromProperties()", "metadata": "root.BoxAffordanceItem._onPropertyChanged", "header": "['class', 'BoxAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 103 }, { "content": "class SphereAffordanceItem(AffordanceItem):\n\n\n", "metadata": "root.SphereAffordanceItem", "header": "['module', '___EOS___']", "index": 110 }, { "content": " def __init__(self, name, view):\n AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)\n self.addProperty('Radius', 0.15, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.properties.setPropertyIndex('Radius', 0)\n self.updateGeometryFromProperties()", "metadata": "root.SphereAffordanceItem.__init__", "header": "['class', 'SphereAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 112 }, { "content": " def updateGeometryFromProperties(self):\n d = DebugData()\n d.addSphere((0,0,0), self.getProperty('Radius'))\n self.setPolyData(d.getPolyData())", "metadata": "root.SphereAffordanceItem.updateGeometryFromProperties", "header": "['class', 'SphereAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 118 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n AffordanceItem._onPropertyChanged(self, propertySet, propertyName)\n\n if propertyName == 'Radius':\n self.updateGeometryFromProperties()", "metadata": "root.SphereAffordanceItem._onPropertyChanged", "header": "['class', 'SphereAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 123 }, { "content": "class CylinderAffordanceItem(AffordanceItem):\n\n\n", "metadata": "root.CylinderAffordanceItem", "header": "['module', '___EOS___']", "index": 130 }, { "content": " def __init__(self, name, view):\n AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)\n self.addProperty('Radius', 0.03, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.addProperty('Length', 0.5, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.properties.setPropertyIndex('Radius', 0)\n self.properties.setPropertyIndex('Length', 1)\n self.updateGeometryFromProperties()", "metadata": "root.CylinderAffordanceItem.__init__", "header": "['class', 'CylinderAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 132 }, { "content": " def updateGeometryFromProperties(self):\n d = DebugData()\n length = self.getProperty('Length')\n d.addCylinder(center=(0,0,0), axis=(0,0,1), length=self.getProperty('Length'), radius=self.getProperty('Radius'))\n self.setPolyData(d.getPolyData())", "metadata": "root.CylinderAffordanceItem.updateGeometryFromProperties", "header": "['class', 'CylinderAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 140 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n AffordanceItem._onPropertyChanged(self, propertySet, propertyName)\n\n if propertyName in ('Length', 'Radius'):\n self.updateGeometryFromProperties()", "metadata": "root.CylinderAffordanceItem._onPropertyChanged", "header": "['class', 'CylinderAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 146 }, { "content": "class CapsuleAffordanceItem(AffordanceItem):\n\n\n", "metadata": "root.CapsuleAffordanceItem", "header": "['module', '___EOS___']", "index": 153 }, { "content": " def __init__(self, name, view):\n AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)\n self.addProperty('Radius', 0.03, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.addProperty('Length', 0.5, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.properties.setPropertyIndex('Radius', 0)\n self.properties.setPropertyIndex('Length', 1)\n self.updateGeometryFromProperties()", "metadata": "root.CapsuleAffordanceItem.__init__", "header": "['class', 'CapsuleAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 155 }, { "content": " def updateGeometryFromProperties(self):\n d = DebugData()\n length = self.getProperty('Length')\n d.addCapsule(center=(0,0,0), axis=(0,0,1), length=self.getProperty('Length'), radius=self.getProperty('Radius'))\n self.setPolyData(d.getPolyData())", "metadata": "root.CapsuleAffordanceItem.updateGeometryFromProperties", "header": "['class', 'CapsuleAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 163 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n AffordanceItem._onPropertyChanged(self, propertySet, propertyName)\n\n if propertyName in ('Length', 'Radius'):\n self.updateGeometryFromProperties()", "metadata": "root.CapsuleAffordanceItem._onPropertyChanged", "header": "['class', 'CapsuleAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 169 }, { "content": "class CapsuleRingAffordanceItem(AffordanceItem):\n\n\n", "metadata": "root.CapsuleRingAffordanceItem", "header": "['module', '___EOS___']", "index": 176 }, { "content": " def __init__(self, name, view):\n AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)\n self.setProperty('Collision Enabled', False)\n self.addProperty('Radius', 0.15, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.addProperty('Tube Radius', 0.02, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))\n self.addProperty('Segments', 8, attributes=om.PropertyAttributes(decimals=3, singleStep=1, minimum=3, maximum=100))\n\n self.properties.setPropertyIndex('Radius', 0)\n self.properties.setPropertyIndex('Tube Radius', 1)\n self.properties.setPropertyIndex('Segments', 2)\n\n self.updateGeometryFromProperties()", "metadata": "root.CapsuleRingAffordanceItem.__init__", "header": "['class', 'CapsuleRingAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 178 }, { "content": " def updateGeometryFromProperties(self):\n radius = self.getProperty('Radius')\n circlePoints = np.linspace(0, 2*np.pi, self.getProperty('Segments')+1)\n spokes = [(0.0, np.sin(x), np.cos(x)) for x in circlePoints]\n spokes = [radius*np.array(x)/np.linalg.norm(x) for x in spokes]\n d = DebugData()\n for a, b in zip(spokes, spokes[1:]):\n d.addCapsule(center=(a+b)/2.0, axis=(b-a), length=np.linalg.norm(b-a), radius=self.getProperty('Tube Radius'))\n self.setPolyData(d.getPolyData())", "metadata": "root.CapsuleRingAffordanceItem.updateGeometryFromProperties", "header": "['class', 'CapsuleRingAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 191 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n AffordanceItem._onPropertyChanged(self, propertySet, propertyName)\n\n if propertyName in ('Radius', 'Tube Radius', 'Segments'):\n self.updateGeometryFromProperties()", "metadata": "root.CapsuleRingAffordanceItem._onPropertyChanged", "header": "['class', 'CapsuleRingAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 201 }, { "content": "class MeshAffordanceItem(AffordanceItem):\n\n _meshManager = None\n\n\n\n\n\n\n", "metadata": "root.MeshAffordanceItem", "header": "['module', '___EOS___']", "index": 208 }, { "content": " def __init__(self, name, view):\n AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)\n self.setProperty('Collision Enabled', False)\n self.addProperty('Filename', '')\n self.properties.setPropertyIndex('Filename', 0)\n\n # attempt to reload geometry if it is currently empty\n if self.getProperty('Filename') and not self.polyData.GetNumberOfPoints():\n self.updateGeometryFromProperties()", "metadata": "root.MeshAffordanceItem.__init__", "header": "['class', 'MeshAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 212 }, { "content": " def updateGeometryFromProperties(self):\n filename = self.getProperty('Filename')\n\n if not filename:\n polyData = vtk.vtkPolyData()\n else:\n polyData = self.getMeshManager().get(filename)\n\n if not polyData:\n\n if not os.path.isabs(filename):\n filename = os.path.join(director.getDRCBaseDir(), filename)\n\n if os.path.isfile(filename):\n polyData = ioUtils.readPolyData(filename)\n else:\n # use axes as a placeholder mesh\n d = DebugData()\n d.addFrame(vtk.vtkTransform(), scale=0.1, tubeRadius=0.005)\n polyData = d.getPolyData()\n\n self.setPolyData(polyData)", "metadata": "root.MeshAffordanceItem.updateGeometryFromProperties", "header": "['class', 'MeshAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 223 }, { "content": " @classmethod\n def getMeshManager(cls):\n if cls._meshManager is None:\n cls._meshManager = meshmanager.MeshManager()\n return cls._meshManager", "metadata": "root.MeshAffordanceItem.getMeshManager", "header": "['class', 'MeshAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 246 }, { "content": " @classmethod\n def promotePolyDataItem(cls, obj):\n parent = obj.parent()\n view = obj.views[0]\n name = obj.getProperty('Name')\n polyData = obj.polyData\n props = obj.properties._properties\n childFrame = obj.getChildFrame()\n if childFrame:\n t = transformUtils.copyFrame(childFrame.transform)\n else:\n t = vtk.vtkTransform()\n t.PostMultiply()\n t.Translate(filterUtils.computeCentroid(polyData))\n polyData = filterUtils.transformPolyData(polyData, t.GetLinearInverse())\n\n children = [c for c in obj.children() if c is not childFrame]\n\n meshId = cls.getMeshManager().add(polyData)\n\n om.removeFromObjectModel(obj)\n obj = MeshAffordanceItem(name, view)\n obj.setProperty('Filename', meshId)\n om.addToObjectModel(obj, parentObj=parent)\n frame = vis.addChildFrame(obj)\n frame.copyFrame(t)\n\n for child in children:\n om.addToObjectModel(child, parentObj=obj)\n\n obj.syncProperties(props)\n return obj", "metadata": "root.MeshAffordanceItem.promotePolyDataItem", "header": "['class', 'MeshAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 252 }, { "content": " def _onPropertyChanged(self, propertySet, propertyName):\n AffordanceItem._onPropertyChanged(self, propertySet, propertyName)\n\n if propertyName == 'Filename':\n self.updateGeometryFromProperties()", "metadata": "root.MeshAffordanceItem._onPropertyChanged", "header": "['class', 'MeshAffordanceItem', '(', 'AffordanceItem', ')', ':', '___EOS___']", "index": 286 } ]
[ { "span": "def updateGeometryFromProperties(self):", "start_line": 98, "start_column": 4, "end_line": 98, "end_column": 43 }, { "span": "def updateGeometryFromProperties(self):", "start_line": 118, "start_column": 4, "end_line": 118, "end_column": 43 }, { "span": "def updateGeometryFromProperties(self):", "start_line": 140, "start_column": 4, "end_line": 140, "end_column": 43 }, { "span": "def updateGeometryFromProperties(self):", "start_line": 163, "start_column": 4, "end_line": 163, "end_column": 43 }, { "span": "def updateGeometryFromProperties(self):", "start_line": 191, "start_column": 4, "end_line": 191, "end_column": 43 }, { "span": "def updateGeometryFromProperties(self):", "start_line": 223, "start_column": 4, "end_line": 223, "end_column": 43 } ]
[ { "span": "def updateGeometryFromProperties():", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 39 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "COPY", "\\u", "MODE", "\\u", "ALL_", "=_", "0_", "#", " ", "copie", "s", " ", "all", " ", "proper", "ties", " ", "from", " ", "aff", "orda", "nce", " ", "descriptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COPY", "\\u", "MODE", "\\u", "SKIP", "\\u", "LOCAL_", "=_", "1_", "#", " ", "skips", " ", "proper", "ties", " ", "tha", "t", " ", "shou", "ld", " ", "keep", " ", "local", " ", "values", " ", "suc", "h", " ", "as", " ", "visibility_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOCAL", "\\u", "PROPERTY", "\\u", "NAMES_", "=_", "(_", "'", "Vis", "ibl", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "poly", "Data_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Poly", "Data", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "poly", "Data_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "uuid", "'_", ",_", "new", "UUID_", "(_", ")_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "hidden_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Colli", "sion", " ", "Enable", "d", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Orig", "in", "'_", ",_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", ",_", "1.0_", ",_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "hidden_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Came", "ra", " ", "Text", "ure", " ", "Enable", "d", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Colli", "sion", " ", "Enable", "d", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Property_", "(_", "'", "Ico", "n", "'_", ",_", "om_", "._", "Icons", "_", "._", "Ham", "mer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Pose", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child", "Frame_", "=_", "self_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "child", "Frame_", "._", "transform_", "if_", "child", "Frame_", "else_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "class", "name", "'_", "]_", "=_", "type_", "(_", "self_", ")_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "update_", "(_", "self_", "._", "properties_", "._", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "'", "pose", "'_", "]_", "=_", "self_", "._", "get", "Pose", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Poly", "Data", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "property", "Name_", "==_", "'", "Orig", "in", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Poly", "Data_", "(_", "self_", ",_", "poly", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "in", "Pose", "_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Orig", "in", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", ",_", "quat_", "=_", "orig", "in", "Pose", "_", "[_", ":_", "3_", "]_", ",_", "orig", "in", "Pose", "_", "[_", "3_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "transform", "Fro", "m", "Pose", "_", "(_", "pos_", ",_", "quat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "filter", "Utils_", "._", "transform", "Poly", "Data_", "(_", "poly", "Data_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Poly", "Data", "Item_", "._", "set", "Poly", "Data_", "(_", "self_", ",_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "repos", "ition", "Fro", "m", "Description_", "(_", "self_", ",_", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "position_", ",_", "quat_", "=_", "desc_", "[_", "'", "pose", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "transform", "Fro", "m", "Pose", "_", "(_", "position_", ",_", "quat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Description_", "(_", "self_", ",_", "desc_", ",_", "copy", "Mode_", "=_", "COPY", "\\u", "MODE", "\\u", "ALL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sync", "Properties_", "(_", "desc_", ",_", "copy", "Mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "repos", "ition", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "render", "All", "Views_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sync", "Properties_", "(_", "self_", ",_", "desc_", ",_", "copy", "Mode_", "=_", "COPY", "\\u", "MODE", "\\u", "ALL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "property", "Name_", ",_", "property", "Value_", "in_", "desc_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "copy", "Mode_", "==_", "self_", "._", "COPY", "\\u", "MODE", "\\u", "SKIP", "\\u", "LOCAL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "property", "Name_", "in_", "self_", "._", "LOCAL", "\\u", "PROPERTY", "\\u", "NAMES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "Property_", "(_", "property", "Name_", ")_", "and_", "(_", "self_", "._", "get", "Property_", "(_", "property", "Name_", ")_", "!=_", "property", "Value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "sync", "ing", " ", "property", " ", "%", "s", ":", " ", "%", "r", "'", " ", "%", " ", "(", "property", "Name", ",", " ", "property", "Value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Property_", "(_", "property", "Name_", ",_", "property", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aff", "orda", "nce", "Item_", "(_", "Poly", "Data", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Remove", "Fro", "m", "Object", "Model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Poly", "Data", "Item_", "._", "on", "Remove", "Fro", "m", "Object", "Model_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Box", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Box", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\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_", ",_", "name_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "vtk_", "._", "vtk", "Poly", "Data_", "(_", ")_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Dimen", "sion", "s", "'_", ",_", "[_", "0.25_", ",_", "0.25_", ",_", "0.25_", "]_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Subd", "ivi", "sion", "s", "'_", ",_", "0_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "minimum_", "=_", "0_", ",_", "maximum_", "=_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Dimen", "sion", "s", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Subd", "ivi", "sion", "s", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Box", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Cube_", "(_", "self_", "._", "get", "Property_", "(_", "'", "Dimen", "sion", "s", "'_", ")_", ",_", "(_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "subdivi", "sions_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Subd", "ivi", "sion", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Box", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "property", "Name_", "in_", "(_", "'", "Dimen", "sion", "s", "'_", ",_", "'", "Subd", "ivi", "sion", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Sphere", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Sphere", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\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_", ",_", "name_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "vtk_", "._", "vtk", "Poly", "Data_", "(_", ")_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Rad", "ius", "'_", ",_", "0.15_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Rad", "ius", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sphere", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "(_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "self_", "._", "get", "Property_", "(_", "'", "Rad", "ius", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sphere", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "property", "Name_", "==_", "'", "Rad", "ius", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Cylinder", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Cylinder", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\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_", ",_", "name_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "vtk_", "._", "vtk", "Poly", "Data_", "(_", ")_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Rad", "ius", "'_", ",_", "0.03_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Length", "'_", ",_", "0.5_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Rad", "ius", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Length", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cylinder", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Cylinder", "_", "(_", "center_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "axis_", "=_", "(_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "length_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Length", "'_", ")_", ",_", "radius_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Rad", "ius", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cylinder", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "property", "Name_", "in_", "(_", "'", "Length", "'_", ",_", "'", "Rad", "ius", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Caps", "ule", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Caps", "ule", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\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_", ",_", "name_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "vtk_", "._", "vtk", "Poly", "Data_", "(_", ")_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Rad", "ius", "'_", ",_", "0.03_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Length", "'_", ",_", "0.5_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Rad", "ius", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Length", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Caps", "ule", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Caps", "ule_", "(_", "center_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ")_", ",_", "axis_", "=_", "(_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "length_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Length", "'_", ")_", ",_", "radius_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Rad", "ius", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Caps", "ule", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "property", "Name_", "in_", "(_", "'", "Length", "'_", ",_", "'", "Rad", "ius", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\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_", ",_", "name_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "vtk_", "._", "vtk", "Poly", "Data_", "(_", ")_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Property_", "(_", "'", "Colli", "sion", " ", "Enable", "d", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Rad", "ius", "'_", ",_", "0.15_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Tu", "be", " ", "Rad", "ius", "'_", ",_", "0.02_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "0.01_", ",_", "minimum_", "=_", "0.0_", ",_", "maximum_", "=_", "1e", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "Segments", "'_", ",_", "8_", ",_", "attributes_", "=_", "om_", "._", "Proper", "ty", "Attributes_", "(_", "decimals_", "=_", "3_", ",_", "single", "Step_", "=_", "1_", ",_", "minimum_", "=_", "3_", ",_", "maximum_", "=_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Rad", "ius", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Tu", "be", " ", "Rad", "ius", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "Segments", "'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "radius_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Rad", "ius", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Points_", "=_", "np_", "._", "linspace_", "(_", "0_", ",_", "2_", "*_", "np_", "._", "pi_", ",_", "self_", "._", "get", "Property_", "(_", "'", "Segments", "'_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "s_", "=_", "[_", "(_", "0.0_", ",_", "np_", "._", "sin_", "(_", "x_", ")_", ",_", "np_", "._", "cos_", "(_", "x_", ")_", ")_", "for_", "x_", "in_", "circle", "Points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "s_", "=_", "[_", "radius_", "*_", "np_", "._", "array_", "(_", "x_", ")_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "x_", ")_", "for_", "x_", "in_", "spoke", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a_", ",_", "b_", "in_", "zip_", "(_", "spoke", "s_", ",_", "spoke", "s_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "add", "Caps", "ule_", "(_", "center_", "=_", "(_", "a_", "+_", "b_", ")_", "/_", "2.0_", ",_", "axis_", "=_", "(_", "b_", "-_", "a_", ")_", ",_", "length_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "b_", "-_", "a_", ")_", ",_", "radius_", "=_", "self_", "._", "get", "Property_", "(_", "'", "Tu", "be", " ", "Rad", "ius", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "property", "Name_", "in_", "(_", "'", "Rad", "ius", "'_", ",_", "'", "Tu", "be", " ", "Rad", "ius", "'_", ",_", "'", "Segments", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Mesh", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "mesh", "Manager_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Mesh", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "vtk_", "._", "vtk", "Poly", "Data_", "(_", ")_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Property_", "(_", "'", "Colli", "sion", " ", "Enable", "d", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Property_", "(_", "'", "File", "name", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "properties_", "._", "set", "Proper", "ty", "Index_", "(_", "'", "File", "name", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "relo", "ad", " ", "geom", "etry", " ", "if", " ", "it", " ", "is", " ", "currentl", "y", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "get", "Property_", "(_", "'", "File", "name", "'_", ")_", "and_", "not_", "self_", "._", "poly", "Data_", "._", "Get", "Number", "Of", "Points_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mesh", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "get", "Property_", "(_", "'", "File", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "vtk_", "._", "vtk", "Poly", "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 ", " _", "poly", "Data_", "=_", "self_", "._", "get", "Mesh", "Manager_", "(_", ")_", "._", "get_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "poly", "Data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isabs_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "director_", "._", "get", "DR", "CB", "ase", "Dir_", "(_", ")_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", "=_", "io", "Utils_", "._", "read", "Poly", "Data_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "axes", " ", "as", " ", "a", " ", "placehold", "er", " ", "mesh_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Frame_", "(_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", ",_", "scale_", "=_", "0.1_", ",_", "tube", "Radius_", "=_", "0.005_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "d_", "._", "get", "Poly", "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_", "._", "set", "Poly", "Data_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mesh", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Mesh", "Manager_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u", "mesh", "Manager_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "mesh", "Manager_", "=_", "mesh", "manager_", "._", "Mesh", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "\\u", "mesh", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mesh", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "promote", "Poly", "Data", "Item_", "(_", "cls_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "obj_", "._", "parent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "obj_", "._", "views_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "obj_", "._", "get", "Property_", "(_", "'", "Name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "props_", "=_", "obj_", "._", "properties_", "._", "\\u", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "Frame_", "=_", "obj_", "._", "get", "Chil", "d", "Frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child", "Frame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "child", "Frame_", "._", "transform_", ")_", "\\u\\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_", "=_", "vtk_", "._", "vtk", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "filter", "Utils_", "._", "compute", "Centro", "id_", "(_", "poly", "Data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "filter", "Utils_", "._", "transform", "Poly", "Data_", "(_", "poly", "Data_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "children_", "=_", "[_", "c_", "for_", "c_", "in_", "obj_", "._", "children_", "(_", ")_", "if_", "c_", "is_", "not_", "child", "Frame_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mesh", "Id_", "=_", "cls_", "._", "get", "Mesh", "Manager_", "(_", ")_", "._", "add_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "om_", "._", "remove", "Fro", "m", "Object", "Model_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "Mesh", "Aff", "orda", "nce", "Item_", "(_", "name_", ",_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "File", "name", "'_", ",_", "mesh", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "add", "To", "Object", "Model_", "(_", "obj_", ",_", "parent", "Obj_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "=_", "vis_", "._", "add", "Chil", "d", "Frame_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "child_", "in_", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "om_", "._", "add", "To", "Object", "Model_", "(_", "child_", ",_", "parent", "Obj_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "sync", "Properties_", "(_", "props_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mesh", "Aff", "orda", "nce", "Item_", "(_", "Aff", "orda", "nce", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Aff", "orda", "nce", "Item_", "._", "\\u", "on", "Proper", "ty", "Changed_", "(_", "self_", ",_", "property", "Set_", ",_", "property", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "property", "Name_", "==_", "'", "File", "name", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "Geometr", "y", "Fro", "m", "Properties_", "(_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jonathanslenders/ptpython/ptpython/key_bindings.py
[ { "content": "def load_python_bindings(key_bindings_manager, python_input):\n \"\"\"\n Custom key bindings.\n \"\"\"\n sidebar_visible = Condition(lambda cli: python_input.show_sidebar)\n handle = key_bindings_manager.registry.add_binding\n has_selection = HasSelection()\n vi_mode_enabled = Condition(lambda cli: python_input.vi_mode)\n\n @handle(Keys.ControlL)\n def _(event):\n \"\"\"\n Clear whole screen and render again -- also when the sidebar is visible.\n \"\"\"\n event.cli.renderer.clear()\n\n @handle(Keys.F2)\n def _(event):\n \"\"\"\n Show/hide sidebar.\n \"\"\"\n python_input.show_sidebar = not python_input.show_sidebar\n\n @handle(Keys.F3)\n def _(event):\n \"\"\"\n Select from the history.\n \"\"\"\n python_input.enter_history(event.cli)\n\n @handle(Keys.F4)\n def _(event):\n \"\"\"\n Toggle between Vi and Emacs mode.\n \"\"\"\n if event.cli.editing_mode == EditingMode.VI:\n event.cli.editing_mode = EditingMode.EMACS\n else:\n event.cli.editing_mode = EditingMode.VI\n\n\n @handle(Keys.F6)\n def _(event):\n \"\"\"\n Enable/Disable paste mode.\n \"\"\"\n python_input.paste_mode = not python_input.paste_mode\n\n @handle(Keys.Tab, filter= ~sidebar_visible & ~has_selection & TabShouldInsertWhitespaceFilter())\n def _(event):\n \"\"\"\n When tab should insert whitespace, do that instead of completion.\n \"\"\"\n event.cli.current_buffer.insert_text(' ')\n\n @handle(Keys.ControlJ, filter= ~sidebar_visible & ~has_selection &\n (ViInsertMode() | EmacsInsertMode()) &\n HasFocus(DEFAULT_BUFFER) & IsMultiline())\n def _(event):\n \"\"\"\n Behaviour of the Enter key.\n\n Auto indent after newline/Enter.\n (When not in Vi navigaton mode, and when multiline is enabled.)\n \"\"\"\n b = event.current_buffer\n empty_lines_required = python_input.accept_input_on_enter or 10000\n\n def at_the_end(b):\n \"\"\" we consider the cursor at the end when there is no text after\n the cursor, or only whitespace. \"\"\"\n text = b.document.text_after_cursor\n return text == '' or (text.isspace() and not '\\n' in text)\n\n if python_input.paste_mode:\n # In paste mode, always insert text.\n b.insert_text('\\n')\n\n elif at_the_end(b) and b.document.text.replace(' ', '').endswith(\n '\\n' * (empty_lines_required - 1)):\n if b.validate():\n # When the cursor is at the end, and we have an empty line:\n # drop the empty lines, but return the value.\n b.document = Document(\n text=b.text.rstrip(),\n cursor_position=len(b.text.rstrip()))\n\n b.accept_action.validate_and_handle(event.cli, b)\n else:\n auto_newline(b)\n\n @handle(Keys.ControlBackslash, filter= ~sidebar_visible & ~has_selection &\n (ViInsertMode() | EmacsInsertMode()) &\n HasFocus(DEFAULT_BUFFER))\n def _(event):\n r\"\"\"\n Always insert a newline when Control+\\ has been pressed.\n \"\"\"\n b = event.current_buffer\n b.insert_text('\\n')\n\n @handle(Keys.ControlD, filter=~sidebar_visible & Condition(lambda cli:\n # Only when the `confirm_exit` flag is set.\n python_input.confirm_exit and\n # And the current buffer is empty.\n cli.current_buffer_name == DEFAULT_BUFFER and\n not cli.current_buffer.text))\n def _(event):\n \"\"\"\n Override Control-D exit, to ask for confirmation.\n \"\"\"\n python_input.show_exit_confirmation = True", "metadata": "root.load_python_bindings", "header": "['module', '___EOS___']", "index": 30 } ]
[ { "span": "vi_mode_enabled ", "start_line": 37, "start_column": 4, "end_line": 37, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "python", "\\u", "bindings_", "(_", "key", "\\u", "bindi", "ngs", "\\u", "manager_", ",_", "python", "\\u", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Custom", " ", "key", " ", "bindi", "ngs", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sidebar", "\\u", "visible_", "=_", "Condition_", "(_", "lambda_", "cli_", ":_", "python", "\\u", "input_", "._", "show", "\\u", "sidebar", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "=_", "key", "\\u", "bindi", "ngs", "\\u", "manager_", "._", "registry_", "._", "add", "\\u", "binding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "selection_", "=_", "Has", "Selection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi", "\\u", "mode", "\\u", "enabled_", "=_", "Condition_", "(_", "lambda_", "cli_", ":_", "python", "\\u", "input_", "._", "vi", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handle_", "(_", "Keys_", "._", "Control", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clear", " ", "whole", " ", "screen", " ", "and", " ", "render", " ", "again", " ", "--", " ", "als", "o", " ", "whe", "n", " ", "the", " ", "sidebar", " ", "is", " ", "visi", "ble", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "._", "cli_", "._", "renderer_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handle_", "(_", "Keys_", "._", "F2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", "/", "hide", " ", "sidebar", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "input_", "._", "show", "\\u", "sidebar", "_", "=_", "not_", "python", "\\u", "input_", "._", "show", "\\u", "sidebar", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handle_", "(_", "Keys_", "._", "F3", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "from", " ", "the", " ", "histo", "ry", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "input_", "._", "enter", "\\u", "history_", "(_", "event_", "._", "cli_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handle_", "(_", "Keys_", "._", "F4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Toggle", " ", "bet", "ween", " ", "Vi", " ", "and", " ", "Ema", "cs", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "._", "cli_", "._", "editin", "g", "\\u", "mode_", "==_", "Editing", "Mode_", "._", "VI", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", "._", "cli_", "._", "editin", "g", "\\u", "mode_", "=_", "Editing", "Mode_", "._", "EMA", "CS_", "\\u\\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_", "._", "cli_", "._", "editin", "g", "\\u", "mode_", "=_", "Editing", "Mode_", "._", "VI", "_", "\\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_", "@_", "handle_", "(_", "Keys_", "._", "F6", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Enable", "/", "Disa", "ble", " ", "paste", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "input_", "._", "paste", "\\u", "mode_", "=_", "not_", "python", "\\u", "input_", "._", "paste", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handle_", "(_", "Keys_", "._", "Tab_", ",_", "filter_", "=_", "~_", "sidebar", "\\u", "visible_", "&_", "~_", "has", "\\u", "selection_", "&_", "Tab", "Sho", "ul", "d", "Insert", "Whitespace", "Filter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "tab", " ", "shou", "ld", " ", "insert", " ", "whitespace", ",", " ", "do", " ", "tha", "t", " ", "inst", "ead", " ", "of", " ", "completion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "._", "cli_", "._", "current", "\\u", "buffer_", "._", "insert", "\\u", "text_", "(_", "'", " ", " ", " ", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handle_", "(_", "Keys_", "._", "Control", "J_", ",_", "filter_", "=_", "~_", "sidebar", "\\u", "visible_", "&_", "~_", "has", "\\u", "selection_", "&_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Vi", "Insert", "Mode_", "(_", ")_", "|_", "Ema", "cs", "Insert", "Mode_", "(_", ")_", ")_", "&_", "\\u\\u\\uNL\\u\\u\\u_", "Has", "Focus_", "(_", "DEF", "AUL", "T", "\\u", "BUFFER_", ")_", "&_", "Is", "Multiline", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Behavio", "ur", " ", "of", " ", "the", " ", "Enter", " ", "key", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Auto", " ", "indent", " ", "after", " ", "newline", "/", "Enter", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "Whe", "n", " ", "not", " ", "in", " ", "Vi", " ", "navi", "gat", "on", " ", "mode", ",", " ", "and", " ", "whe", "n", " ", "multiline", " ", "is", " ", "enable", "d", ".)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "event_", "._", "current", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty", "\\u", "lines", "\\u", "required_", "=_", "python", "\\u", "input_", "._", "accept", "\\u", "input", "\\u", "on", "\\u", "enter_", "or_", "10000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "at", "\\u", "the", "\\u", "end_", "(_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "we", " ", "consider", " ", "the", " ", "cursor", " ", "at", " ", "the", " ", "end", " ", "whe", "n", " ", "there", " ", "is", " ", "no", " ", "text", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "cursor", ",", " ", "or", " ", "only", " ", "whitespace", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "b_", "._", "document_", "._", "text", "\\u", "after", "\\u", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "text_", "==_", "''_", "or_", "(_", "text_", "._", "isspace", "_", "(_", ")_", "and_", "not_", "'\\\\", "n", "'_", "in_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "python", "\\u", "input_", "._", "paste", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "paste", " ", "mode", ",", " ", "alw", "ay", "s", " ", "insert", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "insert", "\\u", "text_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "at", "\\u", "the", "\\u", "end_", "(_", "b_", ")_", "and_", "b_", "._", "document_", "._", "text_", "._", "replace_", "(_", "'", " ", "'_", ",_", "''_", ")_", "._", "endswith_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "'_", "*_", "(_", "empty", "\\u", "lines", "\\u", "required_", "-_", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "b_", "._", "validate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "the", " ", "cursor", " ", "is", " ", "at", " ", "the", " ", "end", ",", " ", "and", " ", "we", " ", "have", " ", "an", " ", "empty", " ", "line", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "drop", " ", "the", " ", "empty", " ", "lines", ",", " ", "but", " ", "return", " ", "the", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "document_", "=_", "Document_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "b_", "._", "text_", "._", "rstrip_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cursor", "\\u", "position_", "=_", "len_", "(_", "b_", "._", "text_", "._", "rstrip_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "accept", "\\u", "action_", "._", "validat", "e\\u", "and", "\\u", "handle_", "(_", "event_", "._", "cli_", ",_", "b_", ")_", "\\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 ", " _", "auto", "\\u", "newline_", "(_", "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_", "@_", "handle_", "(_", "Keys_", "._", "Control", "Back", "slash_", ",_", "filter_", "=_", "~_", "sidebar", "\\u", "visible_", "&_", "~_", "has", "\\u", "selection_", "&_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Vi", "Insert", "Mode_", "(_", ")_", "|_", "Ema", "cs", "Insert", "Mode_", "(_", ")_", ")_", "&_", "\\u\\u\\uNL\\u\\u\\u_", "Has", "Focus_", "(_", "DEF", "AUL", "T", "\\u", "BUFFER_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Al", "way", "s", " ", "insert", " ", "a", " ", "newline", " ", "whe", "n", " ", "Control", "+\\\\", " ", "has", " ", "bee", "n", " ", "presse", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "event_", "._", "current", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "insert", "\\u", "text_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handle_", "(_", "Keys_", "._", "Control", "D_", ",_", "filter_", "=_", "~_", "sidebar", "\\u", "visible_", "&_", "Condition_", "(_", "lambda_", "cli_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "whe", "n", " ", "the", " ", "`", "confirm", "\\u", "exit", "`", " ", "flag", " ", "is", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "input_", "._", "confirm", "\\u", "exit_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "the", " ", "current", " ", "buffer", " ", "is", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "cli_", "._", "current", "\\u", "buffer", "\\u", "name_", "==_", "DEF", "AUL", "T", "\\u", "BUFFER_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "cli_", "._", "current", "\\u", "buffer_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Override", " ", "Control", "-", "D", " ", "exit", ",", " ", "to", " ", "ask", " ", "for", " ", "confirmation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "input_", "._", "show", "\\u", "exit", "\\u", "confirmation_", "=_", "True_", "\\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, 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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 ]
Unused import
flags/Reactor-3/numbers.py
[ { "content": "from globals import *\nfrom math import *\nimport pathfinding\nimport render_los\nimport logging\nimport random\nimport numpy\nimport tiles\nimport time\nimport maps\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def clip(number,start,end):\n\t\"\"\"Returns `number`, but makes sure it's in the range of [start..end]\"\"\"\n\treturn max(start, min(number, end))", "metadata": "root.clip", "header": "['module', '___EOS___']", "index": 11 }, { "content": "def roll(dice, sides):\n\treturn sum([random.choice(range(sides))+1 for d in range(dice)])", "metadata": "root.roll", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def lerp(n1, n2, t):\n\treturn n1 + (n2-n1) * t", "metadata": "root.lerp", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def distance(pos1, pos2, old=False):\n\tif old:\n\t\treturn abs(pos1[0]-pos2[0])+abs(pos1[1]-pos2[1])\n\t\t\n\tx_dist = abs(pos1[0]-pos2[0])\n\ty_dist = abs(pos1[1]-pos2[1])\n\t\n\tif x_dist > y_dist:\n\t\treturn y_dist + (x_dist-y_dist)\n\telse:\n\t\treturn x_dist + (y_dist-x_dist)", "metadata": "root.distance", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def velocity(direction, speed):\n\trad = direction*(pi/180)\n\tvelocity = numpy.multiply(numpy.array([cos(rad), sin(rad)]), speed)\n\t\n\treturn [velocity[0], -velocity[1], 0]", "metadata": "root.velocity", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def lerp_velocity(velocity1, velocity2, interp):\n\treturn [lerp(velocity1[0], velocity2[0], interp),\n\t lerp(velocity1[1], velocity2[1], interp),\n\t lerp(velocity1[2], velocity2[2], interp)]", "metadata": "root.lerp_velocity", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def get_surface_area(structure):\n\tif 'attaches_to' in structure:\n\t\treturn structure['size']*len(structure['attaches_to'])\n\t\n\treturn structure['size']", "metadata": "root.get_surface_area", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def direction_to(pos1, pos2):\n\ttheta = atan2((pos1[1]-pos2[1]), -(pos1[0]-pos2[0]))\n\t\t\n\tif theta < 0:\n\t\ttheta += 2 * pi\n\t\n\treturn theta * (180/pi)", "metadata": "root.direction_to", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def create_flee_map(dijkstra):\n\tfor _x in range(dijkstra['x_range'][0],dijkstra['x_range'][1]):\n\t\tfor _y in range(dijkstra['y_range'][0],dijkstra['y_range'][1]):\n\t\t\tif dijkstra['map'][_y-dijkstra['y_range'][0],_x-dijkstra['x_range'][0]]==9999:\n\t\t\t\tcontinue\n\t\t\t\n\t\t\tdijkstra['map'][_y-dijkstra['y_range'][0],_x-dijkstra['x_range'][0]] *= -1.25", "metadata": "root.create_flee_map", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def calculate_dijkstra_map(dijkstra):\n\t_map = dijkstra['map']\n\t_min_x = dijkstra['x_range'][0]\n\t_max_x = dijkstra['x_range'][1]\n\t_min_y = dijkstra['y_range'][0]\n\t_max_y = dijkstra['y_range'][1]\n\t_target_positions = [tuple(target['position']) for target in dijkstra['targets']]\n\t\n\t_i = 0\n\twhile 1==1:\n\t\t_i += 1\n\t\t_orig_map = _map.copy()\n\t\t\n\t\tfor _x in range(_min_x,_max_x):\n\t\t\tfor _y in range(_min_y,_max_y):\n\t\t\t\tif (_x,_y) in _target_positions or _orig_map[_y-_min_y,_x-_min_x] == -1:\n\t\t\t\t\t\n\t\t\t\t\tcontinue\n\t\t\t\t\n\t\t\t\t_lowest_score = 9000\n\t\t\t\t\n\t\t\t\tfor x1 in range(-1,2):\n\t\t\t\t\tx = _x+x1\n\t\t\t\t\t\n\t\t\t\t\tif 0>x or x>=_max_x:\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t\n\t\t\t\t\tfor y1 in range(-1,2):\n\t\t\t\t\t\t#if (x1,y1) in [(-1,-1),(1,-1),(-1,1),(1,1)]:\n\t\t\t\t\t\t#\tcontinue\n\t\t\t\t\t\t\n\t\t\t\t\t\ty = _y+y1\n\t\t\t\t\t\t\n\t\t\t\t\t\tif 0>y or y>=_max_y or (x1,y1) == (0,0) or _orig_map[y-_min_y,x-_min_x] == -1:\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\n\t\t\t\t\t\tif _orig_map[y-_min_y,x-_min_x] < _lowest_score:\n\t\t\t\t\t\t\t_lowest_score = _orig_map[y-_min_y,x-_min_x]\n\t\t\t\t\n\t\t\t\tif _lowest_score>=0:\n\t\t\t\t\tif _orig_map[_y-_min_y,_x-_min_x]-_lowest_score>=2:\n\t\t\t\t\t\t_map[_y-_min_y,_x-_min_x] = _lowest_score+1\n\t\t\n\t\tif numpy.array_equal(_map,_orig_map):\n\t\t\tbreak", "metadata": "root.calculate_dijkstra_map", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def _create_dijkstra_map(center,source_map,targets,size=(50,50),flee=False,**kvargs):\n\tif not targets:\n\t\traise Exception('No targets passed to create_dijkstra_map()')\n\t\n\t_target_positions = [tuple(target['position']) for target in targets]\n\t\n\t_min_x = clip(center[0]-(size[0]),0,MAP_SIZE[0])\n\t_max_x = clip(center[0]+(size[0]),0,MAP_SIZE[0])\n\t\n\t_min_y = clip(center[1]-(size[1]),0,MAP_SIZE[1])\n\t_max_y = clip(center[1]+(size[1]),0,MAP_SIZE[1])\n\t\n\t_stime = time.time()\n\t\n\t_map = numpy.ones((_max_y,_max_x))\n\t_orig_map = None\n\t\n\tfor target in targets:\n\t\t_map[target['position'][1]-_min_y,target['position'][0]-_min_x] = 0#target['score']\n\t\n\t_map*=30\n\t\n\tfor x in range(_min_x,_max_x):\n\t\tfor y in range(_min_y,_max_y):\t\t\t\n\t\t\tif source_map[x][y][center[2]+1]:\n\t\t\t\tif flee:\n\t\t\t\t\t_map[y-_min_y,x-_min_x] = 1\n\t\t\t\telse:\n\t\t\t\t\t_map[y-_min_y,x-_min_x] = -1\n\t\t\t\t\n\t\t\t\tcontinue\n\t\n\t_dijkstra = {'map': _map,\n\t\t'x_range': (_min_x,_max_x),\n\t\t'y_range': (_min_y,_max_y),\n\t\t'targets': targets}\n\t\n\tcalculate_dijkstra_map(_dijkstra)\n\t\n\tif flee:\n\t\tcreate_flee_map(_dijkstra)\n\t\t#_create_dijkstra_map(center,source_map,targets,size=size)\n\t\tcalculate_dijkstra_map(_dijkstra)\n\t\n\tlogging.info('Dijkstra map took: %s, size %s,%s' % (str(time.time()-_stime),(_max_x-_min_x),(_max_y-_min_y)))\n\tprint 'Dijkstra map took: %s, size %s,%s, %s' % (str(time.time()-_stime),(_max_x-_min_x),(_max_y-_min_y),0)\n\t\n\treturn _dijkstra", "metadata": "root._create_dijkstra_map", "header": "['module', '___EOS___']", "index": 112 }, { "content": "def draw_dijkstra(dijkstra,path):\n\tfor _y in range(dijkstra['y_range'][0],dijkstra['y_range'][1]):\n\t\ty = _y-dijkstra['y_range'][0]\n\t\t\n\t\tfor _x in range(dijkstra['x_range'][0],dijkstra['x_range'][1]):\n\t\t\tx = _x-dijkstra['x_range'][0]\n\t\t\t\n\t\t\t#if _x == 20:\n\t\t\t#\tcontinue\n\t\t\t\n\t\t\t#print _x,dijkstra['x_range']#,_y#,dijkstra['x_range'][1],dijkstra['y_range'][1]\n\t\t\t_score = clip(int(abs(dijkstra['map'][y,x])),0,9)\n\t\t\t#_score = int(dijkstra['map'][y,x])\n\t\t\t\n\t\t\tif (_x,_y,0) in path:\n\t\t\t\t_score = 'O '\n\t\t\telif _score == -1:\n\t\t\t\t_score = 'x '\n\t\t\telse:\n\t\t\t\t_score = '. '\n\t\t\t\t#_score = _score\n\t\t\t\n\t\t\tprint '%s' % _score,\n\t\t\n\t\tprint", "metadata": "root.draw_dijkstra", "header": "['module', '___EOS___']", "index": 161 }, { "content": "def create_dijkstra_map(center,source_map,targets,flee=False):\n\t_farthest_distance = 0\n\t\n\tfor target in targets:\n\t\t_dist = distance(center,target['position'])\n\t\n\t\tif _dist>_farthest_distance:\n\t\t\t_farthest_distance = _dist+1\n\t\n\treturn _create_dijkstra_map(center,source_map,targets,size=(_farthest_distance,_farthest_distance),flee=flee)", "metadata": "root.create_dijkstra_map", "header": "['module', '___EOS___']", "index": 187 } ]
[ { "span": "import pathfinding", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 18 }, { "span": "import render_los", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 17 }, { "span": "import tiles", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 12 }, { "span": "import maps", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "globals_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "path", "finding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "render", "\\u", "los", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tiles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "maps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "clip_", "(_", "number_", ",_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Return", "s", " ", "`", "number", "`", ",", " ", "but", " ", "make", "s", " ", "sure", " ", "it", "'", "s", " ", "in", " ", "the", " ", "range", " ", "of", " ", "[", "start", "..", "end", "]\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "max_", "(_", "start_", ",_", "min_", "(_", "number_", ",_", "end_", ")_", ")_", "\\u\\u\\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_", "roll_", "(_", "dice_", ",_", "sides_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "sum_", "(_", "[_", "random_", "._", "choice_", "(_", "range_", "(_", "sides_", ")_", ")_", "+_", "1_", "for_", "d_", "in_", "range_", "(_", "dice_", ")_", "]_", ")_", "\\u\\u\\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_", "ler", "p_", "(_", "n1_", ",_", "n2_", ",_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "n1_", "+_", "(_", "n2_", "-_", "n1_", ")_", "*_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "distance_", "(_", "pos1_", ",_", "pos2_", ",_", "old_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "old_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "abs_", "(_", "pos1_", "[_", "0_", "]_", "-_", "pos2_", "[_", "0_", "]_", ")_", "+_", "abs_", "(_", "pos1_", "[_", "1_", "]_", "-_", "pos2_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x", "\\u", "dist_", "=_", "abs_", "(_", "pos1_", "[_", "0_", "]_", "-_", "pos2_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "dist_", "=_", "abs_", "(_", "pos1_", "[_", "1_", "]_", "-_", "pos2_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x", "\\u", "dist_", ">_", "y", "\\u", "dist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "y", "\\u", "dist_", "+_", "(_", "x", "\\u", "dist_", "-_", "y", "\\u", "dist_", ")_", "\\u\\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_", "return_", "x", "\\u", "dist_", "+_", "(_", "y", "\\u", "dist_", "-_", "x", "\\u", "dist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "velocity_", "(_", "direction_", ",_", "speed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "rad_", "=_", "direction_", "*_", "(_", "pi_", "/_", "180_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "velocity_", "=_", "numpy_", "._", "multiply_", "(_", "numpy_", "._", "array_", "(_", "[_", "cos_", "(_", "rad_", ")_", ",_", "sin_", "(_", "rad_", ")_", "]_", ")_", ",_", "speed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "velocity_", "[_", "0_", "]_", ",_", "-_", "velocity_", "[_", "1_", "]_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ler", "p", "\\u", "velocity_", "(_", "velo", "city", "1_", ",_", "velo", "city", "2_", ",_", "interp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "[_", "ler", "p_", "(_", "velo", "city", "1_", "[_", "0_", "]_", ",_", "velo", "city", "2_", "[_", "0_", "]_", ",_", "interp_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ler", "p_", "(_", "velo", "city", "1_", "[_", "1_", "]_", ",_", "velo", "city", "2_", "[_", "1_", "]_", ",_", "interp_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ler", "p_", "(_", "velo", "city", "1_", "[_", "2_", "]_", ",_", "velo", "city", "2_", "[_", "2_", "]_", ",_", "interp_", ")_", "]_", "\\u\\u\\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", "surf", "ace", "\\u", "area_", "(_", "structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "'", "attache", "s", "\\u", "to", "'_", "in_", "structure_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "structure_", "[_", "'", "size", "'_", "]_", "*_", "len_", "(_", "structure_", "[_", "'", "attache", "s", "\\u", "to", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "structure_", "[_", "'", "size", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "direction", "\\u", "to_", "(_", "pos1_", ",_", "pos2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "theta_", "=_", "atan2_", "(_", "(_", "pos1_", "[_", "1_", "]_", "-_", "pos2_", "[_", "1_", "]_", ")_", ",_", "-_", "(_", "pos1_", "[_", "0_", "]_", "-_", "pos2_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "theta_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "theta_", "+=_", "2_", "*_", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "theta_", "*_", "(_", "180_", "/_", "pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "fle", "e\\u", "map_", "(_", "dij", "kst", "ra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "for_", "\\u", "x_", "in_", "range_", "(_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "0_", "]_", ",_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "\\u", "y_", "in_", "range_", "(_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "0_", "]_", ",_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "dij", "kst", "ra_", "[_", "'", "map", "'_", "]_", "[_", "\\u", "y_", "-_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "0_", "]_", ",_", "\\u", "x_", "-_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "0_", "]_", "]_", "==_", "9999_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dij", "kst", "ra_", "[_", "'", "map", "'_", "]_", "[_", "\\u", "y_", "-_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "0_", "]_", ",_", "\\u", "x_", "-_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "0_", "]_", "]_", "*=_", "-_", "1.25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "calcul", "ate", "\\u", "dij", "kst", "ra", "\\u", "map_", "(_", "dij", "kst", "ra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\\u", "map_", "=_", "dij", "kst", "ra_", "[_", "'", "map", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "min", "\\u", "x_", "=_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "max", "\\u", "x_", "=_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "min", "\\u", "y_", "=_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "max", "\\u", "y_", "=_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "target", "\\u", "positions_", "=_", "[_", "tuple_", "(_", "target_", "[_", "'", "position", "'_", "]_", ")_", "for_", "target_", "in_", "dij", "kst", "ra_", "[_", "'", "target", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\\u", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "orig", "\\u", "map_", "=_", "\\u", "map_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "x_", "in_", "range_", "(_", "\\u", "min", "\\u", "x_", ",_", "\\u", "max", "\\u", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "\\u", "y_", "in_", "range_", "(_", "\\u", "min", "\\u", "y_", ",_", "\\u", "max", "\\u", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "(_", "\\u", "x_", ",_", "\\u", "y_", ")_", "in_", "\\u", "target", "\\u", "positions_", "or_", "\\u", "orig", "\\u", "map_", "[_", "\\u", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "\\u", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "lowe", "st", "\\u", "score_", "=_", "9000", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x1_", "in_", "range_", "(_", "-_", "1_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "x_", "=_", "\\u", "x_", "+_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "0_", ">_", "x_", "or_", "x_", ">=_", "\\u", "max", "\\u", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "y1_", "in_", "range_", "(_", "-_", "1_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "(", "x1", ",", "y1", ")", " ", "in", " ", "[(", "-1", ",-", "1", "),", "(", "1", ",-", "1", "),", "(-", "1", ",", "1", "),", "(", "1", ",", "1", ")]", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "y_", "=_", "\\u", "y_", "+_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "0_", ">_", "y_", "or_", "y_", ">=_", "\\u", "max", "\\u", "y_", "or_", "(_", "x1_", ",_", "y1_", ")_", "==_", "(_", "0_", ",_", "0_", ")_", "or_", "\\u", "orig", "\\u", "map_", "[_", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "orig", "\\u", "map_", "[_", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "<_", "\\u", "lowe", "st", "\\u", "score_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "\\u", "lowe", "st", "\\u", "score_", "=_", "\\u", "orig", "\\u", "map_", "[_", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "\\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", "lowe", "st", "\\u", "score_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "\\u", "orig", "\\u", "map_", "[_", "\\u", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "\\u", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "-_", "\\u", "lowe", "st", "\\u", "score_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "\\u", "map_", "[_", "\\u", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "\\u", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "=_", "\\u", "lowe", "st", "\\u", "score_", "+_", "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_", "if_", "numpy_", "._", "array", "\\u", "equal_", "(_", "\\u", "map_", ",_", "\\u", "orig", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "create", "\\u", "dij", "kst", "ra", "\\u", "map_", "(_", "center_", ",_", "source", "\\u", "map_", ",_", "targets_", ",_", "size_", "=_", "(_", "50_", ",_", "50_", ")_", ",_", "fle", "e_", "=_", "False_", ",_", "**_", "kv", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "not_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Exception_", "(_", "'", "No", " ", "target", "s", " ", "pass", "ed", " ", "to", " ", "create", "\\u", "dij", "kst", "ra", "\\u", "map", "()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "target", "\\u", "positions_", "=_", "[_", "tuple_", "(_", "target_", "[_", "'", "position", "'_", "]_", ")_", "for_", "target_", "in_", "targets_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "min", "\\u", "x_", "=_", "clip_", "(_", "center_", "[_", "0_", "]_", "-_", "(_", "size_", "[_", "0_", "]_", ")_", ",_", "0_", ",_", "MAP", "\\u", "SIZE_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "max", "\\u", "x_", "=_", "clip_", "(_", "center_", "[_", "0_", "]_", "+_", "(_", "size_", "[_", "0_", "]_", ")_", ",_", "0_", ",_", "MAP", "\\u", "SIZE_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "min", "\\u", "y_", "=_", "clip_", "(_", "center_", "[_", "1_", "]_", "-_", "(_", "size_", "[_", "1_", "]_", ")_", ",_", "0_", ",_", "MAP", "\\u", "SIZE_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "max", "\\u", "y_", "=_", "clip_", "(_", "center_", "[_", "1_", "]_", "+_", "(_", "size_", "[_", "1_", "]_", ")_", ",_", "0_", ",_", "MAP", "\\u", "SIZE_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "stime", "_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "map_", "=_", "numpy_", "._", "ones_", "(_", "(_", "\\u", "max", "\\u", "y_", ",_", "\\u", "max", "\\u", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "orig", "\\u", "map_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "target_", "in_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\\u", "map_", "[_", "target_", "[_", "'", "position", "'_", "]_", "[_", "1_", "]_", "-_", "\\u", "min", "\\u", "y_", ",_", "target_", "[_", "'", "position", "'_", "]_", "[_", "0_", "]_", "-_", "\\u", "min", "\\u", "x_", "]_", "=_", "0_", "#", "target", "['", "score", "']", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "map_", "*=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "\\u", "min", "\\u", "x_", ",_", "\\u", "max", "\\u", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "y_", "in_", "range_", "(_", "\\u", "min", "\\u", "y_", ",_", "\\u", "max", "\\u", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "source", "\\u", "map_", "[_", "x_", "]_", "[_", "y_", "]_", "[_", "center_", "[_", "2_", "]_", "+_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "fle", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "\\u", "map_", "[_", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "\\u", "map_", "[_", "y_", "-_", "\\u", "min", "\\u", "y_", ",_", "x_", "-_", "\\u", "min", "\\u", "x_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "dij", "kst", "ra_", "=_", "{_", "'", "map", "'_", ":_", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "x", "\\u", "range", "'_", ":_", "(_", "\\u", "min", "\\u", "x_", ",_", "\\u", "max", "\\u", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "y", "\\u", "range", "'_", ":_", "(_", "\\u", "min", "\\u", "y_", ",_", "\\u", "max", "\\u", "y_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "s", "'_", ":_", "targets_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "calcul", "ate", "\\u", "dij", "kst", "ra", "\\u", "map_", "(_", "\\u", "dij", "kst", "ra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fle", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "create", "\\u", "fle", "e\\u", "map_", "(_", "\\u", "dij", "kst", "ra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#\\u", "create", "\\u", "dij", "kst", "ra", "\\u", "map", "(", "center", ",", "source", "\\u", "map", ",", "target", "s", ",", "size", "=", "size", ")_", "\\u\\u\\uNL\\u\\u\\u_", "calcul", "ate", "\\u", "dij", "kst", "ra", "\\u", "map_", "(_", "\\u", "dij", "kst", "ra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Di", "jk", "stra", " ", "map", " ", "too", "k", ":", " ", "%", "s", ",", " ", "size", " ", "%", "s", ",%", "s", "'_", "%_", "(_", "str_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "\\u", "stime", "_", ")_", ",_", "(_", "\\u", "max", "\\u", "x_", "-_", "\\u", "min", "\\u", "x_", ")_", ",_", "(_", "\\u", "max", "\\u", "y_", "-_", "\\u", "min", "\\u", "y_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Di", "jk", "stra", " ", "map", " ", "too", "k", ":", " ", "%", "s", ",", " ", "size", " ", "%", "s", ",%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "str_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "\\u", "stime", "_", ")_", ",_", "(_", "\\u", "max", "\\u", "x_", "-_", "\\u", "min", "\\u", "x_", ")_", ",_", "(_", "\\u", "max", "\\u", "y_", "-_", "\\u", "min", "\\u", "y_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u", "dij", "kst", "ra_", "\\u\\u\\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_", "draw", "\\u", "dij", "kst", "ra_", "(_", "dij", "kst", "ra_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "for_", "\\u", "y_", "in_", "range_", "(_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "0_", "]_", ",_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "y_", "=_", "\\u", "y_", "-_", "dij", "kst", "ra_", "[_", "'", "y", "\\u", "range", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "x_", "in_", "range_", "(_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "0_", "]_", ",_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "\\u", "x_", "-_", "dij", "kst", "ra_", "[_", "'", "x", "\\u", "range", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "\\u", "x", " ", "==", " ", "20", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\\u", "x", ",", "dij", "kst", "ra", "['", "x", "\\u", "range", "']", "#", ",\\u", "y", "#", ",", "dij", "kst", "ra", "['", "x", "\\u", "range", "']", "[", "1", "],", "dij", "kst", "ra", "['", "y", "\\u", "range", "']", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "score_", "=_", "clip_", "(_", "int_", "(_", "abs_", "(_", "dij", "kst", "ra_", "[_", "'", "map", "'_", "]_", "[_", "y_", ",_", "x_", "]_", ")_", ")_", ",_", "0_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#\\u", "score", " ", "=", " ", "int", "(", "dij", "kst", "ra", "['", "map", "']", "[", "y", ",", "x", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "\\u", "x_", ",_", "\\u", "y_", ",_", "0_", ")_", "in_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "\\u", "score_", "=_", "'", "O", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "score_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "\\u", "score_", "=_", "'", "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\t", "\t\t\t_", "\\u", "score_", "=_", "'.", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#\\u", "score", " ", "=", " ", "\\u", "score_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'%", "s", "'_", "%_", "\\u", "score_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "\\u", "dij", "kst", "ra", "\\u", "map_", "(_", "center_", ",_", "source", "\\u", "map_", ",_", "targets_", ",_", "fle", "e_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\\u", "far", "thes", "t", "\\u", "distance_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "target_", "in_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\\u", "dist_", "=_", "distance_", "(_", "center_", ",_", "target_", "[_", "'", "position", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "dist_", ">_", "\\u", "far", "thes", "t", "\\u", "distance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "\\u", "far", "thes", "t", "\\u", "distance_", "=_", "\\u", "dist_", "+_", "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_", "return_", "\\u", "create", "\\u", "dij", "kst", "ra", "\\u", "map_", "(_", "center_", ",_", "source", "\\u", "map_", ",_", "targets_", ",_", "size_", "=_", "(_", "\\u", "far", "thes", "t", "\\u", "distance_", ",_", "\\u", "far", "thes", "t", "\\u", "distance_", ")_", ",_", "fle", "e_", "=_", "fle", "e_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Implicit string concatenation in a list
perseas/Pyrseas/tests/dbobject/test_constraint.py
[ { "content": " def test_foreign_key_1(self):\n \"Map a table with a single-column foreign key on another table\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER PRIMARY KEY, pc2 TEXT)\",\n \"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER REFERENCES t2 (pc1) \"\n \"ON UPDATE CASCADE ON DELETE RESTRICT\"\n \", c3 TEXT)\"]\n dbmap = self.to_map(stmts)\n assert dbmap['schema public']['table t1'] == self.map_fkey1", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_1", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 352 }, { "content": " def test_foreign_key_2(self):\n \"Map a table with a single-column foreign key, table level constraint\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER PRIMARY KEY, pc2 TEXT)\",\n \"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER, c3 TEXT, \"\n \"FOREIGN KEY (c2) REFERENCES t2 (pc1)\"\n \"ON UPDATE CASCADE ON DELETE RESTRICT\"\n \")\"]\n dbmap = self.to_map(stmts)\n assert dbmap['schema public']['table t1'] == self.map_fkey1", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_2", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 361 }, { "content": " def test_foreign_key_3(self):\n \"Map a table with a three-column foreign key\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER, pc2 CHAR(5), pc3 DATE, \"\n \"pc4 TEXT, PRIMARY KEY (pc2, pc1, pc3))\",\n \"CREATE TABLE t1 (c1 INTEGER, c2 CHAR(5), c3 INTEGER, \"\n \"c4 DATE, c5 TEXT, \"\n \"FOREIGN KEY (c2, c3, c4) REFERENCES t2 (pc2, pc1, pc3))\"]\n dbmap = self.to_map(stmts)\n assert dbmap['schema public']['table t1'] == self.map_fkey2", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_3", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 371 }, { "content": " def test_foreign_key_4(self):\n \"Map a table with a named, three-column foreign key\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER, pc2 CHAR(5), pc3 DATE, \"\n \"pc4 TEXT, PRIMARY KEY (pc2, pc1, pc3))\",\n \"CREATE TABLE t1 (c1 INTEGER, c2 CHAR(5), c3 INTEGER, \"\n \"c4 DATE, c5 TEXT, \"\n \"CONSTRAINT t1_fgn_key FOREIGN KEY (c2, c3, c4) \"\n \"REFERENCES t2 (pc2, pc1, pc3))\"]\n dbmap = self.to_map(stmts)\n assert dbmap['schema public']['table t1'] == self.map_fkey3", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_4", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 381 }, { "content": " def test_foreign_key_5(self):\n \"Map a table with a primary key and two foreign keys\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER, pc2 CHAR(5), pc3 DATE, \"\n \"pc4 TEXT, PRIMARY KEY (pc2, pc1, pc3))\",\n \"CREATE TABLE t3 (qc1 CHAR(5) PRIMARY KEY, qc2 text)\",\n \"CREATE TABLE t1 (c1 INTEGER, c2 CHAR(5), c3 INTEGER, \"\n \"c4 DATE, c5 TEXT, \"\n \"CONSTRAINT t1_prim_key PRIMARY KEY (c1, c2), \"\n \"CONSTRAINT t1_fgn_key1 FOREIGN KEY (c2, c3, c4) \"\n \"REFERENCES t2 (pc2, pc1, pc3), \"\n \"CONSTRAINT t1_fgn_key2 FOREIGN KEY (c2) \"\n \"REFERENCES t3 (qc1))\"]\n dbmap = self.to_map(stmts)\n assert dbmap['schema public']['table t1'] == self.map_fkey4", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_5", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 392 }, { "content": " def test_foreign_key_actions(self):\n \"Map a table with foreign key ON UPDATE/ON DELETE actions\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER PRIMARY KEY, pc2 TEXT)\",\n \"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER, c3 TEXT, \"\n \"FOREIGN KEY (c2) REFERENCES t2 (pc1) \"\n \"ON UPDATE RESTRICT ON DELETE SET NULL)\"]\n dbmap = self.to_map(stmts)\n expmap = {'columns': [{'c1': {'type': 'integer'}},\n {'c2': {'type': 'integer'}},\n {'c3': {'type': 'text'}}],\n 'foreign_keys': {'t1_c2_fkey': {\n 'columns': ['c2'], 'on_update': 'restrict',\n 'on_delete': 'set null',\n 'references': {'schema': 'public', 'table': 't2',\n 'columns': ['pc1']}}}}\n assert dbmap['schema public']['table t1'] == expmap", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_actions", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 407 }, { "content": " def test_cross_schema_foreign_key(self):\n \"Map a table with a foreign key on a table in another schema\"\n stmts = [\"CREATE SCHEMA s1\",\n \"CREATE TABLE t2 (pc1 INTEGER PRIMARY KEY, pc2 TEXT)\",\n \"CREATE TABLE s1.t1 (c1 INTEGER PRIMARY KEY, \"\n \"c2 INTEGER REFERENCES t2 (pc1), c3 TEXT)\"]\n dbmap = self.to_map(stmts)\n t2map = {'columns': [{'pc1': {'type': 'integer', 'not_null': True}},\n {'pc2': {'type': 'text'}}],\n 'primary_key': {'t2_pkey': {'columns': ['pc1']}}}\n t1map = {'table t1': {\n 'columns': [{'c1': {'type': 'integer', 'not_null': True}},\n {'c2': {'type': 'integer'}}, {'c3': {'type': 'text'}}],\n 'primary_key': {'t1_pkey': {'columns': ['c1']}},\n 'foreign_keys': {'t1_c2_fkey': {\n 'columns': ['c2'],\n 'references': {'schema': 'public', 'table': 't2',\n 'columns': ['pc1']}}}}}\n assert dbmap['schema public']['table t2'] == t2map\n assert dbmap['schema s1'] == t1map", "metadata": "root.ForeignKeyToMapTestCase.test_cross_schema_foreign_key", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 424 }, { "content": " def test_multiple_foreign_key(self):\n \"Map a table with its primary key referenced by two others\"\n stmts = [\"CREATE TABLE t1 (pc1 integer PRIMARY KEY, pc2 text)\",\n \"CREATE TABLE t2 (c1 integer, \"\n \"c2 integer REFERENCES t1 (pc1), c3 text, \"\n \"c4 integer REFERENCES t1 (pc1))\"]\n dbmap = self.to_map(stmts)\n t1map = {'columns': [{'pc1': {'type': 'integer', 'not_null': True}},\n {'pc2': {'type': 'text'}}],\n 'primary_key': {'t1_pkey': {'columns': ['pc1']}}}\n t2map = {'columns': [{'c1': {'type': 'integer'}},\n {'c2': {'type': 'integer'}},\n {'c3': {'type': 'text'}},\n {'c4': {'type': 'integer'}}],\n 'foreign_keys': {\n 't2_c2_fkey': {\n 'columns': ['c2'],\n 'references': {'schema': 'public', 'table': 't1',\n 'columns': ['pc1']}},\n 't2_c4_fkey': {\n 'columns': ['c4'],\n 'references': {'schema': 'public', 'table': 't1',\n 'columns': ['pc1']}}}}\n assert dbmap['schema public']['table t1'] == t1map\n assert dbmap['schema public']['table t2'] == t2map", "metadata": "root.ForeignKeyToMapTestCase.test_multiple_foreign_key", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 445 }, { "content": " def test_foreign_key_dropped_column(self):\n \"Map a table with a foreign key after a column has been dropped\"\n stmts = [\"CREATE TABLE t1 (pc1 integer PRIMARY KEY, pc2 text)\",\n \"CREATE TABLE t2 (c1 integer, c2 text, c3 smallint, \"\n \"c4 integer REFERENCES t1 (pc1))\",\n \"ALTER TABLE t2 DROP COLUMN c3\"]\n dbmap = self.to_map(stmts)\n t2map = {'columns': [{'c1': {'type': 'integer'}},\n {'c2': {'type': 'text'}},\n {'c4': {'type': 'integer'}}],\n 'foreign_keys': {'t2_c4_fkey': {\n 'columns': ['c4'],\n 'references': {'schema': 'public', 'table': 't1',\n 'columns': ['pc1']}}}}\n assert dbmap['schema public']['table t2'] == t2map", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_dropped_column", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 471 }, { "content": " def test_foreign_key_deferred(self):\n \"Check constraints deferred status\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER PRIMARY KEY, pc2 TEXT)\",\n \"CREATE TABLE t1 (c1 INTEGER, \"\n \"c2 INTEGER REFERENCES t2 (pc1), \"\n \"c3 INTEGER REFERENCES t2 (pc1) DEFERRABLE, \"\n \"c4 INTEGER REFERENCES t2 (pc1) DEFERRABLE \"\n \"INITIALLY DEFERRED)\"]\n dbmap = self.to_map(stmts)\n fks = dbmap['schema public']['table t1']['foreign_keys']\n assert not fks['t1_c2_fkey'].get('deferrable')\n assert not fks['t1_c2_fkey'].get('deferred')\n assert fks['t1_c3_fkey'].get('deferrable')\n assert not fks['t1_c3_fkey'].get('deferred')\n assert fks['t1_c4_fkey'].get('deferrable')\n assert fks['t1_c4_fkey'].get('deferred')", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_deferred", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 487 }, { "content": " def test_foreign_key_match(self):\n \"Map a foreign key constraint with a MATCH specification\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER PRIMARY KEY, pc2 TEXT)\",\n \"CREATE TABLE t1 (c1 INTEGER, \"\n \"c2 INTEGER REFERENCES t2 (pc1) MATCH FULL, c3 TEXT)\"]\n dbmap = self.to_map(stmts)\n t1map = {'columns': [{'c1': {'type': 'integer'}},\n {'c2': {'type': 'integer'}},\n {'c3': {'type': 'text'}}],\n 'foreign_keys': {'t1_c2_fkey': {\n 'columns': ['c2'], 'match': 'full',\n 'references': {'schema': 'public', 'table': 't2',\n 'columns': ['pc1']}}}}\n assert dbmap['schema public']['table t1'] == t1map", "metadata": "root.ForeignKeyToMapTestCase.test_foreign_key_match", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 504 }, { "content": " def test_map_fk_comment(self):\n \"Map a foreign key with a comment\"\n stmts = [\"CREATE TABLE t2 (pc1 INTEGER PRIMARY KEY, pc2 TEXT)\",\n \"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER \"\n \"CONSTRAINT cns1 REFERENCES t2 (pc1), c3 TEXT)\", COMMENT_STMT]\n dbmap = self.to_map(stmts)\n assert dbmap['schema public']['table t1']['foreign_keys']['cns1'][\n 'description'] == 'Test constraint cns1'", "metadata": "root.ForeignKeyToMapTestCase.test_map_fk_comment", "header": "['class', 'ForeignKeyToMapTestCase', '(', 'DatabaseToMapTestCase', ')', ':', '___EOS___']", "index": 519 }, { "content": " def test_add_foreign_key(self):\n \"Add a two-column foreign key to an existing table\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER NOT NULL, \"\n \"c12 INTEGER NOT NULL, c13 TEXT, PRIMARY KEY (c11, c12))\",\n \"CREATE TABLE t2 (c21 INTEGER NOT NULL, \"\n \"c22 TEXT, c23 INTEGER, c24 INTEGER, PRIMARY KEY (c21))\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {'columns': [\n {'c11': {'type': 'integer', 'not_null': True}},\n {'c12': {'type': 'integer', 'not_null': True}},\n {'c13': {'type': 'text'}}],\n 'primary_key': {'t1_pkey': {'columns': ['c11', 'c12']}}},\n 'table t2': {'columns': [\n {'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'text'}},\n {'c23': {'type': 'integer'}},\n {'c24': {'type': 'integer'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}},\n 'foreign_keys': {'t2_c23_fkey': {\n 'columns': ['c23', 'c24'],\n 'references': {'columns': ['c11', 'c12'],\n 'table': 't1'}}}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(fix_indent(sql[0]), \"ALTER TABLE t2 ADD CONSTRAINT \" \\\n \"t2_c23_fkey FOREIGN KEY (c23, c24) REFERENCES t1 (c11, c12)\")", "metadata": "root.ForeignKeyToSqlTestCase.test_add_foreign_key", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 600 }, { "content": " def test_alter_foreign_key1(self):\n \"Change foreign key: referencing column\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER PRIMARY KEY NOT NULL, \"\n \"c12 INTEGER NOT NULL)\",\n \"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY NOT NULL, \"\n \"c22 INTEGER, c23 INTEGER)\",\n \"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11)\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {'columns': [\n {'c11': {'type': 'integer', 'not_null': True}},\n {'c12': {'type': 'integer', 'not_null': True}}],\n 'primary_key': {'t1_pkey': {'columns': ['c11']}}},\n 'table t2': {'columns': [\n {'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'integer'}},\n {'c23': {'type': 'integer'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}},\n 'foreign_keys': {'t2_c22_fkey': {\n 'columns': ['c23'],\n 'references': {'columns': ['c11'],\n 'table': 't1'}}}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(2, len(sql))\n self.assertEqual(fix_indent(sql[0]),\n 'ALTER TABLE t2 DROP CONSTRAINT t2_c22_fkey')\n self.assertEqual(fix_indent(sql[1]),\n 'ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey ' \\\n 'FOREIGN KEY (c23) REFERENCES t1 (c11)')", "metadata": "root.ForeignKeyToSqlTestCase.test_alter_foreign_key1", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 627 }, { "content": " def test_alter_foreign_key_columns(self):\n \"Change foreign key: foreign column\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER NOT NULL UNIQUE, \"\n \"c12 INTEGER NOT NULL UNIQUE)\",\n \"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY NOT NULL, \"\n \"c22 INTEGER, c23 INTEGER)\",\n \"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11)\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {'columns': [\n {'c11': {'type': 'integer', 'not_null': True}},\n {'c12': {'type': 'integer', 'not_null': True}}],\n 'unique_constraints': {\n 't1_c11_key': {'columns': ['c11']},\n 't1_c12_key': {'columns': ['c12']}}},\n 'table t2': {'columns': [\n {'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'integer'}},\n {'c23': {'type': 'integer'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}},\n 'foreign_keys': {'t2_c22_fkey': {\n 'columns': ['c22'],\n 'references': {'columns': ['c12'],\n 'table': 't1'}}}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(2, len(sql))\n self.assertEqual(fix_indent(sql[0]),\n 'ALTER TABLE t2 DROP CONSTRAINT t2_c22_fkey')\n self.assertEqual(fix_indent(sql[1]),\n 'ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey ' \\\n 'FOREIGN KEY (c22) REFERENCES t1 (c12)')", "metadata": "root.ForeignKeyToSqlTestCase.test_alter_foreign_key_columns", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 658 }, { "content": " @pytest.mark.xfail\n def test_alter_foreign_key_column_order(self):\n \"Change foreign key: foreign column\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER, c12 INTEGER PRIMARY KEY)\",\n \"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY, c22 INTEGER)\",\n \"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c12)\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {'columns': [\n {'c11': {'type': 'integer'}},\n {'c1N': {'type': 'integer'}},\n {'c12': {'type': 'integer', 'not_null': True}}],\n 'primary_key': {'t1_pkey': {'columns': ['c12']}}},\n 'table t2': {'columns': [\n {'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'integer'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}},\n 'foreign_keys': {'t2_c22_fkey': {\n 'columns': ['c22'],\n 'references': {'columns': ['c1N'], 'table': 't1'}}}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(2, len(sql))\n self.assertEqual(fix_indent(sql[0]),\n 'ALTER TABLE t1 ADD COLUMN c1N integer')\n self.assertEqual(fix_indent(sql[1]),\n 'ALTER TABLE t2 DROP CONSTRAINT t2_c22_fkey')\n self.assertEqual(fix_indent(sql[2]),\n 'ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey ' \\\n 'FOREIGN KEY (c22) REFERENCES t1 (c1N)')", "metadata": "root.ForeignKeyToSqlTestCase.test_alter_foreign_key_column_order", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 691 }, { "content": " def test_alter_foreign_key_change_actions(self):\n \"Change foreign key: foreign column\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER PRIMARY KEY)\",\n \"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY, c22 INTEGER)\",\n \"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11) ON UPDATE RESTRICT\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {'columns': [\n {'c11': {'type': 'integer', 'not_null': True}}],\n 'primary_key': {\n 't1_pkey': {'columns': ['c11']}}},\n 'table t2': {'columns': [\n {'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'integer'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}},\n 'foreign_keys': {'t2_c22_fkey': {\n 'columns': ['c22'],\n 'on_update': 'cascade',\n 'references': {'columns': ['c11'], 'table': 't1'},\n }}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(2, len(sql))\n self.assertEqual(fix_indent(sql[0]),\n 'ALTER TABLE t2 DROP CONSTRAINT t2_c22_fkey')\n self.assertEqual(fix_indent(sql[1]),\n 'ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey ' \\\n 'FOREIGN KEY (c22) REFERENCES t1 (c11) ' \\\n 'ON UPDATE CASCADE')", "metadata": "root.ForeignKeyToSqlTestCase.test_alter_foreign_key_change_actions", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 723 }, { "content": " def test_alter_foreign_key_add_actions(self):\n \"Change foreign key: foreign column\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER PRIMARY KEY)\",\n \"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY, c22 INTEGER)\",\n \"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11)\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {'columns': [\n {'c11': {'type': 'integer', 'not_null': True}}],\n 'primary_key': {\n 't1_pkey': {'columns': ['c11']}}},\n 'table t2': {'columns': [\n {'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'integer'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}},\n 'foreign_keys': {'t2_c22_fkey': {\n 'columns': ['c22'],\n 'on_update': 'cascade',\n 'references': {'columns': ['c11'], 'table': 't1'},\n }}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(2, len(sql))\n self.assertEqual(fix_indent(sql[0]),\n 'ALTER TABLE t2 DROP CONSTRAINT t2_c22_fkey')\n self.assertEqual(fix_indent(sql[1]),\n 'ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey ' \\\n 'FOREIGN KEY (c22) REFERENCES t1 (c11) ' \\\n 'ON UPDATE CASCADE')", "metadata": "root.ForeignKeyToSqlTestCase.test_alter_foreign_key_add_actions", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 753 }, { "content": " def test_alter_foreign_key_drop_actions(self):\n \"Change foreign key: foreign column\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER PRIMARY KEY)\",\n \"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY, c22 INTEGER)\",\n \"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11) ON UPDATE RESTRICT\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {'columns': [\n {'c11': {'type': 'integer', 'not_null': True}}],\n 'primary_key': {\n 't1_pkey': {'columns': ['c11']}}},\n 'table t2': {'columns': [\n {'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'integer'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}},\n 'foreign_keys': {'t2_c22_fkey': {\n 'columns': ['c22'],\n 'references': {'columns': ['c11'], 'table': 't1'},\n }}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(2, len(sql))\n self.assertEqual(fix_indent(sql[0]),\n 'ALTER TABLE t2 DROP CONSTRAINT t2_c22_fkey')\n self.assertEqual(fix_indent(sql[1]),\n 'ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey ' \\\n 'FOREIGN KEY (c22) REFERENCES t1 (c11)')", "metadata": "root.ForeignKeyToSqlTestCase.test_alter_foreign_key_drop_actions", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 784 }, { "content": " def test_drop_foreign_key(self):\n \"Drop a foreign key on an existing table\"\n stmts = [\"CREATE TABLE t1 (c11 INTEGER NOT NULL, c12 TEXT, \"\n \"PRIMARY KEY (c11))\",\n \"CREATE TABLE t2 (c21 INTEGER NOT NULL PRIMARY KEY, \"\n \"c22 INTEGER NOT NULL REFERENCES t1 (c11), c23 TEXT)\"]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t1': {\n 'columns': [{'c11': {'type': 'integer', 'not_null': True}},\n {'c12': {'type': 'text'}}],\n 'primary_key': {'t1_pkey': {'columns': ['c11']}}},\n 'table t2': {\n 'columns': [{'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'integer', 'not_null': True}},\n {'c23': {'type': 'text'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}}}})\n sql = self.to_sql(inmap, stmts)\n assert sql == [\"ALTER TABLE t2 DROP CONSTRAINT t2_c22_fkey\"]", "metadata": "root.ForeignKeyToSqlTestCase.test_drop_foreign_key", "header": "['class', 'ForeignKeyToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 812 }, { "content": " def test_alter_unique_constraint(self):\n \"Change unique constraint column\"\n stmts = [\"CREATE TABLE t1 (c1 INTEGER NOT NULL, \"\n \"c2 INTEGER NOT NULL)\",\n \"ALTER TABLE t1 ADD CONSTRAINT t1_ukey UNIQUE (c1)\"]\n inmap = self.std_map()\n inmap['schema public'].update({'table t1': {\n 'columns': [{'c1': {'type': 'integer', 'not_null': True}},\n {'c2': {'type': 'integer', 'not_null': True}}],\n 'unique_constraints': {'t1_ukey': {'columns': ['c2'],\n 'unique': True}}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(2, len(sql))\n self.assertEqual(fix_indent(sql[0]),\n \"ALTER TABLE t1 DROP CONSTRAINT t1_ukey\")\n self.assertEqual(fix_indent(sql[1]),\n \"ALTER TABLE t1 ADD CONSTRAINT t1_ukey UNIQUE (c2)\")", "metadata": "root.UniqueConstraintToSqlTestCase.test_alter_unique_constraint", "header": "['class', 'UniqueConstraintToSqlTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 966 }, { "content": " def test_drop_foreign_key_comment(self):\n \"Drop the comment on an existing foreign key\"\n stmts = [\"CREATE TABLE t2 (c21 integer PRIMARY KEY, c22 text)\",\n \"CREATE TABLE t1 (c11 integer, c12 text, \"\n \"c13 integer CONSTRAINT cns1 REFERENCES t2 (c21))\",\n COMMENT_STMT]\n inmap = self.std_map()\n inmap['schema public'].update({\n 'table t2': {\n 'columns': [{'c21': {'type': 'integer', 'not_null': True}},\n {'c22': {'type': 'text'}}],\n 'primary_key': {'t2_pkey': {'columns': ['c21']}}},\n 'table t1': {\n 'columns': [{'c11': {'type': 'integer'}},\n {'c12': {'type': 'text'}},\n {'c13': {'type': 'integer'}}],\n 'foreign_keys': {'cns1': {\n 'columns': ['c13'],\n 'references': {'columns': ['c21'], 'table': 't2'}}}}})\n sql = self.to_sql(inmap, stmts)\n self.assertEqual(sql, [\"COMMENT ON CONSTRAINT cns1 ON t1 IS NULL\"])", "metadata": "root.ConstraintCommentTestCase.test_drop_foreign_key_comment", "header": "['class', 'ConstraintCommentTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 1046 }, { "content": " def test_constraint_comment_schema(self):\n \"Add comment on a constraint for a table in another schema\"\n stmts = [\"CREATE SCHEMA s1\", \"CREATE TABLE s1.t1 (c1 integer \"\n \"CONSTRAINT cns1 CHECK (c1 > 50), c2 text)\"]\n inmap = self.std_map()\n inmap.update({'schema s1': {'table t1': {\n 'columns': [{'c1': {'type': 'integer'}},\n {'c2': {'type': 'text'}}],\n 'check_constraints': {'cns1': {\n 'columns': ['c1'], 'expression': 'c1 > 50',\n 'description': 'Test constraint cns1'}}}}})\n sql = self.to_sql(inmap, stmts)\n assert sql[0] == \"COMMENT ON CONSTRAINT cns1 ON s1.t1 IS \" \\\n \"'Test constraint cns1'\"", "metadata": "root.ConstraintCommentTestCase.test_constraint_comment_schema", "header": "['class', 'ConstraintCommentTestCase', '(', 'InputMapToSqlTestCase', ')', ':', '___EOS___']", "index": 1082 } ]
[ { "span": "\"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER REFERENCES t2 (pc1) \"\n \"ON UPDATE CASCADE ON DELETE RESTRICT\"\n \", c3 TEXT)\"]", "start_line": 355, "start_column": 17, "end_line": 357, "end_column": 29 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER, c3 TEXT, \"\n \"FOREIGN KEY (c2) REFERENCES t2 (pc1)\"\n \"ON UPDATE CASCADE ON DELETE RESTRICT\"\n \")\"]", "start_line": 364, "start_column": 17, "end_line": 367, "end_column": 20 }, { "span": "\"CREATE TABLE t2 (pc1 INTEGER, pc2 CHAR(5), pc3 DATE, \"\n \"pc4 TEXT, PRIMARY KEY (pc2, pc1, pc3))\",", "start_line": 373, "start_column": 17, "end_line": 374, "end_column": 57 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, c2 CHAR(5), c3 INTEGER, \"\n \"c4 DATE, c5 TEXT, \"\n \"FOREIGN KEY (c2, c3, c4) REFERENCES t2 (pc2, pc1, pc3))\"]", "start_line": 375, "start_column": 17, "end_line": 377, "end_column": 74 }, { "span": "\"CREATE TABLE t2 (pc1 INTEGER, pc2 CHAR(5), pc3 DATE, \"\n \"pc4 TEXT, PRIMARY KEY (pc2, pc1, pc3))\",", "start_line": 383, "start_column": 17, "end_line": 384, "end_column": 57 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, c2 CHAR(5), c3 INTEGER, \"\n \"c4 DATE, c5 TEXT, \"\n \"CONSTRAINT t1_fgn_key FOREIGN KEY (c2, c3, c4) \"\n \"REFERENCES t2 (pc2, pc1, pc3))\"]", "start_line": 385, "start_column": 17, "end_line": 388, "end_column": 49 }, { "span": "\"CREATE TABLE t2 (pc1 INTEGER, pc2 CHAR(5), pc3 DATE, \"\n \"pc4 TEXT, PRIMARY KEY (pc2, pc1, pc3))\",", "start_line": 394, "start_column": 17, "end_line": 395, "end_column": 57 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, c2 CHAR(5), c3 INTEGER, \"\n \"c4 DATE, c5 TEXT, \"\n \"CONSTRAINT t1_prim_key PRIMARY KEY (c1, c2), \"\n \"CONSTRAINT t1_fgn_key1 FOREIGN KEY (c2, c3, c4) \"\n \"REFERENCES t2 (pc2, pc1, pc3), \"\n \"CONSTRAINT t1_fgn_key2 FOREIGN KEY (c2) \"\n \"REFERENCES t3 (qc1))\"]", "start_line": 397, "start_column": 17, "end_line": 403, "end_column": 39 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER, c3 TEXT, \"\n \"FOREIGN KEY (c2) REFERENCES t2 (pc1) \"\n \"ON UPDATE RESTRICT ON DELETE SET NULL)\"]", "start_line": 410, "start_column": 17, "end_line": 412, "end_column": 57 }, { "span": "\"CREATE TABLE s1.t1 (c1 INTEGER PRIMARY KEY, \"\n \"c2 INTEGER REFERENCES t2 (pc1), c3 TEXT)\"]", "start_line": 428, "start_column": 17, "end_line": 429, "end_column": 59 }, { "span": "\"CREATE TABLE t2 (c1 integer, \"\n \"c2 integer REFERENCES t1 (pc1), c3 text, \"\n \"c4 integer REFERENCES t1 (pc1))\"]", "start_line": 448, "start_column": 17, "end_line": 450, "end_column": 50 }, { "span": "\"CREATE TABLE t2 (c1 integer, c2 text, c3 smallint, \"\n \"c4 integer REFERENCES t1 (pc1))\",", "start_line": 474, "start_column": 17, "end_line": 475, "end_column": 50 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, \"\n \"c2 INTEGER REFERENCES t2 (pc1), \"\n \"c3 INTEGER REFERENCES t2 (pc1) DEFERRABLE, \"\n \"c4 INTEGER REFERENCES t2 (pc1) DEFERRABLE \"\n \"INITIALLY DEFERRED)\"]", "start_line": 490, "start_column": 17, "end_line": 494, "end_column": 38 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, \"\n \"c2 INTEGER REFERENCES t2 (pc1) MATCH FULL, c3 TEXT)\"]", "start_line": 507, "start_column": 17, "end_line": 508, "end_column": 70 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER, c2 INTEGER \"\n \"CONSTRAINT cns1 REFERENCES t2 (pc1), c3 TEXT)\",", "start_line": 522, "start_column": 17, "end_line": 523, "end_column": 64 }, { "span": "\"CREATE TABLE t1 (c11 INTEGER NOT NULL, \"\n \"c12 INTEGER NOT NULL, c13 TEXT, PRIMARY KEY (c11, c12))\",", "start_line": 602, "start_column": 17, "end_line": 603, "end_column": 74 }, { "span": "\"CREATE TABLE t2 (c21 INTEGER NOT NULL, \"\n \"c22 TEXT, c23 INTEGER, c24 INTEGER, PRIMARY KEY (c21))\"]", "start_line": 604, "start_column": 17, "end_line": 605, "end_column": 73 }, { "span": "\"CREATE TABLE t1 (c11 INTEGER PRIMARY KEY NOT NULL, \"\n \"c12 INTEGER NOT NULL)\",", "start_line": 629, "start_column": 17, "end_line": 630, "end_column": 40 }, { "span": "\"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY NOT NULL, \"\n \"c22 INTEGER, c23 INTEGER)\",", "start_line": 631, "start_column": 17, "end_line": 632, "end_column": 44 }, { "span": "\"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11)\"]", "start_line": 633, "start_column": 17, "end_line": 634, "end_column": 56 }, { "span": "\"CREATE TABLE t1 (c11 INTEGER NOT NULL UNIQUE, \"\n \"c12 INTEGER NOT NULL UNIQUE)\",", "start_line": 660, "start_column": 17, "end_line": 661, "end_column": 47 }, { "span": "\"CREATE TABLE t2 (c21 INTEGER PRIMARY KEY NOT NULL, \"\n \"c22 INTEGER, c23 INTEGER)\",", "start_line": 662, "start_column": 17, "end_line": 663, "end_column": 44 }, { "span": "\"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11)\"]", "start_line": 664, "start_column": 17, "end_line": 665, "end_column": 56 }, { "span": "\"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c12)\"]", "start_line": 696, "start_column": 17, "end_line": 697, "end_column": 56 }, { "span": "\"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11) ON UPDATE RESTRICT\"]", "start_line": 727, "start_column": 17, "end_line": 728, "end_column": 75 }, { "span": "\"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11)\"]", "start_line": 757, "start_column": 17, "end_line": 758, "end_column": 56 }, { "span": "\"ALTER TABLE t2 ADD CONSTRAINT t2_c22_fkey \" \\\n \"FOREIGN KEY (c22) REFERENCES t1 (c11) ON UPDATE RESTRICT\"]", "start_line": 788, "start_column": 17, "end_line": 789, "end_column": 75 }, { "span": "\"CREATE TABLE t1 (c11 INTEGER NOT NULL, c12 TEXT, \"\n \"PRIMARY KEY (c11))\",", "start_line": 814, "start_column": 17, "end_line": 815, "end_column": 37 }, { "span": "\"CREATE TABLE t2 (c21 INTEGER NOT NULL PRIMARY KEY, \"\n \"c22 INTEGER NOT NULL REFERENCES t1 (c11), c23 TEXT)\"]", "start_line": 816, "start_column": 17, "end_line": 817, "end_column": 70 }, { "span": "\"CREATE TABLE t1 (c1 INTEGER NOT NULL, \"\n \"c2 INTEGER NOT NULL)\",", "start_line": 968, "start_column": 17, "end_line": 969, "end_column": 39 }, { "span": "\"CREATE TABLE t1 (c11 integer, c12 text, \"\n \"c13 integer CONSTRAINT cns1 REFERENCES t2 (c21))\",", "start_line": 1049, "start_column": 17, "end_line": 1050, "end_column": 67 }, { "span": "\"CREATE TABLE s1.t1 (c1 integer \"\n \"CONSTRAINT cns1 CHECK (c1 > 50), c2 text)\"]", "start_line": 1084, "start_column": 37, "end_line": 1085, "end_column": 60 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "a", " ", "single", "-", "column", " ", "foreign", " ", "key", " ", "on", " ", "anot", "her", " ", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "TEXT", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "c2", " ", "INTEG", "ER", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ON", " ", "UPDATE", " ", "CAS", "CA", "DE", " ", "ON", " ", "DELET", "E", " ", "RESTR", "ICT", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\",", " ", "c3", " ", "TEXT", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "self_", "._", "map", "\\u", "fkey", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "a", " ", "single", "-", "column", " ", "foreign", " ", "key", ",", " ", "table", " ", "level", " ", "constraint", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "TEXT", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "c2", " ", "INTEG", "ER", ",", " ", "c3", " ", "TEXT", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", ")", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ON", " ", "UPDATE", " ", "CAS", "CA", "DE", " ", "ON", " ", "DELET", "E", " ", "RESTR", "ICT", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "self_", "._", "map", "\\u", "fkey", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "a", " ", "three", "-", "column", " ", "foreign", " ", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", ",", " ", "pc", "2", " ", "CHAR", "(", "5", "),", " ", "pc", "3", " ", "DAT", "E", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pc", "4", " ", "TEXT", ",", " ", "PRIMA", "RY", " ", "KEY", " ", "(", "pc", "2", ",", " ", "pc", "1", ",", " ", "pc", "3", "))\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "c2", " ", "CHAR", "(", "5", "),", " ", "c3", " ", "INTEG", "ER", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c4", " ", "DAT", "E", ",", " ", "c5", " ", "TEXT", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", ",", " ", "c3", ",", " ", "c4", ")", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "2", ",", " ", "pc", "1", ",", " ", "pc", "3", "))\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "self_", "._", "map", "\\u", "fkey", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "a", " ", "named", ",", " ", "three", "-", "column", " ", "foreign", " ", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", ",", " ", "pc", "2", " ", "CHAR", "(", "5", "),", " ", "pc", "3", " ", "DAT", "E", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pc", "4", " ", "TEXT", ",", " ", "PRIMA", "RY", " ", "KEY", " ", "(", "pc", "2", ",", " ", "pc", "1", ",", " ", "pc", "3", "))\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "c2", " ", "CHAR", "(", "5", "),", " ", "c3", " ", "INTEG", "ER", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c4", " ", "DAT", "E", ",", " ", "c5", " ", "TEXT", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CONSTR", "AIN", "T", " ", "t1", "\\u", "fg", "n", "\\u", "key", " ", "FORE", "IGN", " ", "KEY", " ", "(", "c2", ",", " ", "c3", ",", " ", "c4", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "2", ",", " ", "pc", "1", ",", " ", "pc", "3", "))\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "self_", "._", "map", "\\u", "fkey", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "5_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "a", " ", "primary", " ", "key", " ", "and", " ", "two", " ", "foreign", " ", "keys", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", ",", " ", "pc", "2", " ", "CHAR", "(", "5", "),", " ", "pc", "3", " ", "DAT", "E", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pc", "4", " ", "TEXT", ",", " ", "PRIMA", "RY", " ", "KEY", " ", "(", "pc", "2", ",", " ", "pc", "1", ",", " ", "pc", "3", "))\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t3", " ", "(", "qc", "1", " ", "CHAR", "(", "5", ")", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "qc", "2", " ", "text", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "c2", " ", "CHAR", "(", "5", "),", " ", "c3", " ", "INTEG", "ER", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c4", " ", "DAT", "E", ",", " ", "c5", " ", "TEXT", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CONSTR", "AIN", "T", " ", "t1", "\\u", "prim", "\\u", "key", " ", "PRIMA", "RY", " ", "KEY", " ", "(", "c1", ",", " ", "c2", "),", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CONSTR", "AIN", "T", " ", "t1", "\\u", "fg", "n", "\\u", "key", "1", " ", "FORE", "IGN", " ", "KEY", " ", "(", "c2", ",", " ", "c3", ",", " ", "c4", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "2", ",", " ", "pc", "1", ",", " ", "pc", "3", "),", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CONSTR", "AIN", "T", " ", "t1", "\\u", "fg", "n", "\\u", "key", "2", " ", "FORE", "IGN", " ", "KEY", " ", "(", "c2", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "REFERENCE", "S", " ", "t3", " ", "(", "qc", "1", "))\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "self_", "._", "map", "\\u", "fkey", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "foreign", " ", "key", " ", "ON", " ", "UPDATE", "/", "ON", " ", "DELET", "E", " ", "action", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "TEXT", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "c2", " ", "INTEG", "ER", ",", " ", "c3", " ", "TEXT", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", ")", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ON", " ", "UPDATE", " ", "RESTR", "ICT", " ", "ON", " ", "DELET", "E", " ", "SET", " ", "NULL", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "map_", "=_", "{_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t1", "\\u", "c2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "'_", "]_", ",_", "'", "on", "\\u", "update", "'_", ":_", "'", "restrict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "on", "\\u", "delete", "'_", ":_", "'", "set", " ", "null", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "schema", "'_", ":_", "'", "public", "'_", ",_", "'", "table", "'_", ":_", "'", "t2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "exp", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cross", "\\u", "schema", "\\u", "foreign", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "a", " ", "foreign", " ", "key", " ", "on", " ", "a", " ", "table", " ", "in", " ", "anot", "her", " ", "schema", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "SCHE", "MA", " ", "s1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "TEXT", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "s1", ".", "t1", " ", "(", "c1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", " ", "INTEG", "ER", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", "),", " ", "c3", " ", "TEXT", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2", "map_", "=_", "{_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "pc", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "pc", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1", "map_", "=_", "{_", "'", "table", " ", "t1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "{_", "'", "c3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t1", "\\u", "c2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "schema", "'_", ":_", "'", "public", "'_", ",_", "'", "table", "'_", ":_", "'", "t2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t2", "'_", "]_", "==_", "t2", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "s1", "'_", "]_", "==_", "t1", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "foreign", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "its", " ", "primary", " ", "key", " ", "referenced", " ", "by", " ", "two", " ", "other", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "pc", "1", " ", "integ", "er", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "text", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c1", " ", "integ", "er", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", " ", "integ", "er", " ", "REFERENCE", "S", " ", "t1", " ", "(", "pc", "1", "),", " ", "c3", " ", "text", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c4", " ", "integ", "er", " ", "REFERENCE", "S", " ", "t1", " ", "(", "pc", "1", "))\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1", "map_", "=_", "{_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "pc", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "pc", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2", "map_", "=_", "{_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c4", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t2", "\\u", "c2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "schema", "'_", ":_", "'", "public", "'_", ",_", "'", "table", "'_", ":_", "'", "t1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t2", "\\u", "c4", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c4", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "schema", "'_", ":_", "'", "public", "'_", ",_", "'", "table", "'_", ":_", "'", "t1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "t1", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t2", "'_", "]_", "==_", "t2", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "dropped", "\\u", "column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "table", " ", "with", " ", "a", " ", "foreign", " ", "key", " ", "after", " ", "a", " ", "column", " ", "has", " ", "bee", "n", " ", "dropped", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "pc", "1", " ", "integ", "er", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "text", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c1", " ", "integ", "er", ",", " ", "c2", " ", "text", ",", " ", "c3", " ", "small", "int", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c4", " ", "integ", "er", " ", "REFERENCE", "S", " ", "t1", " ", "(", "pc", "1", "))\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "COL", "UM", "N", " ", "c3", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2", "map_", "=_", "{_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c4", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c4", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c4", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "schema", "'_", ":_", "'", "public", "'_", ",_", "'", "table", "'_", ":_", "'", "t1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t2", "'_", "]_", "==_", "t2", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "deferred_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Check", " ", "constraint", "s", " ", "defer", "red", " ", "status", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "TEXT", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", " ", "INTEG", "ER", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", "),", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c3", " ", "INTEG", "ER", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", ")", " ", "DEF", "ERR", "AB", "LE", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c4", " ", "INTEG", "ER", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", ")", " ", "DEF", "ERR", "AB", "LE", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "INITIAL", "LY", " ", "DEF", "ERR", "ED", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fk", "s_", "=_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "[_", "'", "foreign", "\\u", "keys", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "fk", "s_", "[_", "'", "t1", "\\u", "c2", "\\u", "fkey", "'_", "]_", "._", "get_", "(_", "'", "defer", "rab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "fk", "s_", "[_", "'", "t1", "\\u", "c2", "\\u", "fkey", "'_", "]_", "._", "get_", "(_", "'", "defer", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "fk", "s_", "[_", "'", "t1", "\\u", "c3", "\\u", "fkey", "'_", "]_", "._", "get_", "(_", "'", "defer", "rab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "fk", "s_", "[_", "'", "t1", "\\u", "c3", "\\u", "fkey", "'_", "]_", "._", "get_", "(_", "'", "defer", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "fk", "s_", "[_", "'", "t1", "\\u", "c4", "\\u", "fkey", "'_", "]_", "._", "get_", "(_", "'", "defer", "rab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "fk", "s_", "[_", "'", "t1", "\\u", "c4", "\\u", "fkey", "'_", "]_", "._", "get_", "(_", "'", "defer", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "foreign", "\\u", "key", "\\u", "match_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "foreign", " ", "key", " ", "constraint", " ", "with", " ", "a", " ", "MATCH", " ", "specifica", "tion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "TEXT", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", " ", "INTEG", "ER", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", ")", " ", "MATCH", " ", "FULL", ",", " ", "c3", " ", "TEXT", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1", "map_", "=_", "{_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t1", "\\u", "c2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "'_", "]_", ",_", "'", "match", "'_", ":_", "'", "full", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "schema", "'_", ":_", "'", "public", "'_", ",_", "'", "table", "'_", ":_", "'", "t2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "pc", "1", "'_", "]_", "}_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "==_", "t1", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Map", "Test", "Case_", "(_", "Databa", "se", "To", "Map", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "map", "\\u", "fk", "\\u", "comment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Map", " ", "a", " ", "foreign", " ", "key", " ", "with", " ", "a", " ", "comment", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "pc", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "pc", "2", " ", "TEXT", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", ",", " ", "c2", " ", "INTEG", "ER", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CONSTR", "AIN", "T", " ", "cns", "1", " ", "REFERENCE", "S", " ", "t2", " ", "(", "pc", "1", "),", " ", "c3", " ", "TEXT", ")\"_", ",_", "COMMENT", "\\u", "STM", "T_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "ap_", "=_", "self_", "._", "to", "\\u", "map_", "(_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dbm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "[_", "'", "table", " ", "t1", "'_", "]_", "[_", "'", "foreign", "\\u", "keys", "'_", "]_", "[_", "'", "cns", "1", "'_", "]_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", "]_", "==_", "'", "Test", " ", "constraint", " ", "cns", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "foreign", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Add", " ", "a", " ", "two", "-", "column", " ", "foreign", " ", "key", " ", "to", " ", "an", " ", "exist", "ing", " ", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c1", "2", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ",", " ", "c1", "3", " ", "TEXT", ",", " ", "PRIMA", "RY", " ", "KEY", " ", "(", "c1", "1", ",", " ", "c1", "2", "))\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", "2", " ", "TEXT", ",", " ", "c2", "3", " ", "INTEG", "ER", ",", " ", "c2", "4", " ", "INTEG", "ER", ",", " ", "PRIMA", "RY", " ", "KEY", " ", "(", "c2", "1", "))\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", ",_", "'", "c1", "2", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "4", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c2", "3", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "3", "'_", ",_", "'", "c2", "4", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", ",_", "'", "c1", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", "'_", ":_", "'", "t1", "'_", "}_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "\"_", "\"", "t2", "\\u", "c2", "3", "\\u", "fkey", " ", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "3", ",", " ", "c2", "4", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ",", " ", "c1", "2", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alter", "\\u", "foreign", "\\u", "key1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Change", " ", "foreign", " ", "key", ":", " ", "referenci", "ng", " ", "column", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", " ", "NOT", " ", "NULL", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c1", "2", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", " ", "NOT", " ", "NULL", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", "2", " ", "INTEG", "ER", ",", " ", "c2", "3", " ", "INTEG", "ER", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "\"_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "3", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", "'_", ":_", "'", "t1", "'_", "}_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "'_", "'", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "3", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alter", "\\u", "foreign", "\\u", "key", "\\u", "columns_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Change", " ", "foreign", " ", "key", ":", " ", "foreign", " ", "column", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", " ", "UNI", "QUE", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c1", "2", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", " ", "UNI", "QUE", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", " ", "NOT", " ", "NULL", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", "2", " ", "INTEG", "ER", ",", " ", "c2", "3", " ", "INTEG", "ER", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "\"_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unique", "\\u", "constraint", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t1", "\\u", "c1", "1", "\\u", "key", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t1", "\\u", "c1", "2", "\\u", "key", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "2", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", "'_", ":_", "'", "t1", "'_", "}_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "'_", "'", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "2", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "xfail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "alter", "\\u", "foreign", "\\u", "key", "\\u", "column", "\\u", "order_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Change", " ", "foreign", " ", "key", ":", " ", "foreign", " ", "column", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", ",", " ", "c1", "2", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "c2", "2", " ", "INTEG", "ER", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "\"_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "2", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "N", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "2", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "N", "'_", "]_", ",_", "'", "table", "'_", ":_", "'", "t1", "'_", "}_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t1", " ", "ADD", " ", "COL", "UM", "N", " ", "c1", "N", " ", "integ", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "'_", "'", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "N", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alter", "\\u", "foreign", "\\u", "key", "\\u", "change", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Change", " ", "foreign", " ", "key", ":", " ", "foreign", " ", "column", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "c2", "2", " ", "INTEG", "ER", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "\"_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")", " ", "ON", " ", "UPDATE", " ", "RESTR", "ICT", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "on", "\\u", "update", "'_", ":_", "'", "cascade", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", ",_", "'", "table", "'_", ":_", "'", "t1", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "'_", "'", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")", " ", "'_", "'", "ON", " ", "UPDATE", " ", "CAS", "CA", "DE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alter", "\\u", "foreign", "\\u", "key", "\\u", "add", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Change", " ", "foreign", " ", "key", ":", " ", "foreign", " ", "column", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "c2", "2", " ", "INTEG", "ER", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "\"_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "on", "\\u", "update", "'_", ":_", "'", "cascade", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", ",_", "'", "table", "'_", ":_", "'", "t1", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "'_", "'", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")", " ", "'_", "'", "ON", " ", "UPDATE", " ", "CAS", "CA", "DE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alter", "\\u", "foreign", "\\u", "key", "\\u", "drop", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Change", " ", "foreign", " ", "key", ":", " ", "foreign", " ", "column", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "c2", "2", " ", "INTEG", "ER", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "\"_", "\"", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")", " ", "ON", " ", "UPDATE", " ", "RESTR", "ICT", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", ",_", "'", "table", "'_", ":_", "'", "t1", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", " ", "'_", "'", "FORE", "IGN", " ", "KEY", " ", "(", "c2", "2", ")", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fore", "ign", "Key", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "drop", "\\u", "foreign", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Drop", " ", "a", " ", "foreign", " ", "key", " ", "on", " ", "an", " ", "exist", "ing", " ", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ",", " ", "c1", "2", " ", "TEXT", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "PRIMA", "RY", " ", "KEY", " ", "(", "c1", "1", "))\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", "2", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", " ", "REFERENCE", "S", " ", "t1", " ", "(", "c1", "1", "),", " ", "c2", "3", " ", "TEXT", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t1", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "1", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sql_", "==_", "[_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t2", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t2", "\\u", "c2", "2", "\\u", "fkey", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Unique", "Constr", "aint", "To", "Sq", "l", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alter", "\\u", "unique", "\\u", "constraint_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Change", " ", "unique", " ", "constraint", " ", "column", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c2", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t1", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t1", "\\u", "uk", "ey", " ", "UNI", "QUE", " ", "(", "c1", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "'", "table", " ", "t1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unique", "\\u", "constraint", "s", "'_", ":_", "{_", "'", "t1", "\\u", "uk", "ey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unique", "'_", ":_", "True_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "sql_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t1", " ", "DROP", " ", "CONSTR", "AIN", "T", " ", "t1", "\\u", "uk", "ey", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fix", "\\u", "indent_", "(_", "sql_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALT", "ER", " ", "TAB", "LE", " ", "t1", " ", "ADD", " ", "CONSTR", "AIN", "T", " ", "t1", "\\u", "uk", "ey", " ", "UNI", "QUE", " ", "(", "c2", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Constr", "aint", "Comme", "nt", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "drop", "\\u", "foreign", "\\u", "key", "\\u", "comment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Drop", " ", "the", " ", "comment", " ", "on", " ", "an", " ", "exist", "ing", " ", "foreign", " ", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "TAB", "LE", " ", "t2", " ", "(", "c2", "1", " ", "integ", "er", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "c2", "2", " ", "text", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CREATE", " ", "TAB", "LE", " ", "t1", " ", "(", "c1", "1", " ", "integ", "er", ",", " ", "c1", "2", " ", "text", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c1", "3", " ", "integ", "er", " ", "CONSTR", "AIN", "T", " ", "cns", "1", " ", "REFERENCE", "S", " ", "t2", " ", "(", "c2", "1", "))\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "COMMENT", "\\u", "STM", "T_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "[_", "'", "schema", " ", "public", "'_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t2", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c2", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", ",_", "'", "not", "\\u", "null", "'_", ":_", "True_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "key", "'_", ":_", "{_", "'", "t2", "\\u", "pkey", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", "}_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", " ", "t1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c1", "3", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foreign", "\\u", "keys", "'_", ":_", "{_", "'", "cns", "1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "3", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reference", "s", "'_", ":_", "{_", "'", "column", "s", "'_", ":_", "[_", "'", "c2", "1", "'_", "]_", ",_", "'", "table", "'_", ":_", "'", "t2", "'_", "}_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sql_", ",_", "[_", "\"", "COMMENT", " ", "ON", " ", "CONSTR", "AIN", "T", " ", "cns", "1", " ", "ON", " ", "t1", " ", "IS", " ", "NULL", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Constr", "aint", "Comme", "nt", "Test", "Case_", "(_", "Inp", "ut", "Map", "To", "Sq", "l", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "constraint", "\\u", "comment", "\\u", "schema_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Add", " ", "comment", " ", "on", " ", "a", " ", "constraint", " ", "for", " ", "a", " ", "table", " ", "in", " ", "anot", "her", " ", "schema", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stmts_", "=_", "[_", "\"", "CREATE", " ", "SCHE", "MA", " ", "s1", "\"_", ",_", "\"", "CREATE", " ", "TAB", "LE", " ", "s1", ".", "t1", " ", "(", "c1", " ", "integ", "er", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "CONSTR", "AIN", "T", " ", "cns", "1", " ", "CHECK", " ", "(", "c1", " ", ">", " ", "50", "),", " ", "c2", " ", "text", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "=_", "self_", "._", "std", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inm", "ap_", "._", "update_", "(_", "{_", "'", "schema", " ", "s1", "'_", ":_", "{_", "'", "table", " ", "t1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "{_", "'", "c1", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "integ", "er", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "c2", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "text", "'_", "}_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", "\\u", "constraint", "s", "'_", ":_", "{_", "'", "cns", "1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "[_", "'", "c1", "'_", "]_", ",_", "'", "express", "ion", "'_", ":_", "'", "c1", " ", ">", " ", "50", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "'", "Test", " ", "constraint", " ", "cns", "1", "'_", "}_", "}_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "self_", "._", "to", "\\u", "sql_", "(_", "inm", "ap_", ",_", "stmts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sql_", "[_", "0_", "]_", "==_", "\"", "COMMENT", " ", "ON", " ", "CONSTR", "AIN", "T", " ", "cns", "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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 ]
Unused local variable
Akagi201/learning-python/func/ref_equal.py
[ { "content": "def add_list(p):\n p = p + [1]", "metadata": "root.add_list", "header": "['module', '___EOS___']", "index": 3 } ]
[ { "span": "p ", "start_line": 4, "start_column": 4, "end_line": 4, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "list_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "p_", "+_", "[_", "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, 0, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
google/encrypted-bigquery-client/src/paillier_test.py
[ { "content": " def testGetRandomFromZNStar(self):\n logging.debug('Running testGetRandomFromZNStar method.')\n # 8 bit values not relatively prime to 143 and less than 143.\n not_relatively_prime_to_143 = [130, 132, 143]\n for _ in xrange(20):\n r = _PAILLIER1._GetRandomFromZNStar(8, 143)\n self.assertFalse(r in not_relatively_prime_to_143)", "metadata": "root.PaillierTest.testGetRandomFromZNStar", "header": "['class', 'PaillierTest', '(', 'googletest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def testEncryptDecryptFloatLargeFiniteNumbers(self):\n logging.debug('Running testEncryptDecryptFloatLargeFiniteNumbers method.')\n # ------- positive large finite numbers ------\n large1 = 1.23456789123456789123456789 * 2**80\n large2 = 1.23456789123456789123456789 * 2**100\n c_large1 = _PAILLIER1.EncryptFloat(large1)\n self.assertEquals(large1, _PAILLIER1.DecryptFloat(c_large1))\n c_large2 = _PAILLIER1.EncryptFloat(large2)\n self.assertEquals(large2, _PAILLIER1.DecryptFloat(c_large2))\n # mantissa with 17 digits.\n c_mantissa17digits = _PAILLIER1.EncryptFloat(\n 1234567890.0123456)\n self.assertEquals(1234567890.0123456,\n _PAILLIER1.DecryptFloat(c_mantissa17digits))\n # mantissa with 18 digits rounds only approximately.\n c_mantissa18digits = _PAILLIER1.EncryptFloat(\n 1234567890.01234568)\n decrypted = _PAILLIER1.DecryptFloat(c_mantissa18digits)\n self.assertNotEquals(1234567890.0123456, decrypted)\n self.assertTrue(abs(decrypted - 1234567890.0123456) <= .0000003)\n # absolute largest normal number allowed\n largest_normal = 1.9999999999999998 * 2**389\n c_largest_normal = _PAILLIER1.EncryptFloat(largest_normal)\n self.assertEquals(largest_normal, _PAILLIER1.DecryptFloat(c_largest_normal))\n # larger than largest normal number throws error\n try:\n beyond_largest_normal = 1.0 * 2**390\n _PAILLIER1.EncryptFloat(beyond_largest_normal)\n self.fail()\n except ValueError:\n pass # success\n\n # ---- negative large finite numbers ------\n # mantissa with 17 digits and negative.\n c_mantissa17digits_neg = _PAILLIER1.EncryptFloat(\n -1234567890.0123456)\n self.assertEquals(-1234567890.0123456,\n _PAILLIER1.DecryptFloat(c_mantissa17digits_neg))\n # mantissa with 18 digits rounds only approximately.\n c_mantissa18digits_neg = _PAILLIER1.EncryptFloat(\n -1234567890.01234568)\n decrypted = _PAILLIER1.DecryptFloat(c_mantissa18digits_neg)\n self.assertNotEquals(-1234567890.0123456, decrypted)\n self.assertTrue(abs(decrypted - -1234567890.0123456) <= .0000003)\n # absolute largest negative normal number allowed\n largest_normal = -1.9999999999999998 * 2**389\n c_largest_normal = _PAILLIER1.EncryptFloat(largest_normal)\n self.assertEquals(largest_normal, _PAILLIER1.DecryptFloat(c_largest_normal))\n # larger magnitude than negative normal number with largest magnituede\n # throws and error\n try:\n beyond_largest_normal = -1.0 * 2**390\n _PAILLIER1.EncryptFloat(beyond_largest_normal)\n self.fail()\n except ValueError:\n pass # success", "metadata": "root.PaillierTest.testEncryptDecryptFloatLargeFiniteNumbers", "header": "['class', 'PaillierTest', '(', 'googletest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 417 }, { "content": " def testEncryptDecryptFloatAddFiniteNumbers(self):\n logging.debug('Running testEncryptDecryptFloatAddFiniteNumbers method.')\n # add a chain of small positive numbers\n c_1_0 = _PAILLIER1.EncryptFloat(1.0)\n c_2_0 = _PAILLIER1.EncryptFloat(2.0)\n c_3_0 = _PAILLIER1.Add(c_2_0, c_1_0)\n c_5_0 = _PAILLIER1.Add(c_3_0, c_2_0)\n self.assertEquals(3.0, _PAILLIER1.DecryptFloat(c_3_0))\n self.assertEquals(5.0, _PAILLIER1.DecryptFloat(c_5_0))\n # add a chain of small negative numbers\n c_2_0neg = _PAILLIER1.EncryptFloat(-2.0)\n c_4_0neg = _PAILLIER1.EncryptFloat(-4.0)\n c_6_0neg = _PAILLIER1.Add(c_2_0neg, c_4_0neg)\n self.assertEquals(-6.0, _PAILLIER1.DecryptFloat(c_6_0neg))\n # add positive and negative small numbers\n c_1_0neg = _PAILLIER1.Add(c_5_0, c_6_0neg)\n self.assertEquals(-1.0, _PAILLIER1.DecryptFloat(c_1_0neg))\n # add a large positive and negative number\n large1 = 1.999999999999999 * 2**389\n c_large1 = _PAILLIER1.EncryptFloat(large1)\n c_large2neg = _PAILLIER1.EncryptFloat(-0.999999999999999 * 2**389)\n decrypted = _PAILLIER1.DecryptFloat(_PAILLIER1.Add(c_large1, c_large2neg))\n # check close to 1.0 * 2**389\n self.assertTrue(decrypted > .9999999999999998 * 2**389)\n self.assertTrue(decrypted < 1.000000000000002 * 2**389)\n # add a very large and a relatively small number --> same large number.\n c_small1 = _PAILLIER1.EncryptFloat(.99999999999999 * 2**-430)\n decrypted = _PAILLIER1.DecryptFloat(_PAILLIER1.Add(c_large1, c_small1))\n self.assertEquals(large1, decrypted)\n # add two subnormal numbers.\n smallest_subnormal = 2**-441\n c_smallest_subnormal = _PAILLIER1.EncryptFloat(smallest_subnormal)\n c_2smallest_subnormal = _PAILLIER1.Add(c_smallest_subnormal,\n c_smallest_subnormal)\n self.assertEquals(2**-440, _PAILLIER1.DecryptFloat(c_2smallest_subnormal))\n # add a positive and negative subnormal numbers\n c_smallest_subnormal_neg = _PAILLIER1.EncryptFloat(-2**-441)\n self.assertEquals(smallest_subnormal, _PAILLIER1.DecryptFloat(\n _PAILLIER1.Add(c_2smallest_subnormal, c_smallest_subnormal_neg)))", "metadata": "root.PaillierTest.testEncryptDecryptFloatAddFiniteNumbers", "header": "['class', 'PaillierTest', '(', 'googletest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 474 } ]
[ { "span": "self.assertFalse(r in not_relatively_prime_to_143)", "start_line": 130, "start_column": 6, "end_line": 130, "end_column": 56 }, { "span": "self.assertTrue(abs(decrypted - 1234567890.0123456) <= .0000003)", "start_line": 436, "start_column": 4, "end_line": 436, "end_column": 68 }, { "span": "self.assertTrue(abs(decrypted - -1234567890.0123456) <= .0000003)", "start_line": 460, "start_column": 4, "end_line": 460, "end_column": 69 }, { "span": "self.assertTrue(decrypted > .9999999999999998 * 2**389)", "start_line": 497, "start_column": 4, "end_line": 497, "end_column": 59 }, { "span": "self.assertTrue(decrypted < 1.000000000000002 * 2**389)", "start_line": 498, "start_column": 4, "end_line": 498, "end_column": 59 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pai", "lli", "er", "Test_", "(_", "google", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Random", "Fro", "m", "ZN", "Star_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "Run", "ning", " ", "test", "Get", "Random", "Fro", "m", "ZN", "Star", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "8", " ", "bit", " ", "values", " ", "not", " ", "relative", "ly", " ", "prim", "e", " ", "to", " ", "143", " ", "and", " ", "less", " ", "than", " ", "143", "._", "\\u\\u\\uNL\\u\\u\\u_", "not", "\\u", "relative", "ly", "\\u", "prim", "e\\u", "to", "\\u", "143_", "=_", "[_", "130_", ",_", "132_", ",_", "143_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "xrange_", "(_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "\\u", "Get", "Random", "Fro", "m", "ZN", "Star_", "(_", "8_", ",_", "143_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "r_", "in_", "not", "\\u", "relative", "ly", "\\u", "prim", "e\\u", "to", "\\u", "143_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pai", "lli", "er", "Test_", "(_", "google", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Encrypt", "Decrypt", "Float", "Large", "Fini", "te", "Numbers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "Run", "ning", " ", "test", "Encrypt", "Decrypt", "Float", "Large", "Fini", "te", "Number", "s", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-------", " ", "posit", "ive", " ", "large", " ", "finite", " ", "numbers", " ", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "large", "1_", "=_", "1.23", "4567", "891", "23456", "789", "12345678", "9_", "*_", "2_", "**_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "large", "2_", "=_", "1.23", "4567", "891", "23456", "789", "12345678", "9_", "*_", "2_", "**_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "large", "1_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "large", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "large", "1_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "large", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "large", "2_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "large", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "large", "2_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "large", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mant", "issa", " ", "with", " ", "1", "7", " ", "digit", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "mant", "issa", "1", "7d", "igi", "ts_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90.", "0123456", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "12345678", "90.", "0123456", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "mant", "issa", "1", "7d", "igi", "ts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mant", "issa", " ", "with", " ", "1", "8", " ", "digit", "s", " ", "round", "s", " ", "only", " ", "approximate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "mant", "issa", "1", "8d", "igi", "ts_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "12345678", "90.", "0123456", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decrypted", "_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "mant", "issa", "1", "8d", "igi", "ts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "12345678", "90.", "0123456", "_", ",_", "decrypted", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "decrypted", "_", "-_", "12345678", "90.", "0123456", "_", ")_", "<=_", ".0000", "003", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "abs", "olute", " ", "large", "st", " ", "normal", " ", "number", " ", "allowed_", "\\u\\u\\uNL\\u\\u\\u_", "large", "st", "\\u", "normal_", "=_", "1.9", "9999999999999", "98_", "*_", "2_", "**_", "389", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "large", "st", "\\u", "normal_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "large", "st", "\\u", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "large", "st", "\\u", "normal_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "large", "st", "\\u", "normal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "large", "r", " ", "than", " ", "large", "st", " ", "normal", " ", "number", " ", "throw", "s", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "be", "yon", "d\\u", "large", "st", "\\u", "normal_", "=_", "1.0_", "*_", "2_", "**_", "390", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "be", "yon", "d\\u", "large", "st", "\\u", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\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_", "#", " ", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "----", " ", "negati", "ve", " ", " ", "large", " ", "finite", " ", "numbers", " ", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mant", "issa", " ", "with", " ", "1", "7", " ", "digit", "s", " ", "and", " ", "negati", "ve", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c\\u", "mant", "issa", "1", "7d", "igi", "ts", "\\u", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "12345678", "90.", "0123456", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "-_", "12345678", "90.", "0123456", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "mant", "issa", "1", "7d", "igi", "ts", "\\u", "neg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mant", "issa", " ", "with", " ", "1", "8", " ", "digit", "s", " ", "round", "s", " ", "only", " ", "approximate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "mant", "issa", "1", "8d", "igi", "ts", "\\u", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "12345678", "90.", "0123456", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decrypted", "_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "mant", "issa", "1", "8d", "igi", "ts", "\\u", "neg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "-_", "12345678", "90.", "0123456", "_", ",_", "decrypted", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "decrypted", "_", "-_", "-_", "12345678", "90.", "0123456", "_", ")_", "<=_", ".0000", "003", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "abs", "olute", " ", "large", "st", " ", "negati", "ve", " ", "normal", " ", "number", " ", "allowed_", "\\u\\u\\uNL\\u\\u\\u_", "large", "st", "\\u", "normal_", "=_", "-_", "1.9", "9999999999999", "98_", "*_", "2_", "**_", "389", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "large", "st", "\\u", "normal_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "large", "st", "\\u", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "large", "st", "\\u", "normal_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "large", "st", "\\u", "normal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "large", "r", " ", "magnitude", " ", "than", " ", "negati", "ve", " ", "normal", " ", "number", " ", "with", " ", "large", "st", " ", "magni", "tu", "ede", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "throw", "s", " ", "and", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "be", "yon", "d\\u", "large", "st", "\\u", "normal_", "=_", "-_", "1.0_", "*_", "2_", "**_", "390", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "be", "yon", "d\\u", "large", "st", "\\u", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", ")_", "\\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_", "#", " ", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pai", "lli", "er", "Test_", "(_", "google", "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", "Encrypt", "Decrypt", "Float", "Add", "Fini", "te", "Numbers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "Run", "ning", " ", "test", "Encrypt", "Decrypt", "Float", "Add", "Fini", "te", "Number", "s", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "chain", " ", "of", " ", "small", " ", "posit", "ive", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "1", "\\u", "0_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "2", "\\u", "0_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "3", "\\u", "0_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Add_", "(_", "c\\u", "2", "\\u", "0_", ",_", "c\\u", "1", "\\u", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "5", "\\u", "0_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Add_", "(_", "c\\u", "3", "\\u", "0_", ",_", "c\\u", "2", "\\u", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "3.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "3", "\\u", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "5.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "5", "\\u", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "chain", " ", "of", " ", "small", " ", "negati", "ve", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "2", "\\u", "0", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "-_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "4", "\\u", "0", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "-_", "4.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "6", "\\u", "0", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Add_", "(_", "c\\u", "2", "\\u", "0", "neg_", ",_", "c\\u", "4", "\\u", "0", "neg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "-_", "6.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "6", "\\u", "0", "neg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "posit", "ive", " ", "and", " ", "negati", "ve", " ", "small", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "1", "\\u", "0", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Add_", "(_", "c\\u", "5", "\\u", "0_", ",_", "c\\u", "6", "\\u", "0", "neg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "-_", "1.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "1", "\\u", "0", "neg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "large", " ", "posit", "ive", " ", "and", " ", "negati", "ve", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "large", "1_", "=_", "1.9", "9999999999999", "9_", "*_", "2_", "**_", "389", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "large", "1_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "large", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "large", "2n", "eg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "-_", "0.999", "99999999999", "9_", "*_", "2_", "**_", "389", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decrypted", "_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u", "PAI", "LL", "IER", "1_", "._", "Add_", "(_", "c\\u", "large", "1_", ",_", "c\\u", "large", "2n", "eg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "close", " ", "to", " ", "1.0", " ", "*", " ", "2", "**", "389", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "decrypted", "_", ">_", ".99", "9999999999999", "8_", "*_", "2_", "**_", "389", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "decrypted", "_", "<_", "1.000000", "00000000", "2_", "*_", "2_", "**_", "389", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "very", " ", "large", " ", "and", " ", "a", " ", "relative", "ly", " ", "small", " ", "number", " ", "-->", " ", "same", " ", "large", " ", "number", "._", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "small", "1_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", ".99", "99999999999", "9_", "*_", "2_", "**_", "-_", "430", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decrypted", "_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u", "PAI", "LL", "IER", "1_", "._", "Add_", "(_", "c\\u", "large", "1_", ",_", "c\\u", "small", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "large", "1_", ",_", "decrypted", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "two", " ", "subn", "ormal", " ", "numbers", "._", "\\u\\u\\uNL\\u\\u\\u_", "smallest", "\\u", "subn", "ormal", "_", "=_", "2_", "**_", "-_", "441", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "smallest", "\\u", "subn", "ormal", "_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "smallest", "\\u", "subn", "ormal", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "2s", "mall", "est", "\\u", "subn", "ormal", "_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Add_", "(_", "c\\u", "smallest", "\\u", "subn", "ormal", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "smallest", "\\u", "subn", "ormal", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "2_", "**_", "-_", "440_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "2s", "mall", "est", "\\u", "subn", "ormal", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "posit", "ive", " ", "and", " ", "negati", "ve", " ", "subn", "ormal", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "smallest", "\\u", "subn", "ormal", "\\u", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "-_", "2_", "**_", "-_", "441", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "smallest", "\\u", "subn", "ormal", "_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u\\u\\uN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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
hzlf/openbroadcast/website/multilingual/admin.py
[ { "content": "\"\"\"Admin suppor for inlines\n\nPeter Cicman, Divio GmbH, 2008\n\"\"\"\nfrom django.utils.text import capfirst, get_text_list\nfrom django.contrib.admin.util import flatten_fieldsets\nfrom django.http import HttpResponseRedirect\nfrom django.utils.encoding import force_unicode\n\nimport re\nfrom copy import deepcopy\nfrom django.conf import settings\nfrom django import forms\nfrom django.contrib import admin\nfrom django.db.models import Model\nfrom django.forms.util import ErrorList, ValidationError\nfrom django.forms.models import BaseInlineFormSet, ModelFormMetaclass\nfrom django.utils.translation import ugettext as _\nfrom django.template.loader import find_template\nfrom django.template import TemplateDoesNotExist\nfrom multilingual.languages import get_default_language\nfrom multilingual.utils import GLL\n\nMULTILINGUAL_PREFIX = '_ml__trans_'\nMULTILINGUAL_INLINE_PREFIX = '_ml__inline_trans_'\n\n\n\n\n\n\n\n \n \n \n \n\n\n\n \n\n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def gll(func):\n def wrapped(cls, request, *args, **kwargs):\n cls.use_language = request.GET.get('lang', request.GET.get('language', get_default_language()))\n GLL.lock(cls.use_language)\n resp = func(cls, request, *args, **kwargs)\n GLL.release()\n return resp\n wrapped.__name__ = func.__name__\n wrapped.__doc__ = func.__doc__\n return wrapped", "metadata": "root.gll", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def standard_get_fill_check_field(stdopts):\n if hasattr(stdopts, 'translation_model'):\n opts = stdopts.translation_model._meta\n for field in opts.fields:\n if field.name in ('language_code', 'master'):\n continue\n if not (field.blank or field.null):\n return field.name\n return None", "metadata": "root.standard_get_fill_check_field", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def relation_hack(form, fields, prefix=''):\n opts = form.instance._meta\n localm2m = [m2m.attname for m2m in opts.local_many_to_many]\n externalfk = [obj.field.related_query_name() for obj in opts.get_all_related_objects()]\n externalm2m = [m2m.get_accessor_name() for m2m in opts.get_all_related_many_to_many_objects()]\n for name, db_field in fields:\n full_name = '%s%s' % (prefix, name)\n if full_name in form.fields:\n value = getattr(form.instance, name, '')\n # check for (local) ForeignKeys\n if isinstance(value, Model):\n value = value.pk\n # check for (local) many to many fields\n elif name in localm2m:\n value = value.all()\n # check for (external) ForeignKeys\n elif name in externalfk:\n value = value.all()\n # check for (external) many to many fields\n elif name in externalm2m:\n value = value.all()\n form.fields[full_name].initial = value", "metadata": "root.relation_hack", "header": "['module', '___EOS___']", "index": 47 }, { "content": "class MultilingualInlineModelForm(forms.ModelForm):", "metadata": "root.MultilingualInlineModelForm", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,\n initial=None, error_class=ErrorList, label_suffix=':',\n empty_permitted=False, instance=None):\n \"\"\"\n Fill initial ML Fields\n \"\"\"\n super(MultilingualInlineModelForm, self).__init__(data, files, auto_id,\n prefix, initial, error_class, label_suffix, empty_permitted, instance)\n \n # only read initial data if the object already exists, not if we're adding it!\n if self.instance.pk:\n relation_hack(self, get_translated_fields(self.instance), MULTILINGUAL_INLINE_PREFIX)", "metadata": "root.MultilingualInlineModelForm.__init__", "header": "['class', 'MultilingualInlineModelForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 72 }, { "content": "class MultilingualInlineFormSet(BaseInlineFormSet):\n\n \n ", "metadata": "root.MultilingualInlineFormSet", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def get_queryset(self):\n if self.queryset is not None:\n qs = self.queryset\n else:\n qs = self.model._default_manager.get_query_set()\n\n if not qs.ordered:\n qs = qs.order_by(self.model._meta.pk.name)\n\n if self.max_num > 0:\n _queryset = qs[:self.max_num]\n else:\n _queryset = qs\n return _queryset", "metadata": "root.MultilingualInlineFormSet.get_queryset", "header": "['class', 'MultilingualInlineFormSet', '(', 'BaseInlineFormSet', ')', ':', '___EOS___']", "index": 87 }, { "content": " def save_new(self, form, commit=True):\n \"\"\"\n NOTE: save_new method is completely overridden here, there's no\n other way to pretend double save otherwise. Just assign translated data\n to object \n \"\"\"\n kwargs = {self.fk.get_attname(): self.instance.pk}\n new_obj = self.model(**kwargs)\n self._prepare_multilingual_object(new_obj, form)\n return forms.save_instance(form, new_obj, exclude=[self._pk_field.name], commit=commit)", "metadata": "root.MultilingualInlineFormSet.save_new", "header": "['class', 'MultilingualInlineFormSet', '(', 'BaseInlineFormSet', ')', ':', '___EOS___']", "index": 102 }, { "content": " def save_existing(self, form, instance, commit=True):\n \"\"\"\n NOTE: save_new method is completely overridden here, there's no\n other way to pretend double save otherwise. Just assign translated data\n to object \n \"\"\"\n self._prepare_multilingual_object(instance, form)\n return forms.save_instance(form, instance, exclude=[self._pk_field.name], commit=commit)", "metadata": "root.MultilingualInlineFormSet.save_existing", "header": "['class', 'MultilingualInlineFormSet', '(', 'BaseInlineFormSet', ')', ':', '___EOS___']", "index": 113 }, { "content": " def _prepare_multilingual_object(self, obj, form):\n opts = obj._meta\n for realname, fieldname in self.ml_fields.items():\n field = opts.get_field_by_name(realname)[0]\n m = re.match(r'^%s(?P<field_name>.*)$' % MULTILINGUAL_INLINE_PREFIX, fieldname)\n if m:\n field.save_form_data(self.instance, form.cleaned_data[fieldname])\n setattr(obj, realname, getattr(self.instance, realname.rsplit('_', 1)[0]))", "metadata": "root.MultilingualInlineFormSet._prepare_multilingual_object", "header": "['class', 'MultilingualInlineFormSet', '(', 'BaseInlineFormSet', ')', ':', '___EOS___']", "index": 122 }, { "content": "class MultilingualInlineAdmin(admin.TabularInline):\n formset = MultilingualInlineFormSet\n form = MultilingualInlineModelForm\n \n template = 'admin/multilingual/edit_inline/tabular.html'\n \n # css class added to inline box\n inline_css_class = None\n \n use_language = None\n \n fill_check_field = None\n #TODO: add some nice template\n \n \n\n ", "metadata": "root.MultilingualInlineAdmin", "header": "['module', '___EOS___']", "index": 132 }, { "content": " def __init__(self, parent_model, admin_site):\n super(MultilingualInlineAdmin, self).__init__(parent_model, admin_site)\n if hasattr(self, 'use_fields'):\n # go around admin fields structure validation\n self.fields = self.use_fields", "metadata": "root.MultilingualInlineAdmin.__init__", "header": "['class', 'MultilingualInlineAdmin', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 146 }, { "content": " def get_formset(self, request, obj=None, **kwargs):\n FormSet = super(MultilingualInlineAdmin, self).get_formset(request, obj, **kwargs)\n FormSet.use_language = GLL.language_code\n FormSet.ml_fields = {}\n for name, field in get_translated_fields(self.model, GLL.language_code):\n fieldname = '%s%s' % (MULTILINGUAL_INLINE_PREFIX, name)\n FormSet.form.base_fields[fieldname] = self.formfield_for_dbfield(field, request=request)\n FormSet.ml_fields[name] = fieldname\n return FormSet", "metadata": "root.MultilingualInlineAdmin.get_formset", "header": "['class', 'MultilingualInlineAdmin', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 152 }, { "content": " def queryset(self, request):\n \"\"\"\n Filter objects which don't have a value in this language\n \"\"\"\n qs = super(MultilingualInlineAdmin, self).queryset(request)\n # Don't now what the hell I was thinking here, but this code breaks stuff:\n #\n # checkfield = self.get_fill_check_field()\n # if checkfield is not None:\n # kwargs = {str('%s_%s__isnull' % (checkfield, GLL.language_code)): False}\n # from django.db.models.fields import CharField\n # if isinstance(self.model._meta.translation_model._meta.get_field_by_name(checkfield)[0], CharField):\n # kwargs[str('%s_%s__gt' % (checkfield, GLL.language_code))] = ''\n # return qs.filter(**kwargs)\n return qs.filter(translations__language_code=GLL.language_code).distinct()", "metadata": "root.MultilingualInlineAdmin.queryset", "header": "['class', 'MultilingualInlineAdmin', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 162 }, { "content": " def get_fill_check_field(self):\n if self.fill_check_field is None:\n self.fill_check_field = standard_get_fill_check_field(self.model._meta)\n return self.fill_check_field", "metadata": "root.MultilingualInlineAdmin.get_fill_check_field", "header": "['class', 'MultilingualInlineAdmin', '(', 'admin', '.', 'TabularInline', ')', ':', '___EOS___']", "index": 178 }, { "content": "class MultilingualModelAdminForm(forms.ModelForm):\n # for rendering / saving multilingual fields connecte to model, takes place\n # when admin per language is ussed\n \n \n \n \n \n \n ", "metadata": "root.MultilingualModelAdminForm", "header": "['module', '___EOS___']", "index": 184 }, { "content": " def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,\n initial=None, error_class=ErrorList, label_suffix=':',\n empty_permitted=False, instance=None):\n \"\"\"\n Fill up initial ML Fields\n \"\"\"\n super(MultilingualModelAdminForm, self).__init__(data, files, auto_id, prefix,\n initial, error_class, label_suffix,\n empty_permitted, instance)\n # only try to fill intial data if we are not adding an object!\n if self.instance.pk:\n fields = [(f, getattr(self.instance, \"%s_%s\" % (f, GLL.language_code), '')) for f in self.ml_fields]\n relation_hack(self, fields)", "metadata": "root.MultilingualModelAdminForm.__init__", "header": "['class', 'MultilingualModelAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___NEWLINE___', '# for rendering / saving multilingual fields connecte to model, takes place', '___NL___', '# when admin per language is ussed', '___NL___', '___EOS___']", "index": 188 }, { "content": " def clean(self):\n cleaned_data = super(MultilingualModelAdminForm, self).clean()\n self.validate_ml_unique()\n return cleaned_data", "metadata": "root.MultilingualModelAdminForm.clean", "header": "['class', 'MultilingualModelAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___NEWLINE___', '# for rendering / saving multilingual fields connecte to model, takes place', '___NL___', '# when admin per language is ussed', '___NL___', '___EOS___']", "index": 202 }, { "content": " def validate_ml_unique(self):\n form_errors = []\n \n if not hasattr(self.instance._meta, 'translation_model'):\n return\n for check in self.instance._meta.translation_model._meta.unique_together[:]:\n lookup_kwargs = {'language_code': GLL.language_code}\n for field_name in check:\n #local_name = \"%s_%s\" % (field_name, self.use_language)\n if self.cleaned_data.get(field_name) is not None:\n lookup_kwargs[field_name] = self.cleaned_data.get(field_name) \n \n if len(check) == 2 and 'master' in check and 'language_code' in check:\n continue\n \n qs = self.instance._meta.translation_model.objects.filter(**lookup_kwargs)\n if self.instance.pk is not None:\n qs = qs.exclude(master=self.instance.pk)\n \n if qs.count():\n model_name = capfirst(self.instance._meta.verbose_name)\n field_labels = []\n for field_name in check:\n if field_name == \"language_code\":\n field_labels.append(_(\"language\"))\n elif field_name == \"master\":\n continue\n else:\n field_labels.append(self.instance._meta.translation_model._meta.get_field_by_name(field_name)[0].verbose_name)\n field_labels = get_text_list(field_labels, _('and'))\n form_errors.append(\n _(u\"%(model_name)s with this %(field_label)s already exists.\") % \\\n {'model_name': unicode(model_name),\n 'field_label': unicode(field_labels)}\n )\n if form_errors:\n # Raise the unique together errors since they are considered\n # form-wide.\n raise ValidationError(form_errors)", "metadata": "root.MultilingualModelAdminForm.validate_ml_unique", "header": "['class', 'MultilingualModelAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___NEWLINE___', '# for rendering / saving multilingual fields connecte to model, takes place', '___NL___', '# when admin per language is ussed', '___NL___', '___EOS___']", "index": 207 }, { "content": " def save(self, commit=True):\n self._prepare_multilingual_object(self.instance, self)\n return super(MultilingualModelAdminForm, self).save(commit) ", "metadata": "root.MultilingualModelAdminForm.save", "header": "['class', 'MultilingualModelAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___NEWLINE___', '# for rendering / saving multilingual fields connecte to model, takes place', '___NL___', '# when admin per language is ussed', '___NL___', '___EOS___']", "index": 248 }, { "content": " def _prepare_multilingual_object(self, obj, form):\n opts = self.instance._meta\n for name in self.ml_fields:\n field = opts.get_field_by_name(name)[0]\n # respect save_form_data\n field.save_form_data(self.instance, form.cleaned_data[name])\n setattr(obj, \"%s_%s\" % (name, GLL.language_code), getattr(self.instance, name))", "metadata": "root.MultilingualModelAdminForm._prepare_multilingual_object", "header": "['class', 'MultilingualModelAdminForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___NEWLINE___', '# for rendering / saving multilingual fields connecte to model, takes place', '___NL___', '# when admin per language is ussed', '___NL___', '___EOS___']", "index": 253 }, { "content": "class MultilingualModelAdmin(admin.ModelAdmin):\n \n # use special template to render tabs for languages on top\n change_form_template = \"admin/multilingual/change_form.html\"\n \n form = MultilingualModelAdminForm\n \n _multilingual_model_admin = True\n \n use_language = None\n \n fill_check_field = None\n \n _use_hacks = ['fieldsets', 'prepopulated_fields', 'readonly_fields']\n\n class Media:\n css = {\n 'all': ('%smultilingual/admin/css/style.css' % settings.MEDIA_URL,)\n }\n \n \n \n \n \n \n \n \n \n \n ", "metadata": "root.MultilingualModelAdmin", "header": "['module', '___EOS___']", "index": 263 }, { "content": " def __init__(self, model, admin_site):\n for attr in self._use_hacks:\n if hasattr(self, 'use_%s' % attr):\n setattr(self, attr, getattr(self, 'use_%s' % attr))\n super(MultilingualModelAdmin, self).__init__(model, admin_site)", "metadata": "root.MultilingualModelAdmin.__init__", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 283 }, { "content": " def get_fill_check_field(self):\n if self.fill_check_field is None:\n self.fill_check_field = standard_get_fill_check_field(self.model._meta)\n return self.fill_check_field", "metadata": "root.MultilingualModelAdmin.get_fill_check_field", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 289 }, { "content": " def get_form(self, request, obj=None, **kwargs): \n # assign language to inlines, so they now how to render\n for inline in self.inline_instances:\n if isinstance(inline, MultilingualInlineAdmin):\n inline.use_language = GLL.language_code\n \n Form = super(MultilingualModelAdmin, self).get_form(request, obj, **kwargs)\n \n Form.ml_fields = {}\n for name, field in get_default_translated_fields(self.model):\n if not field.editable:\n continue\n form_field = self.formfield_for_dbfield(field, request=request)\n local_name = \"%s_%s\" % (name, GLL.language_code)\n Form.ml_fields[name] = form_field\n Form.base_fields[name] = form_field\n Form.use_language = GLL.language_code\n return Form", "metadata": "root.MultilingualModelAdmin.get_form", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 294 }, { "content": " def placeholder_plugin_filter(self, request, queryset):\n \"\"\"\n This is only used on models which use placeholders from the django-cms\n \"\"\"\n if not request:\n return queryset\n if GLL.is_active:\n return queryset.filter(language=GLL.language_code)\n return queryset", "metadata": "root.MultilingualModelAdmin.placeholder_plugin_filter", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 313 }, { "content": " @gll\n def change_view(self, *args, **kwargs):\n return super(MultilingualModelAdmin, self).change_view(*args, **kwargs)", "metadata": "root.MultilingualModelAdmin.change_view", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 323 }, { "content": " @gll\n def add_view(self, *args, **kwargs):\n return super(MultilingualModelAdmin, self).add_view(*args, **kwargs)", "metadata": "root.MultilingualModelAdmin.add_view", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 327 }, { "content": " @gll\n def delete_view(self, *args, **kwargs):\n return super(MultilingualModelAdmin, self).delete_view(*args, **kwargs)", "metadata": "root.MultilingualModelAdmin.delete_view", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 331 }, { "content": " def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):\n # add context variables\n filled_languages = []\n fill_check_field = self.get_fill_check_field()\n if obj and fill_check_field is not None:\n from django.db.models.fields import CharField\n kwargs = {'%s__isnull' % fill_check_field:False}\n if isinstance(self.model._meta.translation_model._meta.get_field_by_name(fill_check_field)[0], CharField):\n kwargs['%s__gt' % fill_check_field] = ''\n filled_languages = [t[0] for t in obj.translations.filter(**kwargs).values_list('language_code')]\n context.update({\n 'current_language_index': GLL.language_code,\n 'current_language_code': GLL.language_code,\n 'filled_languages': filled_languages,\n 'old_template': self.get_old_template(),\n })\n return super(MultilingualModelAdmin, self).render_change_form(request, context, add, change, form_url, obj)", "metadata": "root.MultilingualModelAdmin.render_change_form", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 335 }, { "content": " def get_old_template(self):\n opts = self.model._meta\n app_label = opts.app_label\n search_templates = [\n \"admin/%s/%s/change_form.html\" % (app_label, opts.object_name.lower()),\n \"admin/%s/change_form.html\" % app_label,\n \"admin/change_form.html\"\n ]\n for template in search_templates:\n try:\n find_template(template)\n return template\n except TemplateDoesNotExist:\n pass", "metadata": "root.MultilingualModelAdmin.get_old_template", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 354 }, { "content": " def response_change(self, request, obj):\n # because save & continue - so it shows the same language\n if request.POST.has_key(\"_continue\"):\n opts = obj._meta\n msg = _('The %(name)s \"%(obj)s\" was changed successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj)}\n self.message_user(request, msg + ' ' + _(\"You may edit it again below.\"))\n lang, path = request.GET.get('language', get_default_language()), request.path\n if lang:\n lang = \"language=%s\" % lang\n if request.REQUEST.has_key('_popup'):\n path += \"?_popup=1\" + \"&%s\" % lang\n else:\n path += \"?%s\" % lang\n return HttpResponseRedirect(path)\n return super(MultilingualModelAdmin, self).response_change(request, obj)", "metadata": "root.MultilingualModelAdmin.response_change", "header": "['class', 'MultilingualModelAdmin', '(', 'admin', '.', 'ModelAdmin', ')', ':', '___NEWLINE___', '___NL___', '# use special template to render tabs for languages on top', '___NL___', '___EOS___']", "index": 369 }, { "content": "def get_translated_fields(model, language=None):\n meta = model._meta\n if not hasattr(meta, 'translated_fields'):\n if hasattr(meta, 'translation_model'):\n meta = meta.translation_model._meta\n else:\n return\n # returns all the translatable fields, except of the default ones\n if not language:\n for name, (field, non_default) in meta.translated_fields.items():\n if non_default: \n yield name, field\n else:\n # if language is defined return fields in the same order, like they are defined in the \n # translation class\n for field in meta.fields:\n if field.primary_key:\n continue\n name = field.name + \"_%s\" % language\n field = meta.translated_fields.get(name, None)\n if field:\n yield name, field[0]", "metadata": "root.get_translated_fields", "header": "['module', '___EOS___']", "index": 386 }, { "content": "def get_default_translated_fields(model):\n if hasattr(model._meta, 'translation_model'):\n for name, (field, non_default) in model._meta.translation_model._meta.translated_fields.items():\n if not non_default:\n yield name, field", "metadata": "root.get_default_translated_fields", "header": "['module', '___EOS___']", "index": 410 } ]
[ { "span": "from django.contrib.admin.util import flatten_fieldsets", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 55 }, { "span": "from copy import deepcopy", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 25 }, { "span": "from django.forms.models import BaseInlineFormSet, ModelFormMetaclass", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 69 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Admi", "n", " ", "supp", "or", " ", "for", " ", "inline", "s", "\\", "10", ";", "\\", "10", ";", "Peter", " ", "Ci", "cma", "n", ",", " ", "Di", "vio", " ", "Gm", "b", "H", ",", " ", "2008", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "text_", "import_", "cap", "first_", ",_", "get", "\\u", "text", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "util_", "import_", "flat", "ten", "\\u", "fieldsets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "force", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "util_", "import_", "Error", "List_", ",_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "models_", "import_", "Base", "In", "line", "Form", "Set_", ",_", "Model", "Form", "Meta", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "find", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Templa", "te", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "multil", "ingu", "al_", "._", "languages_", "import_", "get", "\\u", "default", "\\u", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "multil", "ingu", "al_", "._", "utils_", "import_", "GL", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MULTI", "LING", "UAL", "\\u", "PREFIX_", "=_", "'\\u", "ml", "\\u\\u", "trans", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MULTI", "LING", "UAL", "\\u", "IN", "LINE", "\\u", "PREFIX_", "=_", "'\\u", "ml", "\\u\\u", "inline", "\\u", "trans", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "gl", "l_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "wrapped_", "(_", "cls_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "use", "\\u", "language_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "lang", "'_", ",_", "request_", "._", "GET_", "._", "get_", "(_", "'", "language", "'_", ",_", "get", "\\u", "default", "\\u", "language_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GL", "L_", "._", "lock_", "(_", "cls_", "._", "use", "\\u", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "func_", "(_", "cls_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GL", "L_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrapped_", "._", "\\u\\u", "name\\u\\u_", "=_", "func_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrapped_", "._", "\\u\\u", "doc\\u\\u_", "=_", "func_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "wrapped_", "\\u\\u\\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_", "standard", "\\u", "get", "\\u", "fill", "\\u", "check", "\\u", "field_", "(_", "std", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "std", "opts_", ",_", "'", "translatio", "n", "\\u", "model", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "std", "opts_", "._", "translatio", "n", "\\u", "model_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "opts_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "name_", "in_", "(_", "'", "language", "\\u", "code", "'_", ",_", "'", "master", "'_", ")_", ":_", "\\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_", "(_", "field_", "._", "blank_", "or_", "field_", "._", "null_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "field_", "._", "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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "relation", "\\u", "hack", "_", "(_", "form_", ",_", "fields_", ",_", "prefix_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "form_", "._", "instance_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "m2", "m_", "=_", "[_", "m2", "m_", "._", "attn", "ame_", "for_", "m2", "m_", "in_", "opts_", "._", "local", "\\u", "many", "\\u", "to", "\\u", "many_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "fk_", "=_", "[_", "obj_", "._", "field_", "._", "relate", "d\\u", "query", "\\u", "name_", "(_", ")_", "for_", "obj_", "in_", "opts_", "._", "get", "\\u", "all", "\\u", "relate", "d\\u", "objects_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external", "m2", "m_", "=_", "[_", "m2", "m_", "._", "get", "\\u", "accessor", "\\u", "name_", "(_", ")_", "for_", "m2", "m_", "in_", "opts_", "._", "get", "\\u", "all", "\\u", "relate", "d\\u", "many", "\\u", "to", "\\u", "many", "\\u", "objects_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "db", "\\u", "field_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "name_", "=_", "'%", "s", "%", "s", "'_", "%_", "(_", "prefix_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "full", "\\u", "name_", "in_", "form_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "form_", "._", "instance_", ",_", "name_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "(", "local", ")", " ", "Fore", "ign", "Keys_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "(", "local", ")", " ", "many", " ", "to", " ", "many", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "in_", "local", "m2", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "(", "external", ")", " ", "Fore", "ign", "Keys_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "in_", "external", "fk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "(", "external", ")", " ", "many", " ", "to", " ", "many", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "in_", "external", "m2", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "._", "fields_", "[_", "full", "\\u", "name_", "]_", "._", "initial_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "ling", "ual", "In", "line", "Model", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "In", "line", "Model", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\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_", ",_", "data_", "=_", "None_", ",_", "files_", "=_", "None_", ",_", "auto", "\\u", "id_", "=_", "'", "id", "\\u", "%", "s", "'_", ",_", "prefix_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "None_", ",_", "error", "\\u", "class_", "=_", "Error", "List_", ",_", "label", "\\u", "suffix_", "=_", "':'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "permit", "ted_", "=_", "False_", ",_", "instance_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fil", "l", " ", "initial", " ", "ML", " ", "Field", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Multi", "ling", "ual", "In", "line", "Model", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "data_", ",_", "files_", ",_", "auto", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", ",_", "initial_", ",_", "error", "\\u", "class_", ",_", "label", "\\u", "suffix_", ",_", "empty", "\\u", "permit", "ted_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "read", " ", "initial", " ", "data", " ", "if", " ", "the", " ", "object", " ", "alr", "ead", "y", " ", "exist", "s", ",", " ", "not", " ", "if", " ", "we", "'", "re", " ", "addin", "g", " ", "it", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relation", "\\u", "hack", "_", "(_", "self_", ",_", "get", "\\u", "translat", "ed", "\\u", "fields_", "(_", "self_", "._", "instance_", ")_", ",_", "MULTI", "LING", "UAL", "\\u", "IN", "LINE", "\\u", "PREFIX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "ling", "ual", "In", "line", "Form", "Set_", "(_", "Base", "In", "line", "Form", "Set_", ")_", ":_", "\\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_", "Multi", "ling", "ual", "In", "line", "Form", "Set_", "(_", "Base", "In", "line", "Form", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "queryset_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "self_", "._", "queryset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "self_", "._", "model_", "._", "\\u", "default", "\\u", "manager_", "._", "get", "\\u", "query", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "qs_", "._", "ordered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "order", "\\u", "by_", "(_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "pk_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "num_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "queryset_", "=_", "qs_", "[_", ":_", "self_", "._", "max", "\\u", "num_", "]_", "\\u\\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", "queryset_", "=_", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "queryset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "In", "line", "Form", "Set_", "(_", "Base", "In", "line", "Form", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "new_", "(_", "self_", ",_", "form_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "NOTE", ":", " ", "save", "\\u", "new", " ", "method", " ", "is", " ", "complete", "ly", " ", "overrid", "den", " ", "here", ",", " ", "there", "'", "s", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "way", " ", "to", " ", "prete", "nd", " ", "double", " ", "save", " ", "other", "wis", "e", ".", " ", "Ju", "st", " ", "assign", " ", "translat", "ed", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "object", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "self_", "._", "fk_", "._", "get", "\\u", "attn", "ame_", "(_", ")_", ":_", "self_", "._", "instance_", "._", "pk_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "obj_", "=_", "self_", "._", "model_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "prepar", "e\\u", "multil", "ingu", "al", "\\u", "object_", "(_", "new", "\\u", "obj_", ",_", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "forms_", "._", "save", "\\u", "instance_", "(_", "form_", ",_", "new", "\\u", "obj_", ",_", "exclude_", "=_", "[_", "self_", "._", "\\u", "pk", "\\u", "field_", "._", "name_", "]_", ",_", "commit_", "=_", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "In", "line", "Form", "Set_", "(_", "Base", "In", "line", "Form", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "existing_", "(_", "self_", ",_", "form_", ",_", "instance_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "NOTE", ":", " ", "save", "\\u", "new", " ", "method", " ", "is", " ", "complete", "ly", " ", "overrid", "den", " ", "here", ",", " ", "there", "'", "s", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "way", " ", "to", " ", "prete", "nd", " ", "double", " ", "save", " ", "other", "wis", "e", ".", " ", "Ju", "st", " ", "assign", " ", "translat", "ed", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "object", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "prepar", "e\\u", "multil", "ingu", "al", "\\u", "object_", "(_", "instance_", ",_", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "forms_", "._", "save", "\\u", "instance_", "(_", "form_", ",_", "instance_", ",_", "exclude_", "=_", "[_", "self_", "._", "\\u", "pk", "\\u", "field_", "._", "name_", "]_", ",_", "commit_", "=_", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "In", "line", "Form", "Set_", "(_", "Base", "In", "line", "Form", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "prepar", "e\\u", "multil", "ingu", "al", "\\u", "object_", "(_", "self_", ",_", "obj_", ",_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "obj_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "real", "name_", ",_", "fieldname_", "in_", "self_", "._", "ml", "\\u", "fields_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "opts_", "._", "get", "\\u", "field", "\\u", "by", "\\u", "name_", "(_", "real", "name_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "re_", "._", "match_", "(_", "r", "'", "^", "%", "s", "(?", "P", "<", "field", "\\u", "name", ">.*)", "$'_", "%_", "MULTI", "LING", "UAL", "\\u", "IN", "LINE", "\\u", "PREFIX_", ",_", "fieldname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "._", "save", "\\u", "form", "\\u", "data_", "(_", "self_", "._", "instance_", ",_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "fieldname_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "obj_", ",_", "real", "name_", ",_", "getattr_", "(_", "self_", "._", "instance_", ",_", "real", "name_", "._", "rsplit_", "(_", "'\\u'_", ",_", "1_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "ling", "ual", "In", "line", "Admin_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formset_", "=_", "Multi", "ling", "ual", "In", "line", "Form", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Multi", "ling", "ual", "In", "line", "Model", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "'", "admin", "/", "multil", "ingu", "al", "/", "edit", "\\u", "inline", "/", "tabular", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "css", " ", "class", " ", "adde", "d", " ", "to", " ", "inline", " ", "box_", "\\u\\u\\uNL\\u\\u\\u_", "inline", "\\u", "css", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "language_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fill", "\\u", "check", "\\u", "field_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "add", " ", "some", " ", "nice", " ", "template_", "\\u\\u\\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_", "Multi", "ling", "ual", "In", "line", "Admin_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent", "\\u", "model_", ",_", "admin", "\\u", "site_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Multi", "ling", "ual", "In", "line", "Admin_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent", "\\u", "model_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'", "use", "\\u", "fields", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "go", " ", "aro", "und", " ", "admin", " ", "fields", " ", "structure", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "=_", "self_", "._", "use", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "In", "line", "Admin_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "formset_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Form", "Set_", "=_", "super_", "(_", "Multi", "ling", "ual", "In", "line", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "formset_", "(_", "request_", ",_", "obj_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Form", "Set_", "._", "use", "\\u", "language_", "=_", "GL", "L_", "._", "language", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Form", "Set_", "._", "ml", "\\u", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "field_", "in_", "get", "\\u", "translat", "ed", "\\u", "fields_", "(_", "self_", "._", "model_", ",_", "GL", "L_", "._", "language", "\\u", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fieldname_", "=_", "'%", "s", "%", "s", "'_", "%_", "(_", "MULTI", "LING", "UAL", "\\u", "IN", "LINE", "\\u", "PREFIX_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Form", "Set_", "._", "form_", "._", "base", "\\u", "fields_", "[_", "fieldname_", "]_", "=_", "self_", "._", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "field_", ",_", "request_", "=_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Form", "Set_", "._", "ml", "\\u", "fields_", "[_", "name_", "]_", "=_", "fieldname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Form", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "In", "line", "Admin_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queryset_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Filter", " ", "object", "s", " ", "whi", "ch", " ", "don", "'", "t", " ", "have", " ", "a", " ", "value", " ", "in", " ", "this", " ", "language", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "super_", "(_", "Multi", "ling", "ual", "In", "line", "Admin_", ",_", "self_", ")_", "._", "queryset_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "now", " ", "what", " ", "the", " ", "hell", " ", "I", " ", "was", " ", "think", "ing", " ", "here", ",", " ", "but", " ", "this", " ", "code", " ", "breaks", " ", "stu", "ff", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", "field", " ", "=", " ", "self", ".", "get", "\\u", "fill", "\\u", "check", "\\u", "field", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "check", "field", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "kwarg", "s", " ", "=", " ", "{", "str", "('", "%", "s", "\\u", "%", "s", "\\u\\u", "isn", "ull", "'", " ", "%", " ", "(", "check", "field", ",", " ", "GL", "L", ".", "language", "\\u", "code", "))", ":", " ", "Fal", "se", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "django", ".", "db", ".", "model", "s", ".", "fields", " ", "import", " ", "Char", "Field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "isin", "stance", "(", "self", ".", "model", ".\\u", "meta", ".", "translatio", "n", "\\u", "model", ".\\u", "meta", ".", "get", "\\u", "field", "\\u", "by", "\\u", "name", "(", "check", "field", ")[", "0", "],", " ", "Char", "Field", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "kwarg", "s", "[", "str", "('", "%", "s", "\\u", "%", "s", "\\u\\u", "gt", "'", " ", "%", " ", "(", "check", "field", ",", " ", "GL", "L", ".", "language", "\\u", "code", "))", "]", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "qs", ".", "filter", "(*", "*", "kwarg", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "qs_", "._", "filter_", "(_", "translatio", "ns", "\\u\\u", "language", "\\u", "code_", "=_", "GL", "L_", "._", "language", "\\u", "code_", ")_", "._", "distinct_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "In", "line", "Admin_", "(_", "admin_", "._", "Tab", "ular", "Inline_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "fill", "\\u", "check", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "fill", "\\u", "check", "\\u", "field_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fill", "\\u", "check", "\\u", "field_", "=_", "standard", "\\u", "get", "\\u", "fill", "\\u", "check", "\\u", "field_", "(_", "self_", "._", "model_", "._", "\\u", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "fill", "\\u", "check", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "render", "ing", " ", "/", " ", "saving", " ", "multil", "ingu", "al", " ", "fields", " ", "connect", "e", " ", "to", " ", "model", ",", " ", "take", "s", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "admin", " ", "per", " ", "language", " ", "is", " ", "uss", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "render", "ing", " ", "/", " ", "saving", " ", "multil", "ingu", "al", " ", "fields", " ", "connect", "e", " ", "to", " ", "model", ",", " ", "take", "s", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "admin", " ", "per", " ", "language", " ", "is", " ", "uss", "ed_", "\\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_", ",_", "data_", "=_", "None_", ",_", "files_", "=_", "None_", ",_", "auto", "\\u", "id_", "=_", "'", "id", "\\u", "%", "s", "'_", ",_", "prefix_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "None_", ",_", "error", "\\u", "class_", "=_", "Error", "List_", ",_", "label", "\\u", "suffix_", "=_", "':'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "permit", "ted_", "=_", "False_", ",_", "instance_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fil", "l", " ", "up", " ", "initial", " ", "ML", " ", "Field", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "data_", ",_", "files_", ",_", "auto", "\\u", "id_", ",_", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", ",_", "error", "\\u", "class_", ",_", "label", "\\u", "suffix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "empty", "\\u", "permit", "ted_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "try", " ", "to", " ", "fill", " ", "inti", "al", " ", "data", " ", "if", " ", "we", " ", "are", " ", "not", " ", "addin", "g", " ", "an", " ", "object", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "instance_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "(_", "f_", ",_", "getattr_", "(_", "self_", "._", "instance_", ",_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "f_", ",_", "GL", "L_", "._", "language", "\\u", "code_", ")_", ",_", "''_", ")_", ")_", "for_", "f_", "in_", "self_", "._", "ml", "\\u", "fields_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "\\u", "hack", "_", "(_", "self_", ",_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "render", "ing", " ", "/", " ", "saving", " ", "multil", "ingu", "al", " ", "fields", " ", "connect", "e", " ", "to", " ", "model", ",", " ", "take", "s", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "admin", " ", "per", " ", "language", " ", "is", " ", "uss", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "ed", "\\u", "data_", "=_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", ",_", "self_", ")_", "._", "clean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validat", "e\\u", "ml", "\\u", "unique_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "clean", "ed", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "render", "ing", " ", "/", " ", "saving", " ", "multil", "ingu", "al", " ", "fields", " ", "connect", "e", " ", "to", " ", "model", ",", " ", "take", "s", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "admin", " ", "per", " ", "language", " ", "is", " ", "uss", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validat", "e\\u", "ml", "\\u", "unique_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", "._", "instance_", "._", "\\u", "meta_", ",_", "'", "translatio", "n", "\\u", "model", "'_", ")_", ":_", "\\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_", "for_", "check_", "in_", "self_", "._", "instance_", "._", "\\u", "meta_", "._", "translatio", "n", "\\u", "model_", "._", "\\u", "meta_", "._", "unique", "\\u", "together_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "up", "\\u", "kwargs_", "=_", "{_", "'", "language", "\\u", "code", "'_", ":_", "GL", "L_", "._", "language", "\\u", "code_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field", "\\u", "name_", "in_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "local", "\\u", "name", " ", "=", " ", "\"%", "s", "\\u", "%", "s", "\"", " ", "%", " ", "(", "field", "\\u", "name", ",", " ", "self", ".", "use", "\\u", "language", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "field", "\\u", "name_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "look", "up", "\\u", "kwargs_", "[_", "field", "\\u", "name_", "]_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "field", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "check_", ")_", "==_", "2_", "and_", "'", "master", "'_", "in_", "check_", "and_", "'", "language", "\\u", "code", "'_", "in_", "check_", ":_", "\\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_", "qs_", "=_", "self_", "._", "instance_", "._", "\\u", "meta_", "._", "translatio", "n", "\\u", "model_", "._", "objects_", "._", "filter_", "(_", "**_", "look", "up", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "instance_", "._", "pk_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "exclude_", "(_", "master_", "=_", "self_", "._", "instance_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "qs_", "._", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "\\u", "name_", "=_", "cap", "first_", "(_", "self_", "._", "instance_", "._", "\\u", "meta_", "._", "verbo", "se", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "labels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field", "\\u", "name_", "in_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "field", "\\u", "name_", "==_", "\"", "language", "\\u", "code", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "field", "\\u", "labels_", "._", "append_", "(_", "\\u_", "(_", "\"", "language", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field", "\\u", "name_", "==_", "\"", "master", "\"_", ":_", "\\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 ", " ", " _", "field", "\\u", "labels_", "._", "append_", "(_", "self_", "._", "instance_", "._", "\\u", "meta_", "._", "translatio", "n", "\\u", "model_", "._", "\\u", "meta_", "._", "get", "\\u", "field", "\\u", "by", "\\u", "name_", "(_", "field", "\\u", "name_", ")_", "[_", "0_", "]_", "._", "verbo", "se", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "labels_", "=_", "get", "\\u", "text", "\\u", "list_", "(_", "field", "\\u", "labels_", ",_", "\\u_", "(_", "'", "and", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "errors_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "u", "\"%", "(", "model", "\\u", "name", ")", "s", " ", "with", " ", "this", " ", "%", "(", "field", "\\u", "label", ")", "s", " ", "alr", "ead", "y", " ", "exist", "s", ".\"_", ")_", "%_", "{_", "'", "model", "\\u", "name", "'_", ":_", "unicode_", "(_", "model", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "\\u", "label", "'_", ":_", "unicode_", "(_", "field", "\\u", "labels_", ")_", "}_", "\\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_", "form", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rai", "se", " ", "the", " ", "unique", " ", "tog", "ether", " ", "error", "s", " ", "sinc", "e", " ", "the", "y", " ", "are", " ", "consider", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "form", "-", "wide", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "form", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "render", "ing", " ", "/", " ", "saving", " ", "multil", "ingu", "al", " ", "fields", " ", "connect", "e", " ", "to", " ", "model", ",", " ", "take", "s", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "admin", " ", "per", " ", "language", " ", "is", " ", "uss", "ed_", "\\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_", "save_", "(_", "self_", ",_", "commit_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "prepar", "e\\u", "multil", "ingu", "al", "\\u", "object_", "(_", "self_", "._", "instance_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", ",_", "self_", ")_", "._", "save_", "(_", "commit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "render", "ing", " ", "/", " ", "saving", " ", "multil", "ingu", "al", " ", "fields", " ", "connect", "e", " ", "to", " ", "model", ",", " ", "take", "s", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "admin", " ", "per", " ", "language", " ", "is", " ", "uss", "ed_", "\\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", "prepar", "e\\u", "multil", "ingu", "al", "\\u", "object_", "(_", "self_", ",_", "obj_", ",_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "self_", "._", "instance_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "ml", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "opts_", "._", "get", "\\u", "field", "\\u", "by", "\\u", "name_", "(_", "name_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "respec", "t", " ", "save", "\\u", "form", "\\u", "data_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "._", "save", "\\u", "form", "\\u", "data_", "(_", "self_", "._", "instance_", ",_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "obj_", ",_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "name_", ",_", "GL", "L_", "._", "language", "\\u", "code_", ")_", ",_", "getattr_", "(_", "self_", "._", "instance_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "\\u", "form", "\\u", "template_", "=_", "\"", "admin", "/", "multil", "ingu", "al", "/", "change", "\\u", "form", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Multi", "ling", "ual", "Model", "Admi", "n", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "multil", "ingu", "al", "\\u", "model", "\\u", "admin_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "language_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fill", "\\u", "check", "\\u", "field_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "use", "\\u", "hack", "s_", "=_", "[_", "'", "fieldset", "s", "'_", ",_", "'", "prepo", "pulat", "ed", "\\u", "fields", "'_", ",_", "'", "read", "only", "\\u", "fields", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Media_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "css_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "all", "'_", ":_", "(_", "'%", "smu", "lti", "ling", "ual", "/", "admin", "/", "css", "/", "style", ".", "css", "'_", "%_", "settings_", "._", "MEDIA", "\\u", "URL_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model_", ",_", "admin", "\\u", "site_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "attr_", "in_", "self_", "._", "\\u", "use", "\\u", "hack", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'", "use", "\\u", "%", "s", "'_", "%_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "attr_", ",_", "getattr_", "(_", "self_", ",_", "'", "use", "\\u", "%", "s", "'_", "%_", "attr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admin_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "model_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "fill", "\\u", "check", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "fill", "\\u", "check", "\\u", "field_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fill", "\\u", "check", "\\u", "field_", "=_", "standard", "\\u", "get", "\\u", "fill", "\\u", "check", "\\u", "field_", "(_", "self_", "._", "model_", "._", "\\u", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "fill", "\\u", "check", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "obj_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assign", " ", "language", " ", "to", " ", "inline", "s", ",", " ", "so", " ", "the", "y", " ", "now", " ", "how", " ", "to", " ", "render_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "inline_", "in_", "self_", "._", "inline", "\\u", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "inline_", ",_", "Multi", "ling", "ual", "In", "line", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inline_", "._", "use", "\\u", "language_", "=_", "GL", "L_", "._", "language", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Form_", "=_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admin_", ",_", "self_", ")_", "._", "get", "\\u", "form_", "(_", "request_", ",_", "obj_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Form_", "._", "ml", "\\u", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "field_", "in_", "get", "\\u", "default", "\\u", "translat", "ed", "\\u", "fields_", "(_", "self_", "._", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "field_", "._", "editable_", ":_", "\\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_", "form", "\\u", "field_", "=_", "self_", "._", "formfi", "eld", "\\u", "for", "\\u", "dbf", "ield_", "(_", "field_", ",_", "request_", "=_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "name_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "name_", ",_", "GL", "L_", "._", "language", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Form_", "._", "ml", "\\u", "fields_", "[_", "name_", "]_", "=_", "form", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Form_", "._", "base", "\\u", "fields_", "[_", "name_", "]_", "=_", "form", "\\u", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Form_", "._", "use", "\\u", "language_", "=_", "GL", "L_", "._", "language", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\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_", "placehold", "er", "\\u", "plugin", "\\u", "filter_", "(_", "self_", ",_", "request_", ",_", "queryset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "only", " ", "used", " ", "on", " ", "model", "s", " ", "whi", "ch", " ", "use", " ", "placehold", "ers", " ", "from", " ", "the", " ", "django", "-", "cms", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "queryset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "GL", "L_", "._", "is", "\\u", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "queryset_", "._", "filter_", "(_", "language_", "=_", "GL", "L_", "._", "language", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "queryset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gl", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "change", "\\u", "view_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admin_", ",_", "self_", ")_", "._", "change", "\\u", "view_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gl", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "view_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admin_", ",_", "self_", ")_", "._", "add", "\\u", "view_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gl", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "\\u", "view_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admin_", ",_", "self_", ")_", "._", "delete", "\\u", "view_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\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_", "render", "\\u", "change", "\\u", "form_", "(_", "self_", ",_", "request_", ",_", "context_", ",_", "add_", "=_", "False_", ",_", "change_", "=_", "False_", ",_", "form", "\\u", "url_", "=_", "''_", ",_", "obj_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "context", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filled", "\\u", "languages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fill", "\\u", "check", "\\u", "field_", "=_", "self_", "._", "get", "\\u", "fill", "\\u", "check", "\\u", "field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "and_", "fill", "\\u", "check", "\\u", "field_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "._", "models_", "._", "fields_", "import_", "Char", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "'%", "s", "\\u\\u", "isn", "ull", "'_", "%_", "fill", "\\u", "check", "\\u", "field_", ":_", "False_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "self_", "._", "model_", "._", "\\u", "meta_", "._", "translatio", "n", "\\u", "model_", "._", "\\u", "meta_", "._", "get", "\\u", "field", "\\u", "by", "\\u", "name_", "(_", "fill", "\\u", "check", "\\u", "field_", ")_", "[_", "0_", "]_", ",_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'%", "s", "\\u\\u", "gt", "'_", "%_", "fill", "\\u", "check", "\\u", "field_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filled", "\\u", "languages_", "=_", "[_", "t_", "[_", "0_", "]_", "for_", "t_", "in_", "obj_", "._", "translations_", "._", "filter_", "(_", "**_", "kwargs_", ")_", "._", "values", "\\u", "list_", "(_", "'", "language", "\\u", "code", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "language", "\\u", "index", "'_", ":_", "GL", "L_", "._", "language", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "language", "\\u", "code", "'_", ":_", "GL", "L_", "._", "language", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filled", "\\u", "language", "s", "'_", ":_", "filled", "\\u", "languages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "\\u", "template", "'_", ":_", "self_", "._", "get", "\\u", "old", "\\u", "template_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admin_", ",_", "self_", ")_", "._", "render", "\\u", "change", "\\u", "form_", "(_", "request_", ",_", "context_", ",_", "add_", ",_", "change_", ",_", "form", "\\u", "url_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "old", "\\u", "template_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "self_", "._", "model_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "opts_", "._", "app", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "templates_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "admin", "/", "%", "s", "/", "%", "s", "/", "change", "\\u", "form", ".", "html", "\"_", "%_", "(_", "app", "\\u", "label_", ",_", "opts_", "._", "object\\u", "name_", "._", "lower_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "admin", "/", "%", "s", "/", "change", "\\u", "form", ".", "html", "\"_", "%_", "app", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "admin", "/", "change", "\\u", "form", ".", "html", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "template_", "in_", "search", "\\u", "templates_", ":_", "\\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 ", " _", "find", "\\u", "template_", "(_", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Templa", "te", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "ling", "ual", "Model", "Admin_", "(_", "admin_", "._", "Model", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "special", " ", "template", " ", "to", " ", "render", " ", "tabs", " ", "for", " ", "language", "s", " ", "on", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "response", "\\u", "change_", "(_", "self_", ",_", "request_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "save", " ", "&", " ", "continue", " ", "-", " ", "so", " ", "it", " ", "show", "s", " ", "the", " ", "same", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "POST_", "._", "has", "\\u", "key_", "(_", "\"\\u", "continue", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "obj_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "'", "The", " ", "%", "(", "name", ")", "s", " ", "\"%", "(", "obj", ")", "s", "\"", " ", "was", " ", "change", "d", " ", "success", "full", "y", ".'_", ")_", "%_", "{_", "'", "name", "'_", ":_", "force", "\\u", "unicode_", "(_", "opts_", "._", "verbo", "se", "\\u", "name_", ")_", ",_", "'", "obj", "'_", ":_", "force", "\\u", "unicode_", "(_", "obj_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message", "\\u", "user_", "(_", "request_", ",_", "msg_", "+_", "'", " ", "'_", "+_", "\\u_", "(_", "\"", "You", " ", "may", " ", "edit", " ", "it", " ", "again", " ", "belo", "w", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang_", ",_", "path_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "language", "'_", ",_", "get", "\\u", "default", "\\u", "language_", "(_", ")_", ")_", ",_", "request_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lang_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lang_", "=_", "\"", "language", "=", "%", "s", "\"_", "%_", "lang_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "REQUEST_", "._", "has", "\\u", "key_", "(_", "'\\u", "popu", "p", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "+=_", "\"?", "\\u", "popu", "p", "=", "1", "\"_", "+_", "\"&", "%", "s", "\"_", "%_", "lang_", "\\u\\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_", "+=_", "\"?", "%", "s", "\"_", "%_", "lang_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Multi", "ling", "ual", "Model", "Admin_", ",_", "self_", ")_", "._", "response", "\\u", "change_", "(_", "request_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "translat", "ed", "\\u", "fields_", "(_", "model_", ",_", "language_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "model_", "._", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "meta_", ",_", "'", "translat", "ed", "\\u", "fields", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "meta_", ",_", "'", "translatio", "n", "\\u", "model", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "meta_", "._", "translatio", "n", "\\u", "model_", "._", "\\u", "meta_", "\\u\\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_", "#", " ", "return", "s", " ", "all", " ", "the", " ", "translat", "able", " ", "fields", ",", " ", "except", " ", "of", " ", "the", " ", "default", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "language_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "(_", "field_", ",_", "non", "\\u", "default_", ")_", "in_", "meta_", "._", "translat", "ed", "\\u", "fields_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "non", "\\u", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "name_", ",_", "field_", "\\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_", "#", " ", "if", " ", "language", " ", "is", " ", "defin", "ed", " ", "return", " ", "fields", " ", "in", " ", "the", " ", "same", " ", "order", ",", " ", "like", " ", "the", "y", " ", "are", " ", "defin", "ed", " ", "in", " ", "the", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "translatio", "n", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "meta_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "._", "primary", "\\u", "key_", ":_", "\\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_", "name_", "=_", "field_", "._", "name_", "+_", "\"\\u", "%", "s", "\"_", "%_", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "meta_", "._", "translat", "ed", "\\u", "fields_", "._", "get_", "(_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "name_", ",_", "field_", "[_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "translat", "ed", "\\u", "fields_", "(_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "model_", "._", "\\u", "meta_", ",_", "'", "translatio", "n", "\\u", "model", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "(_", "field_", ",_", "non", "\\u", "default_", ")_", "in_", "model_", "._", "\\u", "meta_", "._", "translatio", "n", "\\u", "model_", "._", "\\u", "meta_", "._", "translat", "ed", "\\u", "fields_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "non", "\\u", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "name_", ",_", "field_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
guillermooo/Vintageous/tests/commands/test__vi_big_j.py
[ { "content": "from collections import namedtuple\n\nfrom Vintageous.vi.utils import modes\n\nfrom Vintageous.tests import set_text\nfrom Vintageous.tests import add_sel\nfrom Vintageous.tests import get_sel\nfrom Vintageous.tests import first_sel\nfrom Vintageous.tests import ViewTest\n\n\ntest_data = namedtuple('test_data', 'initial_text regions cmd_params expected msg')\n\nTESTS = (\n test_data('abc\\nabc\\nabc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 1}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 1}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 2}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 2}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 3}, 'abc abc abc', 'should join 3 lines'),\n test_data('abc\\n abc\\n abc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 3}, 'abc abc abc', 'should join 3 lines'),\n test_data('abc\\nabc\\nabc\\nabc\\nabc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 5}, 'abc abc abc abc abc', 'should join 5 lines'),\n test_data('abc\\n abc\\n abc\\n abc\\n abc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 5}, 'abc abc abc abc abc', 'should join 5 lines'),\n test_data('abc\\n\\n', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 3}, 'abc ', 'should join 3 lines and add one trailing space'),\n test_data('\\n\\nabc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 3}, 'abc', 'should join 3 lines without adding any spaces'),\n test_data('abc \\n abc \\n abc', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 3}, 'abc abc abc', 'should join 3 lines with leading spaces removed but trailing spaces intact'),\n test_data(' abc\\nabc ', [[(0, 0), (0, 0)]], {'mode': modes.INTERNAL_NORMAL, 'count': 1}, ' abc abc ', 'should join 2 lines with leading spaces of first line and trailing spaces of last line intact'),\n test_data('abc\\nabc\\nabc', [[(0, 0), (0, 1)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 0), (0, 1)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 0), (0, 1)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 0), (0, 1)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 0), (1, 1)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 0), (1, 1)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(1, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\n abc\\nabc', [[(1, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc\\nabc', 'should join 2 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 0), (2, 1)]], {'mode': modes.VISUAL}, 'abc abc abc', 'should join 3 lines'),\n test_data('abc\\n abc\\nabc', [[(0, 0), (2, 1)]], {'mode': modes.VISUAL}, 'abc abc abc', 'should join 3 lines'),\n test_data('abc\\nabc\\nabc', [[(2, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc abc', 'should join 3 lines'),\n test_data('abc\\n abc\\nabc', [[(2, 1), (0, 0)]], {'mode': modes.VISUAL}, 'abc abc abc', 'should join 3 lines'),\n test_data('abc\\nabc\\nabc', [[(0, 0), (1, 1)]], {'mode': modes.VISUAL, 'count': 3}, 'abc abc\\nabc', 'should join 2 lines - count shouldn\\'t matter'),\n test_data('abc\\n abc\\nabc', [[(0, 0), (1, 1)]], {'mode': modes.VISUAL, 'count': 3}, 'abc abc\\nabc', 'should join 2 lines - count shouldn\\'t matter'),\n test_data(' abc\\nabc ', [[(0, 0), (1, 5)]], {'mode': modes.VISUAL}, ' abc abc ', 'should join 2 lines with leading spaces of first line and trailing spaces of last line intact'),\n test_data(' abc\\n\\n\\n', [[(0, 0), (3, 0)]], {'mode': modes.VISUAL_LINE}, ' abc \\n', 'should join 4 lines'),\n test_data(' abc \\n abc\\nabc', [[(0, 0), (0, 1)], [(1, 0), (1, 1)]], {'mode': modes.VISUAL_BLOCK}, ' abc abc\\nabc', 'should join 2 lines'),\n)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Test_vi_big_j(ViewTest):", "metadata": "root.Test_vi_big_j", "header": "['module', '___EOS___']", "index": 50 }, { "content": " def testAll(self):\n for (i, data) in enumerate(TESTS):\n # TODO: Perhaps we should ensure that other state is reset too?\n self.view.sel().clear()\n\n self.write(data.initial_text)\n for region in data.regions:\n add_sel(self.view, self.R(*region))\n\n self.view.run_command('_vi_big_j', data.cmd_params)\n\n actual = self.view.substr(self.R(0, self.view.size()))\n msg = \"[{0}] {1}\".format(i, data.msg)\n self.assertEqual(data.expected, actual, msg)", "metadata": "root.Test_vi_big_j.testAll", "header": "['class', 'Test_vi_big_j', '(', 'ViewTest', ')', ':', '___EOS___']", "index": 51 } ]
[ { "span": "from Vintageous.tests import set_text", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 37 }, { "span": "from Vintageous.tests import get_sel", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 36 }, { "span": "from Vintageous.tests import first_sel", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "vi_", "._", "utils_", "import_", "modes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "tests_", "import_", "set\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "tests_", "import_", "add", "\\u", "sel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "tests_", "import_", "get", "\\u", "sel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "tests_", "import_", "first", "\\u", "sel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Vin", "tage", "ous_", "._", "tests_", "import_", "View", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "=_", "namedtuple_", "(_", "'", "test\\u", "data", "'_", ",_", "'", "initial", "\\u", "text", " ", "regions", " ", "cmd", "\\u", "params", " ", "expected", " ", "msg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TESTS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "1_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "1_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "2_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "2_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "3_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "3_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "5_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "5", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "5_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "5", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", "\\\\", "n", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "3_", "}_", ",_", "'", "abc", " ", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", " ", "and", " ", "add", " ", "one", " ", "trail", "ing", " ", "space", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'\\\\", "n", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "3_", "}_", ",_", "'", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", " ", "with", "out", " ", "addin", "g", " ", "any", " ", "space", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", " ", "\\\\", "n", " ", " ", " ", " ", "abc", " ", " ", "\\\\", "n", " ", " ", "abc", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "3_", "}_", ",_", "'", "abc", " ", "abc", " ", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", " ", "with", " ", "lead", "ing", " ", "space", "s", " ", "remove", "d", " ", "but", " ", "trail", "ing", " ", "space", "s", " ", "inta", "ct", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", " ", " ", " ", "abc", "\\\\", "nab", "c", " ", " ", " ", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "INTERN", "AL", "\\u", "NORMAL_", ",_", "'", "count", "'_", ":_", "1_", "}_", ",_", "'", " ", " ", " ", "abc", " ", "abc", " ", " ", " ", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", " ", "with", " ", "lead", "ing", " ", "space", "s", " ", "of", " ", "first", " ", "line", " ", "and", " ", "trail", "ing", " ", "space", "s", " ", "of", " ", "last", " ", "line", " ", "inta", "ct", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "1_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "1_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "2_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "2_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "2_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "2_", ",_", "1_", ")_", ",_", "(_", "0_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", "abc", " ", "abc", " ", "abc", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "3", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "nab", "c", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", ",_", "'", "count", "'_", ":_", "3_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", " ", "-", " ", "count", " ", "shou", "ld", "n", "\\\\'", "t", " ", "matte", "r", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", "abc", "\\\\", "n", " ", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", ",_", "'", "count", "'_", ":_", "3_", "}_", ",_", "'", "abc", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", " ", "-", " ", "count", " ", "shou", "ld", "n", "\\\\'", "t", " ", "matte", "r", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", " ", " ", " ", "abc", "\\\\", "nab", "c", " ", " ", " ", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "5_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "_", "}_", ",_", "'", " ", " ", " ", "abc", " ", "abc", " ", " ", " ", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", " ", "with", " ", "lead", "ing", " ", "space", "s", " ", "of", " ", "first", " ", "line", " ", "and", " ", "trail", "ing", " ", "space", "s", " ", "of", " ", "last", " ", "line", " ", "inta", "ct", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", " ", " ", " ", " ", "abc", "\\\\", "n", "\\\\", "n", "\\\\", "n", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "3_", ",_", "0_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "\\u", "LINE_", "}_", ",_", "'", " ", " ", " ", " ", "abc", " ", "\\\\", "n", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "4", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "(_", "'", " ", " ", " ", " ", "abc", " ", " ", "\\\\", "n", " ", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "[_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "0_", ",_", "1_", ")_", "]_", ",_", "[_", "(_", "1_", ",_", "0_", ")_", ",_", "(_", "1_", ",_", "1_", ")_", "]_", "]_", ",_", "{_", "'", "mode", "'_", ":_", "modes_", "._", "VIS", "UAL", "\\u", "BLOCK_", "}_", ",_", "'", " ", " ", " ", " ", "abc", " ", " ", "abc", "\\\\", "nab", "c", "'_", ",_", "'", "shou", "ld", " ", "join", " ", "2", " ", "lines", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "\\u", "vi", "\\u", "big", "\\u", "j_", "(_", "View", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "vi", "\\u", "big", "\\u", "j_", "(_", "View", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "All_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "i_", ",_", "data_", ")_", "in_", "enumerate_", "(_", "TESTS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Per", "hap", "s", " ", "we", " ", "shou", "ld", " ", "ensure", " ", "tha", "t", " ", "other", " ", "state", " ", "is", " ", "reset", " ", "too", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view_", "._", "sel_", "(_", ")_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write_", "(_", "data_", "._", "initial", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "region_", "in_", "data_", "._", "regions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "\\u", "sel_", "(_", "self_", "._", "view_", ",_", "self_", "._", "R_", "(_", "*_", "region_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "view_", "._", "run", "\\u", "command_", "(_", "'\\u", "vi", "\\u", "big", "\\u", "j", "'_", ",_", "data_", "._", "cmd", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "self_", "._", "view_", "._", "substr_", "(_", "self_", "._", "R_", "(_", "0_", ",_", "self_", "._", "view_", "._", "size_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"[{", "0", "}]", " ", "{", "1", "}\"_", "._", "format_", "(_", "i_", ",_", "data_", "._", "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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 ]
Imprecise assert
lukaszb/django-projector/projector/tests/test_teams.py
[ { "content": " def test_wrong_user(self):\n data = {'user': 'not-existing-user-name'}\n form = DashboardAddMemberForm(self.group, data)\n self.assertFalse(form.is_valid())\n self.assertTrue('user' in form._errors)", "metadata": "root.DashboardAddMemberFormTest.test_wrong_user", "header": "['class', 'DashboardAddMemberFormTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_wrong_username(self):\n wrong_usernames = (' ', '.', '*', 'joe!', '###', ',.<>')\n for username in wrong_usernames:\n data = {'user': username}\n form = DashboardAddMemberForm(self.group, data)\n self.assertFalse(form.is_valid())\n self.assertTrue('user' in form._errors)", "metadata": "root.DashboardAddMemberFormTest.test_wrong_username", "header": "['class', 'DashboardAddMemberFormTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_already_in_group(self):\n data = {'user': self.user.username}\n form = DashboardAddMemberForm(self.group, data)\n self.assertFalse(form.is_valid())\n self.assertTrue('user' in form._errors)", "metadata": "root.DashboardAddMemberFormTest.test_already_in_group", "header": "['class', 'DashboardAddMemberFormTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 36 } ]
[ { "span": "self.assertTrue('user' in form._errors)", "start_line": 20, "start_column": 8, "end_line": 20, "end_column": 47 }, { "span": "self.assertTrue('user' in form._errors)", "start_line": 28, "start_column": 12, "end_line": 28, "end_column": 51 }, { "span": "self.assertTrue('user' in form._errors)", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Dash", "board", "Add", "Mem", "ber", "Form", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrong", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "'", "user", "'_", ":_", "'", "not", "-", "exist", "ing", "-", "user", "-", "name", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Dash", "board", "Add", "Mem", "ber", "Form_", "(_", "self_", "._", "group_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "user", "'_", "in_", "form_", "._", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board", "Add", "Mem", "ber", "Form", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrong", "\\u", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrong", "\\u", "usernames", "_", "=_", "(_", "'", " ", "'_", ",_", "'.'_", ",_", "'*'_", ",_", "'", "jo", "e", "!'_", ",_", "'###", "'_", ",_", "',", ".", "<>", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "username_", "in_", "wrong", "\\u", "usernames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "'", "user", "'_", ":_", "username_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Dash", "board", "Add", "Mem", "ber", "Form_", "(_", "self_", "._", "group_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "user", "'_", "in_", "form_", "._", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board", "Add", "Mem", "ber", "Form", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alr", "ead", "y", "\\u", "in", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "'", "user", "'_", ":_", "self_", "._", "user_", "._", "username_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Dash", "board", "Add", "Mem", "ber", "Form_", "(_", "self_", "._", "group_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "user", "'_", "in_", "form_", "._", "\\u", "errors_", ")_" ]
[ 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unnecessary pass
open-cloud/xos/xos/core/admin.py
[ { "content": "class SliceRoleAdmin(XOSBaseAdmin):\n model = SliceRole\n pass", "metadata": "root.SliceRoleAdmin", "header": "['module', '___EOS___']", "index": 694 }, { "content": "class SiteRoleAdmin(XOSBaseAdmin):\n model = SiteRole\n pass", "metadata": "root.SiteRoleAdmin", "header": "['module', '___EOS___']", "index": 699 } ]
[ { "span": "pass", "start_line": 696, "start_column": 4, "end_line": 696, "end_column": 8 }, { "span": "pass", "start_line": 701, "start_column": 4, "end_line": 701, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Slice", "Ro", "le", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Slice", "Role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Ro", "le", "Admin_", "(_", "XO", "SB", "ase", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Site", "Role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2 ]
Unused import
trapeze/transurlvania/tests/run_tests.py
[ { "content": "#!/usr/bin/env python\n\nimport os, os.path\nimport sys\nimport pprint\n\npath, scriptname = os.path.split(__file__)\n\nsys.path.append(os.path.abspath(path))\nsys.path.append(os.path.abspath(os.path.join(path, '..')))\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'\n\nfrom django.core import management\n\nmanagement.call_command('test', 'garfield')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import pprint", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", ",_", "script", "name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'..'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", "]_", "=_", "'", "tests", ".", "settings", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "management_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "management_", "._", "call", "\\u", "command_", "(_", "'", "test", "'_", ",_", "'", "gar", "field", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
jayfk/fundingoss.com/fabfile.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nThis is a collection of useful utility functions when working with docker on different environments.\nIn order to use these functions, install fabric on your local machine with::\n pip install fabric\nPlease note: Fabric is a remote code execution tool, NOT a remote configuration tool. While you can copy files\nfrom here to there, it is not a good replacement for salt or ansible in this regard.\nThere is a function called `production` where you need to fill in the details about your production machine(s).\nYou can then run::\n fab production status\nto get the status of your stack\nTo list all available commands, run::\n fab -l\n\"\"\"\n\nfrom __future__ import absolute_import, print_function, unicode_literals\nfrom fabric.operations import local as lrun, run, sudo, put\nfrom fabric.api import *\nfrom fabric.colors import green, red, yellow, blue\nfrom fabric.contrib.console import confirm\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def local():\n \"\"\"\n Work on the local environment\n \"\"\"\n env.compose_file = \"dev.yml\"\n env.project_dir = \".\"\n env.run = lrun\n env.cd = lcd", "metadata": "root.local", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def production():\n \"\"\"\n Work on the production environment\n \"\"\"\n env.hosts = [\"fundingoss.com\"] # list the ip addresses or domain names of your production boxes here\n env.port = 56565 # ssh port\n env.user = \"root\" # remote user, see `env.run` if you don't log in as root\n\n env.compose_file = \"docker-compose.yml\"\n env.project_dir = \"/code/fundingoss.com\" # this is the project dir where your code lives on this machine\n\n # if you don't use key authentication, add your password here\n # env.password = \"foobar\"\n # if your machine has no bash installed, fall back to sh\n # env.shell = \"/bin/sh -c\"\n\n env.run = run # if you don't log in as root, replace with 'env.run = sudo'\n env.cd = cd", "metadata": "root.production", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def copy_secrets():\n \"\"\"\n\n :return:\n \"\"\"\n secrets = [\".env\"]\n for secret in secrets:\n remote_path = \"/\".join([env.project_dir, secret])\n print(blue(\"Copying {secret} to {remote_path} on {host}\".format(\n secret=secret, remote_path=remote_path, host=env.host\n )))\n put(secret, remote_path)", "metadata": "root.copy_secrets", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def rollback(commit=\"HEAD~1\"):\n \"\"\"\n Rollback to a previous commit and build the stack\n :param commit: Commit you want to roll back to. Default is the previous commit\n \"\"\"\n with env.cd(env.project_dir):\n env.run(\"git checkout {}\".format(commit))\n\n docker_compose(\"build\")", "metadata": "root.rollback", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def deploy():\n \"\"\"\n Pulls the latest changes from master, rebuilt and restarts the stack\n \"\"\"\n lrun(\"git push origin master\")\n copy_secrets()\n with env.cd(env.project_dir):\n env.run(\"git pull origin master\")\n\n build()\n restart()", "metadata": "root.deploy", "header": "['module', '___EOS___']", "index": 80 }, { "content": "def restart():\n \"\"\"\n Restart all services\n \"\"\"\n docker_compose(\"stop\")", "metadata": "root.restart", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def build(cache=True):\n \"\"\"\n Builds the the stack\n :param cache: Use docker cache. Default is True\n \"\"\"\n docker_compose(\"build\" if cache else \"build --no-cache\")", "metadata": "root.build", "header": "['module', '___EOS___']", "index": 103 }, { "content": "def status():\n \"\"\"\n Display the status of all services\n \"\"\"\n docker_compose(\"ps\")", "metadata": "root.status", "header": "['module', '___EOS___']", "index": 111 }, { "content": "def django_shell():\n \"\"\"\n Starts a Django shell\n \"\"\"\n docker_compose(\"run django python manage.py shell\")", "metadata": "root.django_shell", "header": "['module', '___EOS___']", "index": 118 }, { "content": "def migrate_database():\n \"\"\"\n Run a Django database migration\n \"\"\"\n docker_compose(\"run django python manage.py migrate\")", "metadata": "root.migrate_database", "header": "['module', '___EOS___']", "index": 128 }, { "content": "def logs(service=\"\"):\n \"\"\"\n Display logs\n :param service: Service to display the logs from. Default is all\n \"\"\"\n docker_compose(\"logs\" if not service else \"logs {}\".format(service))", "metadata": "root.logs", "header": "['module', '___EOS___']", "index": 140 }, { "content": "def docker_compose(command):\n \"\"\"\n Run a docker-compose command\n :param command: Command you want to run\n \"\"\"\n with env.cd(env.project_dir):\n return env.run(\"docker-compose -f {file} {command}\".format(file=env.compose_file, command=command))", "metadata": "root.docker_compose", "header": "['module', '___EOS___']", "index": 151 } ]
[ { "span": "from fabric.operations import local as lrun, run, sudo, put", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 59 }, { "span": "from fabric.colors import green, red, yellow, blue", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 50 }, { "span": "from fabric.contrib.console import confirm", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 42 }, { "span": "import os", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 9 }, { "span": "import requests", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 15 }, { "span": "from requests.auth import HTTPBasicAuth", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "is", " ", "a", " ", "collection", " ", "of", " ", "usef", "ul", " ", "utility", " ", "function", "s", " ", "whe", "n", " ", "working", " ", "with", " ", "docker", " ", "on", " ", "different", " ", "environ", "ment", "s", ".", "\\", "10", ";", "In", " ", "order", " ", "to", " ", "use", " ", "these", " ", "function", "s", ",", " ", "install", " ", "fab", "ric", " ", "on", " ", "your", " ", "local", " ", "machine", " ", "with", "::", "\\", "10", ";", " ", " ", " ", " ", "pip", " ", "install", " ", "fab", "ric", "\\", "10", ";", "Ple", "ase", " ", "note", ":", " ", "Fabric", " ", "is", " ", "a", " ", "remote", " ", "code", " ", "executi", "on", " ", "tool", ",", " ", "NOT", " ", "a", " ", "remote", " ", "configura", "tion", " ", "tool", ".", " ", "Whi", "le", " ", "you", " ", "can", " ", "copy", " ", "files", "\\", "10", ";", "from", " ", "here", " ", "to", " ", "there", ",", " ", "it", " ", "is", " ", "not", " ", "a", " ", "good", " ", "replace", "ment", " ", "for", " ", "salt", " ", "or", " ", "ansi", "ble", " ", "in", " ", "this", " ", "rega", "rd", ".", "\\", "10", ";", "There", " ", "is", " ", "a", " ", "function", " ", "call", "ed", " ", "`", "producti", "on", "`", " ", "where", " ", "you", " ", "need", " ", "to", " ", "fill", " ", "in", " ", "the", " ", "deta", "il", "s", " ", "abo", "ut", " ", "your", " ", "producti", "on", " ", "machine", "(", "s", ").", "\\", "10", ";", "You", " ", "can", " ", "then", " ", "run", "::", "\\", "10", ";", " ", " ", " ", " ", "fab", " ", "producti", "on", " ", "status", "\\", "10", ";", "to", " ", "get", " ", "the", " ", "status", " ", "of", " ", "your", " ", "stack", "\\", "10", ";", "To", " ", "list", " ", "all", " ", "avail", "able", " ", "command", "s", ",", " ", "run", "::", "\\", "10", ";", " ", " ", " ", " ", "fab", " ", "-", "l", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "operations_", "import_", "local_", "as_", "lr", "un_", ",_", "run_", ",_", "sudo_", ",_", "put_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "api_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "colors_", "import_", "green_", ",_", "red_", ",_", "yellow_", ",_", "blue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "contrib_", "._", "console_", "import_", "confirm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "requests_", "._", "auth_", "import_", "HTTP", "Basic", "Auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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\\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_", "local_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Work", " ", "on", " ", "the", " ", "local", " ", "environ", "ment", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "compose", "\\u", "file_", "=_", "\"", "dev", ".", "yml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "project", "\\u", "dir_", "=_", "\".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "run_", "=_", "lr", "un_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "cd_", "=_", "lcd_", "\\u\\u\\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_", "production_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Work", " ", "on", " ", "the", " ", "producti", "on", " ", "environ", "ment", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "hosts_", "=_", "[_", "\"", "funding", "oss", ".", "com", "\"_", "]_", "#", " ", "list", " ", "the", " ", "ip", " ", "addresse", "s", " ", "or", " ", "domain", " ", "names", " ", "of", " ", "your", " ", "producti", "on", " ", "box", "es", " ", "here_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "port_", "=_", "565", "65_", "#", " ", "ssh", " ", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "user_", "=_", "\"", "root", "\"_", "#", " ", "remote", " ", "user", ",", " ", "see", " ", "`", "env", ".", "run", "`", " ", "if", " ", "you", " ", "don", "'", "t", " ", "log", " ", "in", " ", "as", " ", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "compose", "\\u", "file_", "=_", "\"", "docker", "-", "compose", ".", "yml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "project", "\\u", "dir_", "=_", "\"/", "code", "/", "funding", "oss", ".", "com", "\"_", "#", " ", "this", " ", "is", " ", "the", " ", "project", " ", "dir", " ", "where", " ", "your", " ", "code", " ", "lives", " ", "on", " ", "this", " ", "machine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "you", " ", "don", "'", "t", " ", "use", " ", "key", " ", "authenticat", "ion", ",", " ", "add", " ", "your", " ", "password", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "env", ".", "password", " ", "=", " ", "\"", "fooba", "r", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "your", " ", "machine", " ", "has", " ", "no", " ", "bash", " ", "install", "ed", ",", " ", "fall", " ", "back", " ", "to", " ", "sh_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "env", ".", "shell", " ", "=", " ", "\"/", "bin", "/", "sh", " ", "-", "c", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "run_", "=_", "run_", "#", " ", "if", " ", "you", " ", "don", "'", "t", " ", "log", " ", "in", " ", "as", " ", "root", ",", " ", "replace", " ", "with", " ", "'", "env", ".", "run", " ", "=", " ", "sudo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "cd_", "=_", "cd_", "\\u\\u\\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_", "copy", "\\u", "secrets_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "secrets_", "=_", "[_", "\".", "env", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "secret_", "in_", "secrets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "\\u", "path_", "=_", "\"/\"_", "._", "join_", "(_", "[_", "env_", "._", "project", "\\u", "dir_", ",_", "secret_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "blue_", "(_", "\"", "Copy", "ing", " ", "{", "secret", "}", " ", "to", " ", "{", "remote", "\\u", "path", "}", " ", "on", " ", "{", "host", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "secret_", "=_", "secret_", ",_", "remote", "\\u", "path_", "=_", "remote", "\\u", "path_", ",_", "host_", "=_", "env_", "._", "host_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put_", "(_", "secret_", ",_", "remote", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rollback_", "(_", "commit_", "=_", "\"", "HEAD", "~", "1", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Roll", "back", " ", "to", " ", "a", " ", "previ", "ous", " ", "commit", " ", "and", " ", "build", " ", "the", " ", "stack", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "commit", ":", " ", "Commi", "t", " ", "you", " ", "want", " ", "to", " ", "roll", " ", "back", " ", "to", ".", " ", "Default", " ", "is", " ", "the", " ", "previ", "ous", " ", "commit", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "env_", "._", "cd_", "(_", "env_", "._", "project", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "run_", "(_", "\"", "git", " ", "check", "out", " ", "{}\"_", "._", "format_", "(_", "commit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "docker", "\\u", "compose_", "(_", "\"", "build", "\"_", ")_", "\\u\\u\\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_", "deploy_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pul", "ls", " ", "the", " ", "late", "st", " ", "change", "s", " ", "from", " ", "master", ",", " ", "rebu", "ilt", " ", "and", " ", "restart", "s", " ", "the", " ", "stack", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lr", "un_", "(_", "\"", "git", " ", "push", " ", "orig", "in", " ", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "\\u", "secrets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "env_", "._", "cd_", "(_", "env_", "._", "project", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "run_", "(_", "\"", "git", " ", "pull", " ", "orig", "in", " ", "master", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restart_", "(_", ")_", "\\u\\u\\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_", "restart_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Restart", " ", "all", " ", "service", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docker", "\\u", "compose_", "(_", "\"", "stop", "\"_", ")_", "\\u\\u\\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_", "build_", "(_", "cache_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Build", "s", " ", "the", " ", "the", " ", "stack", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cache", ":", " ", "Us", "e", " ", "docker", " ", "cache", ".", " ", "Default", " ", "is", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docker", "\\u", "compose_", "(_", "\"", "build", "\"_", "if_", "cache_", "else_", "\"", "build", " ", "--", "no", "-", "cache", "\"_", ")_", "\\u\\u\\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_", "status_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "the", " ", "status", " ", "of", " ", "all", " ", "service", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docker", "\\u", "compose_", "(_", "\"", "ps", "\"_", ")_", "\\u\\u\\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_", "django", "\\u", "shell_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Start", "s", " ", "a", " ", "Dj", "ang", "o", " ", "shell", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docker", "\\u", "compose_", "(_", "\"", "run", " ", "django", " ", "python", " ", "manage", ".", "py", " ", "shell", "\"_", ")_", "\\u\\u\\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_", "migr", "ate", "\\u", "database_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "a", " ", "Dj", "ang", "o", " ", "databa", "se", " ", "migrati", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docker", "\\u", "compose_", "(_", "\"", "run", " ", "django", " ", "python", " ", "manage", ".", "py", " ", "migr", "ate", "\"_", ")_", "\\u\\u\\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_", "(_", "service_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "logs", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "service", ":", " ", "Service", " ", "to", " ", "display", " ", "the", " ", "logs", " ", "from", ".", " ", "Default", " ", "is", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docker", "\\u", "compose_", "(_", "\"", "logs", "\"_", "if_", "not_", "service_", "else_", "\"", "logs", " ", "{}\"_", "._", "format_", "(_", "service_", ")_", ")_", "\\u\\u\\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_", "docker", "\\u", "compose_", "(_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "a", " ", "docker", "-", "compose", " ", "command", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "command", ":", " ", "Command", " ", "you", " ", "want", " ", "to", " ", "run", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "env_", "._", "cd_", "(_", "env_", "._", "project", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "env_", "._", "run_", "(_", "\"", "docker", "-", "compose", " ", "-", "f", " ", "{", "file", "}", " ", "{", "command", "}\"_", "._", "format_", "(_", "file_", "=_", "env_", "._", "compose", "\\u", "file_", ",_", "command_", "=_", "command_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unreachable code
fp7-ofelia/ocf/ofam/src/src/foam/api/legacyexpedientapi.py
[ { "content": " def priv_CreateSliver(self, slice_urn, credentials, rspec, users, force_approval=False, options=None):\t\n #user_info = {}\n user_info = users\n try:\n #if CredVerifier.checkValid(credentials, \"createsliver\"):\n if True:\n self.recordAction(\"createsliver\", credentials, slice_urn)\n try:\n #cert = Certificate(request.environ['CLIENT_RAW_CERT'])\n #user_info[\"urn\"] = cert.getURN()\n #user_info[\"email\"] = cert.getEmailAddress()\n self._log.debug(\"Parsed user cert with URN (%(urn)s) and email (%(email)s)\" % users)\n except Exception, e:\n self._log.exception(\"UNFILTERED EXCEPTION\")\n user_info[\"urn\"] = None\n user_info[\"email\"] = None\n from foam.app import admin_apih\n if not admin_apih.vlan_automation_on:\n sliver = foam.geni.lib.createSliver(slice_urn, credentials, rspec, user_info)\n style = ConfigDB.getConfigItemByKey(\"geni.approval.approve-on-creation\").getValue()\n if style == foam.geni.approval.NEVER:\n approve = False\n elif style == foam.geni.approval.ALWAYS:\n approve = True\n else:\n approve = foam.geni.ofeliaapproval.of_analyzeForApproval(sliver)\n if approve or force_approval:\n pid = foam.task.approveSliver(sliver.getURN(), AUTO_SLIVER_PRIORITY)\n self._log.debug(\"task.py launched for approve-sliver (PID: %d)\" % pid)\t\n else:\n free_vlan_list = self.pub_get_offered_vlans(1)\n free_vlan = free_vlan_list[0]\n slice_id = slice_urn.split(\"+slice+\")[1].split(\":\")[0].split(\"id_\")[1].split(\"name_\")[0]\n #filedir = './opt/ofelia/ofam/local/db'\n #filename = os.path.join(filedir, 'expedient_slices_info.json')\n #f = open(filename, 'r')\n #self.slice_info_dict = json.load(f)\n #f.close()\n if (slice_id == \"\") or (slice_id not in self.slice_info_dict): \n self._log.exception(\"The slice id you specified is non-existent\")\n raise Exception\n updated_slice_info_dict = self.slice_info_dict.copy()\n for sliv_pos, sliver in enumerate(self.slice_info_dict[slice_id]['switch_slivers']):\n for sfs_pos, sfs in enumerate(sliver['flowspace']): \n updated_slice_info_dict[slice_id]['switch_slivers'][sliv_pos]['flowspace'][sfs_pos]['vlan_id_start'] = free_vlan\n updated_slice_info_dict[slice_id]['switch_slivers'][sliv_pos]['flowspace'][sfs_pos]['vlan_id_end'] = free_vlan\n all_efs = self.create_slice_fs(updated_slice_info_dict[slice_id]['switch_slivers'])\n new_slice_of_rspec = create_ofv3_rspec(slice_id, updated_slice_info_dict[slice_id]['project_name'], updated_slice_info_dict[slice_id]['project_desc'], \\\n updated_slice_info_dict[slice_id]['slice_name'], updated_slice_info_dict[slice_id]['slice_desc'], \\\n updated_slice_info_dict[slice_id]['controller_url'], updated_slice_info_dict[slice_id]['owner_email'], \\\n updated_slice_info_dict[slice_id]['owner_password'], \\\n updated_slice_info_dict[slice_id]['switch_slivers'], all_efs)\n self.slice_info_dict = updated_slice_info_dict.copy()\n sliver = foam.geni.lib.createSliver(slice_urn, credentials, new_slice_of_rspec, user_info)\n pid = foam.task.approveSliver(sliver.getURN(), AUTO_SLIVER_PRIORITY)\n self._log.debug(\"task.py launched for approve-sliver (PID: %d)\" % pid)\n data = GeniDB.getSliverData(sliver.getURN(), True)\n foam.task.emailCreateSliver(data)\n return self.successResult(GeniDB.getManifest(sliver.getURN()))\n return\n\t\t\n except foam.geni.lib.RspecParseError, e:\n self._log.info(str(e))\n e._foam_logged = True\n raise e\n except foam.geni.lib.RspecValidationError, e:\n self._log.info(str(e))\n e._foam_logged = True\n raise e\n except foam.geni.lib.DuplicateSliver, ds:\n self._log.info(\"Attempt to create multiple slivers for slice [%s]\" % (ds.slice_urn))\n ds._foam_logged = True\n raise ds\n except foam.geni.lib.UnknownComponentManagerID, ucm:\n raise Fault(\"UnknownComponentManager\", \"Component Manager ID specified in %s does not match this aggregate.\" % (ucm.cid))\n except (foam.geni.lib.UnmanagedComponent, UnknownNode), uc:\n self._log.info(\"Attempt to request unknown component %s\" % (uc.cid))\n f = Fault(\"UnmanagedComponent\", \"DPID in component %s is unknown to this aggregate.\" % (uc.cid))\n f._foam_logged = True\n raise f\n except Exception, e:\n self._log.exception(\"Exception\")\n raise e", "metadata": "root.AMLegExpAPI.priv_CreateSliver", "header": "['class', 'AMLegExpAPI', '(', 'foam', '.', 'api', '.', 'xmlrpc', '.', 'Dispatcher', ')', ':', '___EOS___']", "index": 135 }, { "content": " def priv_DeleteSliver(self, slice_urn, credentials, options=None):\n try:\n #if CredVerifier.checkValid(credentials, \"deletesliver\", slice_urn):\n if True:\n self.recordAction(\"deletesliver\", credentials, slice_urn)\n if GeniDB.getSliverURN(slice_urn) is None:\n raise Fault(\"DeleteSliver\", \"Sliver for slice URN (%s) does not exist\" % (slice_urn))\n return self.errorResult(12, \"\") #not sure if this is needed\n sliver_urn = GeniDB.getSliverURN(slice_urn)\n data = GeniDB.getSliverData(sliver_urn, True)\n foam.geni.lib.deleteSliver(sliver_urn = sliver_urn)\n foam.task.emailGAPIDeleteSliver(data)\n return self.successResult(True)\n return self.successResult(False)\n\t\t\n except UnknownSlice, x:\n self._log.info(\"Attempt to delete unknown sliver for slice URN %s\" % (slice_urn))\n x._foam_logged = True\n raise x \n except Exception, e:\n self._log.exception(\"Exception\")\n raise e", "metadata": "root.AMLegExpAPI.priv_DeleteSliver", "header": "['class', 'AMLegExpAPI', '(', 'foam', '.', 'api', '.', 'xmlrpc', '.', 'Dispatcher', ')', ':', '___EOS___']", "index": 219 } ]
[ { "span": "return", "start_line": 194, "start_column": 6, "end_line": 194, "end_column": 12 }, { "span": "return self.errorResult(12, \"\") ", "start_line": 226, "start_column": 10, "end_line": 226, "end_column": 41 }, { "span": "return self.successResult(False)", "start_line": 232, "start_column": 6, "end_line": 232, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "AM", "Leg", "Exp", "API_", "(_", "foa", "m_", "._", "api_", "._", "xmlrpc", "_", "._", "Dispatcher_", ")_", ":_", "\\u\\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", "\\u", "Creat", "e", "Sli", "ver_", "(_", "self_", ",_", "slice", "\\u", "urn_", ",_", "credentials_", ",_", "rsp", "ec_", ",_", "users_", ",_", "force", "\\u", "approval", "_", "=_", "False_", ",_", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "user", "\\u", "info", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "info_", "=_", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "Cred", "Verifie", "r", ".", "check", "Valid", "(", "cred", "ential", "s", ",", " ", "\"", "create", "sli", "ver", "\"):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "record", "Action_", "(_", "\"", "create", "sli", "ver", "\"_", ",_", "credentials_", ",_", "slice", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cert", " ", "=", " ", "Certificat", "e", "(", "request", ".", "environ", "['", "CLIENT", "\\u", "RA", "W", "\\u", "CERT", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "user", "\\u", "info", "[\"", "urn", "\"]", " ", "=", " ", "cert", ".", "get", "URN", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "user", "\\u", "info", "[\"", "email", "\"]", " ", "=", " ", "cert", ".", "get", "Ema", "il", "Address", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "debug_", "(_", "\"", "Pars", "ed", " ", "user", " ", "cert", " ", "with", " ", "URN", " ", "(%", "(", "urn", ")", "s", ")", " ", "and", " ", "email", " ", "(%", "(", "email", ")", "s", ")\"_", "%_", "users_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "exception_", "(_", "\"", "UN", "FILTER", "ED", " ", "EXCEPTION", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "[_", "\"", "urn", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "[_", "\"", "email", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "foa", "m_", "._", "app_", "import_", "admin", "\\u", "api", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "admin", "\\u", "api", "h_", "._", "vlan", "\\u", "automati", "on", "\\u", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sli", "ver_", "=_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "create", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "credentials_", ",_", "rsp", "ec_", ",_", "user", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style_", "=_", "Config", "DB_", "._", "get", "Config", "Item", "By", "Key_", "(_", "\"", "geni", ".", "approval", ".", "approve", "-", "on", "-", "creati", "on", "\"_", ")_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "style_", "==_", "foa", "m_", "._", "geni", "_", "._", "approval", "_", "._", "NE", "VER_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "approve", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "style_", "==_", "foa", "m_", "._", "geni", "_", "._", "approval", "_", "._", "ALWAYS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "approve", "_", "=_", "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 ", " _", "approve", "_", "=_", "foa", "m_", "._", "geni", "_", "._", "of", "eli", "aa", "ppro", "val_", "._", "of", "\\u", "analyze", "For", "Approval", "_", "(_", "sli", "ver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "approve", "_", "or_", "force", "\\u", "approval", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid_", "=_", "foa", "m_", "._", "task_", "._", "approve", "Sli", "ver_", "(_", "sli", "ver_", "._", "get", "URN", "_", "(_", ")_", ",_", "AUTO", "\\u", "SLI", "VER", "\\u", "PRIORITY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "._", "debug_", "(_", "\"", "task", ".", "py", " ", "launched", " ", "for", " ", "approve", "-", "sli", "ver", " ", "(", "PID", ":", " ", "%", "d", ")\"_", "%_", "pid_", ")_", "\\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 ", " _", "free", "\\u", "vlan", "\\u", "list_", "=_", "self_", "._", "pub", "\\u", "get", "\\u", "offered", "\\u", "vlans_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "free", "\\u", "vlan_", "=_", "free", "\\u", "vlan", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "id_", "=_", "slice", "\\u", "urn_", "._", "split_", "(_", "\"+", "slice", "+\"_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "\":\"_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "\"", "id", "\\u\"_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "\"", "name", "\\u\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "filedi", "r", " ", "=", " ", "'./", "opt", "/", "of", "eli", "a", "/", "ofa", "m", "/", "local", "/", "db", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filename", " ", "=", " ", "os", ".", "path", ".", "join", "(", "filedi", "r", ",", " ", "'", "expe", "die", "nt", "\\u", "slice", "s", "\\u", "info", ".", "json", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "f", " ", "=", " ", "open", "(", "filename", ",", " ", "'", "r", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "slice", "\\u", "info", "\\u", "dict", " ", "=", " ", "json", ".", "load", "(", "f", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "f", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "slice", "\\u", "id_", "==_", "\"\"_", ")_", "or_", "(_", "slice", "\\u", "id_", "not_", "in_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "exception_", "(_", "\"", "The", " ", "slice", " ", "id", " ", "you", " ", "specified", " ", "is", " ", "non", "-", "existen", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "=_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sli", "v", "\\u", "pos_", ",_", "sli", "ver_", "in_", "enumerate_", "(_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sf", "s", "\\u", "pos_", ",_", "sf", "s_", "in_", "enumerate_", "(_", "sli", "ver_", "[_", "'", "flow", "space", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", "[_", "sli", "v", "\\u", "pos_", "]_", "[_", "'", "flow", "space", "'_", "]_", "[_", "sf", "s", "\\u", "pos_", "]_", "[_", "'", "vlan", "\\u", "id", "\\u", "start", "'_", "]_", "=_", "free", "\\u", "vlan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", "[_", "sli", "v", "\\u", "pos_", "]_", "[_", "'", "flow", "space", "'_", "]_", "[_", "sf", "s", "\\u", "pos_", "]_", "[_", "'", "vlan", "\\u", "id", "\\u", "end", "'_", "]_", "=_", "free", "\\u", "vlan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "efs_", "=_", "self_", "._", "create", "\\u", "slice", "\\u", "fs_", "(_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "slice", "\\u", "of", "\\u", "rsp", "ec_", "=_", "create", "\\u", "of", "v", "3", "\\u", "rsp", "ec_", "(_", "slice", "\\u", "id_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "project", "\\u", "name", "'_", "]_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "project", "\\u", "desc", "'_", "]_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "name", "'_", "]_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "slice", "\\u", "desc", "'_", "]_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "controlle", "r", "\\u", "url", "'_", "]_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "email", "'_", "]_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "owner", "\\u", "password", "'_", "]_", ",_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "[_", "slice", "\\u", "id_", "]_", "[_", "'", "switch", "\\u", "sli", "vers", "'_", "]_", ",_", "all", "\\u", "efs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "info", "\\u", "dict_", "=_", "update", "d\\u", "slice", "\\u", "info", "\\u", "dict_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sli", "ver_", "=_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "create", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "credentials_", ",_", "new", "\\u", "slice", "\\u", "of", "\\u", "rsp", "ec_", ",_", "user", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pid_", "=_", "foa", "m_", "._", "task_", "._", "approve", "Sli", "ver_", "(_", "sli", "ver_", "._", "get", "URN", "_", "(_", ")_", ",_", "AUTO", "\\u", "SLI", "VER", "\\u", "PRIORITY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "._", "debug_", "(_", "\"", "task", ".", "py", " ", "launched", " ", "for", " ", "approve", "-", "sli", "ver", " ", "(", "PID", ":", " ", "%", "d", ")\"_", "%_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "Data_", "(_", "sli", "ver_", "._", "get", "URN", "_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foa", "m_", "._", "task_", "._", "email", "Creat", "e", "Sli", "ver_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "success", "Result_", "(_", "Gen", "i", "DB_", "._", "get", "Manifest", "_", "(_", "sli", "ver_", "._", "get", "URN", "_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "Rs", "pec", "Pars", "e", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "\\u", "foa", "m", "\\u", "logged", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "Rs", "pec", "Validat", "ion", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "\\u", "foa", "m", "\\u", "logged", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "Duplicate", "Sli", "ver_", ",_", "ds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "\"", "Atte", "mpt", " ", "to", " ", "create", " ", "multiple", " ", "sli", "vers", " ", "for", " ", "slice", " ", "[", "%", "s", "]\"_", "%_", "(_", "ds_", "._", "slice", "\\u", "urn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds_", "._", "\\u", "foa", "m", "\\u", "logged", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "ds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "Un", "know", "n", "Compo", "nent", "Manager", "ID_", ",_", "uc", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Fault_", "(_", "\"", "Un", "know", "n", "Compo", "nent", "Manager", "\"_", ",_", "\"", "Compo", "nent", " ", "Manager", " ", "ID", " ", "specified", " ", "in", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "match", " ", "this", " ", "aggre", "gate", ".\"_", "%_", "(_", "uc", "m_", "._", "cid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "Unma", "nage", "d", "Component_", ",_", "Un", "know", "n", "Node_", ")_", ",_", "uc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "\"", "Atte", "mpt", " ", "to", " ", "request", " ", "unknown", " ", "component", " ", "%", "s", "\"_", "%_", "(_", "uc_", "._", "cid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "Fault_", "(_", "\"", "Unma", "nage", "d", "Compo", "nent", "\"_", ",_", "\"", "DP", "ID", " ", "in", " ", "component", " ", "%", "s", " ", "is", " ", "unknown", " ", "to", " ", "this", " ", "aggre", "gate", ".\"_", "%_", "(_", "uc_", "._", "cid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "\\u", "foa", "m", "\\u", "logged", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "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 ", " _", "self_", "._", "\\u", "log_", "._", "exception_", "(_", "\"", "Except", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AM", "Leg", "Exp", "API_", "(_", "foa", "m_", "._", "api_", "._", "xmlrpc", "_", "._", "Dispatcher_", ")_", ":_", "\\u\\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", "\\u", "Delete", "Sli", "ver_", "(_", "self_", ",_", "slice", "\\u", "urn_", ",_", "credentials_", ",_", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "Cred", "Verifie", "r", ".", "check", "Valid", "(", "cred", "ential", "s", ",", " ", "\"", "delete", "sli", "ver", "\",", " ", "slice", "\\u", "urn", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "record", "Action_", "(_", "\"", "delete", "sli", "ver", "\"_", ",_", "credentials_", ",_", "slice", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "URN", "_", "(_", "slice", "\\u", "urn_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Fault_", "(_", "\"", "Delete", "Sli", "ver", "\"_", ",_", "\"", "Sli", "ver", " ", "for", " ", "slice", " ", "URN", " ", "(%", "s", ")", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "%_", "(_", "slice", "\\u", "urn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "error", "Result_", "(_", "12_", ",_", "\"\"_", ")_", "#", "not", " ", "sure", " ", "if", " ", "this", " ", "is", " ", "needed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sli", "ver", "\\u", "urn_", "=_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "URN", "_", "(_", "slice", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "Gen", "i", "DB_", "._", "get", "Sli", "ver", "Data_", "(_", "sli", "ver", "\\u", "urn_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foa", "m_", "._", "geni", "_", "._", "lib_", "._", "delete", "Sli", "ver_", "(_", "sli", "ver", "\\u", "urn_", "=_", "sli", "ver", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foa", "m_", "._", "task_", "._", "email", "GAP", "ID", "ele", "te", "Sli", "ver_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "success", "Result_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "success", "Result_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Un", "know", "n", "Slice_", ",_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "info_", "(_", "\"", "Atte", "mpt", " ", "to", " ", "delete", " ", "unknown", " ", "sli", "ver", " ", "for", " ", "slice", " ", "URN", " ", "%", "s", "\"_", "%_", "(_", "slice", "\\u", "urn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "._", "\\u", "foa", "m", "\\u", "logged", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "log_", "._", "exception_", "(_", "\"", "Except", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Insecure temporary file
azoft-dev-team/imagrium/env/Lib/test/zxjdbc/zxtest.py
[ { "content": " def testInsertWithFile(self):\n \"\"\"testing insert with file\"\"\"\n assert self.has_table(\"texttable\"), \"missing attribute texttable\"\n fp = open(tempfile.mktemp(), \"w\")\n c = self.cursor()\n try:\n try:\n c.execute(self.table(\"texttable\")[1])\n data = fp.name * 300\n data = data[:3500]\n fp.write(data)\n fp.flush()\n fp.close()\n fp = open(fp.name, \"r\")\n c.execute(\"insert into %s (a, b) values (?, ?)\" % (self.table(\"texttable\")[0]), [(0, fp)], {1:zxJDBC.LONGVARCHAR})\n self.db.commit()\n c.execute(\"select b from %s\" % (self.table(\"texttable\")[0]))\n f = c.fetchall()\n assert len(f) == 1, \"expected [1] row, got [%d]\" % (len(f))\n assert len(f[0][0]) == len(data), \"expected [%d], got [%d]\" % (len(data), len(f[0][0]))\n assert data == f[0][0], \"failed to retrieve the same text as inserted\"\n except Exception, e:\n raise e\n finally:\n c.execute(\"drop table %s\" % (self.table(\"texttable\")[0]))\n c.close()\n self.db.commit()\n fp.close()\n os.remove(fp.name)", "metadata": "root.zxAPITestCase.testInsertWithFile", "header": "['class', 'zxAPITestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 469 }, { "content": " def _test_blob(self, obj=0):\n assert self.has_table(\"blobtable\"), \"no blob table\"\n tabname, sql = self.table(\"blobtable\")\n fn = tempfile.mktemp()\n fp = None\n\n c = self.cursor()\n try:\n\n hello = (\"hello\",) * 1024\n\n c.execute(sql)\n self.db.commit()\n\n from java.io import FileOutputStream, FileInputStream, ObjectOutputStream, ObjectInputStream, ByteArrayInputStream\n\n fp = FileOutputStream(fn)\n oos = ObjectOutputStream(fp)\n oos.writeObject(hello)\n fp.close()\n\n fp = FileInputStream(fn)\n blob = ObjectInputStream(fp)\n value = blob.readObject()\n fp.close()\n assert hello == value, \"unable to serialize properly\"\n\n if obj == 1:\n fp = open(fn, \"rb\")\n else:\n fp = FileInputStream(fn)\n\n c.execute(\"insert into %s (a, b) values (?, ?)\" % (tabname), [(0, fp)], {1:zxJDBC.BLOB})\n self.db.commit()\n\n c.execute(\"select * from %s\" % (tabname))\n f = c.fetchall()\n bytes = f[0][1]\n blob = ObjectInputStream(ByteArrayInputStream(bytes)).readObject()\n\n assert hello == blob, \"blobs are not equal\"\n\n finally:\n c.execute(\"drop table %s\" % (tabname))\n c.close()\n self.db.commit()\n if os.path.exists(fn):\n if fp:\n fp.close()\n os.remove(fn)", "metadata": "root.LOBTestCase._test_blob", "header": "['class', 'LOBTestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 957 }, { "content": " def _test_clob(self, asfile=0):\n assert self.has_table(\"clobtable\"), \"no clob table\"\n tabname, sql = self.table(\"clobtable\")\n\n c = self.cursor()\n try:\n hello = \"hello\" * 1024 * 10\n\n c.execute(sql)\n self.db.commit()\n\n if asfile:\n fp = open(tempfile.mktemp(), \"w\")\n fp.write(hello)\n fp.flush()\n fp.close()\n obj = open(fp.name, \"r\")\n else:\n obj = hello\n\n c.execute(\"insert into %s (a, b) values (?, ?)\" % (tabname), [(0, obj)], {1:zxJDBC.CLOB})\n c.execute(\"select * from %s\" % (tabname), maxrows=1)\n f = c.fetchall()\n assert len(f) == 1, \"expected [%d], got [%d]\" % (1, len(f))\n assert hello == f[0][1], \"clobs are not equal\"\n\n finally:\n c.execute(\"drop table %s\" % (tabname))\n c.close()\n self.db.commit()\n if asfile:\n obj.close()\n os.remove(obj.name)", "metadata": "root.LOBTestCase._test_clob", "header": "['class', 'LOBTestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 1016 }, { "content": " def testCSVPipe(self):\n \"\"\"testing the CSV pipe\"\"\"\n from java.io import PrintWriter, FileWriter\n from com.ziclix.python.sql.pipe import Pipe\n from com.ziclix.python.sql.pipe.db import DBSource\n from com.ziclix.python.sql.pipe.csv import CSVSink\n\n try:\n src = self.connect()\n fn = tempfile.mktemp(suffix=\"csv\")\n writer = PrintWriter(FileWriter(fn))\n csvSink = CSVSink(writer)\n\n c = self.cursor()\n try:\n c.execute(\"insert into zxtesting (id, name, state) values (?, ?, ?)\", [(1000, 'this,has,a,comma', 'and a \" quote')])\n c.execute(\"insert into zxtesting (id, name, state) values (?, ?, ?)\", [(1001, 'this,has,a,comma and a \"', 'and a \" quote')])\n # ORACLE has a problem calling stmt.setObject(index, null)\n c.execute(\"insert into zxtesting (id, name, state) values (?, ?, ?)\", [(1010, '\"this,has,a,comma\"', None)], {2:zxJDBC.VARCHAR})\n self.db.commit()\n finally:\n self.db.rollback()\n c.close()\n\n dbSource = DBSource(src, c.datahandler.__class__, \"zxtesting\", None, None, None)\n\n cnt = Pipe().pipe(dbSource, csvSink) - 1 # ignore the header row\n\n finally:\n writer.close()\n src.close()\n os.remove(fn)", "metadata": "root.BCPTestCase.testCSVPipe", "header": "['class', 'BCPTestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 1060 } ]
[ { "span": "tempfile.mktemp(),", "start_line": 472, "start_column": 18, "end_line": 472, "end_column": 35 }, { "span": "tempfile.mktemp()", "start_line": 960, "start_column": 13, "end_line": 960, "end_column": 30 }, { "span": "tempfile.mktemp(),", "start_line": 1028, "start_column": 26, "end_line": 1028, "end_column": 43 }, { "span": "tempfile.mktemp(suffix=\"csv\")", "start_line": 1069, "start_column": 17, "end_line": 1069, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Inse", "cure", "_", "temporar", "y_", "file_", "[SEP]_", "class_", "zx", "API", "Test", "Case_", "(_", "zx", "JD", "BC", "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", "Insert", "With", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "testi", "ng", " ", "insert", " ", "with", " ", "file", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "has", "\\u", "table_", "(_", "\"", "text", "table", "\"_", ")_", ",_", "\"", "missi", "ng", " ", "attribute", " ", "text", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "=_", "open_", "(_", "tempfile_", "._", "mktemp_", "(_", ")_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "execute_", "(_", "self_", "._", "table_", "(_", "\"", "text", "table", "\"_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "fp_", "._", "name_", "*_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "[_", ":_", "3500", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "=_", "open_", "(_", "fp_", "._", "name_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "%", "s", " ", "(", "a", ",", " ", "b", ")", " ", "values", " ", "(?", ",", " ", "?)\"_", "%_", "(_", "self_", "._", "table_", "(_", "\"", "text", "table", "\"_", ")_", "[_", "0_", "]_", ")_", ",_", "[_", "(_", "0_", ",_", "fp_", ")_", "]_", ",_", "{_", "1_", ":_", "zx", "JD", "BC_", "._", "LONG", "VARCHA", "R_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "b", " ", "from", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "table_", "(_", "\"", "text", "table", "\"_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "c_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "f_", ")_", "==_", "1_", ",_", "\"", "expected", " ", "[", "1", "]", " ", "row", ",", " ", "got", " ", "[", "%", "d", "]\"_", "%_", "(_", "len_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "f_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "==_", "len_", "(_", "data_", ")_", ",_", "\"", "expected", " ", "[", "%", "d", "],", " ", "got", " ", "[", "%", "d", "]\"_", "%_", "(_", "len_", "(_", "data_", ")_", ",_", "len_", "(_", "f_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "==_", "f_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "\"", "fail", "ed", " ", "to", " ", "retrieve", " ", "the", " ", "same", " ", "text", " ", "as", " ", "inserted", "\"_", "\\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 ", " _", "raise_", "e_", "\\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 ", " _", "c_", "._", "execute_", "(_", "\"", "drop", " ", "table", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "table_", "(_", "\"", "text", "table", "\"_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "fp_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LO", "BT", "est", "Case_", "(_", "zx", "JD", "BC", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "test\\u", "blob_", "(_", "self_", ",_", "obj_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "has", "\\u", "table_", "(_", "\"", "blob", "table", "\"_", ")_", ",_", "\"", "no", " ", "blob", " ", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "name_", ",_", "sql_", "=_", "self_", "._", "table_", "(_", "\"", "blob", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "tempfile_", "._", "mktemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hello_", "=_", "(_", "\"", "hell", "o", "\"_", ",_", ")_", "*_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "java_", "._", "io_", "import_", "File", "Output", "Stream_", ",_", "File", "Inp", "ut", "Stream_", ",_", "Object", "Output", "Stream_", ",_", "Object", "Inp", "ut", "Stream_", ",_", "Byte", "Array", "Inp", "ut", "Stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fp_", "=_", "File", "Output", "Stream_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oos", "_", "=_", "Object", "Output", "Stream_", "(_", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oos", "_", "._", "write", "Object_", "(_", "hello_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fp_", "=_", "File", "Inp", "ut", "Stream_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob_", "=_", "Object", "Inp", "ut", "Stream_", "(_", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "blob_", "._", "read", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "hello_", "==_", "value_", ",_", "\"", "una", "ble", " ", "to", " ", "serialize", " ", "proper", "ly", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "obj_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "open_", "(_", "fn_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "File", "Inp", "ut", "Stream_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "%", "s", " ", "(", "a", ",", " ", "b", ")", " ", "values", " ", "(?", ",", " ", "?)\"_", "%_", "(_", "tab", "name_", ")_", ",_", "[_", "(_", "0_", ",_", "fp_", ")_", "]_", ",_", "{_", "1_", ":_", "zx", "JD", "BC_", "._", "BLOB", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "*", " ", "from", " ", "%", "s", "\"_", "%_", "(_", "tab", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "c_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "f_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob_", "=_", "Object", "Inp", "ut", "Stream_", "(_", "Byte", "Array", "Inp", "ut", "Stream_", "(_", "bytes_", ")_", ")_", "._", "read", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "hello_", "==_", "blob_", ",_", "\"", "blobs", " ", "are", " ", "not", " ", "equal", "\"_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "execute_", "(_", "\"", "drop", " ", "table", " ", "%", "s", "\"_", "%_", "(_", "tab", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LO", "BT", "est", "Case_", "(_", "zx", "JD", "BC", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "clo", "b_", "(_", "self_", ",_", "asf", "ile_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "has", "\\u", "table_", "(_", "\"", "clo", "bt", "able", "\"_", ")_", ",_", "\"", "no", " ", "clo", "b", " ", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "name_", ",_", "sql_", "=_", "self_", "._", "table_", "(_", "\"", "clo", "bt", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hello_", "=_", "\"", "hell", "o", "\"_", "*_", "1024_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "asf", "ile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "open_", "(_", "tempfile_", "._", "mktemp_", "(_", ")_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "write_", "(_", "hello_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "open_", "(_", "fp_", "._", "name_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "hello_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "%", "s", " ", "(", "a", ",", " ", "b", ")", " ", "values", " ", "(?", ",", " ", "?)\"_", "%_", "(_", "tab", "name_", ")_", ",_", "[_", "(_", "0_", ",_", "obj_", ")_", "]_", ",_", "{_", "1_", ":_", "zx", "JD", "BC_", "._", "CLO", "B_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "*", " ", "from", " ", "%", "s", "\"_", "%_", "(_", "tab", "name_", ")_", ",_", "maxr", "ows_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "c_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "f_", ")_", "==_", "1_", ",_", "\"", "expected", " ", "[", "%", "d", "],", " ", "got", " ", "[", "%", "d", "]\"_", "%_", "(_", "1_", ",_", "len_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "hello_", "==_", "f_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "\"", "clo", "bs", " ", "are", " ", "not", " ", "equal", "\"_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "execute_", "(_", "\"", "drop", " ", "table", " ", "%", "s", "\"_", "%_", "(_", "tab", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "asf", "ile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "obj_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BC", "PT", "est", "Case_", "(_", "zx", "JD", "BC", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "CSV", "Pipe_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "testi", "ng", " ", "the", " ", "CSV", " ", "pipe", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "java_", "._", "io_", "import_", "Print", "Writer_", ",_", "File", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com_", "._", "zi", "cli", "x_", "._", "python_", "._", "sql_", "._", "pipe_", "import_", "Pipe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com_", "._", "zi", "cli", "x_", "._", "python_", "._", "sql_", "._", "pipe_", "._", "db_", "import_", "DB", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com_", "._", "zi", "cli", "x_", "._", "python_", "._", "sql_", "._", "pipe_", "._", "csv_", "import_", "CSV", "Sink_", "\\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 ", " _", "src_", "=_", "self_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "tempfile_", "._", "mktemp_", "(_", "suffix_", "=_", "\"", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "=_", "Print", "Writer_", "(_", "File", "Writer_", "(_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Sink_", "=_", "CSV", "Sink_", "(_", "writer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(?", ",", " ", "?", ",", " ", "?)\"_", ",_", "[_", "(_", "1000_", ",_", "'", "this", ",", "has", ",", "a", ",", "comma", "'_", ",_", "'", "and", " ", "a", " ", "\"", " ", "quote", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(?", ",", " ", "?", ",", " ", "?)\"_", ",_", "[_", "(_", "1001_", ",_", "'", "this", ",", "has", ",", "a", ",", "comma", " ", "and", " ", "a", " ", "\"'_", ",_", "'", "and", " ", "a", " ", "\"", " ", "quote", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ORA", "CLE", " ", "has", " ", "a", " ", "problem", " ", "calling", " ", "stmt", ".", "set", "Object", "(", "index", ",", " ", "null", ")_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(?", ",", " ", "?", ",", " ", "?)\"_", ",_", "[_", "(_", "1010", "_", ",_", "'\"", "this", ",", "has", ",", "a", ",", "comma", "\"'_", ",_", "None_", ")_", "]_", ",_", "{_", "2_", ":_", "zx", "JD", "BC_", "._", "VARCHA", "R_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db", "Source_", "=_", "DB", "Source_", "(_", "src_", ",_", "c_", "._", "data", "handler_", "._", "\\u\\u", "class\\u\\u_", ",_", "\"", "zx", "testi", "ng", "\"_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "Pipe_", "(_", ")_", "._", "pipe_", "(_", "db", "Source_", ",_", "csv", "Sink_", ")_", "-_", "1_", "#", " ", "ignore", " ", "the", " ", "header", " ", "row_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writer_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "fn_", ")_", "\\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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Imprecise assert
meejah/txtorcon/test/test_addrmap.py
[ { "content": " def test_expires(self):\n \"\"\"\n Test simply expiry case\n \"\"\"\n\n clock = task.Clock()\n am = AddrMap()\n am.scheduler = IReactorTime(clock)\n\n now = datetime.datetime.now() + datetime.timedelta(seconds=10)\n nowutc = datetime.datetime.utcnow() + datetime.timedelta(seconds=10)\n line = 'www.example.com 72.30.2.43 \"%s\" EXPIRES=\"%s\"' % (now.strftime(self.fmt), nowutc.strftime(self.fmt))\n\n am.update(line)\n\n self.assertTrue('www.example.com' in am.addr)\n # advance time past when the expiry should have occurred\n clock.advance(10)\n self.assertTrue('www.example.com' not in am.addr)", "metadata": "root.AddrMapTests.test_expires", "header": "['class', 'AddrMapTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_expires_never(self):\n \"\"\"\n Test a NEVER expires line, as in what we'd get a startup for a\n configured address-mapping.\n \"\"\"\n\n clock = task.Clock()\n am = AddrMap()\n am.scheduler = IReactorTime(clock)\n\n line = 'www.example.com 72.30.2.43 \"NEVER\"'\n am.update(line)\n\n self.assertTrue('www.example.com' in am.addr)\n self.assertEqual(len(clock.getDelayedCalls()), 0)", "metadata": "root.AddrMapTests.test_expires_never", "header": "['class', 'AddrMapTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_expires_old(self):\n \"\"\"\n Test something that expires before \"now\"\n \"\"\"\n\n clock = task.Clock()\n am = AddrMap()\n am.scheduler = IReactorTime(clock)\n\n now = datetime.datetime.now() + datetime.timedelta(seconds=-10)\n nowutc = datetime.datetime.utcnow() + datetime.timedelta(seconds=-10)\n line = 'www.example.com 72.30.2.43 \"%s\" EXPIRES=\"%s\"' % (now.strftime(self.fmt), nowutc.strftime(self.fmt))\n\n am.update(line)\n self.assertTrue('www.example.com' in am.addr)\n # arguably we shouldn't even have put this in the map maybe,\n # but the reactor needs to iterate before our expiry callback\n # gets called (right away) which is simulated by the\n # clock.advance call\n clock.advance(0)\n self.assertTrue('www.example.com' not in am.addr)", "metadata": "root.AddrMapTests.test_expires_old", "header": "['class', 'AddrMapTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_expires_with_update(self):\n \"\"\"\n This test updates the expiry time and checks that we properly\n delay our expiry callback.\n \"\"\"\n clock = task.Clock()\n am = AddrMap()\n am.scheduler = IReactorTime(clock)\n\n # now do an actual update to an existing Addr entry.\n now = datetime.datetime.now() + datetime.timedelta(seconds=10)\n nowutc = datetime.datetime.utcnow() + datetime.timedelta(seconds=10)\n line = 'www.example.com 72.30.2.43 \"%s\" EXPIRES=\"%s\"' % (now.strftime(self.fmt), nowutc.strftime(self.fmt))\n am.update(line)\n self.assertTrue(am.find('www.example.com'))\n\n # the update\n now = datetime.datetime.now() + datetime.timedelta(seconds=20)\n nowutc = datetime.datetime.utcnow() + datetime.timedelta(seconds=20)\n line = 'www.example.com 72.30.2.43 \"%s\" EXPIRES=\"%s\"' % (now.strftime(self.fmt), nowutc.strftime(self.fmt))\n am.update(line)\n self.assertTrue('www.example.com' in am.addr)\n\n # advance time by the old expiry value and we should still\n # find the entry\n clock.advance(10)\n self.assertTrue('www.example.com' in am.addr)\n\n # ...but advance past the new expiry (another 10 seconds) and\n # it should vanish\n clock.advance(10)\n self.assertTrue('www.example.com' not in am.addr)", "metadata": "root.AddrMapTests.test_expires_with_update", "header": "['class', 'AddrMapTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": " def test_8596_cached_1(self):\n clock = task.Clock()\n am = AddrMap()\n am.scheduler = IReactorTime(clock)\n\n line = 'example.com 192.0.2.1 NEVER CACHED=\"YES\"'\n am.update(line)\n\n self.assertTrue('example.com' in am.addr)\n self.assertEqual(len(clock.getDelayedCalls()), 0)", "metadata": "root.AddrMapTests.test_8596_cached_1", "header": "['class', 'AddrMapTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 134 }, { "content": " def test_8596_cached_2(self):\n clock = task.Clock()\n am = AddrMap()\n am.scheduler = IReactorTime(clock)\n\n line = 'example.com 192.0.43.10 \"2013-04-03 22:29:11\" EXPIRES=\"2013-04-03 20:29:11\" CACHED=\"NO\"'\n am.update(line)\n\n self.assertTrue('example.com' in am.addr)\n self.assertEqual(len(clock.getDelayedCalls()), 1)", "metadata": "root.AddrMapTests.test_8596_cached_2", "header": "['class', 'AddrMapTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 145 }, { "content": " def test_8596_cached_3(self):\n clock = task.Clock()\n am = AddrMap()\n am.scheduler = IReactorTime(clock)\n\n line = 'example.invalid <error> \"2013-04-03 08:28:52\" error=yes EXPIRES=\"2013-04-03 06:28:52\" CACHE=\"NO\"'\n am.update(line)\n\n self.assertTrue('example.invalid' not in am.addr)\n self.assertEqual(len(clock.getDelayedCalls()), 0)", "metadata": "root.AddrMapTests.test_8596_cached_3", "header": "['class', 'AddrMapTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 156 } ]
[ { "span": "self.assertTrue('www.example.com' in am.addr)", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 53 }, { "span": "self.assertTrue('www.example.com' not in am.addr)", "start_line": 61, "start_column": 8, "end_line": 61, "end_column": 57 }, { "span": "self.assertTrue('www.example.com' in am.addr)", "start_line": 76, "start_column": 8, "end_line": 76, "end_column": 53 }, { "span": "self.assertTrue('www.example.com' in am.addr)", "start_line": 93, "start_column": 8, "end_line": 93, "end_column": 53 }, { "span": "self.assertTrue('www.example.com' not in am.addr)", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 57 }, { "span": "self.assertTrue('www.example.com' in am.addr)", "start_line": 122, "start_column": 8, "end_line": 122, "end_column": 53 }, { "span": "self.assertTrue('www.example.com' in am.addr)", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 53 }, { "span": "self.assertTrue('www.example.com' not in am.addr)", "start_line": 132, "start_column": 8, "end_line": 132, "end_column": 57 }, { "span": "self.assertTrue('example.com' in am.addr)", "start_line": 142, "start_column": 8, "end_line": 142, "end_column": 49 }, { "span": "self.assertTrue('example.com' in am.addr)", "start_line": 153, "start_column": 8, "end_line": 153, "end_column": 49 }, { "span": "self.assertTrue('example.invalid' not in am.addr)", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 57 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Add", "r", "Map", "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", "expires_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "simp", "ly", " ", "expir", "y", " ", "case", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "=_", "task_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "=_", "Add", "r", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "scheduler_", "=_", "IR", "eac", "tor", "Time_", "(_", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now", "utc_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "'", "www", ".", "example", ".", "com", " ", "72.", "30.", "2.4", "3", " ", "\"%", "s", "\"", " ", "EXPIRE", "S", "=\"", "%", "s", "\"'_", "%_", "(_", "now_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ",_", "now", "utc_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "advance", " ", "time", " ", "past", " ", "whe", "n", " ", "the", " ", "expir", "y", " ", "shou", "ld", " ", "have", " ", "occur", "red_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "._", "advance_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "not_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "r", "Map", "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", "expir", "es", "\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "a", " ", "NE", "VER", " ", "expir", "es", " ", "line", ",", " ", "as", " ", "in", " ", "what", " ", "we", "'", "d", " ", "get", " ", "a", " ", "start", "up", " ", "for", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "configur", "ed", " ", "address", "-", "mapping", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "=_", "task_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "=_", "Add", "r", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "scheduler_", "=_", "IR", "eac", "tor", "Time_", "(_", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "'", "www", ".", "example", ".", "com", " ", "72.", "30.", "2.4", "3", " ", "\"", "NE", "VER", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "clock_", "._", "get", "Delay", "ed", "Calls", "_", "(_", ")_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "r", "Map", "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", "expir", "es", "\\u", "old_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "somet", "hing", " ", "tha", "t", " ", "expir", "es", " ", "bef", "ore", " ", "\"", "now", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "=_", "task_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "=_", "Add", "r", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "scheduler_", "=_", "IR", "eac", "tor", "Time_", "(_", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "-_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now", "utc_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "-_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "'", "www", ".", "example", ".", "com", " ", "72.", "30.", "2.4", "3", " ", "\"%", "s", "\"", " ", "EXPIRE", "S", "=\"", "%", "s", "\"'_", "%_", "(_", "now_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ",_", "now", "utc_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "argu", "abl", "y", " ", "we", " ", "shou", "ld", "n", "'", "t", " ", "even", " ", "have", " ", "put", " ", "this", " ", "in", " ", "the", " ", "map", " ", "may", "be", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "the", " ", "react", "or", " ", "need", "s", " ", "to", " ", "iterate", " ", "bef", "ore", " ", "our", " ", "expir", "y", " ", "callback_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gets", " ", "call", "ed", " ", "(", "right", " ", "awa", "y", ")", " ", "whi", "ch", " ", "is", " ", "simulat", "ed", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clock", ".", "advance", " ", "call_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "._", "advance_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "not_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "r", "Map", "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", "expir", "es", "\\u", "with", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "test", " ", "update", "s", " ", "the", " ", "expir", "y", " ", "time", " ", "and", " ", "checks", " ", "tha", "t", " ", "we", " ", "proper", "ly", "\\", "10", ";", " ", " ", " ", " ", "dela", "y", " ", "our", " ", "expir", "y", " ", "callback", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock_", "=_", "task_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "=_", "Add", "r", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "scheduler_", "=_", "IR", "eac", "tor", "Time_", "(_", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "do", " ", "an", " ", "actual", " ", "update", " ", "to", " ", "an", " ", "exist", "ing", " ", "Add", "r", " ", "entry", "._", "\\u\\u\\uNL\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now", "utc_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "'", "www", ".", "example", ".", "com", " ", "72.", "30.", "2.4", "3", " ", "\"%", "s", "\"", " ", "EXPIRE", "S", "=\"", "%", "s", "\"'_", "%_", "(_", "now_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ",_", "now", "utc_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "am_", "._", "find_", "(_", "'", "www", ".", "example", ".", "com", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now", "utc_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "'", "www", ".", "example", ".", "com", " ", "72.", "30.", "2.4", "3", " ", "\"%", "s", "\"", " ", "EXPIRE", "S", "=\"", "%", "s", "\"'_", "%_", "(_", "now_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ",_", "now", "utc_", "._", "strftime_", "(_", "self_", "._", "fmt_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "advance", " ", "time", " ", "by", " ", "the", " ", "old", " ", "expir", "y", " ", "value", " ", "and", " ", "we", " ", "shou", "ld", " ", "still", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "entry_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "._", "advance_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", "but", " ", "advance", " ", "past", " ", "the", " ", "new", " ", "expir", "y", " ", "(", "anot", "her", " ", "10", " ", "second", "s", ")", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "shou", "ld", " ", "vani", "sh_", "\\u\\u\\uNL\\u\\u\\u_", "clock_", "._", "advance_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "www", ".", "example", ".", "com", "'_", "not_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "r", "Map", "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", "859", "6", "\\u", "cache", "d\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clock_", "=_", "task_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "=_", "Add", "r", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "scheduler_", "=_", "IR", "eac", "tor", "Time_", "(_", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "'", "example", ".", "com", " ", "192", ".0", ".2", ".1", " ", "NE", "VER", " ", "CACHE", "D", "=\"", "YE", "S", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "example", ".", "com", "'_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "clock_", "._", "get", "Delay", "ed", "Calls", "_", "(_", ")_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "r", "Map", "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", "859", "6", "\\u", "cache", "d\\u", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clock_", "=_", "task_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "=_", "Add", "r", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "scheduler_", "=_", "IR", "eac", "tor", "Time_", "(_", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "'", "example", ".", "com", " ", "192", ".0", ".4", "3.1", "0", " ", "\"", "2013", "-0", "4", "-0", "3", " ", "2", "2", ":", "2", "9", ":", "11", "\"", " ", "EXPIRE", "S", "=\"", "2013", "-0", "4", "-0", "3", " ", "20", ":", "2", "9", ":", "11", "\"", " ", "CACHE", "D", "=\"", "NO", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "example", ".", "com", "'_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "clock_", "._", "get", "Delay", "ed", "Calls", "_", "(_", ")_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "r", "Map", "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", "859", "6", "\\u", "cache", "d\\u", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clock_", "=_", "task_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "=_", "Add", "r", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "scheduler_", "=_", "IR", "eac", "tor", "Time_", "(_", "clock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "'", "example", ".", "invalid", " ", "<", "error", ">", " ", "\"", "2013", "-0", "4", "-0", "3", " ", "0", "8", ":", "2", "8", ":", "5", "2", "\"", " ", "error", "=", "ye", "s", " ", "EXPIRE", "S", "=\"", "2013", "-0", "4", "-0", "3", " ", "0", "6", ":", "2", "8", ":", "5", "2", "\"", " ", "CACHE", "=\"", "NO", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "am_", "._", "update_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "example", ".", "invalid", "'_", "not_", "in_", "am_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "clock_", "._", "get", "Delay", "ed", "Calls", "_", "(_", ")_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 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 ]
Testing equality to None
beebotte/bbt_python/beebotte/__init__.py
[ { "content": " def __init__(self, akey = None, skey = None, token = None, hostname = \"api.beebotte.com\", port = \"80\", ssl = False):\n if akey and skey and token == None :\n self.akey = akey\n self.skey = skey\n elif akey == None and skey == None and token:\n self.token = token\n else:\n raise InitializationError(\"Initialization Error; Message: You must specify either (1) your access and secret keys pair or (2) your channel token!\")\n\n self.hostname = hostname\n self.port = port\n self.ssl = ssl", "metadata": "root.BBT.__init__", "header": "['class', 'BBT', ':', '___EOS___']", "index": 41 }, { "content": " def getUserConnections(self, userid = None, sid = None):\n if self.skey == None:\n raise AuthenticationError(\"Authentication Error; Message: This method requires access key and secret key authentication!\")\n\n endpoint = __connectionsEndpoint__\n query = None\n if userid != None:\n endpoint = \"%s/%s\" % ( __connectionsEndpoint__, userid )\n elif sid != None:\n query = {'sid': sid}\n\n response = self.__getData__( endpoint, query, True )\n return response;", "metadata": "root.BBT.getUserConnections", "header": "['class', 'BBT', ':', '___EOS___']", "index": 448 }, { "content": " def dropUserConnection(self, userid, sid = None):\n if self.skey == None:\n raise AuthenticationError(\"Authentication Error; Message: This method requires access key and secret key authentication!\")\n\n query = None\n if sid != None:\n query = {'sid': sid}\n\n endpoint = \"%s/drop/%s\" % ( __connectionsEndpoint__, userid )\n response = self.__deleteData__( endpoint, query, True )\n return response;", "metadata": "root.BBT.dropUserConnection", "header": "['class', 'BBT', ':', '___EOS___']", "index": 471 }, { "content": " def getResource(self, channel, resource = None):\n if self.skey == None:\n raise AuthenticationError(\"Authentication Error; Message: This method requires access key and secret key authentication!\")\n\n endpoint = \"%s/%s/resources\" % ( __channelsEndpoint__, channel )\n\n if resource != None:\n endpoint = \"%s/%s\" % ( endpoint, resource )\n\n response = self.__getData__( endpoint, None, True )\n return response;", "metadata": "root.BBT.getResource", "header": "['class', 'BBT', ':', '___EOS___']", "index": 496 }, { "content": " def deleteResource(self, channel, resource):\n if self.skey == None:\n raise AuthenticationError(\"Authentication Error; Message: This method requires access key and secret key authentication!\")\n\n endpoint = \"%s/%s/resources/%s\" % ( __channelsEndpoint__, channel, resource )\n response = self.__deleteData__( endpoint, None, True )\n return response;", "metadata": "root.BBT.deleteResource", "header": "['class', 'BBT', ':', '___EOS___']", "index": 516 }, { "content": " def getChannel(self, channel = None):\n if self.skey == None:\n raise AuthenticationError(\"Authentication Error; Message: This method requires access key and secret key authentication!\")\n\n endpoint = __channelsEndpoint__\n\n if channel != None:\n endpoint = \"%s/%s\" % ( endpoint, channel )\n\n response = self.__getData__( endpoint, None, True )\n return response;", "metadata": "root.BBT.getChannel", "header": "['class', 'BBT', ':', '___EOS___']", "index": 531 }, { "content": " def deleteChannel(self, channel):\n if self.skey == None:\n raise AuthenticationError(\"Authentication Error; Message: This method requires access key and secret key authentication!\")\n\n endpoint = \"%s/%s\" % ( __channelsEndpoint__, channel )\n response = self.__deleteData__( endpoint, None, True )\n return response;", "metadata": "root.BBT.deleteChannel", "header": "['class', 'BBT', ':', '___EOS___']", "index": 550 }, { "content": " def regenerateChannelToken(self, channel):\n if self.skey == None:\n raise AuthenticationError(\"Authentication Error; Message: This method requires access key and secret key authentication!\")\n\n endpoint = \"%s/%s/token/regenerate\" % ( __channelsEndpoint__, channel )\n\n response = self.__getData__( endpoint, None, True )\n return response;", "metadata": "root.BBT.regenerateChannelToken", "header": "['class', 'BBT', ':', '___EOS___']", "index": 566 } ]
[ { "span": "token == None ", "start_line": 42, "start_column": 25, "end_line": 42, "end_column": 38 }, { "span": "akey == None ", "start_line": 45, "start_column": 9, "end_line": 45, "end_column": 21 }, { "span": "skey == None ", "start_line": 45, "start_column": 26, "end_line": 45, "end_column": 38 }, { "span": "self.skey == None:", "start_line": 449, "start_column": 7, "end_line": 449, "end_column": 24 }, { "span": "self.skey == None:", "start_line": 472, "start_column": 7, "end_line": 472, "end_column": 24 }, { "span": "self.skey == None:", "start_line": 497, "start_column": 7, "end_line": 497, "end_column": 24 }, { "span": "self.skey == None:", "start_line": 517, "start_column": 7, "end_line": 517, "end_column": 24 }, { "span": "self.skey == None:", "start_line": 532, "start_column": 7, "end_line": 532, "end_column": 24 }, { "span": "self.skey == None:", "start_line": 551, "start_column": 7, "end_line": 551, "end_column": 24 }, { "span": "self.skey == None:", "start_line": 567, "start_column": 7, "end_line": 567, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ake", "y_", "=_", "None_", ",_", "skey", "_", "=_", "None_", ",_", "token_", "=_", "None_", ",_", "hostname_", "=_", "\"", "api", ".", "bee", "bot", "te", ".", "com", "\"_", ",_", "port_", "=_", "\"", "80", "\"_", ",_", "ssl_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ake", "y_", "and_", "skey", "_", "and_", "token_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ake", "y_", "=_", "ake", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "skey", "_", "=_", "skey", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ake", "y_", "==_", "None_", "and_", "skey", "_", "==_", "None_", "and_", "token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "token_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Initializ", "ation", "Error_", "(_", "\"", "Initializ", "ation", " ", "Error", ";", " ", "Messag", "e", ":", " ", "You", " ", "must", " ", "speci", "fy", " ", "eit", "her", " ", "(", "1", ")", " ", "your", " ", "access", " ", "and", " ", "secret", " ", "keys", " ", "pair", " ", "or", " ", "(", "2", ")", " ", "your", " ", "channel", " ", "token", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "hostname_", "=_", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssl_", "=_", "ssl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "User", "Connections_", "(_", "self_", ",_", "userid_", "=_", "None_", ",_", "sid_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "skey", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Auth", "entica", "tion", "Error_", "(_", "\"", "Auth", "entica", "tion", " ", "Error", ";", " ", "Messag", "e", ":", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "access", " ", "key", " ", "and", " ", "secret", " ", "key", " ", "authenticat", "ion", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint_", "=_", "\\u\\u", "connections", "End", "point", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "userid_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "\\u\\u", "connections", "End", "point", "\\u\\u_", ",_", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sid_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "{_", "'", "sid", "'_", ":_", "sid_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u\\u", "get", "Data", "\\u\\u_", "(_", "endpoint_", ",_", "query_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "drop", "User", "Connection_", "(_", "self_", ",_", "userid_", ",_", "sid_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "skey", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Auth", "entica", "tion", "Error_", "(_", "\"", "Auth", "entica", "tion", " ", "Error", ";", " ", "Messag", "e", ":", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "access", " ", "key", " ", "and", " ", "secret", " ", "key", " ", "authenticat", "ion", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sid_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "{_", "'", "sid", "'_", ":_", "sid_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint_", "=_", "\"%", "s", "/", "drop", "/", "%", "s", "\"_", "%_", "(_", "\\u\\u", "connections", "End", "point", "\\u\\u_", ",_", "userid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u\\u", "delete", "Data", "\\u\\u_", "(_", "endpoint_", ",_", "query_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Resource_", "(_", "self_", ",_", "channel_", ",_", "resource_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "skey", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Auth", "entica", "tion", "Error_", "(_", "\"", "Auth", "entica", "tion", " ", "Error", ";", " ", "Messag", "e", ":", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "access", " ", "key", " ", "and", " ", "secret", " ", "key", " ", "authenticat", "ion", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint_", "=_", "\"%", "s", "/", "%", "s", "/", "resource", "s", "\"_", "%_", "(_", "\\u\\u", "channel", "s", "End", "point", "\\u\\u_", ",_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "resource_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "endpoint_", ",_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u\\u", "get", "Data", "\\u\\u_", "(_", "endpoint_", ",_", "None_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "Resource_", "(_", "self_", ",_", "channel_", ",_", "resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "skey", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Auth", "entica", "tion", "Error_", "(_", "\"", "Auth", "entica", "tion", " ", "Error", ";", " ", "Messag", "e", ":", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "access", " ", "key", " ", "and", " ", "secret", " ", "key", " ", "authenticat", "ion", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint_", "=_", "\"%", "s", "/", "%", "s", "/", "resource", "s", "/", "%", "s", "\"_", "%_", "(_", "\\u\\u", "channel", "s", "End", "point", "\\u\\u_", ",_", "channel_", ",_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u\\u", "delete", "Data", "\\u\\u_", "(_", "endpoint_", ",_", "None_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Channel_", "(_", "self_", ",_", "channel_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "skey", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Auth", "entica", "tion", "Error_", "(_", "\"", "Auth", "entica", "tion", " ", "Error", ";", " ", "Messag", "e", ":", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "access", " ", "key", " ", "and", " ", "secret", " ", "key", " ", "authenticat", "ion", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint_", "=_", "\\u\\u", "channel", "s", "End", "point", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "channel_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "endpoint_", ",_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u\\u", "get", "Data", "\\u\\u_", "(_", "endpoint_", ",_", "None_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete", "Channel_", "(_", "self_", ",_", "channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "skey", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Auth", "entica", "tion", "Error_", "(_", "\"", "Auth", "entica", "tion", " ", "Error", ";", " ", "Messag", "e", ":", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "access", " ", "key", " ", "and", " ", "secret", " ", "key", " ", "authenticat", "ion", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "\\u\\u", "channel", "s", "End", "point", "\\u\\u_", ",_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u\\u", "delete", "Data", "\\u\\u_", "(_", "endpoint_", ",_", "None_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "BB", "T_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "regenerate", "Chan", "nel", "Token_", "(_", "self_", ",_", "channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "skey", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Auth", "entica", "tion", "Error_", "(_", "\"", "Auth", "entica", "tion", " ", "Error", ";", " ", "Messag", "e", ":", " ", "Thi", "s", " ", "method", " ", "require", "s", " ", "access", " ", "key", " ", "and", " ", "secret", " ", "key", " ", "authenticat", "ion", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "endpoint_", "=_", "\"%", "s", "/", "%", "s", "/", "token", "/", "regenerate", "\"_", "%_", "(_", "\\u\\u", "channel", "s", "End", "point", "\\u\\u_", ",_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u\\u", "get", "Data", "\\u\\u_", "(_", "endpoint_", ",_", "None_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", ";_", "\\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, 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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 ]
Unused local variable
menpo/menpo/menpo/transform/test/compose_chain_test.py
[ { "content": "def chain_compose_after_inplace_chain_test():\n a = PointCloud(np.random.random([10, 2]))\n b = PointCloud(np.random.random([10, 2]))\n\n t = Translation([3, 4])\n s = Scale([4, 2])\n chain_1 = TransformChain([t, s])\n chain_2 = TransformChain([s.pseudoinverse(), t.pseudoinverse()])\n chain_1.compose_before_inplace(chain_2)\n\n points = PointCloud(np.random.random([10, 2]))\n chain_res = chain_1.apply(points)\n assert(np.allclose(points.points, chain_res.points))", "metadata": "root.chain_compose_after_inplace_chain_test", "header": "['module', '___EOS___']", "index": 156 } ]
[ { "span": "a ", "start_line": 157, "start_column": 4, "end_line": 157, "end_column": 5 }, { "span": "b ", "start_line": 158, "start_column": 4, "end_line": 158, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "chain", "\\u", "compose", "\\u", "after", "\\u", "inpla", "ce", "\\u", "chain", "\\u", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "Point", "Cloud_", "(_", "np_", "._", "random_", "._", "random_", "(_", "[_", "10_", ",_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "Point", "Cloud_", "(_", "np_", "._", "random_", "._", "random_", "(_", "[_", "10_", ",_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "Translation_", "(_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Scale_", "(_", "[_", "4_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chain", "\\u", "1_", "=_", "Transform", "Chain_", "(_", "[_", "t_", ",_", "s_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chain", "\\u", "2_", "=_", "Transform", "Chain_", "(_", "[_", "s_", "._", "pseudo", "inverse_", "(_", ")_", ",_", "t_", "._", "pseudo", "inverse_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chain", "\\u", "1_", "._", "compose", "\\u", "bef", "ore", "\\u", "inplace_", "(_", "chain", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "Point", "Cloud_", "(_", "np_", "._", "random_", "._", "random_", "(_", "[_", "10_", ",_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chain", "\\u", "res_", "=_", "chain", "\\u", "1_", "._", "apply_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "np_", "._", "allclose_", "(_", "points_", "._", "points_", ",_", "chain", "\\u", "res_", "._", "points_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
lord63/tldr.py/tests/basic.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\n\nimport os\nfrom os import path\nimport unittest\n\nfrom click.testing import CliRunner\nfrom tldr import cli\nimport mock\n\n\nROOT = path.dirname(path.realpath(__file__))\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "click_", "._", "testing_", "import_", "Cli", "Runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tld", "r_", "import_", "cli_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ROOT_", "=_", "path_", "._", "dirname_", "(_", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
sippy/b2bua/sippy/SipRequest.py
[ { "content": " def __init__(self, buf = None, method = None, ruri = None, sipver = 'SIP/2.0', to = None, fr0m = None, via = None, cseq = None, \\\n callid = None, maxforwards = None, body = None, contact = None, routes = (), target = None, cguid = None,\n user_agent = None, expires = None):\n SipMsg.__init__(self, buf)\n if buf != None:\n return\n self.method = method\n self.ruri = ruri\n if target == None:\n if len(routes) == 0:\n self.setTarget(self.ruri.getAddr())\n else:\n self.setTarget(routes[0].getAddr())\n else:\n self.setTarget(target)\n self.sipver = sipver\n self.appendHeader(SipHeader(name = 'via', body = via))\n if via == None:\n self.getHFBody('via').genBranch()\n self.appendHeaders([SipHeader(name = 'route', body = x) for x in routes])\n self.appendHeader(SipHeader(name = 'max-forwards', body = maxforwards))\n self.appendHeader(SipHeader(name = 'from', body = fr0m))\n if to == None:\n to = SipTo(address = SipAddress(url = ruri))\n self.appendHeader(SipHeader(name = 'to', body = to))\n self.appendHeader(SipHeader(name = 'call-id', body = callid))\n self.appendHeader(SipHeader(name = 'cseq', body = SipCSeq(cseq = cseq, method = method)))\n if contact != None:\n self.appendHeader(SipHeader(name = 'contact', body = contact))\n if expires == None and method == 'INVITE':\n expires = SipHeader(name = 'expires')\n self.appendHeader(expires)\n elif expires != None:\n expires = SipHeader(name = 'expires', body = expires)\n self.appendHeader(expires)\n if user_agent != None:\n self.user_agent = user_agent\n self.appendHeader(SipHeader(name = 'user-agent', bodys = user_agent))\n else:\n self.appendHeader(SipHeader(name = 'user-agent'))\n if cguid != None:\n self.appendHeader(SipHeader(name = 'cisco-guid', body = cguid))\n self.appendHeader(SipHeader(name = 'h323-conf-id', body = cguid))\n if body != None:\n self.setBody(body)", "metadata": "root.SipRequest.__init__", "header": "['class', 'SipRequest', '(', 'SipMsg', ')', ':', '___EOS___']", "index": 41 }, { "content": " def genACK(self, to = None):\n if to == None:\n to = self.getHFBody('to').getCopy()\n maxforwards = self.getHFBodys('max-forwards')\n if len(maxforwards) > 0:\n maxforward = maxforwards[0].getCopy()\n else:\n maxforward = None\n return SipRequest(method = 'ACK', ruri = self.ruri.getCopy(), sipver = self.sipver, \\\n fr0m = self.getHFBCopy('from'), to = to, \\\n via = self.getHFBCopy('via'), callid = self.getHFBCopy('call-id'), \\\n cseq = self.getHFBody('cseq').getCSeqNum(), maxforwards = maxforward, \\\n user_agent = self.user_agent)", "metadata": "root.SipRequest.genACK", "header": "['class', 'SipRequest', '(', 'SipMsg', ')', ':', '___EOS___']", "index": 114 }, { "content": " def genRequest(self, method, cseq = None):\n if cseq == None:\n cseq = self.getHFBody('cseq').getCSeqNum()\n maxforwards = self.getHFBodys('max-forwards')\n if len(maxforwards) > 0:\n maxforward = maxforwards[0].getCopy()\n else:\n maxforward = None\n expires = self.getHFBodys('expires')\n if len(expires) > 0:\n expires = expires[0].getCopy()\n else:\n expires = None\n return SipRequest(method = method, ruri = self.ruri.getCopy(), sipver = self.sipver, \\\n fr0m = self.getHFBCopy('from'), to = self.getHFBCopy('to'), \\\n via = self.getHFBCopy('via'), callid = self.getHFBCopy('call-id'), \\\n cseq = cseq, maxforwards = maxforward, \\\n user_agent = self.user_agent, expires = expires)", "metadata": "root.SipRequest.genRequest", "header": "['class', 'SipRequest', '(', 'SipMsg', ')', ':', '___EOS___']", "index": 141 } ]
[ { "span": "target == None:", "start_line": 49, "start_column": 11, "end_line": 49, "end_column": 25 }, { "span": "via == None:", "start_line": 58, "start_column": 11, "end_line": 58, "end_column": 22 }, { "span": "to == None:", "start_line": 63, "start_column": 11, "end_line": 63, "end_column": 21 }, { "span": "expires == None ", "start_line": 70, "start_column": 11, "end_line": 70, "end_column": 26 }, { "span": "to == None:", "start_line": 115, "start_column": 11, "end_line": 115, "end_column": 21 }, { "span": "cseq == None:", "start_line": 142, "start_column": 11, "end_line": 142, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Si", "p", "Request_", "(_", "Si", "p", "Msg_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "buf_", "=_", "None_", ",_", "method_", "=_", "None_", ",_", "ru", "ri_", "=_", "None_", ",_", "sip", "ver_", "=_", "'", "SI", "P", "/", "2.0", "'_", ",_", "to_", "=_", "None_", ",_", "fr", "0", "m_", "=_", "None_", ",_", "via_", "=_", "None_", ",_", "cse", "q_", "=_", "None_", ",_", "call", "id_", "=_", "None_", ",_", "maxf", "or", "ward", "s_", "=_", "None_", ",_", "body_", "=_", "None_", ",_", "contact_", "=_", "None_", ",_", "routes_", "=_", "(_", ")_", ",_", "target_", "=_", "None_", ",_", "cg", "uid_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "agent_", "=_", "None_", ",_", "expires_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Si", "p", "Msg_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "buf_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ru", "ri_", "=_", "ru", "ri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "routes_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Target_", "(_", "self_", "._", "ru", "ri_", "._", "get", "Addr_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Target_", "(_", "routes_", "[_", "0_", "]_", "._", "get", "Addr_", "(_", ")_", ")_", "\\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_", "._", "set", "Target_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sip", "ver_", "=_", "sip", "ver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "via", "'_", ",_", "body_", "=_", "via_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "via_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "HF", "Body_", "(_", "'", "via", "'_", ")_", "._", "gen", "Branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "append", "Headers_", "(_", "[_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "route", "'_", ",_", "body_", "=_", "x_", ")_", "for_", "x_", "in_", "routes_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "max", "-", "forward", "s", "'_", ",_", "body_", "=_", "maxf", "or", "ward", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "from", "'_", ",_", "body_", "=_", "fr", "0", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "to_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to_", "=_", "Si", "p", "To_", "(_", "address_", "=_", "Si", "p", "Address_", "(_", "url_", "=_", "ru", "ri_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "to", "'_", ",_", "body_", "=_", "to_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "call", "-", "id", "'_", ",_", "body_", "=_", "call", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "cse", "q", "'_", ",_", "body_", "=_", "Si", "p", "CS", "eq_", "(_", "cse", "q_", "=_", "cse", "q_", ",_", "method_", "=_", "method_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contact_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "contact", "'_", ",_", "body_", "=_", "contact_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "expires_", "==_", "None_", "and_", "method_", "==_", "'", "INVI", "TE", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expires_", "=_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "expir", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "expires_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "expires_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expires_", "=_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "expir", "es", "'_", ",_", "body_", "=_", "expires_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "expires_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user", "\\u", "agent_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "\\u", "agent_", "=_", "user", "\\u", "agent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "user", "-", "agent", "'_", ",_", "body", "s_", "=_", "user", "\\u", "agent_", ")_", ")_", "\\u\\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_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "user", "-", "agent", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cg", "uid_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "cis", "co", "-", "guid", "'_", ",_", "body_", "=_", "cg", "uid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "append", "Header_", "(_", "Si", "p", "Header_", "(_", "name_", "=_", "'", "h", "323", "-", "conf", "-", "id", "'_", ",_", "body_", "=_", "cg", "uid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "body_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Body_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Si", "p", "Request_", "(_", "Si", "p", "Msg_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gen", "ACK_", "(_", "self_", ",_", "to_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "to_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to_", "=_", "self_", "._", "get", "HF", "Body_", "(_", "'", "to", "'_", ")_", "._", "get", "Copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "maxf", "or", "ward", "s_", "=_", "self_", "._", "get", "HF", "Bod", "ys_", "(_", "'", "max", "-", "forward", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "maxf", "or", "ward", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxf", "or", "ward", "_", "=_", "maxf", "or", "ward", "s_", "[_", "0_", "]_", "._", "get", "Copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxf", "or", "ward", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Si", "p", "Request_", "(_", "method_", "=_", "'", "AC", "K", "'_", ",_", "ru", "ri_", "=_", "self_", "._", "ru", "ri_", "._", "get", "Copy_", "(_", ")_", ",_", "sip", "ver_", "=_", "self_", "._", "sip", "ver_", ",_", "fr", "0", "m_", "=_", "self_", "._", "get", "HF", "BC", "opy_", "(_", "'", "from", "'_", ")_", ",_", "to_", "=_", "to_", ",_", "via_", "=_", "self_", "._", "get", "HF", "BC", "opy_", "(_", "'", "via", "'_", ")_", ",_", "call", "id_", "=_", "self_", "._", "get", "HF", "BC", "opy_", "(_", "'", "call", "-", "id", "'_", ")_", ",_", "cse", "q_", "=_", "self_", "._", "get", "HF", "Body_", "(_", "'", "cse", "q", "'_", ")_", "._", "get", "CS", "eq", "Num_", "(_", ")_", ",_", "maxf", "or", "ward", "s_", "=_", "maxf", "or", "ward", "_", ",_", "user", "\\u", "agent_", "=_", "self_", "._", "user", "\\u", "agent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Si", "p", "Request_", "(_", "Si", "p", "Msg_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gen", "Request_", "(_", "self_", ",_", "method_", ",_", "cse", "q_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cse", "q_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cse", "q_", "=_", "self_", "._", "get", "HF", "Body_", "(_", "'", "cse", "q", "'_", ")_", "._", "get", "CS", "eq", "Num_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "maxf", "or", "ward", "s_", "=_", "self_", "._", "get", "HF", "Bod", "ys_", "(_", "'", "max", "-", "forward", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "maxf", "or", "ward", "s_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxf", "or", "ward", "_", "=_", "maxf", "or", "ward", "s_", "[_", "0_", "]_", "._", "get", "Copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxf", "or", "ward", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expires_", "=_", "self_", "._", "get", "HF", "Bod", "ys_", "(_", "'", "expir", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "expires_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expires_", "=_", "expires_", "[_", "0_", "]_", "._", "get", "Copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expires_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Si", "p", "Request_", "(_", "method_", "=_", "method_", ",_", "ru", "ri_", "=_", "self_", "._", "ru", "ri_", "._", "get", "Copy_", "(_", ")_", ",_", "sip", "ver_", "=_", "self_", "._", "sip", "ver_", ",_", "fr", "0", "m_", "=_", "self_", "._", "get", "HF", "BC", "opy_", "(_", "'", "from", "'_", ")_", ",_", "to_", "=_", "self_", "._", "get", "HF", "BC", "opy_", "(_", "'", "to", "'_", ")_", ",_", "via_", "=_", "self_", "._", "get", "HF", "BC", "opy_", "(_", "'", "via", "'_", ")_", ",_", "call", "id_", "=_", "self_", "._", "get", "HF", "BC", "opy_", "(_", "'", "call", "-", "id", "'_", ")_", ",_", "cse", "q_", "=_", "cse", "q_", ",_", "maxf", "or", "ward", "s_", "=_", "maxf", "or", "ward", "_", ",_", "user", "\\u", "agent_", "=_", "self_", "._", "user", "\\u", "agent_", ",_", "expires_", "=_", "expires_", ")_" ]
[ 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, 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, 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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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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
appnexus/schema-tool/schematool/mysql/connector/constants.py
[ { "content": " @classmethod\n def get_desc(cls,name):\n try:\n return cls.desc[name][1]\n except:\n return None", "metadata": "root._constants.get_desc", "header": "['class', '_constants', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " @classmethod\n def get_default_collation(cls, charset):\n \"\"\"Retrieves the default collation for given character set\n \n Raises ProgrammingError when character set is not supported.\n \n Returns list (collation, charset, index)\n \"\"\"\n if isinstance(charset, int):\n try:\n c = cls.desc[charset]\n return c[1], c[0], charset\n except:\n ProgrammingError(\"Character set ID '%s' unsupported.\" % (\n charset))\n \n for cid, c in enumerate(cls.desc):\n if c is None:\n continue\n if c[0] == charset and c[2] is True:\n return c[1], c[0], cid\n \n raise ProgrammingError(\"Character set '%s' unsupported.\" % (charset))", "metadata": "root.CharacterSet.get_default_collation", "header": "['class', 'CharacterSet', '(', '_constants', ')', ':', '___EOS___']", "index": 708 } ]
[ { "span": "except:", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 15 }, { "span": "except:", "start_line": 720, "start_column": 10, "end_line": 720, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "\\u", "constants_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "desc_", "(_", "cls_", ",_", "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 ", " _", "return_", "cls_", "._", "desc_", "[_", "name_", "]_", "[_", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Char", "acte", "r", "Set_", "(_", "\\u", "constants_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "collatio", "n_", "(_", "cls_", ",_", "charset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", "s", " ", "the", " ", "default", " ", "collatio", "n", " ", "for", " ", "give", "n", " ", "character", " ", "set", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Rai", "ses", " ", "Programm", "ing", "Error", " ", "whe", "n", " ", "character", " ", "set", " ", "is", " ", "not", " ", "support", "ed", ".", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Return", "s", " ", "list", " ", "(", "collatio", "n", ",", " ", "charset", ",", " ", "index", ")", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "charset_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "cls_", "._", "desc_", "[_", "charset_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "c_", "[_", "1_", "]_", ",_", "c_", "[_", "0_", "]_", ",_", "charset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Programm", "ing", "Error_", "(_", "\"", "Char", "acte", "r", " ", "set", " ", "ID", " ", "'%", "s", "'", " ", "unsup", "porte", "d", ".\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "charset_", ")_", ")_", "\\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_", "cid_", ",_", "c_", "in_", "enumerate_", "(_", "cls_", "._", "desc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "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_", "c_", "[_", "0_", "]_", "==_", "charset_", "and_", "c_", "[_", "2_", "]_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "c_", "[_", "1_", "]_", ",_", "c_", "[_", "0_", "]_", ",_", "cid_", "\\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_", "Programm", "ing", "Error_", "(_", "\"", "Char", "acte", "r", " ", "set", " ", "'%", "s", "'", " ", "unsup", "porte", "d", ".\"_", "%_", "(_", "charset_", ")_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First parameter of a method is not named 'self'
RoseOu/flasky/venv/lib/python2.7/site-packages/pygments/lexers/math.py
[ { "content": " def analyse_text(text):\n return shebang_matches(text, r'julia')", "metadata": "root.JuliaLexer.analyse_text", "header": "['class', 'JuliaLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 137 }, { "content": " def analyse_text(text):\n if re.match('^\\s*%', text, re.M): # comment\n return 0.9\n elif re.match('^!\\w+', text, re.M): # system cmd\n return 0.9\n return 0.1", "metadata": "root.MatlabLexer.analyse_text", "header": "['class', 'MatlabLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 370 }, { "content": " def analyse_text(text):\n if re.match('^\\s*[%#]', text, re.M): #Comment\n return 0.1", "metadata": "root.OctaveLexer.analyse_text", "header": "['class', 'OctaveLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 819 }, { "content": " def analyse_text(text):\n return '<-' in text", "metadata": "root.SLexer.analyse_text", "header": "['class', 'SLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1108 }, { "content": " def analyse_text(text):\n if re.search(r\"^\\s*model\\s*{\", text, re.M):\n return 0.7\n else:\n return 0.0", "metadata": "root.BugsLexer.analyse_text", "header": "['class', 'BugsLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1202 }, { "content": " def analyse_text(text):\n if re.search(r'^\\s*model\\s*\\{', text, re.M):\n if re.search(r'^\\s*data\\s*\\{', text, re.M):\n return 0.9\n elif re.search(r'^\\s*var', text, re.M):\n return 0.9\n else:\n return 0.3\n else:\n return 0", "metadata": "root.JagsLexer.analyse_text", "header": "['class', 'JagsLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1284 }, { "content": " def analyse_text(text):\n if re.search(r'^\\s*parameters\\s*\\{', text, re.M):\n return 1.0\n else:\n return 0.0", "metadata": "root.StanLexer.analyse_text", "header": "['class', 'StanLexer', '(', 'RegexLexer', ')', ':', '___EOS___']", "index": 1367 } ]
[ { "span": "def analyse_text(text):", "start_line": 137, "start_column": 4, "end_line": 137, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 370, "start_column": 4, "end_line": 370, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 819, "start_column": 4, "end_line": 819, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1108, "start_column": 4, "end_line": 1108, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1202, "start_column": 4, "end_line": 1202, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1284, "start_column": 4, "end_line": 1284, "end_column": 27 }, { "span": "def analyse_text(text):", "start_line": 1367, "start_column": 4, "end_line": 1367, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Juli", "a", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "she", "bang", "\\u", "matches_", "(_", "text_", ",_", "r", "'", "julia", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mat", "lab", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "match_", "(_", "'", "^", "\\\\", "s", "*", "%'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "#", " ", "comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "'", "^", "!\\\\", "w", "+'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "#", " ", "system", " ", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oct", "ave", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "match_", "(_", "'", "^", "\\\\", "s", "*[", "%#", "]'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "#", "Comment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SL", "exe", "r_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "-'_", "in_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bug", "s", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "\"", "^", "\\\\", "s", "*", "model", "\\\\", "s", "*{", "\"_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.7_", "\\u\\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_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ja", "gs", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "model", "\\\\", "s", "*\\\\", "{'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "data", "\\\\", "s", "*\\\\", "{'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "var", "'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0.9_", "\\u\\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_", "0.3_", "\\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_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stan", "Lexer_", "(_", "Rege", "x", "Lexer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "analyse", "\\u", "text_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "r", "'", "^", "\\\\", "s", "*", "parameter", "s", "\\\\", "s", "*\\\\", "{'_", ",_", "text_", ",_", "re_", "._", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1.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 ", " _", "return_", "0.0_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 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/Models_2D/Power.py
[ { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n\n try:\n temp = a * numpy.power(x_in, (b/x_in))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.Geometric_Modified.CalculateModelPredictions", "header": "['class', 'Geometric_Modified', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 59 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n\n try:\n temp = a * numpy.power(b, x_in)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerA_Modified.CalculateModelPredictions", "header": "['class', 'PowerA_Modified', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 114 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n d = inCoeffs[3]\n\n try:\n temp = a * numpy.power(b, c * x_in + d)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerA_Modified_Transform.CalculateModelPredictions", "header": "['class', 'PowerA_Modified_Transform', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 163 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_LogX = inDataCacheDictionary['LogX'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n\n try:\n temp = numpy.power(a, x_LogX)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerB_Modified.CalculateModelPredictions", "header": "['class', 'PowerB_Modified', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 214 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = numpy.power(a, numpy.log(b * x_in + c))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerB_Modified_Transform.CalculateModelPredictions", "header": "['class', 'PowerB_Modified_Transform', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 262 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n\n try:\n temp = numpy.power(a + x_in, b)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerC_Modified.CalculateModelPredictions", "header": "['class', 'PowerC_Modified', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 312 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = numpy.power(a + b * x_in, c)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerC_Modified_Transform.CalculateModelPredictions", "header": "['class', 'PowerC_Modified_Transform', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 361 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n C = inCoeffs[0]\n T = inCoeffs[1]\n K = inCoeffs[2]\n\n try:\n temp = C * numpy.power(x_in, -1.0 * T) * numpy.exp(-1.0 * x_in / K)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerLawExponentialCutoff.CalculateModelPredictions", "header": "['class', 'PowerLawExponentialCutoff', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 411 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n PowX_Neg1 = inDataCacheDictionary['PowX_-1.0'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n\n try:\n temp = numpy.power(a, PowX_Neg1)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.PowerRoot.CalculateModelPredictions", "header": "['class', 'PowerRoot', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 461 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n\n try:\n temp = numpy.power(x_in, a)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.SimplePower.CalculateModelPredictions", "header": "['class', 'SimplePower', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 509 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n\n try:\n temp = a * numpy.power(x_in, (b*x_in))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.StandardGeometric.CalculateModelPredictions", "header": "['class', 'StandardGeometric', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 557 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n\n try:\n temp = a * numpy.power(x_in, b)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.StandardPower.CalculateModelPredictions", "header": "['class', 'StandardPower', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 606 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n \n a = inCoeffs[0]\n b = inCoeffs[1]\n c = inCoeffs[2]\n\n try:\n temp = a * numpy.power((x_in-b), c)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.XShiftedPower.CalculateModelPredictions", "header": "['class', 'XShiftedPower', '(', 'pyeq2', '.', 'Model_2D_BaseClass', '.', 'Model_2D_BaseClass', ')', ':', '___EOS___']", "index": 655 } ]
[ { "span": "except:", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 15 }, { "span": "except:", "start_line": 123, "start_column": 8, "end_line": 123, "end_column": 15 }, { "span": "except:", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 15 }, { "span": "except:", "start_line": 222, "start_column": 8, "end_line": 222, "end_column": 15 }, { "span": "except:", "start_line": 272, "start_column": 8, "end_line": 272, "end_column": 15 }, { "span": "except:", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 15 }, { "span": "except:", "start_line": 371, "start_column": 8, "end_line": 371, "end_column": 15 }, { "span": "except:", "start_line": 421, "start_column": 8, "end_line": 421, "end_column": 15 }, { "span": "except:", "start_line": 469, "start_column": 8, "end_line": 469, "end_column": 15 }, { "span": "except:", "start_line": 517, "start_column": 8, "end_line": 517, "end_column": 15 }, { "span": "except:", "start_line": 566, "start_column": 8, "end_line": 566, "end_column": 15 }, { "span": "except:", "start_line": 615, "start_column": 8, "end_line": 615, "end_column": 15 }, { "span": "except:", "start_line": 665, "start_column": 8, "end_line": 665, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Geometr", "ic", "\\u", "Modified_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "a_", "*_", "numpy_", "._", "power_", "(_", "x", "\\u", "in_", ",_", "(_", "b_", "/_", "x", "\\u", "in_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "A", "\\u", "Modified_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "a_", "*_", "numpy_", "._", "power_", "(_", "b_", ",_", "x", "\\u", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "A", "\\u", "Modifie", "d\\u", "Transform_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\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 ", " _", "temp_", "=_", "a_", "*_", "numpy_", "._", "power_", "(_", "b_", ",_", "c_", "*_", "x", "\\u", "in_", "+_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "B", "\\u", "Modified_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "Log", "X_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Log", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\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 ", " _", "temp_", "=_", "numpy_", "._", "power_", "(_", "a_", ",_", "x", "\\u", "Log", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "B", "\\u", "Modifie", "d\\u", "Transform_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\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 ", " _", "temp_", "=_", "numpy_", "._", "power_", "(_", "a_", ",_", "numpy_", "._", "log_", "(_", "b_", "*_", "x", "\\u", "in_", "+_", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "C", "\\u", "Modified_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "numpy_", "._", "power_", "(_", "a_", "+_", "x", "\\u", "in_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "C", "\\u", "Modifie", "d\\u", "Transform_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\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 ", " _", "temp_", "=_", "numpy_", "._", "power_", "(_", "a_", "+_", "b_", "*_", "x", "\\u", "in_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "Law", "Expo", "nent", "ial", "Cuto", "ff_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "C_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\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 ", " _", "temp_", "=_", "C_", "*_", "numpy_", "._", "power_", "(_", "x", "\\u", "in_", ",_", "-_", "1.0_", "*_", "T_", ")_", "*_", "numpy_", "._", "exp_", "(_", "-_", "1.0_", "*_", "x", "\\u", "in_", "/_", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Power", "Root_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Pow", "X", "\\u", "Ne", "g1_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Pow", "X", "\\u", "-1", ".0", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\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 ", " _", "temp_", "=_", "numpy_", "._", "power_", "(_", "a_", ",_", "Pow", "X", "\\u", "Ne", "g1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Power_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\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 ", " _", "temp_", "=_", "numpy_", "._", "power_", "(_", "x", "\\u", "in_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Standard", "Geometr", "ic_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "a_", "*_", "numpy_", "._", "power_", "(_", "x", "\\u", "in_", ",_", "(_", "b_", "*_", "x", "\\u", "in_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Standard", "Power_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "a_", "*_", "numpy_", "._", "power_", "(_", "x", "\\u", "in_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XS", "hift", "ed", "Power_", "(_", "pye", "q2_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "2", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\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 ", " _", "temp_", "=_", "a_", "*_", "numpy_", "._", "power_", "(_", "(_", "x", "\\u", "in_", "-_", "b_", ")_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\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_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
walac/pyusb/usb/util.py
[ { "content": "# Copyright (C) 2009-2014 Wander Lairson Costa\n#\n# The following terms apply to all files associated\n# with the software unless explicitly disclaimed in individual files.\n#\n# The authors hereby grant permission to use, copy, modify, distribute,\n# and license this software and its documentation for any purpose, provided\n# that existing copyright notices are retained in all copies and that this\n# notice is included verbatim in any distributions. No written agreement,\n# license, or royalty fee is required for any of the authorized uses.\n# Modifications to this software may be copyrighted by their authors\n# and need not follow the licensing terms described here, provided that\n# the new terms are clearly indicated on the first page of each file where\n# they apply.\n#\n# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY\n# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES\n# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY\n# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n#\n# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,\n# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE\n# IS PROVIDED ON AN \"AS IS\" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE\n# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR\n# MODIFICATIONS.\n\nr\"\"\"usb.util - Utility functions.\n\nThis module exports:\n\nendpoint_address - return the endpoint absolute address.\nendpoint_direction - return the endpoint transfer direction.\nendpoint_type - return the endpoint type\nctrl_direction - return the direction of a control transfer\nbuild_request_type - build a bmRequestType field of a control transfer.\nfind_descriptor - find an inner descriptor.\nclaim_interface - explicitly claim an interface.\nrelease_interface - explicitly release an interface.\ndispose_resources - release internal resources allocated by the object.\nget_langids - retrieve the list of supported string languages from the device.\nget_string - retrieve a string descriptor from the device.\n\"\"\"\n\n__author__ = 'Wander Lairson Costa'\n\nimport operator\nimport array\nfrom sys import hexversion\nimport usb._interop as _interop\n\n# descriptor type\nDESC_TYPE_DEVICE = 0x01\nDESC_TYPE_CONFIG = 0x02\nDESC_TYPE_STRING = 0x03\nDESC_TYPE_INTERFACE = 0x04\nDESC_TYPE_ENDPOINT = 0x05\n\n# endpoint direction\nENDPOINT_IN = 0x80\nENDPOINT_OUT = 0x00\n\n# endpoint type\nENDPOINT_TYPE_CTRL = 0x00\nENDPOINT_TYPE_ISO = 0x01\nENDPOINT_TYPE_BULK = 0x02\nENDPOINT_TYPE_INTR = 0x03\n\n# control request type\nCTRL_TYPE_STANDARD = (0 << 5)\nCTRL_TYPE_CLASS = (1 << 5)\nCTRL_TYPE_VENDOR = (2 << 5)\nCTRL_TYPE_RESERVED = (3 << 5)\n\n# control request recipient\nCTRL_RECIPIENT_DEVICE = 0\nCTRL_RECIPIENT_INTERFACE = 1\nCTRL_RECIPIENT_ENDPOINT = 2\nCTRL_RECIPIENT_OTHER = 3\n\n# control request direction\nCTRL_OUT = 0x00\nCTRL_IN = 0x80\n\n_ENDPOINT_ADDR_MASK = 0x0f\n_ENDPOINT_DIR_MASK = 0x80\n_ENDPOINT_TRANSFER_TYPE_MASK = 0x03\n_CTRL_DIR_MASK = 0x80\n\n# For compatibility between Python 2 and 3\n_dummy_s = '\\x00'.encode('utf-8')\n\n# speed type\nSPEED_LOW = 1\nSPEED_FULL = 2\nSPEED_HIGH = 3\nSPEED_SUPER = 4\nSPEED_UNKNOWN = 0\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def endpoint_address(address):\n r\"\"\"Return the endpoint absolute address.\n\n The address parameter is the bEndpointAddress field\n of the endpoint descriptor.\n \"\"\"\n return address & _ENDPOINT_ADDR_MASK", "metadata": "root.endpoint_address", "header": "['module', '___EOS___']", "index": 100 }, { "content": "def endpoint_direction(address):\n r\"\"\"Return the endpoint direction.\n\n The address parameter is the bEndpointAddress field\n of the endpoint descriptor.\n The possible return values are ENDPOINT_OUT or ENDPOINT_IN.\n \"\"\"\n return address & _ENDPOINT_DIR_MASK", "metadata": "root.endpoint_direction", "header": "['module', '___EOS___']", "index": 108 }, { "content": "def endpoint_type(bmAttributes):\n r\"\"\"Return the transfer type of the endpoint.\n\n The bmAttributes parameter is the bmAttributes field\n of the endpoint descriptor.\n The possible return values are: ENDPOINT_TYPE_CTRL,\n ENDPOINT_TYPE_ISO, ENDPOINT_TYPE_BULK or ENDPOINT_TYPE_INTR.\n \"\"\"\n return bmAttributes & _ENDPOINT_TRANSFER_TYPE_MASK", "metadata": "root.endpoint_type", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def ctrl_direction(bmRequestType):\n r\"\"\"Return the direction of a control request.\n\n The bmRequestType parameter is the value of the\n bmRequestType field of a control transfer.\n The possible return values are CTRL_OUT or CTRL_IN.\n \"\"\"\n return bmRequestType & _CTRL_DIR_MASK", "metadata": "root.ctrl_direction", "header": "['module', '___EOS___']", "index": 127 }, { "content": "def build_request_type(direction, type, recipient):\n r\"\"\"Build a bmRequestType field for control requests.\n\n These is a conventional function to build a bmRequestType\n for a control request.\n\n The direction parameter can be CTRL_OUT or CTRL_IN.\n The type parameter can be CTRL_TYPE_STANDARD, CTRL_TYPE_CLASS,\n CTRL_TYPE_VENDOR or CTRL_TYPE_RESERVED values.\n The recipient can be CTRL_RECIPIENT_DEVICE, CTRL_RECIPIENT_INTERFACE,\n CTRL_RECIPIENT_ENDPOINT or CTRL_RECIPIENT_OTHER.\n\n Return the bmRequestType value.\n \"\"\"\n return recipient | type | direction", "metadata": "root.build_request_type", "header": "['module', '___EOS___']", "index": 136 }, { "content": "def create_buffer(length):\n r\"\"\"Create a buffer to be passed to a read function.\n\n A read function may receive an out buffer so the data\n is read inplace and the object can be reused, avoiding\n the overhead of creating a new object at each new read\n call. This function creates a compatible sequence buffer\n of the given length.\n \"\"\"\n return array.array('B', _dummy_s * length)", "metadata": "root.create_buffer", "header": "['module', '___EOS___']", "index": 152 }, { "content": "def find_descriptor(desc, find_all=False, custom_match=None, **args):\n r\"\"\"Find an inner descriptor.\n\n find_descriptor works in the same way as the core.find() function does,\n but it acts on general descriptor objects. For example, suppose you\n have a Device object called dev and want a Configuration of this\n object with its bConfigurationValue equals to 1, the code would\n be like so:\n\n >>> cfg = util.find_descriptor(dev, bConfigurationValue=1)\n\n You can use any field of the Descriptor as a match criteria, and you\n can supply a customized match just like core.find() does. The\n find_descriptor function also accepts the find_all parameter to get\n an iterator instead of just one descriptor.\n \"\"\"\n def desc_iter(**kwargs):\n for d in desc:\n tests = (val == getattr(d, key) for key, val in kwargs.items())\n if _interop._all(tests) and (custom_match is None or custom_match(d)):\n yield d\n\n if find_all:\n return desc_iter(**args)\n else:\n try:\n return _interop._next(desc_iter(**args))\n except StopIteration:\n return None", "metadata": "root.find_descriptor", "header": "['module', '___EOS___']", "index": 163 }, { "content": "def claim_interface(device, interface):\n r\"\"\"Explicitly claim an interface.\n\n PyUSB users normally do not have to worry about interface claiming,\n as the library takes care of it automatically. But there are situations\n where you need deterministic interface claiming. For these uncommon\n cases, you can use claim_interface.\n\n If the interface is already claimed, either through a previously call\n to claim_interface or internally by the device object, nothing happens.\n \"\"\"\n device._ctx.managed_claim_interface(device, interface)", "metadata": "root.claim_interface", "header": "['module', '___EOS___']", "index": 193 }, { "content": "def release_interface(device, interface):\n r\"\"\"Explicitly release an interface.\n\n This function is used to release an interface previously claimed,\n either through a call to claim_interface or internally by the\n device object.\n\n Normally, you do not need to worry about claiming policies, as\n the device object takes care of it automatically.\n \"\"\"\n device._ctx.managed_release_interface(device, interface)", "metadata": "root.release_interface", "header": "['module', '___EOS___']", "index": 206 }, { "content": "def dispose_resources(device):\n r\"\"\"Release internal resources allocated by the object.\n\n Sometimes you need to provide deterministic resources\n freeing, for example to allow another application to\n talk to the device. As Python does not provide deterministic\n destruction, this function releases all internal resources\n allocated by the device, like device handle and interface\n policy.\n\n After calling this function, you can continue using the device\n object normally. If the resources will be necessary again, it\n will be allocated automatically.\n \"\"\"\n device._ctx.dispose(device)", "metadata": "root.dispose_resources", "header": "['module', '___EOS___']", "index": 218 }, { "content": "def get_langids(dev):\n r\"\"\"Retrieve the list of supported Language IDs from the device.\n\n Most client code should not call this function directly, but instead use\n the langids property on the Device object, which will call this function as\n needed and cache the result.\n\n USB LANGIDs are 16-bit integers familiar to Windows developers, where\n for example instead of en-US you say 0x0409. See the file USB_LANGIDS.pdf\n somewhere on the usb.org site for a list, which does not claim to be\n complete. It requires \"system software must allow the enumeration and\n selection of LANGIDs that are not currently on this list.\" It also requires\n \"system software should never request a LANGID not defined in the LANGID\n code array (string index = 0) presented by a device.\" Client code can\n check this tuple before issuing string requests for a specific language ID.\n\n dev is the Device object whose supported language IDs will be retrieved.\n\n The return value is a tuple of integer LANGIDs, possibly empty if the\n device does not support strings at all (which USB 3.1 r1.0 section\n 9.6.9 allows). In that case client code should not request strings at all.\n\n A USBError may be raised from this function for some devices that have no\n string support, instead of returning an empty tuple. The accessor for the\n langids property on Device catches that case and supplies an empty tuple,\n so client code can ignore this detail by using the langids property instead\n of directly calling this function.\n \"\"\"\n from usb.control import get_descriptor\n buf = get_descriptor(\n dev,\n 254,\n DESC_TYPE_STRING,\n 0\n )\n\n # The array is retrieved by asking for string descriptor zero, which is\n # never the index of a real string. The returned descriptor has bLength\n # and bDescriptorType bytes followed by pairs of bytes representing\n # little-endian LANGIDs. That is, buf[0] contains the length of the\n # returned array, buf[2] is the least-significant byte of the first LANGID\n # (if any), buf[3] is the most-significant byte, and in general the LSBs of\n # all the LANGIDs are given by buf[2:buf[0]:2] and MSBs by buf[3:buf[0]:2].\n # If the length of buf came back odd, something is wrong.\n\n if len(buf) < 4 or buf[0] < 4 or buf[0]&1 != 0:\n return ()\n\n return tuple(map(lambda x,y: x+(y<<8), buf[2:buf[0]:2], buf[3:buf[0]:2]))", "metadata": "root.get_langids", "header": "['module', '___EOS___']", "index": 234 }, { "content": "def get_string(dev, index, langid = None):\n r\"\"\"Retrieve a string descriptor from the device.\n\n dev is the Device object which the string will be read from.\n\n index is the string descriptor index and langid is the Language\n ID of the descriptor. If langid is omitted, the string descriptor\n of the first Language ID will be returned.\n\n Zero is never the index of a real string. The USB spec allows a device to\n use zero in a string index field to indicate that no string is provided.\n So the caller does not have to treat that case specially, this function\n returns None if passed an index of zero, and generates no traffic\n to the device.\n\n The return value is the unicode string present in the descriptor, or None\n if the requested index was zero.\n\n It is a ValueError to request a real string (index not zero), if: the\n device's langid tuple is empty, or with an explicit langid the device does\n not support.\n \"\"\"\n if 0 == index:\n return None\n\n from usb.control import get_descriptor\n langids = dev.langids\n\n if 0 == len(langids):\n raise ValueError(\"The device has no langid\")\n if langid is None:\n langid = langids[0]\n elif langid not in langids:\n raise ValueError(\"The device does not support the specified langid\")\n\n buf = get_descriptor(\n dev,\n 255, # Maximum descriptor size\n DESC_TYPE_STRING,\n index,\n langid\n )\n if hexversion >= 0x03020000:\n return buf[2:buf[0]].tobytes().decode('utf-16-le')\n else:\n return buf[2:buf[0]].tostring().decode('utf-16-le')", "metadata": "root.get_string", "header": "['module', '___EOS___']", "index": 284 } ]
[ { "span": "import operator", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", "-", "2014", " ", "Wan", "der", " ", "La", "irs", "on", " ", "Cost", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "follow", "ing", " ", "term", "s", " ", "appl", "y", " ", "to", " ", "all", " ", "files", " ", "associate", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "the", " ", "software", " ", "unl", "ess", " ", "explicit", "ly", " ", "discl", "aime", "d", " ", "in", " ", "individual", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "author", "s", " ", "here", "by", " ", "grant", " ", "permissi", "on", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "distribute", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "license", " ", "this", " ", "software", " ", "and", " ", "its", " ", "documentation", " ", "for", " ", "any", " ", "purpose", ",", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "exist", "ing", " ", "copyr", "ight", " ", "notice", "s", " ", "are", " ", "retained", " ", "in", " ", "all", " ", "copie", "s", " ", "and", " ", "tha", "t", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", " ", "is", " ", "include", "d", " ", "verba", "tim", " ", "in", " ", "any", " ", "distribu", "tion", "s", ".", " ", "No", " ", "writt", "en", " ", "agreement", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "license", ",", " ", "or", " ", "roy", "alty", " ", "fe", "e", " ", "is", " ", "require", "d", " ", "for", " ", "any", " ", "of", " ", "the", " ", "authoriz", "ed", " ", "use", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modifica", "tion", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "copyr", "ight", "ed", " ", "by", " ", "thei", "r", " ", "authors_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "need", " ", "not", " ", "follow", " ", "the", " ", "lice", "nsi", "ng", " ", "term", "s", " ", "descri", "bed", " ", "here", ",", " ", "provided", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "new", " ", "term", "s", " ", "are", " ", "clear", "ly", " ", "indicat", "ed", " ", "on", " ", "the", " ", "first", " ", "page", " ", "of", " ", "each", " ", "file", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "appl", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "DISTRI", "BUT", "ORS", " ", "BE", " ", "LI", "AB", "LE", " ", "TO", " ", "ANY", " ", "PART", "Y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FOR", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "SPECIAL", ",", " ", "INC", "IDENT", "AL", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "IT", "S", " ", "DOCUMENT", "ATION", ",", " ", "OR", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DER", "IV", "ATI", "VE", "S", " ", "THER", "EO", "F", ",", " ", "EVE", "N", " ", "IF", " ", "THE", " ", "AUTHOR", "S", " ", "HA", "VE", " ", "BE", "EN", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "AUTHOR", "S", " ", "AND", " ", "DISTRI", "BUT", "ORS", " ", "SPECIFI", "CALL", "Y", " ", "DISC", "LAI", "M", " ", "ANY", " ", "WAR", "RAN", "TIES", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "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", ".", " ", " ", "THIS", " ", "SOFT", "WARE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IS", " ", "PROVI", "DED", " ", "ON", " ", "AN", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "AND", " ", "THE", " ", "AUTHOR", "S", " ", "AND", " ", "DISTRI", "BUT", "ORS", " ", "HA", "VE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NO", " ", "OB", "LIG", "ATION", " ", "TO", " ", "PROVI", "DE", " ", "MAIN", "TEN", "ANCE", ",", " ", "SUPPORT", ",", " ", "UPDATE", "S", ",", " ", "EN", "HAN", "CE", "MENT", "S", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MODI", "FICATION", "S", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\"\"", "usb", ".", "util", " ", "-", " ", "Utili", "ty", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "export", "s", ":", "\\", "10", ";", "\\", "10", ";", "endpoint", "\\u", "address", " ", "-", " ", "return", " ", "the", " ", "endpoint", " ", "abs", "olute", " ", "address", ".", "\\", "10", ";", "endpoint", "\\u", "direction", " ", "-", " ", "return", " ", "the", " ", "endpoint", " ", "transfer", " ", "direction", ".", "\\", "10", ";", "endpoint", "\\u", "type", " ", "-", " ", "return", " ", "the", " ", "endpoint", " ", "type", "\\", "10", ";", "ctrl", "\\u", "direction", " ", "-", " ", "return", " ", "the", " ", "direction", " ", "of", " ", "a", " ", "control", " ", "transfer", "\\", "10", ";", "build", "\\u", "request", "\\u", "type", " ", "-", " ", "build", " ", "a", " ", "bm", "Request", "Type", " ", "field", " ", "of", " ", "a", " ", "control", " ", "transfer", ".", "\\", "10", ";", "find", "\\u", "descrip", "tor", " ", "-", " ", "find", " ", "an", " ", "inner", " ", "descrip", "tor", ".", "\\", "10", ";", "claim", "\\u", "interface", " ", "-", " ", "explicit", "ly", " ", "claim", " ", "an", " ", "interface", ".", "\\", "10", ";", "release", "\\u", "interface", " ", "-", " ", "explicit", "ly", " ", "release", " ", "an", " ", "interface", ".", "\\", "10", ";", "dispose", "\\u", "resource", "s", " ", "-", " ", "release", " ", "internal", " ", "resource", "s", " ", "allocated", " ", "by", " ", "the", " ", "object", ".", "\\", "10", ";", "get", "\\u", "lang", "ids", " ", "-", " ", "retrieve", " ", "the", " ", "list", " ", "of", " ", "support", "ed", " ", "string", " ", "language", "s", " ", "from", " ", "the", " ", "device", ".", "\\", "10", ";", "get", "\\u", "string", " ", "-", " ", "retrieve", " ", "a", " ", "string", " ", "descrip", "tor", " ", "from", " ", "the", " ", "device", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Wan", "der", " ", "La", "irs", "on", " ", "Cost", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "hex", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "usb_", "._", "\\u", "inter", "op_", "as_", "\\u", "inter", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "descrip", "tor", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "DESC", "\\u", "TYPE", "\\u", "DEVICE_", "=_", "0x01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DESC", "\\u", "TYPE", "\\u", "CONFIG_", "=_", "0x02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DESC", "\\u", "TYPE", "\\u", "STRING_", "=_", "0x03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DESC", "\\u", "TYPE", "\\u", "INTERFACE_", "=_", "0x04_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DESC", "\\u", "TYPE", "\\u", "ENDPOINT_", "=_", "0x05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "endpoint", " ", "direction_", "\\u\\u\\uNL\\u\\u\\u_", "ENDPOINT", "\\u", "IN_", "=_", "0x80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENDPOINT", "\\u", "OUT_", "=_", "0x00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "endpoint", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "ENDPOINT", "\\u", "TYPE", "\\u", "CTR", "L_", "=_", "0x00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENDPOINT", "\\u", "TYPE", "\\u", "ISO", "_", "=_", "0x01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENDPOINT", "\\u", "TYPE", "\\u", "BUL", "K_", "=_", "0x02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENDPOINT", "\\u", "TYPE", "\\u", "INT", "R_", "=_", "0x03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "control", " ", "request", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "CTR", "L", "\\u", "TYPE", "\\u", "STANDARD", "_", "=_", "(_", "0_", "<<_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CTR", "L", "\\u", "TYPE", "\\u", "CLASS_", "=_", "(_", "1_", "<<_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CTR", "L", "\\u", "TYPE", "\\u", "VENDOR", "_", "=_", "(_", "2_", "<<_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CTR", "L", "\\u", "TYPE", "\\u", "RESERVED", "_", "=_", "(_", "3_", "<<_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "control", " ", "request", " ", "recipient_", "\\u\\u\\uNL\\u\\u\\u_", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "DEVICE_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "INTERFACE_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "ENDPOINT_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "OTHER", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "control", " ", "request", " ", "direction_", "\\u\\u\\uNL\\u\\u\\u_", "CTR", "L", "\\u", "OUT_", "=_", "0x00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CTR", "L", "\\u", "IN_", "=_", "0x80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "ENDPOINT", "\\u", "ADDR", "\\u", "MASK_", "=_", "0x0f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ENDPOINT", "\\u", "DIR", "\\u", "MASK_", "=_", "0x80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ENDPOINT", "\\u", "TRANSFER", "\\u", "TYPE", "\\u", "MASK_", "=_", "0x03_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "CTR", "L", "\\u", "DIR", "\\u", "MASK_", "=_", "0x80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "compatibility", " ", "bet", "ween", " ", "Pyth", "on", " ", "2", " ", "and", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "dummy", "\\u", "s_", "=_", "'\\\\", "x0", "0", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "speed", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "SPEED", "\\u", "LOW_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SPEED", "\\u", "FULL", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SPEED", "\\u", "HIGH_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SPEED", "\\u", "SUPER", "_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SPEED", "\\u", "UNKNOWN_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "endpoint", "\\u", "address_", "(_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", " ", "the", " ", "endpoint", " ", "abs", "olute", " ", "address", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "address", " ", "parameter", " ", "is", " ", "the", " ", "b", "End", "point", "Address", " ", "field", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "endpoint", " ", "descrip", "tor", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "address_", "&_", "\\u", "ENDPOINT", "\\u", "ADDR", "\\u", "MASK_", "\\u\\u\\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_", "endpoint", "\\u", "direction_", "(_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", " ", "the", " ", "endpoint", " ", "direction", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "address", " ", "parameter", " ", "is", " ", "the", " ", "b", "End", "point", "Address", " ", "field", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "endpoint", " ", "descrip", "tor", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "possib", "le", " ", "return", " ", "values", " ", "are", " ", "ENDPOINT", "\\u", "OUT", " ", "or", " ", "ENDPOINT", "\\u", "IN", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "address_", "&_", "\\u", "ENDPOINT", "\\u", "DIR", "\\u", "MASK_", "\\u\\u\\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_", "endpoint", "\\u", "type_", "(_", "bm", "Attributes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", " ", "the", " ", "transfer", " ", "type", " ", "of", " ", "the", " ", "endpoint", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "bm", "Attribute", "s", " ", "parameter", " ", "is", " ", "the", " ", "bm", "Attribute", "s", " ", "field", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "endpoint", " ", "descrip", "tor", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "possib", "le", " ", "return", " ", "values", " ", "are", ":", " ", "ENDPOINT", "\\u", "TYPE", "\\u", "CTR", "L", ",", "\\", "10", ";", " ", " ", " ", " ", "ENDPOINT", "\\u", "TYPE", "\\u", "ISO", ",", " ", "ENDPOINT", "\\u", "TYPE", "\\u", "BUL", "K", " ", "or", " ", "ENDPOINT", "\\u", "TYPE", "\\u", "INT", "R", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bm", "Attributes_", "&_", "\\u", "ENDPOINT", "\\u", "TRANSFER", "\\u", "TYPE", "\\u", "MASK_", "\\u\\u\\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_", "ctrl", "\\u", "direction_", "(_", "bm", "Request", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", " ", "the", " ", "direction", " ", "of", " ", "a", " ", "control", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "bm", "Request", "Type", " ", "parameter", " ", "is", " ", "the", " ", "value", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "bm", "Request", "Type", " ", "field", " ", "of", " ", "a", " ", "control", " ", "transfer", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "possib", "le", " ", "return", " ", "values", " ", "are", " ", "CTR", "L", "\\u", "OUT", " ", "or", " ", "CTR", "L", "\\u", "IN", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bm", "Request", "Type_", "&_", "\\u", "CTR", "L", "\\u", "DIR", "\\u", "MASK_", "\\u\\u\\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_", "build", "\\u", "request", "\\u", "type_", "(_", "direction_", ",_", "type_", ",_", "recipient_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Build", " ", "a", " ", "bm", "Request", "Type", " ", "field", " ", "for", " ", "control", " ", "request", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "is", " ", "a", " ", "convention", "al", " ", "function", " ", "to", " ", "build", " ", "a", " ", "bm", "Request", "Type", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "control", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "direction", " ", "parameter", " ", "can", " ", "be", " ", "CTR", "L", "\\u", "OUT", " ", "or", " ", "CTR", "L", "\\u", "IN", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "type", " ", "parameter", " ", "can", " ", "be", " ", "CTR", "L", "\\u", "TYPE", "\\u", "STANDARD", ",", " ", "CTR", "L", "\\u", "TYPE", "\\u", "CLASS", ",", "\\", "10", ";", " ", " ", " ", " ", "CTR", "L", "\\u", "TYPE", "\\u", "VENDOR", " ", "or", " ", "CTR", "L", "\\u", "TYPE", "\\u", "RESERVED", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "recip", "ient", " ", "can", " ", "be", " ", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "DEV", "ICE", ",", " ", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "INTERFACE", ",", "\\", "10", ";", " ", " ", " ", " ", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "ENDPOINT", " ", "or", " ", "CTR", "L", "\\u", "RECIP", "IENT", "\\u", "OTHER", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "bm", "Request", "Type", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "recipient_", "|_", "type_", "|_", "direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "buffer_", "(_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Creat", "e", " ", "a", " ", "buffer", " ", "to", " ", "be", " ", "pass", "ed", " ", "to", " ", "a", " ", "read", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "read", " ", "function", " ", "may", " ", "receive", " ", "an", " ", "out", " ", "buffer", " ", "so", " ", "the", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "read", " ", "inpla", "ce", " ", "and", " ", "the", " ", "object", " ", "can", " ", "be", " ", "reus", "ed", ",", " ", "avoid", "ing", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "overhead", " ", "of", " ", "creati", "ng", " ", "a", " ", "new", " ", "object", " ", "at", " ", "each", " ", "new", " ", "read", "\\", "10", ";", " ", " ", " ", " ", "call", ".", " ", "Thi", "s", " ", "function", " ", "create", "s", " ", "a", " ", "compatible", " ", "sequence", " ", "buffer", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "give", "n", " ", "length", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "array_", "._", "array_", "(_", "'", "B", "'_", ",_", "\\u", "dummy", "\\u", "s_", "*_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "descriptor_", "(_", "desc_", ",_", "find", "\\u", "all_", "=_", "False_", ",_", "custom", "\\u", "match_", "=_", "None_", ",_", "**_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Fin", "d", " ", "an", " ", "inner", " ", "descrip", "tor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "find", "\\u", "descrip", "tor", " ", "works", " ", "in", " ", "the", " ", "same", " ", "way", " ", "as", " ", "the", " ", "core", ".", "find", "()", " ", "function", " ", "doe", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "it", " ", "acts", " ", "on", " ", "genera", "l", " ", "descrip", "tor", " ", "object", "s", ".", " ", "For", " ", "example", ",", " ", "supp", "ose", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "a", " ", "Dev", "ice", " ", "object", " ", "call", "ed", " ", "dev", " ", "and", " ", "want", " ", "a", " ", "Configura", "tion", " ", "of", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "with", " ", "its", " ", "b", "Configura", "tion", "Value", " ", "equals", " ", "to", " ", "1", ",", " ", "the", " ", "code", " ", "wou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "like", " ", "so", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "cfg", " ", "=", " ", "util", ".", "find", "\\u", "descrip", "tor", "(", "dev", ",", " ", "b", "Configura", "tion", "Value", "=", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "use", " ", "any", " ", "field", " ", "of", " ", "the", " ", "Descrip", "tor", " ", "as", " ", "a", " ", "match", " ", "crite", "ria", ",", " ", "and", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "supply", " ", "a", " ", "customize", "d", " ", "match", " ", "just", " ", "like", " ", "core", ".", "find", "()", " ", "doe", "s", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "find", "\\u", "descrip", "tor", " ", "function", " ", "als", "o", " ", "accepts", " ", "the", " ", "find", "\\u", "all", " ", "parameter", " ", "to", " ", "get", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "iter", "ator", " ", "inst", "ead", " ", "of", " ", "just", " ", "one", " ", "descrip", "tor", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "desc", "\\u", "iter_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "d_", "in_", "desc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tests_", "=_", "(_", "val_", "==_", "getattr_", "(_", "d_", ",_", "key_", ")_", "for_", "key_", ",_", "val_", "in_", "kwargs_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "inter", "op_", "._", "\\u", "all_", "(_", "tests_", ")_", "and_", "(_", "custom", "\\u", "match_", "is_", "None_", "or_", "custom", "\\u", "match_", "(_", "d_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "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_", "if_", "find", "\\u", "all_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "desc", "\\u", "iter_", "(_", "**_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "inter", "op_", "._", "\\u", "next_", "(_", "desc", "\\u", "iter_", "(_", "**_", "args_", ")_", ")_", "\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "claim", "\\u", "interface_", "(_", "device_", ",_", "interface_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Exp", "licit", "ly", " ", "claim", " ", "an", " ", "interface", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Py", "USB", " ", "users", " ", "normal", "ly", " ", "do", " ", "not", " ", "have", " ", "to", " ", "wor", "ry", " ", "abo", "ut", " ", "interface", " ", "claim", "ing", ",", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "the", " ", "librar", "y", " ", "take", "s", " ", "care", " ", "of", " ", "it", " ", "automati", "call", "y", ".", " ", "Bu", "t", " ", "there", " ", "are", " ", "situation", "s", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "you", " ", "need", " ", "deterministic", " ", "interface", " ", "claim", "ing", ".", " ", "For", " ", "these", " ", "uncomm", "on", "\\", "10", ";", " ", " ", " ", " ", "case", "s", ",", " ", "you", " ", "can", " ", "use", " ", "claim", "\\u", "interface", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "interface", " ", "is", " ", "alr", "ead", "y", " ", "claimed", ",", " ", "eit", "her", " ", "through", " ", "a", " ", "previ", "ously", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "claim", "\\u", "interface", " ", "or", " ", "internal", "ly", " ", "by", " ", "the", " ", "device", " ", "object", ",", " ", "not", "hing", " ", "happ", "ens", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device_", "._", "\\u", "ctx_", "._", "manage", "d\\u", "claim", "\\u", "interface_", "(_", "device_", ",_", "interface_", ")_", "\\u\\u\\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_", "release", "\\u", "interface_", "(_", "device_", ",_", "interface_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Exp", "licit", "ly", " ", "release", " ", "an", " ", "interface", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "is", " ", "used", " ", "to", " ", "release", " ", "an", " ", "interface", " ", "previ", "ously", " ", "claimed", ",", "\\", "10", ";", " ", " ", " ", " ", "eit", "her", " ", "through", " ", "a", " ", "call", " ", "to", " ", "claim", "\\u", "interface", " ", "or", " ", "internal", "ly", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "device", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Normal", "ly", ",", " ", "you", " ", "do", " ", "not", " ", "need", " ", "to", " ", "wor", "ry", " ", "abo", "ut", " ", "claim", "ing", " ", "poli", "cies", ",", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "device", " ", "object", " ", "take", "s", " ", "care", " ", "of", " ", "it", " ", "automati", "call", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device_", "._", "\\u", "ctx_", "._", "manage", "d\\u", "release", "\\u", "interface_", "(_", "device_", ",_", "interface_", ")_", "\\u\\u\\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_", "dispose", "\\u", "resources_", "(_", "device_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Release", " ", "internal", " ", "resource", "s", " ", "allocated", " ", "by", " ", "the", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Some", "times", " ", "you", " ", "need", " ", "to", " ", "provide", " ", "deterministic", " ", "resource", "s", "\\", "10", ";", " ", " ", " ", " ", "free", "ing", ",", " ", "for", " ", "example", " ", "to", " ", "allow", " ", "anot", "her", " ", "applica", "tion", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "talk", " ", "to", " ", "the", " ", "device", ".", " ", "As", " ", "Pyth", "on", " ", "doe", "s", " ", "not", " ", "provide", " ", "deterministic", "\\", "10", ";", " ", " ", " ", " ", "destruct", "ion", ",", " ", "this", " ", "function", " ", "release", "s", " ", "all", " ", "internal", " ", "resource", "s", "\\", "10", ";", " ", " ", " ", " ", "allocated", " ", "by", " ", "the", " ", "device", ",", " ", "like", " ", "device", " ", "handle", " ", "and", " ", "interface", "\\", "10", ";", " ", " ", " ", " ", "policy", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "calling", " ", "this", " ", "function", ",", " ", "you", " ", "can", " ", "continue", " ", "usi", "ng", " ", "the", " ", "device", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "normal", "ly", ".", " ", "If", " ", "the", " ", "resource", "s", " ", "will", " ", "be", " ", "necessar", "y", " ", "again", ",", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "allocated", " ", "automati", "call", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device_", "._", "\\u", "ctx_", "._", "dispose", "_", "(_", "device_", ")_", "\\u\\u\\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", "lang", "ids_", "(_", "dev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Retrieve", " ", "the", " ", "list", " ", "of", " ", "support", "ed", " ", "Lang", "ua", "ge", " ", "ID", "s", " ", "from", " ", "the", " ", "device", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "client", " ", "code", " ", "shou", "ld", " ", "not", " ", "call", " ", "this", " ", "function", " ", "direct", "ly", ",", " ", "but", " ", "inst", "ead", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "lang", "ids", " ", "property", " ", "on", " ", "the", " ", "Dev", "ice", " ", "object", ",", " ", "whi", "ch", " ", "will", " ", "call", " ", "this", " ", "function", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "need", "ed", " ", "and", " ", "cache", " ", "the", " ", "result", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "USB", " ", "LANG", "ID", "s", " ", "are", " ", "16", "-", "bit", " ", "integ", "ers", " ", "famil", "iar", " ", "to", " ", "Window", "s", " ", "developer", "s", ",", " ", "where", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "example", " ", "inst", "ead", " ", "of", " ", "en", "-", "US", " ", "you", " ", "say", " ", "0x04", "09", ".", " ", "See", " ", "the", " ", "file", " ", "USB", "\\u", "LANG", "IDS", ".", "pdf", "\\", "10", ";", " ", " ", " ", " ", "some", "where", " ", "on", " ", "the", " ", "usb", ".", "org", " ", "site", " ", "for", " ", "a", " ", "list", ",", " ", "whi", "ch", " ", "doe", "s", " ", "not", " ", "claim", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "complete", ".", " ", "It", " ", "require", "s", " ", "\"", "system", " ", "software", " ", "must", " ", "allow", " ", "the", " ", "enumerati", "on", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "selection", " ", "of", " ", "LANG", "ID", "s", " ", "tha", "t", " ", "are", " ", "not", " ", "currentl", "y", " ", "on", " ", "this", " ", "list", ".\"", " ", "It", " ", "als", "o", " ", "require", "s", "\\", "10", ";", " ", " ", " ", " ", "\"", "system", " ", "software", " ", "shou", "ld", " ", "neve", "r", " ", "request", " ", "a", " ", "LANG", "ID", " ", "not", " ", "defin", "ed", " ", "in", " ", "the", " ", "LANG", "ID", "\\", "10", ";", " ", " ", " ", " ", "code", " ", "array", " ", "(", "string", " ", "index", " ", "=", " ", "0", ")", " ", "presente", "d", " ", "by", " ", "a", " ", "device", ".\"", " ", "Client", " ", "code", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "check", " ", "this", " ", "tuple", " ", "bef", "ore", " ", "issu", "ing", " ", "string", " ", "request", "s", " ", "for", " ", "a", " ", "specific", " ", "language", " ", "ID", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dev", " ", "is", " ", "the", " ", "Dev", "ice", " ", "object", " ", "who", "se", " ", "support", "ed", " ", "language", " ", "ID", "s", " ", "will", " ", "be", " ", "retrieved", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "return", " ", "value", " ", "is", " ", "a", " ", "tuple", " ", "of", " ", "integ", "er", " ", "LANG", "ID", "s", ",", " ", "possib", "ly", " ", "empty", " ", "if", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "device", " ", "doe", "s", " ", "not", " ", "support", " ", "string", "s", " ", "at", " ", "all", " ", "(", "whi", "ch", " ", "USB", " ", "3.1", " ", "r1", ".0", " ", "section", "\\", "10", ";", " ", " ", " ", " ", "9.6", ".9", " ", "allow", "s", ").", " ", "In", " ", "tha", "t", " ", "case", " ", "client", " ", "code", " ", "shou", "ld", " ", "not", " ", "request", " ", "string", "s", " ", "at", " ", "all", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "USB", "Error", " ", "may", " ", "be", " ", "raise", "d", " ", "from", " ", "this", " ", "function", " ", "for", " ", "some", " ", "device", "s", " ", "tha", "t", " ", "have", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "string", " ", "support", ",", " ", "inst", "ead", " ", "of", " ", "return", "ing", " ", "an", " ", "empty", " ", "tuple", ".", " ", "The", " ", "accessor", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "lang", "ids", " ", "property", " ", "on", " ", "Dev", "ice", " ", "catche", "s", " ", "tha", "t", " ", "case", " ", "and", " ", "supplie", "s", " ", "an", " ", "empty", " ", "tuple", ",", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "client", " ", "code", " ", "can", " ", "ignore", " ", "this", " ", "deta", "il", " ", "by", " ", "usi", "ng", " ", "the", " ", "lang", "ids", " ", "property", " ", "inst", "ead", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "direct", "ly", " ", "calling", " ", "this", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "usb_", "._", "control_", "import_", "get", "\\u", "descriptor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "=_", "get", "\\u", "descriptor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dev_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "254_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DESC", "\\u", "TYPE", "\\u", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "array", " ", "is", " ", "retrieved", " ", "by", " ", "ask", "ing", " ", "for", " ", "string", " ", "descrip", "tor", " ", "zero", ",", " ", "whi", "ch", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "neve", "r", " ", "the", " ", "index", " ", "of", " ", "a", " ", "real", " ", "string", ".", " ", "The", " ", "return", "ed", " ", "descrip", "tor", " ", "has", " ", "b", "Length_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "b", "Descrip", "tor", "Type", " ", "bytes", " ", "followe", "d", " ", "by", " ", "pair", "s", " ", "of", " ", "bytes", " ", "represent", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "litt", "le", "-", "endian", " ", "LANG", "ID", "s", ".", " ", "Tha", "t", " ", "is", ",", " ", "buf", "[", "0", "]", " ", "contain", "s", " ", "the", " ", "length", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", "ed", " ", "array", ",", " ", "buf", "[", "2", "]", " ", "is", " ", "the", " ", "leas", "t", "-", "significant", " ", "byte", " ", "of", " ", "the", " ", "first", " ", "LANG", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "if", " ", "any", "),", " ", "buf", "[", "3", "]", " ", "is", " ", "the", " ", "most", "-", "significant", " ", "byte", ",", " ", "and", " ", "in", " ", "genera", "l", " ", "the", " ", "LS", "Bs", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "the", " ", "LANG", "ID", "s", " ", "are", " ", "give", "n", " ", "by", " ", "buf", "[", "2", ":", "buf", "[", "0", "]:", "2", "]", " ", "and", " ", "MS", "Bs", " ", "by", " ", "buf", "[", "3", ":", "buf", "[", "0", "]:", "2", "].", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "length", " ", "of", " ", "buf", " ", "came", " ", "back", " ", "odd", ",", " ", "somet", "hing", " ", "is", " ", "wrong", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "buf_", ")_", "<_", "4_", "or_", "buf_", "[_", "0_", "]_", "<_", "4_", "or_", "buf_", "[_", "0_", "]_", "&_", "1_", "!=_", "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_", "return_", "tuple_", "(_", "map_", "(_", "lambda_", "x_", ",_", "y_", ":_", "x_", "+_", "(_", "y_", "<<_", "8_", ")_", ",_", "buf_", "[_", "2_", ":_", "buf_", "[_", "0_", "]_", ":_", "2_", "]_", ",_", "buf_", "[_", "3_", ":_", "buf_", "[_", "0_", "]_", ":_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "string_", "(_", "dev_", ",_", "index_", ",_", "lang", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Retrieve", " ", "a", " ", "string", " ", "descrip", "tor", " ", "from", " ", "the", " ", "device", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dev", " ", "is", " ", "the", " ", "Dev", "ice", " ", "object", " ", "whi", "ch", " ", "the", " ", "string", " ", "will", " ", "be", " ", "read", " ", "from", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "index", " ", "is", " ", "the", " ", "string", " ", "descrip", "tor", " ", "index", " ", "and", " ", "lang", "id", " ", "is", " ", "the", " ", "Lang", "ua", "ge", "\\", "10", ";", " ", " ", " ", " ", "ID", " ", "of", " ", "the", " ", "descrip", "tor", ".", " ", "If", " ", "lang", "id", " ", "is", " ", "omit", "ted", ",", " ", "the", " ", "string", " ", "descrip", "tor", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "first", " ", "Lang", "ua", "ge", " ", "ID", " ", "will", " ", "be", " ", "return", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Zero", " ", "is", " ", "neve", "r", " ", "the", " ", "index", " ", "of", " ", "a", " ", "real", " ", "string", ".", " ", "The", " ", "USB", " ", "spec", " ", "allow", "s", " ", "a", " ", "device", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "use", " ", "zero", " ", "in", " ", "a", " ", "string", " ", "index", " ", "field", " ", "to", " ", "indicat", "e", " ", "tha", "t", " ", "no", " ", "string", " ", "is", " ", "provided", ".", "\\", "10", ";", " ", " ", " ", " ", "So", " ", "the", " ", "caller", " ", "doe", "s", " ", "not", " ", "have", " ", "to", " ", "treat", " ", "tha", "t", " ", "case", " ", "special", "ly", ",", " ", "this", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "Non", "e", " ", "if", " ", "pass", "ed", " ", "an", " ", "index", " ", "of", " ", "zero", ",", " ", "and", " ", "generat", "es", " ", "no", " ", "traffic", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "device", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "return", " ", "value", " ", "is", " ", "the", " ", "unicode", " ", "string", " ", "presen", "t", " ", "in", " ", "the", " ", "descrip", "tor", ",", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "request", "ed", " ", "index", " ", "was", " ", "zero", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "is", " ", "a", " ", "Value", "Error", " ", "to", " ", "request", " ", "a", " ", "real", " ", "string", " ", "(", "index", " ", "not", " ", "zero", "),", " ", "if", ":", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "device", "'", "s", " ", "lang", "id", " ", "tuple", " ", "is", " ", "empty", ",", " ", "or", " ", "with", " ", "an", " ", "explicit", " ", "lang", "id", " ", "the", " ", "device", " ", "doe", "s", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "support", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "==_", "index_", ":_", "\\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_", "from_", "usb_", "._", "control_", "import_", "get", "\\u", "descriptor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang", "ids_", "=_", "dev_", "._", "lang", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "0_", "==_", "len_", "(_", "lang", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "device", " ", "has", " ", "no", " ", "lang", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lang", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lang", "id_", "=_", "lang", "ids_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lang", "id_", "not_", "in_", "lang", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "device", " ", "doe", "s", " ", "not", " ", "support", " ", "the", " ", "specified", " ", "lang", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "=_", "get", "\\u", "descriptor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dev_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "255_", ",_", "#", " ", "Maxim", "um", " ", "descrip", "tor", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "DESC", "\\u", "TYPE", "\\u", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lang", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hex", "version_", ">=_", "0x03", "02000", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "buf_", "[_", "2_", ":_", "buf_", "[_", "0_", "]_", "]_", "._", "tob", "ytes_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-1", "6", "-", "le", "'_", ")_", "\\u\\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_", "buf_", "[_", "2_", ":_", "buf_", "[_", "0_", "]_", "]_", "._", "tostring_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-1", "6", "-", "le", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
enthought/pyface/pyface/ui/wx/grid/tests/simple_grid_model_test_case.py
[ { "content": " def test_is_cell_empty(self):\n\n rows = self.model.get_row_count()\n columns = self.model.get_column_count()\n\n self.assertEqual(self.model.is_cell_empty(0,0), True,\n \"Cell containing None should be empty.\")\n self.assertEqual(self.model.is_cell_empty(10,10), True,\n \"Cell outside the range of values should be empty.\")\n\n return", "metadata": "root.CompositeGridModelTestCase.test_is_cell_empty", "header": "['class', 'CompositeGridModelTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 } ]
[ { "span": "rows ", "start_line": 64, "start_column": 8, "end_line": 64, "end_column": 12 }, { "span": "columns ", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Composit", "e", "Grid", "Model", "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", "is", "\\u", "cell", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "self_", "._", "model_", "._", "get", "\\u", "row", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "=_", "self_", "._", "model_", "._", "get", "\\u", "column", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "model_", "._", "is", "\\u", "cell", "\\u", "empty_", "(_", "0_", ",_", "0_", ")_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cel", "l", " ", "contain", "ing", " ", "Non", "e", " ", "shou", "ld", " ", "be", " ", "empty", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "model_", "._", "is", "\\u", "cell", "\\u", "empty_", "(_", "10_", ",_", "10_", ")_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cel", "l", " ", "outsi", "de", " ", "the", " ", "range", " ", "of", " ", "values", " ", "shou", "ld", " ", "be", " ", "empty", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
jvns/git-workflow/hello.py
[ { "content": "@app.route('/display/<num>')\ndef display_graph(num=None, sparse=False):\n cursor = g.conn.cursor()\n try:\n cursor.execute(\"SELECT logfile FROM log WHERE id = %s\", (num,));\n history = cursor.fetchone()[0]\n svg = create_svg(history, sparse=sparse)\n if svg is None:\n svg = \"Graph is empty!\"\n except:\n svg = \"Sorry, there's no log file with that id.\"\n return render_template(\"display_graph.html\", svg=svg, num=num)", "metadata": "root.display_graph", "header": "['module', '___EOS___']", "index": 22 } ]
[ { "span": "except:", "start_line": 31, "start_column": 4, "end_line": 31, "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_", "@_", "app_", "._", "route_", "(_", "'/", "display", "/", "<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "display", "\\u", "graph_", "(_", "num_", "=_", "None_", ",_", "sparse_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "g_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "execute_", "(_", "\"", "SELECT", " ", "logfile", " ", "FROM", " ", "log", " ", "WHE", "RE", " ", "id", " ", "=", " ", "%", "s", "\"_", ",_", "(_", "num_", ",_", ")_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "history_", "=_", "cursor_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svg_", "=_", "create", "\\u", "svg_", "(_", "history_", ",_", "sparse_", "=_", "sparse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "svg_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "svg_", "=_", "\"", "Graph", " ", "is", " ", "empty", "!\"_", "\\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 ", " _", "svg_", "=_", "\"", "So", "rr", "y", ",", " ", "there", "'", "s", " ", "no", " ", "log", " ", "file", " ", "with", " ", "tha", "t", " ", "id", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "\"", "display", "\\u", "graph", ".", "html", "\"_", ",_", "svg_", "=_", "svg_", ",_", "num_", "=_", "num_", ")_", "\\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, 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 ]
Unused import
saga-project/BigJob/pilot/__init__.py
[ { "content": "''' B{BigJob Documentation}\n\nThis is the BigJob implementation of the Pilot API. Pilot-Jobs (also referred to as\nPilot Compute) decouple system level and application level job management. \n\nThe main concepts and classes exposed by the Compute part of the API are:\n\n - L{PilotCompute} (PC): \n a pilot job, which can execute some compute workload (L{ComputeUnit}).\n\n - L{PilotComputeDescription} (PCD): \n description for specifying the requirements of a \\L{PilotCompute}. \n\n - L{PilotComputeService} (PCS): \n a factory for creating \\L{PilotCompute}s. \n\nThe data side of the Pilot API is symmetric to the compute side. The exposed\nclasses for managing Pilot Data are:\n\n - L{PilotData} (PD): \n a pilot that manages some data workload (L{DataUnit})\n \n - L{PilotDataDescription} (PDD):\n a abstract description of the requirements of the PD\n\n - L{PilotDataService} (PDS): \n a factory (service) which can create L{PilotData}s according to some\n specification\n\n\nThe application workload is represented by so called L{ComputeUnit}s and L{DataUnit}s: \n \n - L{ComputeUnit} (CU): \n a work item executed on a L{PilotCompute}.\n\n \n - L{DataUnit} (DU): \n a data item managed by a L{PilotData}\n\nBoth Compute and Data Units are specified using an abstract description object:\n\n - L{ComputeUnitDescription} (CUD):\n abstract description of a L{ComputeUnit}.\n \n - L{DataUnitDescription} (DUD):\n abstract description of a L{DataUnit}.\n\n\nThe L{ComputeDataService} represents the central entry point for the application\nworkload:\n\n - L{ComputeDataService} (CDS)\n a service which can map CUs and DUs to a set of Pilot Compute and Pilot Data.\n\nThe L{ComputeDataService} (CDS) takes care of the placement of Compute and Data Units. \nThe set of L{PilotCompute}s and L{PilotData} available to the CDS can be changed during \nthe application's runtime. The CDS different data-compute affinity and will handle\ncompute/data co-locationing for the requested data-compute workload.\n\nPilots, Compute and Data Units are associated with a L{State}.\n\n - L{State<pilot.api.compute.api.State>}: State enumeration\n\n\nB{Example}::\n\n from pilot import PilotComputeService, ComputeDataService, State\n \n pilot_compute_service = PilotComputeService()\n\n # create pilot job service and initiate a pilot job\n pilot_compute_description = {\n \"service_url\": 'fork://localhost',\n \"number_of_processes\": 1, \n \"working_directory\": os.path.join(os.getcwd(),\"work\"),\n 'affinity_datacenter_label': \"eu-de-south\", \n 'affinity_machine_label': \"mymachine\" \n }\n \n pilotjob = pilot_compute_service.create_pilot(pilot_compute_description=pilot_compute_description)\n \n compute_data_service = ComputeDataService()\n compute_data_service.add_pilot_compute_service(pilot_compute_service)\n \n # start work unit\n compute_unit_description = {\n \"executable\": \"/bin/date\",\n \"arguments\": [\"\"],\n \"number_of_processes\": 1, \n \"output\": \"stdout.txt\",\n \"error\": \"stderr.txt\", \n \"affinity_datacenter_label\": \"eu-de-south\", \n \"affinity_machine_label\": \"mymachine\" \n } \n \n compute_unit = compute_data_service.submit_compute_unit(compute_unit_description)\n \n compute_data_service.wait()\n\n compute_data_service.cancel()\n \n\nAll API objects that should be utilized by the application reside in the L{pilot} namespace. The implementation resides in L{pilot.impl}.\n \nPlease, refer to U{https://github.com/saga-project/BigJob/tree/master/examples/pilot-api} for an extensive set of examples.\n'''\n\n\napplication_id = \"bigjob\"\n\n\nfrom pilot.impl.pilotcompute_manager import PilotComputeService\nfrom pilot.impl.pilotcompute_manager import PilotCompute\nfrom pilot.impl.pilotcompute_manager import ComputeUnit\nfrom pilot.impl.pilotdata_manager import PilotDataService\nfrom pilot.impl.pilotdata_manager import PilotData\nfrom pilot.impl.pilotdata_manager import DataUnit\nfrom pilot.impl.pilot_manager import ComputeUnitService, DataUnitService\nfrom pilot.impl.pilot_manager_decentral import ComputeDataServiceDecentral\nfrom pilot.impl.pilot_manager import ComputeDataService as ComputeDataServiceCentral\nfrom pilot.impl.pilot_manager_decentral import ComputeDataServiceDecentral as ComputeDataService\nfrom pilot.api.api import PilotError\nfrom pilot.api import State \nfrom pilot.api import ComputeUnitDescription, DataUnitDescription, PilotComputeDescription\n\nimport bigjob\n\n\"\"\" Version of Pilot-API/BigJob \"\"\"\nversion = bigjob.version\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from pilot.impl.pilotcompute_manager import PilotComputeService", "start_line": 111, "start_column": 0, "end_line": 111, "end_column": 63 }, { "span": "from pilot.impl.pilotcompute_manager import PilotCompute", "start_line": 112, "start_column": 0, "end_line": 112, "end_column": 56 }, { "span": "from pilot.impl.pilotcompute_manager import ComputeUnit", "start_line": 113, "start_column": 0, "end_line": 113, "end_column": 55 }, { "span": "from pilot.impl.pilotdata_manager import PilotDataService", "start_line": 114, "start_column": 0, "end_line": 114, "end_column": 57 }, { "span": "from pilot.impl.pilotdata_manager import PilotData", "start_line": 115, "start_column": 0, "end_line": 115, "end_column": 50 }, { "span": "from pilot.impl.pilotdata_manager import DataUnit", "start_line": 116, "start_column": 0, "end_line": 116, "end_column": 49 }, { "span": "from pilot.impl.pilot_manager import ComputeUnitService, DataUnitService", "start_line": 117, "start_column": 0, "end_line": 117, "end_column": 72 }, { "span": "from pilot.impl.pilot_manager_decentral import ComputeDataServiceDecentral", "start_line": 118, "start_column": 0, "end_line": 118, "end_column": 74 }, { "span": "from pilot.impl.pilot_manager import ComputeDataService as ComputeDataServiceCentral", "start_line": 119, "start_column": 0, "end_line": 119, "end_column": 84 }, { "span": "from pilot.impl.pilot_manager_decentral import ComputeDataServiceDecentral as ComputeDataService", "start_line": 120, "start_column": 0, "end_line": 120, "end_column": 96 }, { "span": "from pilot.api.api import PilotError", "start_line": 121, "start_column": 0, "end_line": 121, "end_column": 36 }, { "span": "from pilot.api import State ", "start_line": 122, "start_column": 0, "end_line": 122, "end_column": 27 }, { "span": "from pilot.api import ComputeUnitDescription, DataUnitDescription, PilotComputeDescription", "start_line": 123, "start_column": 0, "end_line": 123, "end_column": 90 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", " ", "B", "{", "Big", "Jo", "b", " ", "Document", "ation", "}", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "is", " ", "the", " ", "Big", "Jo", "b", " ", "implementation", " ", "of", " ", "the", " ", "Pilo", "t", " ", "API", ".", " ", "Pilo", "t", "-", "Jo", "bs", " ", "(", "als", "o", " ", "referred", " ", "to", " ", "as", "\\", "10", ";", "Pilo", "t", " ", "Compute", ")", " ", "deco", "uple", " ", "system", " ", "level", " ", "and", " ", "applica", "tion", " ", "level", " ", "job", " ", "manage", "ment", ".", " ", " ", "\\", "10", ";", "\\", "10", ";", "The", " ", "main", " ", "concepts", " ", "and", " ", "classe", "s", " ", "exposed", " ", "by", " ", "the", " ", "Compute", " ", "part", " ", "of", " ", "the", " ", "API", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Pilo", "t", "Compute", "}", " ", "(", "PC", "):", " ", "\\", "10", ";", " ", " ", "a", " ", "pilot", " ", "job", ",", " ", "whi", "ch", " ", "can", " ", "execute", " ", "some", " ", "compute", " ", "workload", " ", "(", "L", "{", "Compute", "Unit", "}).", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Pilo", "t", "Compute", "Descripti", "on", "}", " ", "(", "PC", "D", "):", " ", "\\", "10", ";", " ", " ", "description", " ", "for", " ", "speci", "fy", "ing", " ", "the", " ", "require", "ment", "s", " ", "of", " ", "a", " ", "\\\\", "L", "{", "Pilo", "t", "Compute", "}.", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Pilo", "t", "Compute", "Service", "}", " ", "(", "PC", "S", "):", " ", "\\", "10", ";", " ", " ", "a", " ", "factor", "y", " ", "for", " ", "creati", "ng", " ", "\\\\", "L", "{", "Pilo", "t", "Compute", "}", "s", ".", " ", " ", "\\", "10", ";", "\\", "10", ";", "The", " ", "data", " ", "side", " ", "of", " ", "the", " ", "Pilo", "t", " ", "API", " ", "is", " ", "symmetric", " ", "to", " ", "the", " ", "compute", " ", "side", ".", " ", " ", "The", " ", "exposed", "\\", "10", ";", "classe", "s", " ", "for", " ", "mana", "ging", " ", "Pilo", "t", " ", "Data", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Pilo", "t", "Data", "}", " ", "(", "PD", "):", " ", "\\", "10", ";", " ", " ", "a", " ", "pilot", " ", "tha", "t", " ", "manage", "s", " ", "some", " ", "data", " ", "workload", " ", "(", "L", "{", "Data", "Unit", "})", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Pilo", "t", "Data", "Descripti", "on", "}", " ", "(", "PD", "D", "):", "\\", "10", ";", " ", " ", "a", " ", "abstract", " ", "description", " ", "of", " ", "the", " ", "require", "ment", "s", " ", "of", " ", "the", " ", "PD", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Pilo", "t", "Data", "Service", "}", " ", "(", "PD", "S", "):", " ", "\\", "10", ";", " ", " ", "a", " ", "factor", "y", " ", "(", "service", ")", " ", "whi", "ch", " ", "can", " ", "create", " ", "L", "{", "Pilo", "t", "Data", "}", "s", " ", "according", " ", "to", " ", "some", "\\", "10", ";", " ", " ", "specifica", "tion", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "The", " ", "applica", "tion", " ", "workload", " ", "is", " ", "represent", "ed", " ", "by", " ", "so", " ", "call", "ed", " ", "L", "{", "Compute", "Unit", "}", "s", " ", "and", " ", " ", "L", "{", "Data", "Unit", "}", "s", ":", " ", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Compute", "Unit", "}", " ", "(", "CU", "):", " ", "\\", "10", ";", " ", " ", "a", " ", "work", " ", "item", " ", "executed", " ", "on", " ", "a", " ", "L", "{", "Pilo", "t", "Compute", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Data", "Unit", "}", " ", "(", "DU", "):", " ", "\\", "10", ";", " ", " ", "a", " ", "data", " ", "item", " ", "manage", "d", " ", "by", " ", "a", " ", "L", "{", "Pilo", "t", "Data", "}", "\\", "10", ";", "\\", "10", ";", "Bot", "h", " ", "Compute", " ", "and", " ", "Data", " ", "Unit", "s", " ", "are", " ", "specified", " ", "usi", "ng", " ", "an", " ", "abstract", " ", "description", " ", "object", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Compute", "Unit", "Descripti", "on", "}", " ", "(", "CU", "D", "):", "\\", "10", ";", " ", " ", " ", " ", "abstract", " ", "description", " ", "of", " ", "a", " ", "L", "{", "Compute", "Unit", "}.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Data", "Unit", "Descripti", "on", "}", " ", "(", "DU", "D", "):", "\\", "10", ";", " ", " ", " ", " ", "abstract", " ", "description", " ", "of", " ", "a", " ", "L", "{", "Data", "Unit", "}.", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "The", " ", "L", "{", "Compute", "Data", "Service", "}", " ", "represent", "s", " ", "the", " ", "central", " ", "entry", " ", "point", " ", "for", " ", "the", " ", "applica", "tion", "\\", "10", ";", "workload", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "Compute", "Data", "Service", "}", " ", "(", "CD", "S", ")", "\\", "10", ";", " ", " ", "a", " ", "service", " ", "whi", "ch", " ", "can", " ", "map", " ", "CU", "s", " ", "and", " ", "DU", "s", " ", "to", " ", "a", " ", "set", " ", "of", " ", "Pilo", "t", " ", "Compute", " ", "and", " ", "Pilo", "t", " ", "Data", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "L", "{", "Compute", "Data", "Service", "}", " ", "(", "CD", "S", ")", " ", "take", "s", " ", "care", " ", "of", " ", "the", " ", "placem", "ent", " ", "of", " ", "Compute", " ", "and", " ", "Data", " ", "Unit", "s", ".", " ", "\\", "10", ";", "The", " ", "set", " ", "of", " ", "L", "{", "Pilo", "t", "Compute", "}", "s", " ", "and", " ", "L", "{", "Pilo", "t", "Data", "}", " ", "avail", "able", " ", "to", " ", "the", " ", "CD", "S", " ", "can", " ", "be", " ", "change", "d", " ", "dur", "ing", " ", "\\", "10", ";", "the", " ", "applica", "tion", "'", "s", " ", "runt", "ime", ".", " ", " ", "The", " ", "CD", "S", " ", "different", " ", "data", "-", "compute", " ", "affinity", " ", "and", " ", "will", " ", "handle", "\\", "10", ";", "compute", "/", "data", " ", "co", "-", "location", "ing", " ", "for", " ", "the", " ", "request", "ed", " ", "data", "-", "compute", " ", "workload", ".", "\\", "10", ";", "\\", "10", ";", "Pilo", "ts", ",", " ", "Compute", " ", "and", " ", "Data", " ", "Unit", "s", " ", "are", " ", "associate", "d", " ", "with", " ", "a", " ", "L", "{", "State", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "L", "{", "State", "<", "pilot", ".", "api", ".", "compute", ".", "api", ".", "State", ">}", ":", " ", "State", " ", "enumerati", "on", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "B", "{", "Exam", "ple", "}:", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "pilot", " ", "import", " ", "Pilo", "t", "Compute", "Service", ",", " ", "Compute", "Data", "Service", ",", " ", "State", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "pilot", "\\u", "compute", "\\u", "service", " ", "=", " ", "Pilo", "t", "Compute", "Service", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "create", " ", "pilot", " ", "job", " ", "service", " ", "and", " ", "initiate", " ", "a", " ", "pilot", " ", "job", "\\", "10", ";", " ", " ", " ", " ", "pilot", "\\u", "compute", "\\u", "description", " ", "=", " ", "{", "\\", "10", ";", " ", " ", " ", "\"", "service", "\\u", "url", "\":", " ", "'", "fork", "://", "local", "host", "',", "\\", "10", ";", " ", " ", " ", "\"", "number", "\\u", "of", "\\u", "process", "es", "\":", " ", "1", ",", " ", " ", " ", "\\", "10", ";", " ", " ", " ", "\"", "working", "\\u", "director", "y", "\":", " ", "os", ".", "path", ".", "join", "(", "os", ".", "getc", "wd", "()", ",\"", "work", "\")", ",", "\\", "10", ";", " ", " ", " ", "'", "affinity", "\\u", "datacenter", "\\u", "label", "':", " ", "\"", "eu", "-", "de", "-", "south", "\",", " ", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", "'", "affinity", "\\u", "machine", "\\u", "label", "':", " ", "\"", "mym", "achi", "ne", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "pilot", "job", " ", "=", " ", "pilot", "\\u", "compute", "\\u", "service", ".", "create", "\\u", "pilot", "(", "pilot", "\\u", "compute", "\\u", "description", "=", "pilot", "\\u", "compute", "\\u", "description", ")", "\\", "10", ";", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "compute", "\\u", "data\\u", "service", " ", "=", " ", "Compute", "Data", "Service", "()", "\\", "10", ";", " ", " ", " ", " ", "compute", "\\u", "data\\u", "service", ".", "add", "\\u", "pilot", "\\u", "compute", "\\u", "service", "(", "pilot", "\\u", "compute", "\\u", "service", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "start", " ", "work", " ", "unit", "\\", "10", ";", " ", " ", " ", " ", "compute", "\\u", "unit", "\\u", "description", " ", "=", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "executable", "\":", " ", "\"/", "bin", "/", "date", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "argu", "ment", "s", "\":", " ", "[\"", "\"]", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "number", "\\u", "of", "\\u", "process", "es", "\":", " ", "1", ",", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"", "output", "\":", " ", "\"", "stdout", ".", "txt", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "error", "\":", " ", "\"", "std", "err", ".", "txt", "\",", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"", "affinity", "\\u", "datacenter", "\\u", "label", "\":", " ", "\"", "eu", "-", "de", "-", "south", "\",", " ", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"", "affinity", "\\u", "machine", "\\u", "label", "\":", " ", "\"", "mym", "achi", "ne", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "}", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "compute", "\\u", "unit", " ", "=", " ", "compute", "\\u", "data\\u", "service", ".", "submit", "\\u", "compute", "\\u", "unit", "(", "compute", "\\u", "unit", "\\u", "description", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "compute", "\\u", "data\\u", "service", ".", "wait", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "compute", "\\u", "data\\u", "service", ".", "cancel", "()", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "\\", "10", ";", "All", " ", "API", " ", "object", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "utiliz", "ed", " ", "by", " ", "the", " ", "applica", "tion", " ", "reside", " ", "in", " ", "the", " ", "L", "{", "pilot", "}", " ", "namespace", ".", " ", "The", " ", "implementation", " ", "reside", "s", " ", "in", " ", "L", "{", "pilot", ".", "impl", "}.", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", "Ple", "ase", ",", " ", "refer", " ", "to", " ", "U", "{", "https", "://", "git", "hub", ".", "com", "/", "sag", "a", "-", "project", "/", "Big", "Jo", "b", "/", "tree", "/", "master", "/", "example", "s", "/", "pilot", "-", "api", "}", " ", "for", " ", "an", " ", "extensi", "ve", " ", "set", " ", "of", " ", "example", "s", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "applica", "tion", "\\u", "id_", "=_", "\"", "big", "job", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "compute", "\\u", "manager_", "import_", "Pilo", "t", "Compute", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "compute", "\\u", "manager_", "import_", "Pilo", "t", "Compute", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "compute", "\\u", "manager_", "import_", "Compute", "Unit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "data\\u", "manager_", "import_", "Pilo", "t", "Data", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "data\\u", "manager_", "import_", "Pilo", "t", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "data\\u", "manager_", "import_", "Data", "Unit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "\\u", "manager_", "import_", "Compute", "Unit", "Service_", ",_", "Data", "Unit", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "\\u", "manage", "r", "\\u", "dece", "ntra", "l_", "import_", "Compute", "Data", "Service", "Dece", "ntra", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "\\u", "manager_", "import_", "Compute", "Data", "Service_", "as_", "Compute", "Data", "Service", "Cent", "ral_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "impl_", "._", "pilot", "\\u", "manage", "r", "\\u", "dece", "ntra", "l_", "import_", "Compute", "Data", "Service", "Dece", "ntra", "l_", "as_", "Compute", "Data", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "api_", "._", "api_", "import_", "Pilo", "t", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "api_", "import_", "State_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pilot", "_", "._", "api_", "import_", "Compute", "Unit", "Description_", ",_", "Data", "Unit", "Description_", ",_", "Pilo", "t", "Compute", "Description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "big", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Version", " ", "of", " ", "Pilo", "t", "-", "API", "/", "Big", "Jo", "b", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "big", "job_", "._", "version_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/f4mproxy/F4mProxy.py
[ { "content": " def answer_request(self, sendData):\n global g_stopEvent\n global g_downloader\n try:\n\n #Pull apart request path\n request_path=self.path[1:] \n request_path=re.sub(r\"\\?.*\",\"\",request_path)\n #If a request to stop is sent, shut down the proxy\n\n if request_path.lower()==\"stop\":# all special web interfaces here\n sys.exit()\n return\n if request_path.lower()==\"favicon.ico\":\n print 'dont have no icone here, may be in future'\n self.wfile.close()\n return\n\n\n (url,proxy,use_proxy_for_chunks,maxbitrate,simpledownloader, auth,streamtype)=self.decode_url(request_path)\n print 'simpledownloaderxxxxxxxxxxxxxxx',simpledownloader\n if streamtype=='' or streamtype==None or streamtype=='none': streamtype='HDS'\n \n if streamtype=='HDS':\n\n print 'Url received at proxy',url,proxy,use_proxy_for_chunks,maxbitrate\n\n\n #Send file request\n #self.handle_send_request(download_id,file_url, file_name, requested_range,download_mode ,keep_file,connections)\n \n downloader=None\n #downloader=g_downloader\n \n if not downloader or downloader.live==True or not (downloader.init_done and downloader.init_url ==url):\n downloader=F4MDownloader()\n if not downloader.init(self.wfile,url,proxy,use_proxy_for_chunks,g_stopEvent,maxbitrate,auth):\n print 'cannot init'\n return\n g_downloader=downloader\n print 'init...' \n \n enableSeek=False\n requested_range=self.headers.getheader(\"Range\")\n if requested_range==None: requested_range=\"\"\n srange, erange=(None,None)\n \n \n \n if downloader.live==False and len(requested_range)>0 and not requested_range==\"bytes=0-0\": #we have to stream?\n enableSeek=True\n (srange, erange) = self.get_range_request(requested_range, downloader.total_frags)\n \n\n print 'PROXY DATA',downloader.live,enableSeek,requested_range,downloader.total_frags,srange, erange\n enableSeek=False ##disabled for time being, couldn't find better way to handle\n \n framgementToSend=0\n inflate=1815002#(6526684-466/3)#*373/downloader.total_frags# 4142*1024*243/8/40 #1#1024*1024\n if enableSeek:\n #rtype=\"video/x-flv\" #just as default\n self.send_response(206)\n rtype=\"flv-application/octet-stream\" #default type could have gone to the server to get it.\n self.send_header(\"Content-Type\", rtype)\n self.send_header(\"Accept-Ranges\",\"bytes\")\n print 'not LIVE,enable seek',downloader.total_frags\n \n totalsize=downloader.total_frags*inflate\n \n framgementToSend=1#downloader.total_frags\n erange=srange+framgementToSend*inflate\n if erange>=totalsize:\n erange=totalsize-1\n \n # crange=\"bytes \"+str(srange)+\"-\" +str(int(downloader.total_frags-1))+\"/\"+str(downloader.total_frags)#recalculate crange based on srange, portionLen and content_size \n # crange=\"bytes \"+str(srange)+\"-\" +str(int(totalsize-1))+\"/\"+str(totalsize)#recalculate crange based on srange, portionLen and content_size \n crange=\"bytes \"+str(srange)+\"-\" +str(int(erange))+\"/*\"#+str(totalsize)#recalculate crange based on srange, portionLen and content_size \n print srange/inflate,erange/inflate,totalsize/inflate\n self.send_header(\"Content-Length\", str(totalsize))\n self.send_header(\"Content-Range\",crange)\n etag=self.generate_ETag(url)\n self.send_header(\"ETag\",etag)\n print crange\n self.send_header(\"Last-Modified\",\"Wed, 21 Feb 2000 08:43:39 GMT\")\n self.send_header(\"Cache-Control\",\"public, must-revalidate\")\n self.send_header(\"Cache-Control\",\"no-cache\")\n self.send_header(\"Pragma\",\"no-cache\")\n self.send_header(\"features\",\"seekable,stridable\")\n self.send_header(\"client-id\",\"12345\")\n self.send_header(\"Connection\", 'close')\n else:\n self.send_response(200)\n rtype=\"flv-application/octet-stream\" #default type could have gone to the server to get it.\n self.send_header(\"Content-Type\", rtype)\n srange=None\n \n elif streamtype=='SIMPLE' or simpledownloader :\n downloader=interalSimpleDownloader();\n if not downloader.init(self.wfile,url,proxy,g_stopEvent,maxbitrate):\n print 'cannot init'\n return\n srange,framgementToSend=(None,None)\n self.send_response(200)\n rtype=\"flv-application/octet-stream\" #default type could have gone to the server to get it.\n self.send_header(\"Content-Type\", rtype)\n srange=None\n elif streamtype=='HLS' or simpledownloader :\n downloader=HLSDownloader()\n if not downloader.init(self.wfile,url,proxy,use_proxy_for_chunks,g_stopEvent,maxbitrate,auth):\n print 'cannot init'\n return\n \n srange,framgementToSend=(None,None)\n self.send_response(200)\n rtype=\"flv-application/octet-stream\" #default type could have gone to the server to get it.\n self.send_header(\"Content-Type\", rtype)\n srange=None\n \n\n #rtype=\"flv-application/octet-stream\" #default type could have gone to the server to get it. \n #self.send_header(\"Content-Type\", rtype) \n \n self.end_headers()\n if not srange==None:\n srange=srange/inflate\n \n if sendData:\n downloader.keep_sending_video(self.wfile,srange,framgementToSend)\n #runningthread=thread.start_new_thread(downloader.download,(self.wfile,url,proxy,use_proxy_for_chunks,))\n print 'srange,framgementToSend',srange,framgementToSend\n #runningthread=thread.start_new_thread(downloader.keep_sending_video,(self.wfile,srange,framgementToSend,))\n \n xbmc.sleep(500)\n while not downloader.status==\"finished\":\n xbmc.sleep(200);\n\n\n except:\n #Print out a stack trace\n traceback.print_exc()\n g_stopEvent.set()\n self.send_response(404)\n #Close output stream file\n self.wfile.close()\n return\n\n #Close output stream file\n self.wfile.close()\n return ", "metadata": "root.MyHandler.answer_request", "header": "['class', 'MyHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 69 }, { "content": " def get_range_request(self, hrange, file_size):\n if hrange==None:\n srange=0\n erange=None\n else:\n try:\n #Get the byte value from the request string.\n hrange=str(hrange)\n splitRange=hrange.split(\"=\")[1].split(\"-\")\n srange=int(splitRange[0])\n erange = splitRange[1]\n if erange==\"\":\n erange=int(file_size)-1\n #Build range string\n \n except:\n # Failure to build range string? Create a 0- range.\n srange=0\n erange=int(file_size-1);\n return (srange, erange)", "metadata": "root.MyHandler.get_range_request", "header": "['class', 'MyHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 224 }, { "content": " def decode_url(self, url):\n print 'in params'\n params=urlparse.parse_qs(url)\n print 'params',params # TODO read all params\n #({'url': url, 'downloadmode': downloadmode, 'keep_file':keep_file,'connections':connections})\n received_url = params['url'][0]#\n use_proxy_for_chunks =False\n proxy=None\n try:\n proxy = params['proxy'][0]#\n use_proxy_for_chunks = params['use_proxy_for_chunks'][0]#\n except: pass\n \n maxbitrate=0\n try:\n maxbitrate = int(params['maxbitrate'][0])\n except: pass\n auth=None\n try:\n auth = params['auth'][0]\n except: pass\n\n if auth=='None' and auth=='':\n auth=None\n\n if proxy=='None' or proxy=='':\n proxy=None\n if use_proxy_for_chunks=='False':\n use_proxy_for_chunks=False\n simpledownloader=False\n try:\n simpledownloader = params['simpledownloader'][0]#\n if simpledownloader.lower()=='true':\n print 'params[simpledownloader][0]',params['simpledownloader'][0]\n simpledownloader=True\n else:\n simpledownloader=False\n except: pass\n streamtype='HDS'\n try:\n streamtype = params['streamtype'][0]# \n except: pass \n if streamtype=='None' and streamtype=='': streamtype='HDS'\n return (received_url,proxy,use_proxy_for_chunks,maxbitrate,simpledownloader,auth,streamtype) ", "metadata": "root.MyHandler.decode_url", "header": "['class', 'MyHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 245 } ]
[ { "span": "except:", "start_line": 206, "start_column": 8, "end_line": 206, "end_column": 15 }, { "span": "except:", "start_line": 239, "start_column": 12, "end_line": 239, "end_column": 19 }, { "span": "except: ", "start_line": 256, "start_column": 8, "end_line": 256, "end_column": 15 }, { "span": "except: ", "start_line": 261, "start_column": 8, "end_line": 261, "end_column": 15 }, { "span": "except: ", "start_line": 265, "start_column": 8, "end_line": 265, "end_column": 15 }, { "span": "except: ", "start_line": 282, "start_column": 8, "end_line": 282, "end_column": 15 }, { "span": "except: ", "start_line": 286, "start_column": 8, "end_line": 286, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "My", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "answer", "\\u", "request_", "(_", "self_", ",_", "send", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "g", "\\u", "stop", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "g", "\\u", "downloader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pul", "l", " ", "apart", " ", "request", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "path_", "=_", "self_", "._", "path_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "path_", "=_", "re_", "._", "sub_", "(_", "r", "\"\\\\", "?", ".*\"_", ",_", "\"\"_", ",_", "request", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "If", " ", "a", " ", "request", " ", "to", " ", "stop", " ", "is", " ", "sent", ",", " ", "shut", " ", "down", " ", "the", " ", "proxy_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request", "\\u", "path_", "._", "lower_", "(_", ")_", "==_", "\"", "stop", "\"_", ":_", "#", " ", "all", " ", "special", " ", "web", " ", "interface", "s", " ", "here_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request", "\\u", "path_", "._", "lower_", "(_", ")_", "==_", "\"", "fav", "icon", ".", "ico", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "don", "t", " ", "have", " ", "no", " ", "icon", "e", " ", "here", ",", " ", "may", " ", "be", " ", "in", " ", "future", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "url_", ",_", "proxy_", ",_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", ",_", "max", "bitrate_", ",_", "simple", "downloader_", ",_", "auth_", ",_", "stream", "type_", ")_", "=_", "self_", "._", "decode", "\\u", "url_", "(_", "request", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "simple", "downloader", "xxxxxxxx", "xxxxxx", "x", "'_", ",_", "simple", "downloader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stream", "type_", "==_", "''_", "or_", "stream", "type_", "==_", "None_", "or_", "stream", "type_", "==_", "'", "none", "'_", ":_", "stream", "type_", "=_", "'", "HD", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stream", "type_", "==_", "'", "HD", "S", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Ur", "l", " ", "receive", "d", " ", "at", " ", "proxy", "'_", ",_", "url_", ",_", "proxy_", ",_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", ",_", "max", "bitrate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Sen", "d", " ", "file", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "handle", "\\u", "send", "\\u", "request", "(", "download", "\\u", "id", ",", "file", "\\u", "url", ",", " ", "file", "\\u", "name", ",", " ", "request", "ed", "\\u", "range", ",", "download", "\\u", "mode", " ", ",", "keep", "\\u", "file", ",", "connections", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "downloader_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "downloader", "=", "g", "\\u", "downloader_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "downloader_", "or_", "downloader_", "._", "live_", "==_", "True_", "or_", "not_", "(_", "downloader_", "._", "init", "\\u", "done_", "and_", "downloader_", "._", "init", "\\u", "url_", "==_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "downloader_", "=_", "F4", "MD", "own", "loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "downloader_", "._", "init_", "(_", "self_", "._", "wfile_", ",_", "url_", ",_", "proxy_", ",_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", ",_", "g", "\\u", "stop", "Event_", ",_", "max", "bitrate_", ",_", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "cann", "ot", " ", "init", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g", "\\u", "downloader_", "=_", "downloader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "init", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "enable", "Seek", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "ed", "\\u", "range_", "=_", "self_", "._", "headers_", "._", "getheader_", "(_", "\"", "Range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request", "ed", "\\u", "range_", "==_", "None_", ":_", "request", "ed", "\\u", "range_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sra", "nge_", ",_", "era", "nge_", "=_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "downloader_", "._", "live_", "==_", "False_", "and_", "len_", "(_", "request", "ed", "\\u", "range_", ")_", ">_", "0_", "and_", "not_", "request", "ed", "\\u", "range_", "==_", "\"", "bytes", "=", "0", "-0", "\"_", ":_", "#", "we", " ", "have", " ", "to", " ", "stream", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "enable", "Seek", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "sra", "nge_", ",_", "era", "nge_", ")_", "=_", "self_", "._", "get", "\\u", "range", "\\u", "request_", "(_", "request", "ed", "\\u", "range_", ",_", "downloader_", "._", "total", "\\u", "frags", "_", ")_", "\\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_", "'", "PROX", "Y", " ", "DATA", "'_", ",_", "downloader_", "._", "live_", ",_", "enable", "Seek", "_", ",_", "request", "ed", "\\u", "range_", ",_", "downloader_", "._", "total", "\\u", "frags", "_", ",_", "sra", "nge_", ",_", "era", "nge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enable", "Seek", "_", "=_", "False_", "##", "disable", "d", " ", "for", " ", "time", " ", "bei", "ng", ",", " ", "coul", "dn", "'", "t", " ", "find", " ", "bett", "er", " ", "way", " ", "to", " ", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fra", "mg", "ement", "To", "Send_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "infla", "te_", "=_", "181", "500", "2_", "#(", "652", "668", "4", "-", "466", "/", "3", ")#", "*", "373", "/", "downloader", ".", "total", "\\u", "frags", "#", " ", "414", "2", "*", "1024", "*", "243", "/", "8", "/", "40", " ", "#", "1", "#", "1024", "*", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "enable", "Seek", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "rty", "pe", "=\"", "video", "/", "x", "-", "fl", "v", "\"", " ", "#", "just", " ", "as", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "send", "\\u", "response_", "(_", "206_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtype_", "=_", "\"", "fl", "v", "-", "applica", "tion", "/", "oct", "et", "-", "stream", "\"_", "#", "default", " ", "type", " ", "coul", "d", " ", "have", " ", "gone", " ", "to", " ", "the", " ", "server", " ", "to", " ", "get", " ", "it", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Conten", "t", "-", "Type", "\"_", ",_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Accept", "-", "Range", "s", "\"_", ",_", "\"", "bytes", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "not", " ", "LIVE", ",", "enable", " ", "seek", "'_", ",_", "downloader_", "._", "total", "\\u", "frags", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "totals", "ize_", "=_", "downloader_", "._", "total", "\\u", "frags", "_", "*_", "infla", "te_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fra", "mg", "ement", "To", "Send_", "=_", "1_", "#", "downloader", ".", "total", "\\u", "frags", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "era", "nge_", "=_", "sra", "nge_", "+_", "fra", "mg", "ement", "To", "Send_", "*_", "infla", "te_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "era", "nge_", ">=_", "totals", "ize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "era", "nge_", "=_", "totals", "ize_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "cra", "nge", "=\"", "bytes", " ", "\"+", "str", "(", "sra", "nge", ")+", "\"-", "\"", " ", "+", "str", "(", "int", "(", "downloader", ".", "total", "\\u", "frags", "-1", "))", "+\"", "/\"", "+", "str", "(", "downloader", ".", "total", "\\u", "frags", ")#", "recalc", "ulate", " ", "cra", "nge", " ", "based", " ", "on", " ", "sra", "nge", ",", " ", "porti", "on", "Len", " ", "and", " ", "content", "\\u", "size", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "cra", "nge", "=\"", "bytes", " ", "\"+", "str", "(", "sra", "nge", ")+", "\"-", "\"", " ", "+", "str", "(", "int", "(", "totals", "ize", "-1", "))", "+\"", "/\"", "+", "str", "(", "totals", "ize", ")#", "recalc", "ulate", " ", "cra", "nge", " ", "based", " ", "on", " ", "sra", "nge", ",", " ", "porti", "on", "Len", " ", "and", " ", "content", "\\u", "size", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cra", "nge_", "=_", "\"", "bytes", " ", "\"_", "+_", "str_", "(_", "sra", "nge_", ")_", "+_", "\"-\"_", "+_", "str_", "(_", "int_", "(_", "era", "nge_", ")_", ")_", "+_", "\"/*", "\"_", "#", "+", "str", "(", "totals", "ize", ")#", "recalc", "ulate", " ", "cra", "nge", " ", "based", " ", "on", " ", "sra", "nge", ",", " ", "porti", "on", "Len", " ", "and", " ", "content", "\\u", "size", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "sra", "nge_", "/_", "infla", "te_", ",_", "era", "nge_", "/_", "infla", "te_", ",_", "totals", "ize_", "/_", "infla", "te_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Conten", "t", "-", "Length", "\"_", ",_", "str_", "(_", "totals", "ize_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Conten", "t", "-", "Range", "\"_", ",_", "cra", "nge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "generat", "e\\u", "ET", "ag_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "ET", "ag", "\"_", ",_", "etag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "cra", "nge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Las", "t", "-", "Modifie", "d", "\"_", ",_", "\"", "We", "d", ",", " ", "21", " ", "Fe", "b", " ", "2000", " ", "0", "8", ":", "4", "3", ":", "3", "9", " ", "GM", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Cache", "-", "Control", "\"_", ",_", "\"", "public", ",", " ", "must", "-", "rev", "alid", "ate", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Cache", "-", "Control", "\"_", ",_", "\"", "no", "-", "cache", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Pra", "gma", "\"_", ",_", "\"", "no", "-", "cache", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "features", "\"_", ",_", "\"", "seek", "able", ",", "stri", "dable", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "client", "-", "id", "\"_", ",_", "\"", "12345", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Connect", "ion", "\"_", ",_", "'", "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_", "._", "send", "\\u", "response_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtype_", "=_", "\"", "fl", "v", "-", "applica", "tion", "/", "oct", "et", "-", "stream", "\"_", "#", "default", " ", "type", " ", "coul", "d", " ", "have", " ", "gone", " ", "to", " ", "the", " ", "server", " ", "to", " ", "get", " ", "it", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Conten", "t", "-", "Type", "\"_", ",_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sra", "nge_", "=_", "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_", "elif_", "stream", "type_", "==_", "'", "SIMPLE", "'_", "or_", "simple", "downloader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "downloader_", "=_", "inter", "al", "Simple", "Downloader_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "downloader_", "._", "init_", "(_", "self_", "._", "wfile_", ",_", "url_", ",_", "proxy_", ",_", "g", "\\u", "stop", "Event_", ",_", "max", "bitrate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "cann", "ot", " ", "init", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sra", "nge_", ",_", "fra", "mg", "ement", "To", "Send_", "=_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtype_", "=_", "\"", "fl", "v", "-", "applica", "tion", "/", "oct", "et", "-", "stream", "\"_", "#", "default", " ", "type", " ", "coul", "d", " ", "have", " ", "gone", " ", "to", " ", "the", " ", "server", " ", "to", " ", "get", " ", "it", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Conten", "t", "-", "Type", "\"_", ",_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sra", "nge_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stream", "type_", "==_", "'", "HL", "S", "'_", "or_", "simple", "downloader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "downloader_", "=_", "HL", "SD", "own", "loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "downloader_", "._", "init_", "(_", "self_", "._", "wfile_", ",_", "url_", ",_", "proxy_", ",_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", ",_", "g", "\\u", "stop", "Event_", ",_", "max", "bitrate_", ",_", "auth_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "cann", "ot", " ", "init", "'_", "\\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_", "sra", "nge_", ",_", "fra", "mg", "ement", "To", "Send_", "=_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtype_", "=_", "\"", "fl", "v", "-", "applica", "tion", "/", "oct", "et", "-", "stream", "\"_", "#", "default", " ", "type", " ", "coul", "d", " ", "have", " ", "gone", " ", "to", " ", "the", " ", "server", " ", "to", " ", "get", " ", "it", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "\"", "Conten", "t", "-", "Type", "\"_", ",_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sra", "nge_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "rty", "pe", "=\"", "fl", "v", "-", "applica", "tion", "/", "oct", "et", "-", "stream", "\"", " ", " ", "#", "default", " ", "type", " ", "coul", "d", " ", "have", " ", "gone", " ", "to", " ", "the", " ", "server", " ", "to", " ", "get", " ", "it", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "send", "\\u", "header", "(\"", "Conten", "t", "-", "Type", "\",", " ", "rty", "pe", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sra", "nge_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sra", "nge_", "=_", "sra", "nge_", "/_", "infla", "te_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "send", "Data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "downloader_", "._", "keep", "\\u", "sendin", "g", "\\u", "video_", "(_", "self_", "._", "wfile_", ",_", "sra", "nge_", ",_", "fra", "mg", "ement", "To", "Send_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "runn", "ing", "thread", "=", "thread", ".", "start", "\\u", "new", "\\u", "thread", "(", "downloader", ".", "download", ",(", "self", ".", "wf", "ile", ",", "url", ",", "proxy", ",", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks", ",)", ")_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "sra", "nge", ",", "fra", "mg", "ement", "To", "Sen", "d", "'_", ",_", "sra", "nge_", ",_", "fra", "mg", "ement", "To", "Send_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "runn", "ing", "thread", "=", "thread", ".", "start", "\\u", "new", "\\u", "thread", "(", "downloader", ".", "keep", "\\u", "sendin", "g", "\\u", "video", ",(", "self", ".", "wf", "ile", ",", "sra", "nge", ",", "fra", "mg", "ement", "To", "Sen", "d", ",)", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xbmc_", "._", "sleep_", "(_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "downloader_", "._", "status_", "==_", "\"", "finish", "ed", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "xbmc_", "._", "sleep_", "(_", "200_", ")_", ";_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Print", " ", "out", " ", "a", " ", "stack", " ", "trace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "stop", "Event_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Clos", "e", " ", "output", " ", "stream", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Clos", "e", " ", "output", " ", "stream", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "wfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "range", "\\u", "request_", "(_", "self_", ",_", "hra", "nge_", ",_", "file", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hra", "nge_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sra", "nge_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "era", "nge_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Get", " ", "the", " ", "byte", " ", "value", " ", "from", " ", "the", " ", "request", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hra", "nge_", "=_", "str_", "(_", "hra", "nge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "split", "Range_", "=_", "hra", "nge_", "._", "split_", "(_", "\"=\"_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "\"-\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sra", "nge_", "=_", "int_", "(_", "split", "Range_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "era", "nge_", "=_", "split", "Range_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "era", "nge_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "era", "nge_", "=_", "int_", "(_", "file", "\\u", "size_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Build", " ", "range", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fail", "ure", " ", "to", " ", "build", " ", "range", " ", "string", "?", " ", "Creat", "e", " ", "a", " ", "0", "-", " ", "range", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sra", "nge_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "era", "nge_", "=_", "int_", "(_", "file", "\\u", "size_", "-_", "1_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "sra", "nge_", ",_", "era", "nge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode", "\\u", "url_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "in", " ", "params", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "params", "'_", ",_", "params_", "#", " ", "TOD", "O", " ", "read", " ", "all", " ", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#(", "{", "'", "url", "':", " ", "url", ",", " ", "'", "download", "mode", "':", " ", "download", "mode", ",", " ", "'", "keep", "\\u", "file", "':", "keep", "\\u", "file", ",'", "connections", "':", "connections", "})", "_", "\\u\\u\\uNL\\u\\u\\u_", "receive", "d\\u", "url_", "=_", "params_", "[_", "'", "url", "'_", "]_", "[_", "0_", "]_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proxy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxy_", "=_", "params_", "[_", "'", "proxy", "'_", "]_", "[_", "0_", "]_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", "=_", "params_", "[_", "'", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks", "'_", "]_", "[_", "0_", "]_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "bitrate_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "bitrate_", "=_", "int_", "(_", "params_", "[_", "'", "max", "bit", "rate", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "params_", "[_", "'", "auth", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auth_", "==_", "'", "Non", "e", "'_", "and_", "auth_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proxy_", "==_", "'", "Non", "e", "'_", "or_", "proxy_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", "==_", "'", "Fal", "se", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "simple", "downloader_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "simple", "downloader_", "=_", "params_", "[_", "'", "simple", "downloader", "'_", "]_", "[_", "0_", "]_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "simple", "downloader_", "._", "lower_", "(_", ")_", "==_", "'", "true", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "params", "[", "simple", "downloader", "][", "0", "]'_", ",_", "params_", "[_", "'", "simple", "downloader", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simple", "downloader_", "=_", "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 ", " _", "simple", "downloader_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "type_", "=_", "'", "HD", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream", "type_", "=_", "params_", "[_", "'", "stream", "type", "'_", "]_", "[_", "0_", "]_", "#", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stream", "type_", "==_", "'", "Non", "e", "'_", "and_", "stream", "type_", "==_", "''_", ":_", "stream", "type_", "=_", "'", "HD", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "receive", "d\\u", "url_", ",_", "proxy_", ",_", "use", "\\u", "proxy", "\\u", "for", "\\u", "chunks_", ",_", "max", "bitrate_", ",_", "simple", "downloader_", ",_", "auth_", ",_", "stream", "type_", ")_", "\\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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 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
ilastik/ilastik-0.5/ilastik/modules/interactive_console/gui/shellWidget.py
[ { "content": "# -*- python -*-\n#\n# Copyright 2006-2009 - 2008 INRIA - CIRAD - INRA \n#\n# File author(s): Samuel Dufour-Kowalski <samuel.dufour@sophia.inria.fr>\n# Christophe Pradal <christophe.prada@cirad.fr>\n#\n# Distributed under the CeCILL v2 License.\n# See accompanying LICENSE section at the end of this file or \n# http://www.cecill.info/licences/Licence_CeCILL_V2-en.html\n# \n################################################################################\n\"\"\"This module implements a QT4 python interpreter widget.\"\"\"\n\n__license__ = \"CeCILL V2\"\n\n\nimport sys\nfrom PyQt4 import QtCore, QtGui\nfrom PyQt4.QtCore import Qt\n\nfrom PyQt4.Qsci import QsciScintilla, QsciLexerPython\nfrom PyQt4.QtGui import QApplication\nfrom PyQt4.QtCore import QThread, QEvent\n\nRedirectionEventId = QEvent.User+100\nsys_stderr = None\nsys_stdout = None\nsys_stdin = None\n\ntry:\n import openalea.lpy.gui.py2exe_release\n py2exe_release = True\nexcept:\n py2exe_release = False\n \n#*******************************************************************************\n# M u l t i p l e R e d i r e c t i o n *\n#*******************************************************************************\n\n\n\n#*******************************************************************************\n# T h r e a d e d R e d i r e c t i o n *\n#*******************************************************************************\n\n\n \n#*******************************************************************************\n# G r a p h i c a l S t r e a m R e d i r e c t i o n *\n#*******************************************************************************\n\n \n\n#*******************************************************************************\n# S c i S h e l l *\n#*******************************************************************************\n\n\n\n\n#*******************************************************************************\n# i f _ _ n a m e _ _ = = \" _ _ m a i n _ _ \" *\n#*******************************************************************************\n\nif __name__==\"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def __showDynCompletion(self):\n \"\"\"\n Display a completion list based on the last token\n \"\"\"\n\n text = self.__get_current_line()\n \n try:\n locals = self.interpreter.locals\n obj = eval(text, globals(), self.interpreter.locals)\n l = dir(obj)\n #l = filter(lambda x : not x.startswith('__'), l)\n self.__showCompletions(l, text) \n except : pass", "metadata": "root.SciShell.__showDynCompletion", "header": "['class', 'SciShell', '(', 'QsciScintilla', ',', 'GraphicalStreamRedirection', ')', ':', '___EOS___']", "index": 739 } ]
[ { "span": "except:", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 7 }, { "span": "except : ", "start_line": 752, "start_column": 8, "end_line": 752, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "python", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "2006", "-", "200", "9", " ", "-", " ", "2008", " ", "IN", "RIA", " ", "-", " ", "CIR", "AD", " ", "-", " ", "IN", "RA", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "File", " ", "author", "(", "s", "):", " ", "Sam", "uel", " ", "Du", "four", "-", "Ko", "wal", "ski", " ", "<", "sam", "uel", ".", "du", "four", "@", "sop", "hia", ".", "inr", "ia", ".", "fr", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "Christ", "oph", "e", " ", "Pra", "dal", " ", "<", "chris", "top", "he", ".", "pra", "da", "@", "cir", "ad", ".", "fr", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "Ce", "CI", "LL", " ", "v2", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "accom", "pan", "ying", " ", "LICENSE", " ", "section", " ", "at", " ", "the", " ", "end", " ", "of", " ", "this", " ", "file", " ", "or", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "cec", "ill", ".", "info", "/", "licence", "s", "/", "Licen", "ce", "\\u", "Ce", "CI", "LL", "\\u", "V2", "-", "en", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "module", " ", "implement", "s", " ", "a", " ", "QT", "4", " ", "python", " ", "interprete", "r", " ", "widget", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "Ce", "CI", "LL", " ", "V2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Core_", "import_", "Qt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qs", "ci_", "import_", "Qs", "ci", "Sci", "ntil", "la_", ",_", "Qs", "ci", "Lex", "er", "Python_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Gui_", "import_", "QA", "ppl", "ication", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Core_", "import_", "QT", "hread", "_", ",_", "QE", "vent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Redirect", "ion", "Event", "Id_", "=_", "QE", "vent_", "._", "User_", "+_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys", "\\u", "stderr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys", "\\u", "stdout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys", "\\u", "stdin_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "opena", "lea", "_", "._", "lp", "y_", "._", "gui_", "._", "py2", "exe", "\\u", "release_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py2", "exe", "\\u", "release_", "=_", "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 ", " _", "py2", "exe", "\\u", "release_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "***********", "***********", "***********", "***********", "**_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "M", " ", "u", " ", "l", " ", "t", " ", "i", " ", "p", " ", "l", " ", "e", " ", "R", " ", "e", " ", "d", " ", "i", " ", "r", " ", "e", " ", "c", " ", "t", " ", "i", " ", "o", " ", "n", " ", " ", " ", " ", "*_", "\\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_", "#", " ", "T", " ", "h", " ", "r", " ", "e", " ", "a", " ", "d", " ", "e", " ", "d", " ", "R", " ", "e", " ", "d", " ", "i", " ", "r", " ", "e", " ", "c", " ", "t", " ", "i", " ", "o", " ", "n", " ", " ", " ", " ", "*_", "\\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_", "#", " ", "G", " ", "r", " ", "a", " ", "p", " ", "h", " ", "i", " ", "c", " ", "a", " ", "l", " ", "S", " ", "t", " ", "r", " ", "e", " ", "a", " ", "m", " ", "R", " ", "e", " ", "d", " ", "i", " ", "r", " ", "e", " ", "c", " ", "t", " ", "i", " ", "o", " ", "n", " ", " ", " ", " ", "*_", "\\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_", "#", " ", "S", " ", "c", " ", "i", " ", "S", " ", "h", " ", "e", " ", "l", " ", "l", " ", " ", " ", " ", "*_", "\\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_", "#", " ", "i", " ", "f", " ", " ", " ", "\\u", " ", "\\u", " ", "n", " ", "a", " ", "m", " ", "e", " ", "\\u", " ", "\\u", " ", " ", " ", "=", " ", "=", " ", " ", " ", "\"", " ", "\\u", " ", "\\u", " ", "m", " ", "a", " ", "i", " ", "n", " ", "\\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 ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Sci", "Shell_", "(_", "Qs", "ci", "Sci", "ntil", "la_", ",_", "Graphic", "al", "Stream", "Redirect", "ion_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "show", "Dyn", "Completi", "on_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "a", " ", "completion", " ", "list", " ", "based", " ", "on", " ", "the", " ", "last", " ", "token", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "current", "\\u", "line_", "(_", ")_", "\\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 ", " _", "locals_", "=_", "self_", "._", "interpreter_", "._", "locals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "eval_", "(_", "text_", ",_", "globals_", "(_", ")_", ",_", "self_", "._", "interpreter_", "._", "locals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "dir_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "l", " ", "=", " ", "filter", "(", "lambda", " ", "x", " ", ":", " ", "not", " ", "x", ".", "startswith", "('\\", "u\\u", "')", ",", " ", "l", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "show", "Completi", "ons_", "(_", "l_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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ests/unit/test_stacky_server.py
[ { "content": " def test_search_with_wrong_field_value_returns_400_error_and_a_message(self):\n fake_request = self.mox.CreateMockAnything()\n fake_request.GET = {'field': 'tenant', 'value': 'tenant'}\n models.RawData.objects.filter(tenant='tenant').AndRaise(FieldError)\n self.mox.ReplayAll()\n\n resp = stacky_server.search(fake_request)\n\n self.assertEqual(resp.status_code, 400)\n json_resp = json.loads(resp.content)\n self.assertEquals(json_resp[0],[u'Error', u'Message'])\n self.assertEquals(json_resp[1],\n [u'Bad Request', u\"The requested field\"\n u\" 'tenant' does not exist for the corresponding object.\\nNote: \"\n u\"The field names of database are case-sensitive.\"])\n\n self.mox.VerifyAll()", "metadata": "root.StackyServerTestCase.test_search_with_wrong_field_value_returns_400_error_and_a_message", "header": "['class', 'StackyServerTestCase', '(', 'StacktachBaseTestCase', ')', ':', '___EOS___']", "index": 1179 }, { "content": " def test_jsonreports_search_with_invalid_fields(self):\n request = self.mox.CreateMockAnything()\n request.GET = {'invalid_column_1': 'value_1',\n 'invalid_column_2': 'value_2',\n 'version': 4,\n 'json': 'json',\n 'period_start': '2014-01-01 00:00:00'}\n self.mox.ReplayAll()\n\n actual_result = stacky_server.do_jsonreports_search(request).content\n expected_result = [\n [\"Error\", \"Message\"],\n [\"Bad Request\", \"The requested fields either do not exist for the \"\n \"corresponding object or are not searchable: invalid_column_1, \"\n \"invalid_column_2, json, version. Note: The field names of \"\n \"database are case-sensitive.\"]\n ]\n self.assertEqual(ast.literal_eval(actual_result), expected_result)\n self.mox.VerifyAll()", "metadata": "root.JsonReportsSearchAPI.test_jsonreports_search_with_invalid_fields", "header": "['class', 'JsonReportsSearchAPI', '(', 'StacktachBaseTestCase', ')', ':', '___EOS___']", "index": 1360 }, { "content": " def test_jsonreports_search_with_invalid_period_start(self):\n request = self.mox.CreateMockAnything()\n request.GET = {'period_start': '1234'}\n self.mox.ReplayAll()\n\n actual_result = stacky_server.do_jsonreports_search(request).content\n expected_result = [\n [\"Error\", \"Message\"],\n [\"Bad Request\", \"'1234' value has an invalid format. It must be in \"\n \"YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.\"]\n ]\n self.assertEqual(ast.literal_eval(actual_result), expected_result)\n self.mox.VerifyAll()", "metadata": "root.JsonReportsSearchAPI.test_jsonreports_search_with_invalid_period_start", "header": "['class', 'JsonReportsSearchAPI', '(', 'StacktachBaseTestCase', ')', ':', '___EOS___']", "index": 1380 }, { "content": " def test_jsonreports_search_with_invalid_period_end(self):\n request = self.mox.CreateMockAnything()\n request.GET = {'period_end': '1234'}\n self.mox.ReplayAll()\n\n actual_result = stacky_server.do_jsonreports_search(request).content\n expected_result = [\n [\"Error\", \"Message\"],\n [\"Bad Request\", \"'1234' value has an invalid format. It must be in \"\n \"YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.\"]\n ]\n self.assertEqual(ast.literal_eval(actual_result), expected_result)\n self.mox.VerifyAll()", "metadata": "root.JsonReportsSearchAPI.test_jsonreports_search_with_invalid_period_end", "header": "['class', 'JsonReportsSearchAPI', '(', 'StacktachBaseTestCase', ')', ':', '___EOS___']", "index": 1394 }, { "content": " def test_jsonreports_search_with_invalid_id(self):\n request = self.mox.CreateMockAnything()\n request.GET = {'id': 'abcd'}\n self.mox.ReplayAll()\n\n actual_result = stacky_server.do_jsonreports_search(request).content\n expected_result = [\n [\"Error\", \"Message\"],\n [\"Bad Request\", \"'abcd' value has an invalid format. It must be in \"\n \"integer format.\"]\n ]\n self.assertEqual(ast.literal_eval(actual_result), expected_result)\n self.mox.VerifyAll()", "metadata": "root.JsonReportsSearchAPI.test_jsonreports_search_with_invalid_id", "header": "['class', 'JsonReportsSearchAPI', '(', 'StacktachBaseTestCase', ')', ':', '___EOS___']", "index": 1408 }, { "content": " def test_jsonreports_search_with_invalid_created_format(self):\n request = self.mox.CreateMockAnything()\n request.GET = {\n 'created': '2014-01-01 00:00:00'\n }\n self.mox.ReplayAll()\n\n actual_result = stacky_server.do_jsonreports_search(request).content\n expected_result = [\n [\"Error\", \"Message\"],\n [\"Bad Request\", \"'2014-01-01 00:00:00' value has an invalid format.\"\n \" It must be in YYYY-MM-DD format.\"]\n ]\n\n self.assertEqual(ast.literal_eval(actual_result), expected_result)\n self.mox.VerifyAll()", "metadata": "root.JsonReportsSearchAPI.test_jsonreports_search_with_invalid_created_format", "header": "['class', 'JsonReportsSearchAPI', '(', 'StacktachBaseTestCase', ')', ':', '___EOS___']", "index": 1422 }, { "content": " def test_jsonreports_search_by_invalid_created_400(self):\n request = self.mox.CreateMockAnything()\n request.GET = {\n 'created': '1234'}\n self.mox.ReplayAll()\n\n actual_result = stacky_server.do_jsonreports_search(request).content\n expected_result = \\\n [\n [\"Error\", \"Message\"],\n [\"Bad Request\", \"'1234' value has an invalid format. It must be in \"\n \"YYYY-MM-DD format.\"]\n ]\n self.assertEquals(ast.literal_eval(actual_result), expected_result)\n self.mox.VerifyAll()", "metadata": "root.JsonReportsSearchAPI.test_jsonreports_search_by_invalid_created_400", "header": "['class', 'JsonReportsSearchAPI', '(', 'StacktachBaseTestCase', ')', ':', '___EOS___']", "index": 1439 } ]
[ { "span": "u\"The requested field\"\n u\" 'tenant' does not exist for the corresponding object.\\nNote: \"\n u\"The field names of database are case-sensitive.\"]", "start_line": 1191, "start_column": 43, "end_line": 1193, "end_column": 58 }, { "span": "\"The requested fields either do not exist for the \"\n \"corresponding object or are not searchable: invalid_column_1, \"\n \"invalid_column_2, json, version. Note: The field names of \"\n \"database are case-sensitive.\"]", "start_line": 1372, "start_column": 28, "end_line": 1375, "end_column": 43 }, { "span": "\"'1234' value has an invalid format. It must be in \"\n \"YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.\"]", "start_line": 1388, "start_column": 28, "end_line": 1389, "end_column": 57 }, { "span": "\"'1234' value has an invalid format. It must be in \"\n \"YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.\"]", "start_line": 1402, "start_column": 28, "end_line": 1403, "end_column": 57 }, { "span": "\"'abcd' value has an invalid format. It must be in \"\n \"integer format.\"]", "start_line": 1416, "start_column": 28, "end_line": 1417, "end_column": 30 }, { "span": "\"'2014-01-01 00:00:00' value has an invalid format.\"\n \" It must be in YYYY-MM-DD format.\"]", "start_line": 1432, "start_column": 28, "end_line": 1433, "end_column": 48 }, { "span": "\"'1234' value has an invalid format. It must be in \"\n \"YYYY-MM-DD format.\"]", "start_line": 1449, "start_column": 28, "end_line": 1450, "end_column": 33 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "Stack", "y", "Server", "Test", "Case_", "(_", "Stack", "tach", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "search", "\\u", "with", "\\u", "wrong", "\\u", "field", "\\u", "value", "\\u", "return", "s", "\\u", "400", "\\u", "error", "\\u", "and", "\\u", "a", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fake", "\\u", "request_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "request_", "._", "GET_", "=_", "{_", "'", "field", "'_", ":_", "'", "tenan", "t", "'_", ",_", "'", "value", "'_", ":_", "'", "tenan", "t", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "._", "Ra", "w", "Data_", "._", "objects_", "._", "filter_", "(_", "tenant_", "=_", "'", "tenan", "t", "'_", ")_", "._", "And", "Raise_", "(_", "Field", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "stack", "y", "\\u", "server_", "._", "search_", "(_", "fake", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "resp_", "=_", "json_", "._", "loads_", "(_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "json", "\\u", "resp_", "[_", "0_", "]_", ",_", "[_", "u", "'", "Error", "'_", ",_", "u", "'", "Messag", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "json", "\\u", "resp_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Ba", "d", " ", "Request", "'_", ",_", "u", "\"", "The", " ", "request", "ed", " ", "field", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", " ", "'", "tenan", "t", "'", " ", "doe", "s", " ", "not", " ", "exist", " ", "for", " ", "the", " ", "correspond", "ing", " ", "object", ".\\\\", "n", "Not", "e", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "The", " ", "field", " ", "names", " ", "of", " ", "databa", "se", " ", "are", " ", "case", "-", "sensi", "tiv", "e", ".\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Report", "s", "Sear", "ch", "API_", "(_", "Stack", "tach", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "json", "report", "s", "\\u", "search", "\\u", "with", "\\u", "invalid", "\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "invalid", "\\u", "column", "\\u", "1", "'_", ":_", "'", "value", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "column", "\\u", "2", "'_", ":_", "'", "value", "\\u", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "json", "'_", ":_", "'", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "period", "\\u", "start", "'_", ":_", "'", "2014", "-0", "1", "-0", "1", " ", "00", ":", "00", ":", "00", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "result_", "=_", "stack", "y", "\\u", "server_", "._", "do", "\\u", "json", "report", "s", "\\u", "search_", "(_", "request_", ")_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "result_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Error", "\"_", ",_", "\"", "Messag", "e", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Ba", "d", " ", "Request", "\"_", ",_", "\"", "The", " ", "request", "ed", " ", "fields", " ", "eit", "her", " ", "do", " ", "not", " ", "exist", " ", "for", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "correspond", "ing", " ", "object", " ", "or", " ", "are", " ", "not", " ", "searcha", "ble", ":", " ", "invalid", "\\u", "column", "\\u", "1", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "invalid", "\\u", "column", "\\u", "2", ",", " ", "json", ",", " ", "version", ".", " ", "Not", "e", ":", " ", "The", " ", "field", " ", "names", " ", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "databa", "se", " ", "are", " ", "case", "-", "sensi", "tiv", "e", ".\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ast_", "._", "literal", "\\u", "eval_", "(_", "actual", "\\u", "result_", ")_", ",_", "expected", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Report", "s", "Sear", "ch", "API_", "(_", "Stack", "tach", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "json", "report", "s", "\\u", "search", "\\u", "with", "\\u", "invalid", "\\u", "period", "\\u", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "period", "\\u", "start", "'_", ":_", "'", "1234", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "result_", "=_", "stack", "y", "\\u", "server_", "._", "do", "\\u", "json", "report", "s", "\\u", "search_", "(_", "request_", ")_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "result_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Error", "\"_", ",_", "\"", "Messag", "e", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Ba", "d", " ", "Request", "\"_", ",_", "\"'", "1234", "'", " ", "value", " ", "has", " ", "an", " ", "invalid", " ", "format", ".", " ", "It", " ", "must", " ", "be", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "YYY", "Y", "-", "MM", "-", "DD", " ", "HH", ":", "MM", "[:", "ss", "[.", "uu", "uu", "uu", "]]", "[", "TZ", "]", " ", "format", ".\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ast_", "._", "literal", "\\u", "eval_", "(_", "actual", "\\u", "result_", ")_", ",_", "expected", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Report", "s", "Sear", "ch", "API_", "(_", "Stack", "tach", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "json", "report", "s", "\\u", "search", "\\u", "with", "\\u", "invalid", "\\u", "period", "\\u", "end_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "period", "\\u", "end", "'_", ":_", "'", "1234", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "result_", "=_", "stack", "y", "\\u", "server_", "._", "do", "\\u", "json", "report", "s", "\\u", "search_", "(_", "request_", ")_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "result_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Error", "\"_", ",_", "\"", "Messag", "e", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Ba", "d", " ", "Request", "\"_", ",_", "\"'", "1234", "'", " ", "value", " ", "has", " ", "an", " ", "invalid", " ", "format", ".", " ", "It", " ", "must", " ", "be", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "YYY", "Y", "-", "MM", "-", "DD", " ", "HH", ":", "MM", "[:", "ss", "[.", "uu", "uu", "uu", "]]", "[", "TZ", "]", " ", "format", ".\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ast_", "._", "literal", "\\u", "eval_", "(_", "actual", "\\u", "result_", ")_", ",_", "expected", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Report", "s", "Sear", "ch", "API_", "(_", "Stack", "tach", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "json", "report", "s", "\\u", "search", "\\u", "with", "\\u", "invalid", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "'", "id", "'_", ":_", "'", "abc", "d", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "result_", "=_", "stack", "y", "\\u", "server_", "._", "do", "\\u", "json", "report", "s", "\\u", "search_", "(_", "request_", ")_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "result_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Error", "\"_", ",_", "\"", "Messag", "e", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Ba", "d", " ", "Request", "\"_", ",_", "\"'", "abc", "d", "'", " ", "value", " ", "has", " ", "an", " ", "invalid", " ", "format", ".", " ", "It", " ", "must", " ", "be", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "integ", "er", " ", "format", ".\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ast_", "._", "literal", "\\u", "eval_", "(_", "actual", "\\u", "result_", ")_", ",_", "expected", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Report", "s", "Sear", "ch", "API_", "(_", "Stack", "tach", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "json", "report", "s", "\\u", "search", "\\u", "with", "\\u", "invalid", "\\u", "created", "\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "'", "2014", "-0", "1", "-0", "1", " ", "00", ":", "00", ":", "00", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "result_", "=_", "stack", "y", "\\u", "server_", "._", "do", "\\u", "json", "report", "s", "\\u", "search_", "(_", "request_", ")_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "result_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Error", "\"_", ",_", "\"", "Messag", "e", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Ba", "d", " ", "Request", "\"_", ",_", "\"'", "2014", "-0", "1", "-0", "1", " ", "00", ":", "00", ":", "00", "'", " ", "value", " ", "has", " ", "an", " ", "invalid", " ", "format", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "It", " ", "must", " ", "be", " ", "in", " ", "YYY", "Y", "-", "MM", "-", "DD", " ", "format", ".\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ast_", "._", "literal", "\\u", "eval_", "(_", "actual", "\\u", "result_", ")_", ",_", "expected", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Report", "s", "Sear", "ch", "API_", "(_", "Stack", "tach", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "json", "report", "s", "\\u", "search", "\\u", "by", "\\u", "invalid", "\\u", "created", "\\u", "400_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "mox_", "._", "Creat", "e", "Moc", "k", "Any", "thing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "GET_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "'", "1234", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "result_", "=_", "stack", "y", "\\u", "server_", "._", "do", "\\u", "json", "report", "s", "\\u", "search_", "(_", "request_", ")_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "result_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Error", "\"_", ",_", "\"", "Messag", "e", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Ba", "d", " ", "Request", "\"_", ",_", "\"'", "1234", "'", " ", "value", " ", "has", " ", "an", " ", "invalid", " ", "format", ".", " ", "It", " ", "must", " ", "be", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "YYY", "Y", "-", "MM", "-", "DD", " ", "format", ".\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "ast_", "._", "literal", "\\u", "eval_", "(_", "actual", "\\u", "result_", ")_", ",_", "expected", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Verify", "All_", "(_", ")_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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 ]
Variable defined multiple times
RobotLocomotion/director/src/python/director/segmentation.py
[ { "content": "def refitValveAffordance(aff, point1, origin, normal):\n\n xaxis = aff.params['xaxis']\n yaxis = aff.params['yaxis']\n zaxis = aff.params['zaxis']\n origin = aff.params['origin']\n\n zaxis = normal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n aff.actor.GetUserTransform().SetMatrix(t.GetMatrix())\n aff.updateParamsFromActorTransform()", "metadata": "root.refitValveAffordance", "header": "['module', '___EOS___']", "index": 1023 }, { "content": "def segmentValveByRim(polyData, rimPoint1, rimPoint2):\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n\n yaxis = np.array(rimPoint2) - np.array(rimPoint1)\n zaxis = [0,0,1]\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n\n # flip xaxis to be with view direction\n if np.dot(xaxis, viewDirection) < 0:\n xaxis = -xaxis\n\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n\n origin = (np.array(rimPoint2) + np.array(rimPoint1)) / 2.0\n\n polyData = labelPointDistanceAlongAxis(polyData, xaxis, origin)\n polyData = thresholdPoints(polyData, 'distance_along_axis', [-0.05, 0.05])\n updatePolyData(polyData, 'valve plane region', parent=getDebugFolder(), colorByName='distance_along_axis', visible=False)\n\n\n polyData = cropToSphere(polyData, origin, radius=0.4)\n polyData = applyVoxelGrid(polyData, leafSize=0.015)\n\n updatePolyData(polyData, 'valve search region', parent=getDebugFolder(), color=[1,0,0], visible=False)\n\n\n valveFit = extractLargestCluster(polyData, minClusterSize=1)\n updatePolyData(valveFit, 'valve cluster', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n points = vtkNumpy.getNumpyFromVtk(valveFit, 'Points')\n zvalues = points[:,2].copy()\n minZ = np.min(zvalues)\n maxZ = np.max(zvalues)\n\n tubeRadius = 0.017\n radius = float((maxZ - minZ) / 2.0) - tubeRadius\n\n fields = makePolyDataFields(valveFit)\n origin = np.array(fields.frame.GetPosition())\n vis.updatePolyData(transformPolyData(fields.box, fields.frame), 'valve cluster bounding box', visible=False)\n\n #origin = computeCentroid(valveFit)\n\n '''\n zaxis = [0,0,1]\n xaxis = normal\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n '''\n\n radius = np.max(fields.dims)/2.0 - tubeRadius\n\n\n proj = [np.abs(np.dot(xaxis, axis)) for axis in fields.axes]\n xaxisNew = fields.axes[np.argmax(proj)]\n if np.dot(xaxisNew, xaxis) < 0:\n xaxisNew = -xaxisNew\n\n xaxis = xaxisNew\n\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n\n\n t = getTransformFromAxes(xaxis, yaxis, zaxis)\n t.PostMultiply()\n t.Translate(origin)\n\n pose = transformUtils.poseFromTransform(t)\n desc = dict(classname='CapsuleRingAffordanceItem', Name='valve', uuid=newUUID(), pose=pose, Color=[0,1,0], Radius=float(radius), Segments=20)\n desc['Tube Radius'] = tubeRadius\n\n obj = affordanceManager.newAffordanceFromDescription(desc)\n obj.params = dict(radius=radius)\n\n return obj", "metadata": "root.segmentValveByRim", "header": "['module', '___EOS___']", "index": 1196 }, { "content": "def segmentValveByWallPlane(expectedValveRadius, point1, point2):\n\n\n centerPoint = (point1 + point2) / 2.0\n\n inputObj = om.findObjectByName('pointcloud snapshot')\n polyData = inputObj.polyData\n\n _ , polyData = removeGround(polyData)\n\n viewDirection = SegmentationContext.getGlobalInstance().getViewDirection()\n polyData, origin, normal = applyPlaneFit(polyData, expectedNormal=-viewDirection, returnOrigin=True)\n\n\n perpLine = np.cross(point2 - point1, normal)\n #perpLine /= np.linalg.norm(perpLine)\n #perpLine * np.linalg.norm(point2 - point1)/2.0\n point3, point4 = centerPoint + perpLine/2.0, centerPoint - perpLine/2.0\n\n d = DebugData()\n d.addLine(point1, point2)\n d.addLine(point3, point4)\n updatePolyData(d.getPolyData(), 'crop lines', parent=getDebugFolder(), visible=False)\n\n wallPoints = thresholdPoints(polyData, 'dist_to_plane', [-0.01, 0.01])\n updatePolyData(wallPoints, 'valve wall', parent=getDebugFolder(), visible=False)\n\n searchRegion = thresholdPoints(polyData, 'dist_to_plane', [0.05, 0.5])\n searchRegion = cropToLineSegment(searchRegion, point1, point2)\n searchRegion = cropToLineSegment(searchRegion, point3, point4)\n\n updatePolyData(searchRegion, 'valve search region', parent=getDebugFolder(), color=[1,0,0], visible=False)\n\n searchRegionSpokes = shallowCopy(searchRegion)\n\n searchRegion, origin, _ = applyPlaneFit(searchRegion, expectedNormal=normal, perpendicularAxis=normal, returnOrigin=True)\n searchRegion = thresholdPoints(searchRegion, 'dist_to_plane', [-0.015, 0.015])\n\n updatePolyData(searchRegion, 'valve search region 2', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n\n largestCluster = extractLargestCluster(searchRegion, minClusterSize=1)\n\n updatePolyData(largestCluster, 'valve cluster', parent=getDebugFolder(), color=[0,1,0], visible=False)\n\n\n radiusLimit = [expectedValveRadius - 0.01, expectedValveRadius + 0.01] if expectedValveRadius else None\n #radiusLimit = None\n\n polyData, circleFit = extractCircle(largestCluster, distanceThreshold=0.01, radiusLimit=radiusLimit)\n updatePolyData(polyData, 'circle fit', parent=getDebugFolder(), visible=False)\n\n\n #polyData, circleFit = extractCircle(polyData, distanceThreshold=0.01)\n #showPolyData(polyData, 'circle fit', colorByName='z')\n\n\n radius = circleFit.GetCircleRadius()\n origin = np.array(circleFit.GetCircleOrigin())\n circleNormal = np.array(circleFit.GetCircleNormal())\n circleNormal = circleNormal/np.linalg.norm(circleNormal)\n\n if np.dot(circleNormal, normal) < 0:\n circleNormal *= -1\n\n # force use of the plane normal\n circleNormal = normal\n radius = expectedValveRadius\n\n d = DebugData()\n d.addLine(origin - normal*radius, origin + normal*radius)\n d.addCircle(origin, circleNormal, radius)\n updatePolyData(d.getPolyData(), 'valve axes', parent=getDebugFolder(), visible=False)\n\n\n zaxis = -circleNormal\n xaxis = [0, 0, 1]\n yaxis = np.cross(zaxis, xaxis)\n xaxis = np.cross(yaxis, zaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n #t = getTransformFromAxes(xaxis, yaxis, zaxis) # this was added to be consistent with segmentValveByRim\n t = getTransformFromAxes(zaxis, -yaxis, xaxis) # this was added to be consistent with segmentValveByRim\n t.PostMultiply()\n t.Translate(origin)\n\n\n # Spoke angle fitting:\n if (1==0): # disabled jan 2015\n # extract the relative positon of the points to the valve axis:\n searchRegionSpokes = labelDistanceToLine(searchRegionSpokes, origin, [origin + circleNormal])\n searchRegionSpokes = thresholdPoints(searchRegionSpokes, 'distance_to_line', [0.05, radius-0.04])\n updatePolyData(searchRegionSpokes, 'valve spoke search', parent=getDebugFolder(), visible=False)\n searchRegionSpokesLocal = transformPolyData(searchRegionSpokes, t.GetLinearInverse() )\n points = vtkNumpy.getNumpyFromVtk(searchRegionSpokesLocal , 'Points')\n\n spoke_angle = findValveSpokeAngle(points)\n else:\n spoke_angle = 0\n\n spokeAngleTransform = transformUtils.frameFromPositionAndRPY([0,0,0], [0,0,spoke_angle])\n spokeTransform = transformUtils.copyFrame(t)\n spokeAngleTransform.Concatenate(spokeTransform)\n spokeObj = showFrame(spokeAngleTransform, 'spoke frame', parent=getDebugFolder(), visible=False, scale=radius)\n spokeObj.addToView(app.getDRCView())\n t = spokeAngleTransform\n\n tubeRadius = 0.017\n\n pose = transformUtils.poseFromTransform(t)\n desc = dict(classname='CapsuleRingAffordanceItem', Name='valve', uuid=newUUID(), pose=pose, Color=[0,1,0], Radius=float(radius), Segments=20)\n desc['Tube Radius'] = tubeRadius\n\n obj = affordanceManager.newAffordanceFromDescription(desc)\n obj.params = dict(radius=radius)", "metadata": "root.segmentValveByWallPlane", "header": "['module', '___EOS___']", "index": 1281 }, { "content": "def sortFittedDrills(fitResults, robotOrigin, robotForward):\n\n angleToFitResults = []\n\n for fitResult in fitResults:\n cluster, drillFrame = fitResult\n drillOrigin = np.array(drillFrame.GetPosition())\n angleToDrill = np.abs(computeSignedAngleBetweenVectors(robotForward, drillOrigin - robotOrigin, [0,0,1]))\n angleToFitResults.append((angleToDrill, cluster, drillFrame))\n #print 'angle to candidate drill:', angleToDrill\n\n angleToFitResults.sort(key=lambda x: x[0])\n\n #print 'using drill at angle:', angleToFitResults[0][0]\n\n drillMesh = getDrillBarrelMesh()\n\n for i, fitResult in enumerate(angleToFitResults):\n\n angleToDrill, cluster, drillFrame = fitResult\n\n if i == 0:\n\n drill = om.findObjectByName('drill')\n drill = updatePolyData(drillMesh, 'drill', color=[0, 1, 0], cls=FrameAffordanceItem, visible=True)\n drillFrame = updateFrame(drillFrame, 'drill frame', parent=drill, visible=False)\n drill.actor.SetUserTransform(drillFrame.transform)\n\n drill.setAffordanceParams(dict(otdf_type='dewalt_button', friendly_name='dewalt_button'))\n drill.updateParamsFromActorTransform()\n\n drill.setSolidColor([0, 1, 0])\n #cluster.setProperty('Visible', True)\n\n else:\n\n drill = showPolyData(drillMesh, 'drill candidate', color=[1,0,0], visible=False, parent=getDebugFolder())\n drill.actor.SetUserTransform(drillFrame)\n om.addToObjectModel(drill, parentObj=getDebugFolder())", "metadata": "root.sortFittedDrills", "header": "['module', '___EOS___']", "index": 2913 }, { "content": "def segmentBlockByTopPlane(polyData, blockDimensions, expectedNormal, expectedXAxis, edgeSign=1, name='block affordance'):\n\n polyData, planeOrigin, normal = applyPlaneFit(polyData, distanceThreshold=0.05, expectedNormal=expectedNormal, returnOrigin=True)\n\n _, lineDirection, _ = applyLineFit(polyData)\n\n zaxis = lineDirection\n yaxis = normal\n xaxis = np.cross(yaxis, zaxis)\n\n if np.dot(xaxis, expectedXAxis) < 0:\n xaxis *= -1\n\n # make right handed\n zaxis = np.cross(xaxis, yaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis /= np.linalg.norm(zaxis)\n\n expectedXAxis = np.array(xaxis)\n\n edgePoints = computeEdge(polyData, zaxis, xaxis*edgeSign)\n edgePoints = vtkNumpy.getVtkPolyDataFromNumpyPoints(edgePoints)\n\n d = DebugData()\n obj = updatePolyData(edgePoints, 'edge points', parent=getDebugFolder(), visible=False)\n\n linePoint, lineDirection, _ = applyLineFit(edgePoints)\n zaxis = lineDirection\n xaxis = np.cross(yaxis, zaxis)\n\n\n if np.dot(xaxis, expectedXAxis) < 0:\n xaxis *= -1\n\n # make right handed\n zaxis = np.cross(xaxis, yaxis)\n xaxis /= np.linalg.norm(xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis /= np.linalg.norm(zaxis)\n\n polyData = labelPointDistanceAlongAxis(polyData, xaxis, resultArrayName='dist_along_line')\n pts = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n\n dists = np.dot(pts-linePoint, zaxis)\n\n p1 = linePoint + zaxis*np.min(dists)\n p2 = linePoint + zaxis*np.max(dists)\n\n p1 = projectPointToPlane(p1, planeOrigin, normal)\n p2 = projectPointToPlane(p2, planeOrigin, normal)\n\n xwidth, ywidth = blockDimensions\n zwidth = np.linalg.norm(p2 - p1)\n\n origin = p1 - edgeSign*xaxis*xwidth/2.0 - yaxis*ywidth/2.0 + zaxis*zwidth/2.0\n\n d = DebugData()\n\n #d.addSphere(linePoint, radius=0.02)\n #d.addLine(linePoint, linePoint + yaxis*ywidth)\n #d.addLine(linePoint, linePoint + xaxis*xwidth)\n #d.addLine(linePoint, linePoint + zaxis*zwidth)\n\n\n d.addSphere(p1, radius=0.01)\n d.addSphere(p2, radius=0.01)\n d.addLine(p1, p2)\n\n d.addSphere(origin, radius=0.01)\n #d.addLine(origin - xaxis*xwidth/2.0, origin + xaxis*xwidth/2.0)\n #d.addLine(origin - yaxis*ywidth/2.0, origin + yaxis*ywidth/2.0)\n #d.addLine(origin - zaxis*zwidth/2.0, origin + zaxis*zwidth/2.0)\n\n d.addLine(origin, origin + xaxis*xwidth/2.0)\n d.addLine(origin, origin + yaxis*ywidth/2.0)\n d.addLine(origin, origin + zaxis*zwidth/2.0)\n\n\n #obj = updatePolyData(d.getPolyData(), 'block axes')\n #obj.setProperty('Color', QtGui.QColor(255, 255, 0))\n #obj.setProperty('Visible', False)\n\n obj = createBlockAffordance(origin, xaxis, yaxis, zaxis, xwidth, ywidth, zwidth, name)\n obj.setProperty('Color', [222/255.0, 184/255.0, 135/255.0])\n\n computeDebrisGraspSeed(obj)\n t = computeDebrisStanceFrame(obj)\n if t:\n showFrame(t, 'debris stance frame', parent=obj)\n obj.publishCallback = functools.partial(publishDebrisStanceFrame, obj)\n\n return obj", "metadata": "root.segmentBlockByTopPlane", "header": "['module', '___EOS___']", "index": 3736 }, { "content": "def findFarRightCorner(polyData, linkFrame):\n '''\n Within a point cloud find the point to the far right from the link\n The input is the 4 corners of a minimum bounding box\n '''\n\n diagonalTransform = transformUtils.copyFrame(linkFrame)\n diagonalTransform.PreMultiply()\n diagonalTransform.Concatenate( transformUtils.frameFromPositionAndRPY([0,0,0], [0,0,45]) )\n vis.updateFrame(diagonalTransform, 'diagonal frame', parent=getDebugFolder(), visible=False)\n\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n viewOrigin = diagonalTransform.TransformPoint([0.0, 0.0, 0.0])\n viewX = diagonalTransform.TransformVector([1.0, 0.0, 0.0])\n viewY = diagonalTransform.TransformVector([0.0, 1.0, 0.0])\n viewZ = diagonalTransform.TransformVector([0.0, 0.0, 1.0])\n polyData = labelPointDistanceAlongAxis(polyData, viewY, origin=viewOrigin, resultArrayName='distance_along_foot_y')\n\n vis.updatePolyData( polyData, 'cornerPoints', parent='segmentation', visible=False)\n farRightIndex = vtkNumpy.getNumpyFromVtk(polyData, 'distance_along_foot_y').argmin()\n points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')\n return points[farRightIndex,:]", "metadata": "root.findFarRightCorner", "header": "['module', '___EOS___']", "index": 4736 } ]
[ { "span": "xaxis ", "start_line": 1025, "start_column": 4, "end_line": 1025, "end_column": 9 }, { "span": "yaxis ", "start_line": 1026, "start_column": 4, "end_line": 1026, "end_column": 9 }, { "span": "zaxis ", "start_line": 1027, "start_column": 4, "end_line": 1027, "end_column": 9 }, { "span": "radius ", "start_line": 1234, "start_column": 4, "end_line": 1234, "end_column": 10 }, { "span": "radius ", "start_line": 1338, "start_column": 4, "end_line": 1338, "end_column": 10 }, { "span": "drill ", "start_line": 2936, "start_column": 12, "end_line": 2936, "end_column": 17 }, { "span": "d ", "start_line": 3760, "start_column": 4, "end_line": 3760, "end_column": 5 }, { "span": "obj ", "start_line": 3761, "start_column": 4, "end_line": 3761, "end_column": 7 }, { "span": "points ", "start_line": 4747, "start_column": 4, "end_line": 4747, "end_column": 10 } ]
[ { "span": "zaxis ", "start_line": 1030, "start_column": 4, "end_line": 1030, "end_column": 9 }, { "span": "xaxis ", "start_line": 1031, "start_column": 4, "end_line": 1031, "end_column": 9 }, { "span": "yaxis ", "start_line": 1032, "start_column": 4, "end_line": 1032, "end_column": 9 }, { "span": "radius ", "start_line": 1251, "start_column": 4, "end_line": 1251, "end_column": 10 }, { "span": "radius ", "start_line": 1348, "start_column": 4, "end_line": 1348, "end_column": 10 }, { "span": "drill ", "start_line": 2937, "start_column": 12, "end_line": 2937, "end_column": 17 }, { "span": "obj ", "start_line": 3819, "start_column": 4, "end_line": 3819, "end_column": 7 }, { "span": "points ", "start_line": 4756, "start_column": 4, "end_line": 4756, "end_column": 10 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "refi", "t", "Val", "ve", "Aff", "orda", "nce_", "(_", "aff", "_", ",_", "point1_", ",_", "origin_", ",_", "normal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "=_", "aff", "_", "._", "params_", "[_", "'", "xaxis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "aff", "_", "._", "params_", "[_", "'", "yax", "is", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "aff", "_", "._", "params_", "[_", "'", "za", "xis", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "aff", "_", "._", "params_", "[_", "'", "orig", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aff", "_", "._", "actor_", "._", "Get", "User", "Transform_", "(_", ")_", "._", "Set", "Matrix_", "(_", "t_", "._", "Get", "Matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\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_", "segment", "Val", "ve", "By", "Ri", "m_", "(_", "poly", "Data_", ",_", "rim", "Point", "1_", ",_", "rim", "Point", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "array_", "(_", "rim", "Point", "2_", ")_", "-_", "np_", "._", "array_", "(_", "rim", "Point", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flip", " ", "xaxis", " ", "to", " ", "be", " ", "with", " ", "view", " ", "direction_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "view", "Direction_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "=_", "-_", "xaxis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "(_", "np_", "._", "array_", "(_", "rim", "Point", "2_", ")_", "+_", "np_", "._", "array_", "(_", "rim", "Point", "1_", ")_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "xaxis_", ",_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "along", "\\u", "axis", "'_", ",_", "[_", "-_", "0.05_", ",_", "0.05_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "valve", " ", "plane", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color", "By", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "axis", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "crop", "To", "Sphere", "_", "(_", "poly", "Data_", ",_", "origin_", ",_", "radius_", "=_", "0.4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "appl", "y", "Vo", "xel", "Grid_", "(_", "poly", "Data_", ",_", "leaf", "Size_", "=_", "0.015", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "valve", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valve", "Fit_", "=_", "extract", "Large", "st", "Cluster_", "(_", "poly", "Data_", ",_", "min", "Cluster", "Size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "valve", "Fit_", ",_", "'", "valve", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "valve", "Fit_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zv", "alues", "_", "=_", "points_", "[_", ":_", ",_", "2_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Z_", "=_", "np_", "._", "min_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Z_", "=_", "np_", "._", "max_", "(_", "zv", "alues", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tube", "Radius_", "=_", "0.01", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "float_", "(_", "(_", "max", "Z_", "-_", "min", "Z_", ")_", "/_", "2.0_", ")_", "-_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "make", "Poly", "Data", "Fields_", "(_", "valve", "Fit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "fields_", "._", "frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "transform", "Poly", "Data_", "(_", "fields_", "._", "box_", ",_", "fields_", "._", "frame_", ")_", ",_", "'", "valve", " ", "cluster", " ", "bound", "ing", " ", "box", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "orig", "in", " ", "=", " ", "compute", "Centro", "id", "(", "valve", "Fit", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "za", "xis", " ", "=", " ", "[", "0", ",", "0", ",", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "xaxis", " ", "=", " ", "normal", "\\", "10", ";", " ", " ", " ", " ", "yax", "is", " ", "=", " ", "np", ".", "cross", "(", "za", "xis", ",", " ", "xaxis", ")", "\\", "10", ";", " ", " ", " ", " ", "yax", "is", " ", "/", "=", " ", "np", ".", "linalg", ".", "norm", "(", "yax", "is", ")", "\\", "10", ";", " ", " ", " ", " ", "xaxis", " ", "=", " ", "np", ".", "cross", "(", "yax", "is", ",", " ", "za", "xis", ")", "\\", "10", ";", " ", " ", " ", " ", "xaxis", " ", "/", "=", " ", "np", ".", "linalg", ".", "norm", "(", "xaxis", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "np_", "._", "max_", "(_", "fields_", "._", "dims_", ")_", "/_", "2.0_", "-_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proj_", "=_", "[_", "np_", "._", "abs_", "(_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "axis_", ")_", ")_", "for_", "axis_", "in_", "fields_", "._", "axes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis", "New_", "=_", "fields_", "._", "axes_", "[_", "np_", "._", "argmax_", "(_", "proj_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis", "New_", ",_", "xaxis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis", "New_", "=_", "-_", "xaxis", "New_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xaxis_", "=_", "xaxis", "New_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "valve", "'_", ",_", "uuid_", "=_", "new", "UUID_", "(_", ")_", ",_", "pose_", "=_", "pose_", ",_", "Color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "Radius_", "=_", "float_", "(_", "radius_", ")_", ",_", "Segments", "_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "[_", "'", "Tu", "be", " ", "Rad", "ius", "'_", "]_", "=_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "params_", "=_", "dict_", "(_", "radius_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "segment", "Val", "ve", "By", "Wall", "Plane_", "(_", "expected", "Val", "ve", "Radius_", ",_", "point1_", ",_", "point2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "center", "Point_", "=_", "(_", "point1_", "+_", "point2_", ")_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "Obj_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "point", "cloud", " ", "snapshot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "input", "Obj_", "._", "poly", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "poly", "Data_", "=_", "remove", "Gro", "und_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", ",_", "origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "expected", "Normal_", "=_", "-_", "view", "Direction_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "perp", "Line_", "=_", "np_", "._", "cross_", "(_", "point2_", "-_", "point1_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "perp", "Line", " ", "/", "=", " ", "np", ".", "linalg", ".", "norm", "(", "perp", "Line", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "perp", "Line", " ", "*", " ", "np", ".", "linalg", ".", "norm", "(", "point", "2", " ", "-", " ", "point", "1", ")/", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "point", "3_", ",_", "point", "4_", "=_", "center", "Point_", "+_", "perp", "Line_", "/_", "2.0_", ",_", "center", "Point_", "-_", "perp", "Line_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "point", "3_", ",_", "point", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "crop", " ", "lines", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wall", "Points_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.01_", ",_", "0.01_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "wall", "Points_", ",_", "'", "valve", " ", "wall", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "poly", "Data_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "0.05_", ",_", "0.5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Line", "Segment_", "(_", "search", "Region_", ",_", "point1_", ",_", "point2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "crop", "To", "Line", "Segment_", "(_", "search", "Region_", ",_", "point", "3_", ",_", "point", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "valve", " ", "search", " ", "region", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region", "Spo", "kes", "_", "=_", "shallow", "Copy_", "(_", "search", "Region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Region_", ",_", "origin_", ",_", "\\u_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "search", "Region_", ",_", "expected", "Normal_", "=_", "normal_", ",_", "perp", "endi", "cula", "r", "Axis_", "=_", "normal_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region_", "=_", "threshol", "d", "Points_", "(_", "search", "Region_", ",_", "'", "dist", "\\u", "to", "\\u", "plane", "'_", ",_", "[_", "-_", "0.015", "_", ",_", "0.015", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region_", ",_", "'", "valve", " ", "search", " ", "region", " ", "2", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "large", "st", "Cluster_", "=_", "extract", "Large", "st", "Cluster_", "(_", "search", "Region_", ",_", "min", "Cluster", "Size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Poly", "Data_", "(_", "large", "st", "Cluster_", ",_", "'", "valve", " ", "cluster", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radi", "us", "Limit_", "=_", "[_", "expected", "Val", "ve", "Radius_", "-_", "0.01_", ",_", "expected", "Val", "ve", "Radius_", "+_", "0.01_", "]_", "if_", "expected", "Val", "ve", "Radius_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "radi", "us", "Limit", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", ",_", "circle", "Fit_", "=_", "extract", "Circle_", "(_", "large", "st", "Cluster_", ",_", "distance", "Threshold_", "=_", "0.01_", ",_", "radi", "us", "Limit_", "=_", "radi", "us", "Limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "circle", " ", "fit", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "poly", "Data", ",", " ", "circle", "Fit", " ", "=", " ", "extract", "Circ", "le", "(", "poly", "Data", ",", " ", "distance", "Thresh", "old", "=", "0.01", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "Poly", "Data", "(", "poly", "Data", ",", " ", "'", "circle", " ", "fit", "',", " ", "color", "By", "Name", "='", "z", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "radius_", "=_", "circle", "Fit_", "._", "Get", "Circ", "le", "Radius_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "origin_", "=_", "np_", "._", "array_", "(_", "circle", "Fit_", "._", "Get", "Circ", "le", "Origin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Normal_", "=_", "np_", "._", "array_", "(_", "circle", "Fit_", "._", "Get", "Circ", "le", "Normal_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "circle", "Normal_", "=_", "circle", "Normal_", "/_", "np_", "._", "linalg_", "._", "norm_", "(_", "circle", "Normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "circle", "Normal_", ",_", "normal_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "circle", "Normal_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "use", " ", "of", " ", "the", " ", "plane", " ", "normal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "circle", "Normal_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "expected", "Val", "ve", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", "-_", "normal_", "*_", "radius_", ",_", "origin_", "+_", "normal_", "*_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Circle_", "(_", "origin_", ",_", "circle", "Normal_", ",_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "d_", "._", "get", "Poly", "Data_", "(_", ")_", ",_", "'", "valve", " ", "axes", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "-_", "circle", "Normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "t", " ", "=", " ", "get", "Transform", "Fro", "m", "Axe", "s", "(", "xaxis", ",", " ", "yax", "is", ",", " ", "za", "xis", ")", " ", "#", " ", "this", " ", "was", " ", "adde", "d", " ", "to", " ", "be", " ", "consistent", " ", "with", " ", "segment", "Val", "ve", "By", "Ri", "m_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "get", "Transform", "Fro", "m", "Axes_", "(_", "za", "xis_", ",_", "-_", "yaxis_", ",_", "xaxis_", ")_", "#", " ", "this", " ", "was", " ", "adde", "d", " ", "to", " ", "be", " ", "consistent", " ", "with", " ", "segment", "Val", "ve", "By", "Ri", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "origin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Spo", "ke", " ", "angle", " ", "fitting", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "1_", "==_", "0_", ")_", ":_", "#", " ", "disable", "d", " ", "jan", " ", "2015_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "extract", " ", "the", " ", "relative", " ", "posit", "on", " ", "of", " ", "the", " ", "points", " ", "to", " ", "the", " ", "valve", " ", "axis", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "Region", "Spo", "kes", "_", "=_", "label", "Distan", "ce", "To", "Line_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "origin_", ",_", "[_", "origin_", "+_", "circle", "Normal_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region", "Spo", "kes", "_", "=_", "threshol", "d", "Points_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "'", "distance", "\\u", "to", "\\u", "line", "'_", ",_", "[_", "0.05_", ",_", "radius_", "-_", "0.04_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "Poly", "Data_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "'", "valve", " ", "spoke", " ", "search", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "Region", "Spo", "kes", "Local_", "=_", "transform", "Poly", "Data_", "(_", "search", "Region", "Spo", "kes", "_", ",_", "t_", "._", "Get", "Linea", "r", "Inv", "erse", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "search", "Region", "Spo", "kes", "Local_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spoke", "\\u", "angle_", "=_", "find", "Val", "ve", "Spo", "ke", "Angle_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spoke", "\\u", "angle_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spoke", "Ang", "le", "Transform_", "=_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "spoke", "\\u", "angle_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Transform_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Ang", "le", "Transform_", "._", "Concat", "enat", "e_", "(_", "spoke", "Transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Obj_", "=_", "show", "Frame_", "(_", "spoke", "Ang", "le", "Transform_", ",_", "'", "spoke", " ", "frame", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ",_", "scale_", "=_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spoke", "Obj_", "._", "add", "To", "View_", "(_", "app_", "._", "get", "DR", "CV", "iew_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "spoke", "Ang", "le", "Transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tube", "Radius_", "=_", "0.01", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pose_", "=_", "transform", "Utils_", "._", "pose", "Fro", "m", "Transform_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "=_", "dict_", "(_", "classname_", "=_", "'", "Caps", "ule", "Ring", "Aff", "orda", "nce", "Item", "'_", ",_", "Name_", "=_", "'", "valve", "'_", ",_", "uuid_", "=_", "new", "UUID_", "(_", ")_", ",_", "pose_", "=_", "pose_", ",_", "Color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "Radius_", "=_", "float_", "(_", "radius_", ")_", ",_", "Segments", "_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desc_", "[_", "'", "Tu", "be", " ", "Rad", "ius", "'_", "]_", "=_", "tube", "Radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "aff", "orda", "nce", "Manager_", "._", "new", "Aff", "orda", "nce", "Fro", "m", "Description_", "(_", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "params_", "=_", "dict_", "(_", "radius_", "=_", "radius_", ")_", "\\u\\u\\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_", "sort", "Fitt", "ed", "Dri", "lls_", "(_", "fit", "Results_", ",_", "robot", "Origin_", ",_", "robot", "Forward_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "angle", "To", "Fit", "Results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fit", "Result_", "in_", "fit", "Results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster_", ",_", "drill", "Frame_", "=_", "fit", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Origin_", "=_", "np_", "._", "array_", "(_", "drill", "Frame_", "._", "Get", "Position_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "To", "Dri", "ll_", "=_", "np_", "._", "abs_", "(_", "compute", "Signe", "d", "Ang", "le", "Bet", "ween", "Vectors_", "(_", "robot", "Forward_", ",_", "drill", "Origin_", "-_", "robot", "Origin_", ",_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "angle", "To", "Fit", "Results_", "._", "append_", "(_", "(_", "angle", "To", "Dri", "ll_", ",_", "cluster_", ",_", "drill", "Frame_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "angle", " ", "to", " ", "candidate", " ", "drill", ":'", ",", " ", "angle", "To", "Dri", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "angle", "To", "Fit", "Results_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "usi", "ng", " ", "drill", " ", "at", " ", "angle", ":'", ",", " ", "angle", "To", "Fit", "Result", "s", "[", "0", "][", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "Mesh_", "=_", "get", "Dri", "ll", "Barr", "el", "Mesh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "fit", "Result_", "in_", "enumerate_", "(_", "angle", "To", "Fit", "Results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "angle", "To", "Dri", "ll_", ",_", "cluster_", ",_", "drill", "Frame_", "=_", "fit", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "_", "=_", "om_", "._", "find", "Object", "By", "Name_", "(_", "'", "drill", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "=_", "update", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "cls_", "=_", "Frame", "Aff", "orda", "nce", "Item_", ",_", "visible_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "Frame_", "=_", "update", "Frame_", "(_", "drill", "Frame_", ",_", "'", "drill", " ", "frame", "'_", ",_", "parent_", "=_", "drill", "_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "drill", "Frame_", "._", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "_", "._", "set", "Aff", "orda", "nce", "Params_", "(_", "dict_", "(_", "ot", "df", "\\u", "type_", "=_", "'", "dew", "alt", "\\u", "button", "'_", ",_", "frie", "ndl", "y", "\\u", "name_", "=_", "'", "dew", "alt", "\\u", "button", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "._", "update", "Param", "s", "Fro", "m", "Act", "or", "Transform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "drill", "_", "._", "set", "Soli", "d", "Color_", "(_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "cluster", ".", "set", "Proper", "ty", "('", "Vis", "ibl", "e", "',", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drill", "_", "=_", "show", "Poly", "Data_", "(_", "drill", "Mesh_", ",_", "'", "drill", " ", "candidate", "'_", ",_", "color_", "=_", "[_", "1_", ",_", "0_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drill", "_", "._", "actor_", "._", "Set", "User", "Transform_", "(_", "drill", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "om_", "._", "add", "To", "Object", "Model_", "(_", "drill", "_", ",_", "parent", "Obj_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ")_", "\\u\\u\\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_", "segment", "Block", "By", "Top", "Plane_", "(_", "poly", "Data_", ",_", "block", "Dimensions_", ",_", "expected", "Normal_", ",_", "expected", "XA", "xis_", ",_", "edge", "Sign_", "=_", "1_", ",_", "name_", "=_", "'", "block", " ", "aff", "orda", "nce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poly", "Data_", ",_", "plane", "Origin_", ",_", "normal_", "=_", "appl", "y", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "distance", "Threshold_", "=_", "0.05_", ",_", "expected", "Normal_", "=_", "expected", "Normal_", ",_", "return", "Origin_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "line", "Direction_", ",_", "\\u_", "=_", "appl", "y", "Line", "Fit_", "(_", "poly", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "line", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "expected", "XA", "xis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "right", " ", "hande", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "XA", "xis_", "=_", "np_", "._", "array_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edge", "Points_", "=_", "compute", "Edge_", "(_", "poly", "Data_", ",_", "za", "xis_", ",_", "xaxis_", "*_", "edge", "Sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge", "Points_", "=_", "vtk", "Num", "py_", "._", "get", "Vt", "k", "Poly", "Data", "Fro", "m", "Num", "py", "Points_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "update", "Poly", "Data_", "(_", "edge", "Points_", ",_", "'", "edge", " ", "points", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "Point_", ",_", "line", "Direction_", ",_", "\\u_", "=_", "appl", "y", "Line", "Fit_", "(_", "edge", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "line", "Direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "np_", "._", "cross_", "(_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "xaxis_", ",_", "expected", "XA", "xis_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xaxis_", "*=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "right", " ", "hande", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "xaxis_", ",_", "result", "Array", "Name_", "=_", "'", "dist", "\\u", "along", "\\u", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pts_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dists_", "=_", "np_", "._", "dot_", "(_", "pts_", "-_", "line", "Point_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "line", "Point_", "+_", "za", "xis_", "*_", "np_", "._", "min_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "line", "Point_", "+_", "za", "xis_", "*_", "np_", "._", "max_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p1_", "=_", "project", "Point", "To", "Plane_", "(_", "p1_", ",_", "plane", "Origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "project", "Point", "To", "Plane_", "(_", "p2_", ",_", "plane", "Origin_", ",_", "normal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xw", "idth_", ",_", "yw", "idth_", "=_", "block", "Dimensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zw", "idth_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "p2_", "-_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "origin_", "=_", "p1_", "-_", "edge", "Sign_", "*_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", "-_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", "+_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Deb", "ug", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Sphere", "(", "line", "Point", ",", " ", "radi", "us", "=", "0.02", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "line", "Point", ",", " ", "line", "Point", " ", "+", " ", "yax", "is", "*", "yw", "idt", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "line", "Point", ",", " ", "line", "Point", " ", "+", " ", "xaxis", "*", "xw", "idt", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "line", "Point", ",", " ", "line", "Point", " ", "+", " ", "za", "xis", "*", "zw", "idt", "h", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p1_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "p2_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "p1_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Sphere", "_", "(_", "origin_", ",_", "radius_", "=_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "orig", "in", " ", "-", " ", "xaxis", "*", "xw", "idt", "h", "/", "2.0", ",", " ", "orig", "in", " ", "+", " ", "xaxis", "*", "xw", "idt", "h", "/", "2.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "orig", "in", " ", "-", " ", "yax", "is", "*", "yw", "idt", "h", "/", "2.0", ",", " ", "orig", "in", " ", "+", " ", "yax", "is", "*", "yw", "idt", "h", "/", "2.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "d", ".", "add", "Line", "(", "orig", "in", " ", "-", " ", "za", "xis", "*", "zw", "idt", "h", "/", "2.0", ",", " ", "orig", "in", " ", "+", " ", "za", "xis", "*", "zw", "idt", "h", "/", "2.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", ",_", "origin_", "+_", "xaxis_", "*_", "xw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", ",_", "origin_", "+_", "yaxis_", "*_", "yw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Line_", "(_", "origin_", ",_", "origin_", "+_", "za", "xis_", "*_", "zw", "idth_", "/_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "obj", " ", "=", " ", "update", "Poly", "Data", "(", "d", ".", "get", "Poly", "Data", "()", ",", " ", "'", "block", " ", "axes", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "obj", ".", "set", "Proper", "ty", "('", "Color", "',", " ", "Qt", "Gui", ".", "QC", "olor", "(", "255", ",", " ", "255", ",", " ", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "obj", ".", "set", "Proper", "ty", "('", "Vis", "ibl", "e", "',", " ", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "create", "Block", "Aff", "orda", "nce_", "(_", "origin_", ",_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ",_", "xw", "idth_", ",_", "yw", "idth_", ",_", "zw", "idth_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Color", "'_", ",_", "[_", "222_", "/_", "255.0_", ",_", "184_", "/_", "255.0_", ",_", "135_", "/_", "255.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "Deb", "ris", "Gra", "sp", "Seed_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "compute", "Deb", "ris", "Stan", "ce", "Frame_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "Frame_", "(_", "t_", ",_", "'", "deb", "ris", " ", "stance", " ", "frame", "'_", ",_", "parent_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "publi", "sh", "Callback_", "=_", "functools_", "._", "partial_", "(_", "publi", "sh", "Deb", "ris", "Stan", "ce", "Frame_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "Far", "Rig", "ht", "Corner", "_", "(_", "poly", "Data_", ",_", "link", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "With", "in", " ", "a", " ", "point", " ", "cloud", " ", "find", " ", "the", " ", "point", " ", "to", " ", "the", " ", "far", " ", "right", " ", "from", " ", "the", " ", "link", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "input", " ", "is", " ", "the", " ", "4", " ", "corners", " ", "of", " ", "a", " ", "minim", "um", " ", "bound", "ing", " ", "box", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diagonal", "Transform_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "link", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diagonal", "Transform_", "._", "Pre", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diagonal", "Transform_", "._", "Concat", "enat", "e_", "(_", "transform", "Utils_", "._", "frame", "Fro", "m", "Position", "And", "RP", "Y_", "(_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "45_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "._", "update", "Frame_", "(_", "diagonal", "Transform_", ",_", "'", "diagonal", " ", "frame", "'_", ",_", "parent_", "=_", "get", "Deb", "ug", "Folder_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Origin_", "=_", "diagonal", "Transform_", "._", "Transform", "Point_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "X_", "=_", "diagonal", "Transform_", "._", "Transform", "Vector_", "(_", "[_", "1.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Y_", "=_", "diagonal", "Transform_", "._", "Transform", "Vector_", "(_", "[_", "0.0_", ",_", "1.0_", ",_", "0.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Z_", "=_", "diagonal", "Transform_", "._", "Transform", "Vector_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "1.0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poly", "Data_", "=_", "label", "Point", "Distan", "ce", "Al", "ong", "Axis_", "(_", "poly", "Data_", ",_", "view", "Y_", ",_", "origin_", "=_", "view", "Origin_", ",_", "result", "Array", "Name_", "=_", "'", "distance", "\\u", "along", "\\u", "foot", "\\u", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis_", "._", "update", "Poly", "Data_", "(_", "poly", "Data_", ",_", "'", "corn", "er", "Point", "s", "'_", ",_", "parent_", "=_", "'", "segmentation", "'_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "far", "Rig", "ht", "Index_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "distance", "\\u", "along", "\\u", "foot", "\\u", "y", "'_", ")_", "._", "argmin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "vtk", "Num", "py_", "._", "get", "Num", "py", "Fro", "m", "Vt", "k_", "(_", "poly", "Data_", ",_", "'", "Point", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "points_", "[_", "far", "Rig", "ht", "Index_", ",_", ":_", "]_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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,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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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
Demonware/jose/tests.py
[ { "content": " def test_jwe_compression(self):\n local_claims = copy(claims)\n\n for v in xrange(1000):\n local_claims['dummy_' + str(v)] = '0' * 100\n\n jwe = jose.serialize_compact(jose.encrypt(local_claims, rsa_pub_key))\n _, _, _, uncompressed_ciphertext, _ = jwe.split('.')\n\n jwe = jose.serialize_compact(jose.encrypt(local_claims, rsa_pub_key,\n compression='DEF'))\n _, _, _, compressed_ciphertext, _ = jwe.split('.')\n\n self.assertTrue(len(compressed_ciphertext) <\n len(uncompressed_ciphertext))\n\n jwt = jose.legacy_decrypt(jose.deserialize_compact(jwe), rsa_priv_key)\n self.assertEqual(jwt.claims, local_claims)", "metadata": "root.TestJWE.test_jwe_compression", "header": "['class', 'TestJWE', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 276 }, { "content": " def test_jwe_compression(self):\n local_claims = copy(claims)\n\n for v in xrange(1000):\n local_claims['dummy_' + str(v)] = '0' * 100\n\n jwe = jose.serialize_compact(\n jose.spec_compliant_encrypt(local_claims, rsa_pub_key)\n )\n _, _, _, uncompressed_ciphertext, _ = jwe.split('.')\n\n jwe = jose.serialize_compact(\n jose.spec_compliant_encrypt(local_claims, rsa_pub_key,\n add_header={'zip': 'DEF'})\n )\n _, _, _, compressed_ciphertext, _ = jwe.split('.')\n\n self.assertTrue(len(compressed_ciphertext) <\n len(uncompressed_ciphertext))\n\n jwt = jose.spec_compliant_decrypt(jose.deserialize_compact(jwe),\n rsa_priv_key)\n self.assertEqual(jwt.claims, local_claims)", "metadata": "root.TestSpecCompliantJWE.test_jwe_compression", "header": "['class', 'TestSpecCompliantJWE', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 456 } ]
[ { "span": "self.assertTrue(len(compressed_ciphertext) <\n len(uncompressed_ciphertext))", "start_line": 289, "start_column": 8, "end_line": 290, "end_column": 45 }, { "span": "self.assertTrue(len(compressed_ciphertext) <\n len(uncompressed_ciphertext))", "start_line": 473, "start_column": 8, "end_line": 474, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "JW", "E_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "jw", "e\\u", "compression_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "claims_", "=_", "copy_", "(_", "claims_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", "in_", "xrange_", "(_", "1000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "claims_", "[_", "'", "dummy", "\\u'_", "+_", "str_", "(_", "v_", ")_", "]_", "=_", "'", "0", "'_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jw", "e_", "=_", "jos", "e_", "._", "serialize", "\\u", "compact_", "(_", "jos", "e_", "._", "encrypt_", "(_", "local", "\\u", "claims_", ",_", "rsa", "\\u", "pub", "\\u", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "uncompressed", "\\u", "ciphertext_", ",_", "\\u_", "=_", "jw", "e_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jw", "e_", "=_", "jos", "e_", "._", "serialize", "\\u", "compact_", "(_", "jos", "e_", "._", "encrypt_", "(_", "local", "\\u", "claims_", ",_", "rsa", "\\u", "pub", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compression_", "=_", "'", "DEF", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "compress", "ed", "\\u", "ciphertext_", ",_", "\\u_", "=_", "jw", "e_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "compress", "ed", "\\u", "ciphertext_", ")_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "uncompressed", "\\u", "ciphertext_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jwt_", "=_", "jos", "e_", "._", "lega", "cy", "\\u", "decrypt_", "(_", "jos", "e_", "._", "deserialize", "\\u", "compact_", "(_", "jw", "e_", ")_", ",_", "rsa", "\\u", "priv", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "jwt_", "._", "claims_", ",_", "local", "\\u", "claims_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Spec", "Comp", "lian", "t", "JW", "E_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "jw", "e\\u", "compression_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "claims_", "=_", "copy_", "(_", "claims_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v_", "in_", "xrange_", "(_", "1000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "claims_", "[_", "'", "dummy", "\\u'_", "+_", "str_", "(_", "v_", ")_", "]_", "=_", "'", "0", "'_", "*_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jw", "e_", "=_", "jos", "e_", "._", "serialize", "\\u", "compact_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "jos", "e_", "._", "spec", "\\u", "compliant", "\\u", "encrypt_", "(_", "local", "\\u", "claims_", ",_", "rsa", "\\u", "pub", "\\u", "key_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "uncompressed", "\\u", "ciphertext_", ",_", "\\u_", "=_", "jw", "e_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jw", "e_", "=_", "jos", "e_", "._", "serialize", "\\u", "compact_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "jos", "e_", "._", "spec", "\\u", "compliant", "\\u", "encrypt_", "(_", "local", "\\u", "claims_", ",_", "rsa", "\\u", "pub", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "header_", "=_", "{_", "'", "zip", "'_", ":_", "'", "DEF", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "compress", "ed", "\\u", "ciphertext_", ",_", "\\u_", "=_", "jw", "e_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "compress", "ed", "\\u", "ciphertext_", ")_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "uncompressed", "\\u", "ciphertext_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jwt_", "=_", "jos", "e_", "._", "spec", "\\u", "compliant", "\\u", "decrypt_", "(_", "jos", "e_", "._", "deserialize", "\\u", "compact_", "(_", "jw", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsa", "\\u", "priv",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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
datamade/dedupe/dedupe/training.py
[ { "content": " @staticmethod\n def coveredRecords(blocker, records) :\n CP = predicates.CompoundPredicate\n\n cover = {}\n\n for predicate in blocker.predicates :\n cover[predicate] = {}\n for id, record in viewitems(records) :\n blocks = predicate(record)\n for block in blocks :\n cover[predicate].setdefault(block, set()).add(id)\n\n return cover", "metadata": "root.DedupeBlockLearner.coveredRecords", "header": "['class', 'DedupeBlockLearner', '(', 'BlockLearner', ')', ':', '___EOS___']", "index": 197 }, { "content": " @staticmethod\n def coveredRecords(blocker, records_1, records_2) :\n CP = predicates.CompoundPredicate\n\n cover = {}\n\n for predicate in blocker.predicates :\n cover[predicate] = {}\n for id, record in viewitems(records_2) :\n blocks = predicate(record)\n for block in blocks :\n cover[predicate].setdefault(block, (set(), set()))[1].add(id)\n\n current_blocks = set(cover[predicate])\n for id, record in viewitems(records_1) :\n blocks = set(predicate(record))\n for block in blocks & current_blocks :\n cover[predicate][block][0].add(id)\n\n return cover", "metadata": "root.RecordLinkBlockLearner.coveredRecords", "header": "['class', 'RecordLinkBlockLearner', '(', 'BlockLearner', ')', ':', '___EOS___']", "index": 259 } ]
[ { "span": "CP ", "start_line": 199, "start_column": 8, "end_line": 199, "end_column": 10 }, { "span": "CP ", "start_line": 261, "start_column": 8, "end_line": 261, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ded", "upe", "Block", "Learner", "_", "(_", "Block", "Learner", "_", ")_", ":_", "\\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_", "covered", "Records_", "(_", "blocker", "_", ",_", "records_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CP_", "=_", "predicates_", "._", "Compo", "und", "Predicate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cover_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "predicate_", "in_", "blocker", "_", "._", "predicates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cover_", "[_", "predicate_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", ",_", "record_", "in_", "view", "items_", "(_", "records_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blocks_", "=_", "predicate_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "block_", "in_", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cover_", "[_", "predicate_", "]_", "._", "setdefault_", "(_", "block_", ",_", "set_", "(_", ")_", ")_", "._", "add_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Record", "Link", "Block", "Learner", "_", "(_", "Block", "Learner", "_", ")_", ":_", "\\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_", "covered", "Records_", "(_", "blocker", "_", ",_", "record", "s", "\\u", "1_", ",_", "record", "s", "\\u", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CP_", "=_", "predicates_", "._", "Compo", "und", "Predicate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cover_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "predicate_", "in_", "blocker", "_", "._", "predicates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cover_", "[_", "predicate_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", ",_", "record_", "in_", "view", "items_", "(_", "record", "s", "\\u", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blocks_", "=_", "predicate_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "block_", "in_", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cover_", "[_", "predicate_", "]_", "._", "setdefault_", "(_", "block_", ",_", "(_", "set_", "(_", ")_", ",_", "set_", "(_", ")_", ")_", ")_", "[_", "1_", "]_", "._", "add_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "blocks_", "=_", "set_", "(_", "cover_", "[_", "predicate_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", ",_", "record_", "in_", "view", "items_", "(_", "record", "s", "\\u", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blocks_", "=_", "set_", "(_", "predicate_", "(_", "record_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "block_", "in_", "blocks_", "&_", "current", "\\u", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cover_", "[_", "predicate_", "]_", "[_", "block_", "]_", "[_", "0_", "]_", "._", "add_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cover_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
xumiao/pymonk/monk/roles/monitor.py
[ { "content": " def act(self):\n key = self.name\n if not key:\n self.warning(logger, 'no valid tracking name set')\n return\n try:\n value = float(self.get('value'))\n except:\n self.warning(logger, 'no valid value set')\n return\n try:\n t = float(self.get('time'))\n except:\n self.warning(logger, 'no valid time set')\n return\n user = self.get('user')\n if key not in monitor.trackers:\n monitor.trackers[key] = Tracker()\n tracker = monitor.trackers[key]\n tracker.add(t, value, user)", "metadata": "root.Track.act", "header": "['class', 'Track', '(', 'Task', ')', ':', '___EOS___']", "index": 116 }, { "content": " def act(self):\n key = self.name\n if not key:\n self.warning(logger, 'no valid tracking name set')\n return\n annotator = self.get('annotator')\n try:\n t = float(self.get('time'))\n except:\n self.warning(logger, 'no valid time set')\n return\n if annotator and key in monitor.trackers:\n tracker = monitor.trackers[key]\n tracker.annotate(t, annotator)", "metadata": "root.AnnotateTracker.act", "header": "['class', 'AnnotateTracker', '(', 'Task', ')', ':', '___EOS___']", "index": 161 }, { "content": " def act(self):\n key = self.name\n if not key:\n self.warning(logger, 'no valid aggregator name set')\n return\n try:\n value = float(self.get('value'))\n except:\n self.warning(logger, 'no valid value set')\n return\n user = self.get('user')\n if key not in monitor.aggregators:\n monitor.aggregators[key] = Aggregator()\n aggregator = monitor.aggregators[key]\n aggregator.add(value, user)", "metadata": "root.Aggregate.act", "header": "['class', 'Aggregate', '(', 'Task', ')', ':', '___EOS___']", "index": 208 }, { "content": " def set_resolution(self, resolution):\n try:\n self.resolution = float(resolution)\n self.invalid = True\n except:\n logger.warning('resolution can not be converted to a float {}'.format(resolution))", "metadata": "root.Measurer.set_resolution", "header": "['class', 'Measurer', '(', 'object', ')', ':', '___EOS___']", "index": 372 }, { "content": " def act(self):\n logger.info('measure {}'.format(self.decodedMessage))\n key = self.name\n if not key:\n self.warning(logger, 'no valid measurer name set')\n return\n try:\n value = float(self.get('value'))\n except:\n self.warning(logger, 'no valid value set')\n return\n try:\n pos = int(self.get('label'))\n except:\n self.warning(logger, 'no valid label')\n return\n user = self.get('user')\n if key not in monitor.measurers:\n monitor.measurers[key] = Measurer()\n measurer = monitor.measurers[key]\n measurer.add(value, user, pos)", "metadata": "root.Measure.act", "header": "['class', 'Measure', '(', 'Task', ')', ':', '___EOS___']", "index": 390 } ]
[ { "span": "except:", "start_line": 123, "start_column": 8, "end_line": 123, "end_column": 15 }, { "span": "except:", "start_line": 128, "start_column": 8, "end_line": 128, "end_column": 15 }, { "span": "except:", "start_line": 169, "start_column": 8, "end_line": 169, "end_column": 15 }, { "span": "except:", "start_line": 215, "start_column": 8, "end_line": 215, "end_column": 15 }, { "span": "except:", "start_line": 376, "start_column": 8, "end_line": 376, "end_column": 15 }, { "span": "except:", "start_line": 398, "start_column": 8, "end_line": 398, "end_column": 15 }, { "span": "except:", "start_line": 403, "start_column": 8, "end_line": 403, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Track_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "act_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "track", "ing", " ", "name", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "float_", "(_", "self_", "._", "get_", "(_", "'", "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 ", " _", "self_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "value", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "float_", "(_", "self_", "._", "get_", "(_", "'", "time", "'_", ")_", ")_", "\\u\\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_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "time", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "self_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "not_", "in_", "monitor_", "._", "trackers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monitor_", "._", "trackers", "_", "[_", "key_", "]_", "=_", "Tracker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tracker_", "=_", "monitor_", "._", "trackers", "_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tracker_", "._", "add_", "(_", "t_", ",_", "value_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Annotate", "Tracker_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "act_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "track", "ing", " ", "name", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "annotator", "_", "=_", "self_", "._", "get_", "(_", "'", "annotator", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "float_", "(_", "self_", "._", "get_", "(_", "'", "time", "'_", ")_", ")_", "\\u\\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_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "time", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "annotator", "_", "and_", "key_", "in_", "monitor_", "._", "trackers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tracker_", "=_", "monitor_", "._", "trackers", "_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tracker_", "._", "annotate_", "(_", "t_", ",_", "annotator", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aggregate", "_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "act_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "aggregator", " ", "name", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "float_", "(_", "self_", "._", "get_", "(_", "'", "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 ", " _", "self_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "value", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "self_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "not_", "in_", "monitor_", "._", "aggregator", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monitor_", "._", "aggregator", "s_", "[_", "key_", "]_", "=_", "Aggregator", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aggregator", "_", "=_", "monitor_", "._", "aggregator", "s_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggregator", "_", "._", "add_", "(_", "value_", ",_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Measure", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "resolution_", "(_", "self_", ",_", "resolution_", ")_", ":_", "\\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_", "._", "resolution_", "=_", "float_", "(_", "resolution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "invalid_", "=_", "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 ", " _", "logger_", "._", "warning_", "(_", "'", "resolu", "tion", " ", "can", " ", "not", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "float", " ", "{}'_", "._", "format_", "(_", "resolution_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Measure_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "act_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "measure", " ", "{}'_", "._", "format_", "(_", "self_", "._", "decode", "d", "Message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "measure", "r", " ", "name", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "float_", "(_", "self_", "._", "get_", "(_", "'", "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 ", " _", "self_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "value", " ", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "int_", "(_", "self_", "._", "get_", "(_", "'", "label", "'_", ")_", ")_", "\\u\\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_", "._", "warning_", "(_", "logger_", ",_", "'", "no", " ", "valid", " ", "label", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "self_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "not_", "in_", "monitor_", "._", "measure", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "monitor_", "._", "measure", "rs_", "[_", "key_", "]_", "=_", "Measure", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "measure", "r_", "=_", "monitor_", "._", "measure", "rs_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measure", "r_", "._", "add_", "(_", "value_", ",_", "user_", ",_", "pos_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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(self):\n 'Test building an AnnotationDB from file'\n from pygr import seqdb, cnestedlist, sqlgraph\n dm2 = pygr.Data.getResource('TEST.Seq.Genome.dm2')\n # BUILD ANNOTATION DATABASE FOR REFSEQ EXONS\n exon_slices = Collection(\n filename=os.path.join(self.path, 'refGene_exonAnnot_dm2.cdb'),\n intKeys=True, mode='cr', writeback=False)\n exon_db = seqdb.AnnotationDB(exon_slices, dm2,\n sliceAttrDict=dict(id=0, exon_id=1,\n orientation=2,\n gene_id=3, start=4,\n stop=5))\n msa = cnestedlist.NLMSA(os.path.join(self.path,\n 'refGene_exonAnnot_dm2'), 'w',\n pairwiseMode=True, bidirectional=False)\n for lines in open(os.path.join(testInputDir,\n 'refGene_exonAnnot%s_dm2.txt'\n % smallSamplePostfix),\n 'r').xreadlines():\n row = [x for x in lines.split('\\t')] # CONVERT TO LIST SO MUTABLE\n row[1] = int(row[1]) # CONVERT FROM STRING TO INTEGER\n exon_slices[row[1]] = row\n exon = exon_db[row[1]] # GET THE ANNOTATION OBJECT FOR THIS EXON\n msa.addAnnotation(exon) # SAVE IT TO GENOME MAPPING\n exon_db.clear_cache() # not really necessary; cache should autoGC\n # SHELVE SHOULD BE EXPLICITLY CLOSED IN ORDER TO SAVE CURRENT CONTENTS\n exon_slices.close()\n msa.build() # FINALIZE GENOME ALIGNMENT INDEXES\n exon_db.__doc__ = 'Exon Annotation Database for dm2'\n pygr.Data.addResource('TEST.Annotation.dm2.exons', exon_db)\n msa.__doc__ = 'NLMSA Exon for dm2'\n pygr.Data.addResource('TEST.Annotation.NLMSA.dm2.exons', msa)\n exon_schema = pygr.Data.ManyToManyRelation(dm2, exon_db,\n bindAttrs=('exon1', ))\n exon_schema.__doc__ = 'Exon Schema for dm2'\n pygr.Data.addSchema('TEST.Annotation.NLMSA.dm2.exons', exon_schema)\n # BUILD ANNOTATION DATABASE FOR REFSEQ SPLICES\n splice_slices = Collection(\n filename=os.path.join(self.path, 'refGene_spliceAnnot_dm2.cdb'),\n intKeys=True, mode='cr', writeback=False)\n splice_db = seqdb.AnnotationDB(splice_slices, dm2,\n sliceAttrDict=dict(id=0, splice_id=1,\n orientation=2,\n gene_id=3, start=4,\n stop=5))\n msa = cnestedlist.NLMSA(os.path.join(self.path,\n 'refGene_spliceAnnot_dm2'), 'w',\n pairwiseMode=True, bidirectional=False)\n for lines in open(os.path.join(testInputDir,\n 'refGene_spliceAnnot%s_dm2.txt'\n % smallSamplePostfix),\n 'r').xreadlines():\n row = [x for x in lines.split('\\t')] # CONVERT TO LIST SO MUTABLE\n row[1] = int(row[1]) # CONVERT FROM STRING TO INTEGER\n splice_slices[row[1]] = row\n # GET THE ANNOTATION OBJECT FOR THIS EXON\n splice = splice_db[row[1]]\n msa.addAnnotation(splice) # SAVE IT TO GENOME MAPPING\n splice_db.clear_cache() # not really necessary; cache should autoGC\n # SHELVE SHOULD BE EXPLICITLY CLOSED IN ORDER TO SAVE CURRENT CONTENTS\n splice_slices.close()\n msa.build() # FINALIZE GENOME ALIGNMENT INDEXES\n splice_db.__doc__ = 'Splice Annotation Database for dm2'\n pygr.Data.addResource('TEST.Annotation.dm2.splices', splice_db)\n msa.__doc__ = 'NLMSA Splice for dm2'\n pygr.Data.addResource('TEST.Annotation.NLMSA.dm2.splices', msa)\n splice_schema = pygr.Data.ManyToManyRelation(dm2, splice_db,\n bindAttrs=('splice1', ))\n splice_schema.__doc__ = 'Splice Schema for dm2'\n pygr.Data.addSchema('TEST.Annotation.NLMSA.dm2.splices', splice_schema)\n # BUILD ANNOTATION DATABASE FOR MOST CONSERVED ELEMENTS FROM UCSC\n ucsc_slices = Collection(\n filename=os.path.join(self.path, 'phastConsElements15way_dm2.cdb'),\n intKeys=True, mode='cr', writeback=False)\n ucsc_db = seqdb.AnnotationDB(ucsc_slices, dm2,\n sliceAttrDict=dict(id=0, ucsc_id=1,\n orientation=2,\n gene_id=3, start=4,\n stop=5))\n msa = cnestedlist.NLMSA(os.path.join(self.path,\n 'phastConsElements15way_dm2'),\n 'w', pairwiseMode=True, bidirectional=False)\n for lines in open(os.path.join(testInputDir,\n 'phastConsElements15way%s_dm2.txt'\n % smallSamplePostfix),\n 'r').xreadlines():\n row = [x for x in lines.split('\\t')] # CONVERT TO LIST SO MUTABLE\n row[1] = int(row[1]) # CONVERT FROM STRING TO INTEGER\n ucsc_slices[row[1]] = row\n ucsc = ucsc_db[row[1]] # GET THE ANNOTATION OBJECT FOR THIS EXON\n msa.addAnnotation(ucsc) # SAVE IT TO GENOME MAPPING\n ucsc_db.clear_cache() # not really necessary; cache should autoGC\n # SHELVE SHOULD BE EXPLICITLY CLOSED IN ORDER TO SAVE CURRENT CONTENTS\n ucsc_slices.close()\n msa.build() # FINALIZE GENOME ALIGNMENT INDEXES\n ucsc_db.__doc__ = 'Most Conserved Elements for dm2'\n pygr.Data.addResource('TEST.Annotation.UCSC.dm2.mostconserved',\n ucsc_db)\n msa.__doc__ = 'NLMSA for Most Conserved Elements for dm2'\n pygr.Data.addResource('TEST.Annotation.UCSC.NLMSA.dm2.mostconserved',\n msa)\n ucsc_schema = pygr.Data.ManyToManyRelation(dm2, ucsc_db,\n bindAttrs=('element1', ))\n ucsc_schema.__doc__ = 'Schema for UCSC Most Conserved Elements for dm2'\n pygr.Data.addSchema('TEST.Annotation.UCSC.NLMSA.dm2.mostconserved',\n ucsc_schema)\n pygr.Data.save()\n pygr.Data.clear_cache() # force resources to reload when requested\n\n # QUERY TO EXON AND SPLICES ANNOTATION DATABASE\n dm2 = pygr.Data.getResource('TEST.Seq.Genome.dm2')\n exonmsa = pygr.Data.getResource('TEST.Annotation.NLMSA.dm2.exons')\n splicemsa = pygr.Data.getResource('TEST.Annotation.NLMSA.dm2.splices')\n conservedmsa = \\\n pygr.Data.getResource('TEST.Annotation.UCSC.NLMSA.dm2.mostconserved')\n exons = pygr.Data.getResource('TEST.Annotation.dm2.exons')\n splices = pygr.Data.getResource('TEST.Annotation.dm2.splices')\n mostconserved = \\\n pygr.Data.getResource('TEST.Annotation.UCSC.dm2.mostconserved')\n\n # OPEN DM2_MULTIZ15WAY NLMSA\n msa = cnestedlist.NLMSA(os.path.join(msaDir, 'dm2_multiz15way'), 'r',\n trypath=[seqDir])\n\n exonAnnotFileName = os.path.join(testInputDir,\n 'Annotation_ConservedElement_Exons%s_dm2.txt'\n % smallSamplePostfix)\n intronAnnotFileName = os.path.join(testInputDir,\n 'Annotation_ConservedElement_Introns%s_dm2.txt'\n % smallSamplePostfix)\n newexonAnnotFileName = os.path.join(self.path, 'new_Exons_dm2.txt')\n newintronAnnotFileName = os.path.join(self.path, 'new_Introns_dm2.txt')\n tmpexonAnnotFileName = self.copyFile(exonAnnotFileName)\n tmpintronAnnotFileName = self.copyFile(intronAnnotFileName)\n\n if smallSampleKey:\n chrList = [smallSampleKey]\n else:\n chrList = dm2.seqLenDict.keys()\n chrList.sort()\n\n outfile = open(newexonAnnotFileName, 'w')\n for chrid in chrList:\n slice = dm2[chrid]\n try:\n ex1 = exonmsa[slice]\n except KeyError:\n continue\n else:\n exlist1 = [(ix.exon_id, ix) for ix in ex1.keys()]\n exlist1.sort()\n for ixx, exon in exlist1:\n saveList = []\n tmp = exon.sequence\n tmpexon = exons[exon.exon_id]\n tmpslice = tmpexon.sequence # FOR REAL EXON COORDINATE\n wlist1 = 'EXON', chrid, tmpexon.exon_id, tmpexon.gene_id, \\\n tmpslice.start, tmpslice.stop\n try:\n out1 = conservedmsa[tmp]\n except KeyError:\n pass\n else:\n elementlist = [(ix.ucsc_id, ix) for ix in out1.keys()]\n elementlist.sort()\n for iyy, element in elementlist:\n if element.stop - element.start < 100:\n continue\n score = int(string.split(element.gene_id, '=')[1])\n if score < 100:\n continue\n tmp2 = element.sequence\n tmpelement = mostconserved[element.ucsc_id]\n # FOR REAL ELEMENT COORDINATE\n tmpslice2 = tmpelement.sequence\n wlist2 = wlist1 + (tmpelement.ucsc_id,\n tmpelement.gene_id,\n tmpslice2.start, tmpslice2.stop)\n slicestart, sliceend = max(tmp.start, tmp2.start),\\\n min(tmp.stop, tmp2.stop)\n tmp1 = msa.seqDict['dm2.' + chrid][slicestart:\n sliceend]\n edges = msa[tmp1].edges()\n for src, dest, e in edges:\n if src.stop - src.start < 100:\n continue\n palign, pident = e.pAligned(), e.pIdentity()\n if palign < 0.8 or pident < 0.8:\n continue\n palign, pident = '%.2f' % palign, \\\n '%.2f' % pident\n wlist3 = wlist2 + ((~msa.seqDict)[src],\n str(src), src.start,\n src.stop,\n (~msa.seqDict)[dest],\n str(dest), dest.start,\n dest.stop, palign, pident)\n saveList.append('\\t'.join(map(str, wlist3))\n + '\\n')\n saveList.sort()\n for saveline in saveList:\n outfile.write(saveline)\n outfile.close()\n md5old = hashlib.md5()\n md5old.update(open(tmpexonAnnotFileName, 'r').read())\n md5new = hashlib.md5()\n md5new.update(open(newexonAnnotFileName, 'r').read())\n assert md5old.digest() == md5new.digest()\n\n outfile = open(newintronAnnotFileName, 'w')\n for chrid in chrList:\n slice = dm2[chrid]\n try:\n sp1 = splicemsa[slice]\n except:\n continue\n else:\n splist1 = [(ix.splice_id, ix) for ix in sp1.keys()]\n splist1.sort()\n for ixx, splice in splist1:\n saveList = []\n tmp = splice.sequence\n tmpsplice = splices[splice.splice_id]\n tmpslice = tmpsplice.sequence # FOR REAL EXON COORDINATE\n wlist1 = 'INTRON', chrid, tmpsplice.splice_id, \\\n tmpsplice.gene_id, tmpslice.start, tmpslice.stop\n try:\n out1 = conservedmsa[tmp]\n except KeyError:\n pass\n else:\n elementlist = [(ix.ucsc_id, ix) for ix in out1.keys()]\n elementlist.sort()\n for iyy, element in elementlist:\n if element.stop - element.start < 100:\n continue\n score = int(string.split(element.gene_id, '=')[1])\n if score < 100:\n continue\n tmp2 = element.sequence\n tmpelement = mostconserved[element.ucsc_id]\n # FOR REAL ELEMENT COORDINATE\n tmpslice2 = tmpelement.sequence\n wlist2 = wlist1 + (tmpelement.ucsc_id,\n tmpelement.gene_id,\n tmpslice2.start, tmpslice2.stop)\n slicestart, sliceend = max(tmp.start, tmp2.start),\\\n min(tmp.stop, tmp2.stop)\n tmp1 = msa.seqDict['dm2.' + chrid][slicestart:\n sliceend]\n edges = msa[tmp1].edges()\n for src, dest, e in edges:\n if src.stop - src.start < 100:\n continue\n palign, pident = e.pAligned(), e.pIdentity()\n if palign < 0.8 or pident < 0.8:\n continue\n palign, pident = '%.2f' % palign, \\\n '%.2f' % pident\n wlist3 = wlist2 + ((~msa.seqDict)[src],\n str(src), src.start,\n src.stop,\n (~msa.seqDict)[dest],\n str(dest), dest.start,\n dest.stop, palign, pident)\n saveList.append('\\t'.join(map(str, wlist3))\n + '\\n')\n saveList.sort()\n for saveline in saveList:\n outfile.write(saveline)\n outfile.close()\n md5old = hashlib.md5()\n md5old.update(open(tmpintronAnnotFileName, 'r').read())\n md5new = hashlib.md5()\n md5new.update(open(newintronAnnotFileName, 'r').read())\n assert md5old.digest() == md5new.digest()", "metadata": "root.Build_Test.test_collectionannot", "header": "['class', 'Build_Test', '(', 'PygrBuildNLMSAMegabase', ')', ':', '___EOS___']", "index": 126 }, { "content": " def test_mysqlannot(self):\n 'Test building an AnnotationDB from MySQL'\n from pygr import seqdb, cnestedlist, sqlgraph\n dm2 = pygr.Data.getResource('TEST.Seq.Genome.dm2')\n # BUILD ANNOTATION DATABASE FOR REFSEQ EXONS: MYSQL VERSION\n exon_slices = sqlgraph.SQLTableClustered(\n '%s.pygr_refGene_exonAnnot%s_dm2' % (testInputDB,\n smallSamplePostfix),\n clusterKey='chromosome', maxCache=0)\n exon_db = seqdb.AnnotationDB(exon_slices, dm2,\n sliceAttrDict=dict(id='chromosome',\n gene_id='name',\n exon_id='exon_id'))\n msa = cnestedlist.NLMSA(os.path.join(self.path,\n 'refGene_exonAnnot_SQL_dm2'), 'w',\n pairwiseMode=True, bidirectional=False)\n for id in exon_db:\n msa.addAnnotation(exon_db[id])\n exon_db.clear_cache() # not really necessary; cache should autoGC\n exon_slices.clear_cache()\n msa.build()\n exon_db.__doc__ = 'SQL Exon Annotation Database for dm2'\n pygr.Data.addResource('TEST.Annotation.SQL.dm2.exons', exon_db)\n msa.__doc__ = 'SQL NLMSA Exon for dm2'\n pygr.Data.addResource('TEST.Annotation.NLMSA.SQL.dm2.exons', msa)\n exon_schema = pygr.Data.ManyToManyRelation(dm2, exon_db,\n bindAttrs=('exon2', ))\n exon_schema.__doc__ = 'SQL Exon Schema for dm2'\n pygr.Data.addSchema('TEST.Annotation.NLMSA.SQL.dm2.exons', exon_schema)\n # BUILD ANNOTATION DATABASE FOR REFSEQ SPLICES: MYSQL VERSION\n splice_slices = sqlgraph.SQLTableClustered(\n '%s.pygr_refGene_spliceAnnot%s_dm2' % (testInputDB,\n smallSamplePostfix),\n clusterKey='chromosome', maxCache=0)\n splice_db = seqdb.AnnotationDB(splice_slices, dm2,\n sliceAttrDict=dict(id='chromosome',\n gene_id='name',\n splice_id='splice_id'))\n msa = cnestedlist.NLMSA(os.path.join(self.path,\n 'refGene_spliceAnnot_SQL_dm2'),\n 'w', pairwiseMode=True, bidirectional=False)\n for id in splice_db:\n msa.addAnnotation(splice_db[id])\n splice_db.clear_cache() # not really necessary; cache should autoGC\n splice_slices.clear_cache()\n msa.build()\n splice_db.__doc__ = 'SQL Splice Annotation Database for dm2'\n pygr.Data.addResource('TEST.Annotation.SQL.dm2.splices', splice_db)\n msa.__doc__ = 'SQL NLMSA Splice for dm2'\n pygr.Data.addResource('TEST.Annotation.NLMSA.SQL.dm2.splices', msa)\n splice_schema = pygr.Data.ManyToManyRelation(dm2, splice_db,\n bindAttrs=('splice2', ))\n splice_schema.__doc__ = 'SQL Splice Schema for dm2'\n pygr.Data.addSchema('TEST.Annotation.NLMSA.SQL.dm2.splices',\n splice_schema)\n # BUILD ANNOTATION DATABASE FOR MOST CONSERVED ELEMENTS FROM UCSC:\n # MYSQL VERSION\n ucsc_slices = sqlgraph.SQLTableClustered(\n '%s.pygr_phastConsElements15way%s_dm2' % (testInputDB,\n smallSamplePostfix),\n clusterKey='chromosome', maxCache=0)\n ucsc_db = seqdb.AnnotationDB(ucsc_slices, dm2,\n sliceAttrDict=dict(id='chromosome',\n gene_id='name',\n ucsc_id='ucsc_id'))\n msa = cnestedlist.NLMSA(os.path.join(self.path,\n 'phastConsElements15way_SQL_dm2'),\n 'w', pairwiseMode=True, bidirectional=False)\n for id in ucsc_db:\n msa.addAnnotation(ucsc_db[id])\n ucsc_db.clear_cache() # not really necessary; cache should autoGC\n ucsc_slices.clear_cache()\n msa.build()\n ucsc_db.__doc__ = 'SQL Most Conserved Elements for dm2'\n pygr.Data.addResource('TEST.Annotation.UCSC.SQL.dm2.mostconserved',\n ucsc_db)\n msa.__doc__ = 'SQL NLMSA for Most Conserved Elements for dm2'\n pygr.Data.addResource(\n 'TEST.Annotation.UCSC.NLMSA.SQL.dm2.mostconserved', msa)\n ucsc_schema = pygr.Data.ManyToManyRelation(dm2, ucsc_db,\n bindAttrs=('element2', ))\n ucsc_schema.__doc__ = \\\n 'SQL Schema for UCSC Most Conserved Elements for dm2'\n pygr.Data.addSchema('TEST.Annotation.UCSC.NLMSA.SQL.dm2.mostconserved',\n ucsc_schema)\n pygr.Data.save()\n pygr.Data.clear_cache()\n\n # QUERY TO EXON AND SPLICES ANNOTATION DATABASE\n dm2 = pygr.Data.getResource('TEST.Seq.Genome.dm2')\n exonmsa = pygr.Data.getResource('TEST.Annotation.NLMSA.SQL.dm2.exons')\n splicemsa = \\\n pygr.Data.getResource('TEST.Annotation.NLMSA.SQL.dm2.splices')\n conservedmsa = \\\n pygr.Data.getResource('TEST.Annotation.UCSC.NLMSA.SQL.dm2.mostconserved')\n exons = pygr.Data.getResource('TEST.Annotation.SQL.dm2.exons')\n splices = pygr.Data.getResource('TEST.Annotation.SQL.dm2.splices')\n mostconserved = \\\n pygr.Data.getResource('TEST.Annotation.UCSC.SQL.dm2.mostconserved')\n\n # OPEN DM2_MULTIZ15WAY NLMSA\n msa = cnestedlist.NLMSA(os.path.join(msaDir, 'dm2_multiz15way'), 'r',\n trypath=[seqDir])\n\n exonAnnotFileName = os.path.join(testInputDir,\n 'Annotation_ConservedElement_Exons%s_dm2.txt'\n % smallSamplePostfix)\n intronAnnotFileName = os.path.join(testInputDir,\n 'Annotation_ConservedElement_Introns%s_dm2.txt'\n % smallSamplePostfix)\n newexonAnnotFileName = os.path.join(self.path, 'new_Exons_dm2.txt')\n newintronAnnotFileName = os.path.join(self.path, 'new_Introns_dm2.txt')\n tmpexonAnnotFileName = self.copyFile(exonAnnotFileName)\n tmpintronAnnotFileName = self.copyFile(intronAnnotFileName)\n\n if smallSampleKey:\n chrList = [smallSampleKey]\n else:\n chrList = dm2.seqLenDict.keys()\n chrList.sort()\n\n outfile = open(newexonAnnotFileName, 'w')\n for chrid in chrList:\n slice = dm2[chrid]\n try:\n ex1 = exonmsa[slice]\n except KeyError:\n continue\n else:\n exlist1 = [(ix.exon_id, ix) for ix in ex1.keys()]\n exlist1.sort()\n for ixx, exon in exlist1:\n saveList = []\n tmp = exon.sequence\n tmpexon = exons[exon.exon_id]\n tmpslice = tmpexon.sequence # FOR REAL EXON COORDINATE\n wlist1 = 'EXON', chrid, tmpexon.exon_id, tmpexon.gene_id, \\\n tmpslice.start, tmpslice.stop\n try:\n out1 = conservedmsa[tmp]\n except KeyError:\n pass\n else:\n elementlist = [(ix.ucsc_id, ix) for ix in out1.keys()]\n elementlist.sort()\n for iyy, element in elementlist:\n if element.stop - element.start < 100:\n continue\n score = int(string.split(element.gene_id, '=')[1])\n if score < 100:\n continue\n tmp2 = element.sequence\n tmpelement = mostconserved[element.ucsc_id]\n # FOR REAL ELEMENT COORDINATE\n tmpslice2 = tmpelement.sequence\n wlist2 = wlist1 + (tmpelement.ucsc_id,\n tmpelement.gene_id,\n tmpslice2.start, tmpslice2.stop)\n slicestart, sliceend = max(tmp.start, tmp2.start),\\\n min(tmp.stop, tmp2.stop)\n tmp1 = msa.seqDict['dm2.' + chrid][slicestart:\n sliceend]\n edges = msa[tmp1].edges()\n for src, dest, e in edges:\n if src.stop - src.start < 100:\n continue\n palign, pident = e.pAligned(), e.pIdentity()\n if palign < 0.8 or pident < 0.8:\n continue\n palign, pident = '%.2f' % palign, \\\n '%.2f' % pident\n wlist3 = wlist2 + ((~msa.seqDict)[src],\n str(src), src.start,\n src.stop,\n (~msa.seqDict)[dest],\n str(dest), dest.start,\n dest.stop, palign, pident)\n saveList.append('\\t'.join(map(str, wlist3))\n + '\\n')\n saveList.sort()\n for saveline in saveList:\n outfile.write(saveline)\n outfile.close()\n md5old = hashlib.md5()\n md5old.update(open(tmpexonAnnotFileName, 'r').read())\n md5new = hashlib.md5()\n md5new.update(open(newexonAnnotFileName, 'r').read())\n assert md5old.digest() == md5new.digest()\n\n outfile = open(newintronAnnotFileName, 'w')\n for chrid in chrList:\n slice = dm2[chrid]\n try:\n sp1 = splicemsa[slice]\n except:\n continue\n else:\n splist1 = [(ix.splice_id, ix) for ix in sp1.keys()]\n splist1.sort()\n for ixx, splice in splist1:\n saveList = []\n tmp = splice.sequence\n tmpsplice = splices[splice.splice_id]\n tmpslice = tmpsplice.sequence # FOR REAL EXON COORDINATE\n wlist1 = 'INTRON', chrid, tmpsplice.splice_id, \\\n tmpsplice.gene_id, tmpslice.start, tmpslice.stop\n try:\n out1 = conservedmsa[tmp]\n except KeyError:\n pass\n else:\n elementlist = [(ix.ucsc_id, ix) for ix in out1.keys()]\n elementlist.sort()\n for iyy, element in elementlist:\n if element.stop - element.start < 100:\n continue\n score = int(string.split(element.gene_id, '=')[1])\n if score < 100:\n continue\n tmp2 = element.sequence\n tmpelement = mostconserved[element.ucsc_id]\n # FOR REAL ELEMENT COORDINATE\n tmpslice2 = tmpelement.sequence\n wlist2 = wlist1 + (tmpelement.ucsc_id,\n tmpelement.gene_id,\n tmpslice2.start, tmpslice2.stop)\n slicestart, sliceend = max(tmp.start, tmp2.start),\\\n min(tmp.stop, tmp2.stop)\n tmp1 = msa.seqDict['dm2.' + chrid][slicestart:\n sliceend]\n edges = msa[tmp1].edges()\n for src, dest, e in edges:\n if src.stop - src.start < 100:\n continue\n palign, pident = e.pAligned(), e.pIdentity()\n if palign < 0.8 or pident < 0.8:\n continue\n palign, pident = '%.2f' % palign, \\\n '%.2f' % pident\n wlist3 = wlist2 + ((~msa.seqDict)[src],\n str(src), src.start,\n src.stop,\n (~msa.seqDict)[dest],\n str(dest), dest.start,\n dest.stop, palign, pident)\n saveList.append('\\t'.join(map(str, wlist3))\n + '\\n')\n saveList.sort()\n for saveline in saveList:\n outfile.write(saveline)\n outfile.close()\n md5old = hashlib.md5()\n md5old.update(open(tmpintronAnnotFileName, 'r').read())\n md5new = hashlib.md5()\n md5new.update(open(newintronAnnotFileName, 'r').read())\n assert md5old.digest() == md5new.digest()", "metadata": "root.Build_Test.test_mysqlannot", "header": "['class', 'Build_Test', '(', 'PygrBuildNLMSAMegabase', ')', ':', '___EOS___']", "index": 404 } ]
[ { "span": "except:", "start_line": 341, "start_column": 12, "end_line": 341, "end_column": 19 }, { "span": "except:", "start_line": 598, "start_column": 12, "end_line": 598, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Build", "\\u", "Test_", "(_", "Pyg", "r", "Build", "NL", "MS", "AM", "ega", "base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "collection", "annot_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Test", " ", "buildi", "ng", " ", "an", " ", "Annot", "ation", "DB", " ", "from", " ", "file", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyg", "r_", "import_", "seq", "db_", ",_", "cn", "este", "dlist", "_", ",_", "sql", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dm", "2_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Seq", ".", "Genome", ".", "dm", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BUILD", " ", "ANNOTAT", "ION", " ", "DATA", "BASE", " ", "FOR", " ", "REF", "SEQ", " ", "EX", "ONS", "_", "\\u\\u\\uNL\\u\\u\\u_", "exon", "\\u", "slices_", "=_", "Collection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "'", "ref", "Gene", "\\u", "exon", "Annot", "\\u", "dm", "2", ".", "cdb", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int", "Keys_", "=_", "True_", ",_", "mode_", "=_", "'", "cr", "'_", ",_", "write", "back_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "db_", "=_", "seq", "db_", "._", "Annot", "ation", "DB_", "(_", "exon", "\\u", "slices_", ",_", "dm", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "Attr", "Dict_", "=_", "dict_", "(_", "id_", "=_", "0_", ",_", "exon", "\\u", "id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orientation_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "\\u", "id_", "=_", "3_", ",_", "start_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ref", "Gene", "\\u", "exon", "Annot", "\\u", "dm", "2", "'_", ")_", ",_", "'", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pairwise", "Mode_", "=_", "True_", ",_", "bidirect", "ional", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lines_", "in_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "test", "Inp", "ut", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ref", "Gene", "\\u", "exon", "Annot", "%", "s", "\\u", "dm", "2", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "small", "Sampl", "e", "Post", "fix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "r", "'_", ")_", "._", "xre", "adl", "ines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "[_", "x_", "for_", "x_", "in_", "lines_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", "]_", "#", " ", "CONVERT", " ", "TO", " ", "LIST", " ", "SO", " ", "MUT", "ABLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "[_", "1_", "]_", "=_", "int_", "(_", "row_", "[_", "1_", "]_", ")_", "#", " ", "CONVERT", " ", "FROM", " ", "STRING", " ", "TO", " ", "INTEGER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "slices_", "[_", "row_", "[_", "1_", "]_", "]_", "=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon_", "=_", "exon", "\\u", "db_", "[_", "row_", "[_", "1_", "]_", "]_", "#", " ", "GET", " ", "THE", " ", "ANNOTAT", "ION", " ", "OBJ", "ECT", " ", "FOR", " ", "THIS", " ", "EX", "ON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "add", "Annotation_", "(_", "exon_", ")_", "#", " ", "SAVE", " ", "IT", " ", "TO", " ", "GEN", "OME", " ", "MAPPING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exon", "\\u", "db_", "._", "clear", "\\u", "cache_", "(_", ")_", "#", " ", "not", " ", "reall", "y", " ", "necessar", "y", ";", " ", "cache", " ", "shou", "ld", " ", "auto", "GC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SHE", "LV", "E", " ", "SHO", "UL", "D", " ", "BE", " ", "EXPL", "ICIT", "LY", " ", "CLOSED", " ", "IN", " ", "ORDE", "R", " ", "TO", " ", "SAVE", " ", "CURREN", "T", " ", "CONTE", "NTS", "_", "\\u\\u\\uNL\\u\\u\\u_", "exon", "\\u", "slices_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "build_", "(_", ")_", "#", " ", "FINAL", "IZE", " ", "GEN", "OME", " ", "ALIGN", "MENT", " ", "INDE", "XE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "db_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "Exo", "n", " ", "Annot", "ation", " ", "Databa", "se", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "dm", "2", ".", "exon", "s", "'_", ",_", "exon", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "NL", "MS", "A", " ", "Exo", "n", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "dm", "2", ".", "exon", "s", "'_", ",_", "msa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "schema_", "=_", "pyg", "r_", "._", "Data_", "._", "Many", "To", "Many", "Relation_", "(_", "dm", "2_", ",_", "exon", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "Attrs_", "=_", "(_", "'", "exon", "1", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "schema_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "Exo", "n", " ", "Schema", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Schema_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "dm", "2", ".", "exon", "s", "'_", ",_", "exon", "\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BUILD", " ", "ANNOTAT", "ION", " ", "DATA", "BASE", " ", "FOR", " ", "REF", "SEQ", " ", "SPL", "ICE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "splice", "\\u", "slices_", "=_", "Collection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "'", "ref", "Gene", "\\u", "splice", "Annot", "\\u", "dm", "2", ".", "cdb", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int", "Keys_", "=_", "True_", ",_", "mode_", "=_", "'", "cr", "'_", ",_", "write", "back_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "db_", "=_", "seq", "db_", "._", "Annot", "ation", "DB_", "(_", "splice", "\\u", "slices_", ",_", "dm", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "Attr", "Dict_", "=_", "dict_", "(_", "id_", "=_", "0_", ",_", "splice", "\\u", "id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orientation_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "\\u", "id_", "=_", "3_", ",_", "start_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ref", "Gene", "\\u", "splice", "Annot", "\\u", "dm", "2", "'_", ")_", ",_", "'", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pairwise", "Mode_", "=_", "True_", ",_", "bidirect", "ional", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lines_", "in_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "test", "Inp", "ut", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ref", "Gene", "\\u", "splice", "Annot", "%", "s", "\\u", "dm", "2", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "small", "Sampl", "e", "Post", "fix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "r", "'_", ")_", "._", "xre", "adl", "ines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "[_", "x_", "for_", "x_", "in_", "lines_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", "]_", "#", " ", "CONVERT", " ", "TO", " ", "LIST", " ", "SO", " ", "MUT", "ABLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "[_", "1_", "]_", "=_", "int_", "(_", "row_", "[_", "1_", "]_", ")_", "#", " ", "CONVERT", " ", "FROM", " ", "STRING", " ", "TO", " ", "INTEGER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "slices_", "[_", "row_", "[_", "1_", "]_", "]_", "=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "GET", " ", "THE", " ", "ANNOTAT", "ION", " ", "OBJ", "ECT", " ", "FOR", " ", "THIS", " ", "EX", "ON_", "\\u\\u\\uNL\\u\\u\\u_", "splice", "_", "=_", "splice", "\\u", "db_", "[_", "row_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "add", "Annotation_", "(_", "splice", "_", ")_", "#", " ", "SAVE", " ", "IT", " ", "TO", " ", "GEN", "OME", " ", "MAPPING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "splice", "\\u", "db_", "._", "clear", "\\u", "cache_", "(_", ")_", "#", " ", "not", " ", "reall", "y", " ", "necessar", "y", ";", " ", "cache", " ", "shou", "ld", " ", "auto", "GC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SHE", "LV", "E", " ", "SHO", "UL", "D", " ", "BE", " ", "EXPL", "ICIT", "LY", " ", "CLOSED", " ", "IN", " ", "ORDE", "R", " ", "TO", " ", "SAVE", " ", "CURREN", "T", " ", "CONTE", "NTS", "_", "\\u\\u\\uNL\\u\\u\\u_", "splice", "\\u", "slices_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "build_", "(_", ")_", "#", " ", "FINAL", "IZE", " ", "GEN", "OME", " ", "ALIGN", "MENT", " ", "INDE", "XE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "db_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "Spl", "ice", " ", "Annot", "ation", " ", "Databa", "se", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "dm", "2", ".", "splice", "s", "'_", ",_", "splice", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "NL", "MS", "A", " ", "Spl", "ice", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "dm", "2", ".", "splice", "s", "'_", ",_", "msa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "schema_", "=_", "pyg", "r_", "._", "Data_", "._", "Many", "To", "Many", "Relation_", "(_", "dm", "2_", ",_", "splice", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "Attrs_", "=_", "(_", "'", "splice", "1", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "schema_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "Spl", "ice", " ", "Schema", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Schema_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "dm", "2", ".", "splice", "s", "'_", ",_", "splice", "\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BUILD", " ", "ANNOTAT", "ION", " ", "DATA", "BASE", " ", "FOR", " ", "MOS", "T", " ", "CONS", "ERVE", "D", " ", "ELEMENT", "S", " ", "FROM", " ", "UCS", "C_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "slices_", "=_", "Collection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "'", "pha", "st", "Cons", "Element", "s1", "5", "way", "\\u", "dm", "2", ".", "cdb", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int", "Keys_", "=_", "True_", ",_", "mode_", "=_", "'", "cr", "'_", ",_", "write", "back_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "db_", "=_", "seq", "db_", "._", "Annot", "ation", "DB_", "(_", "ucs", "c\\u", "slices_", ",_", "dm", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "Attr", "Dict_", "=_", "dict_", "(_", "id_", "=_", "0_", ",_", "ucs", "c\\u", "id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orientation_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "\\u", "id_", "=_", "3_", ",_", "start_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pha", "st", "Cons", "Element", "s1", "5", "way", "\\u", "dm", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "w", "'_", ",_", "pairwise", "Mode_", "=_", "True_", ",_", "bidirect", "ional", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lines_", "in_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "test", "Inp", "ut", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pha", "st", "Cons", "Element", "s1", "5", "way", "%", "s", "\\u", "dm", "2", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "small", "Sampl", "e", "Post", "fix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "r", "'_", ")_", "._", "xre", "adl", "ines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "[_", "x_", "for_", "x_", "in_", "lines_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", "]_", "#", " ", "CONVERT", " ", "TO", " ", "LIST", " ", "SO", " ", "MUT", "ABLE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "[_", "1_", "]_", "=_", "int_", "(_", "row_", "[_", "1_", "]_", ")_", "#", " ", "CONVERT", " ", "FROM", " ", "STRING", " ", "TO", " ", "INTEGER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "slices_", "[_", "row_", "[_", "1_", "]_", "]_", "=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c_", "=_", "ucs", "c\\u", "db_", "[_", "row_", "[_", "1_", "]_", "]_", "#", " ", "GET", " ", "THE", " ", "ANNOTAT", "ION", " ", "OBJ", "ECT", " ", "FOR", " ", "THIS", " ", "EX", "ON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "add", "Annotation_", "(_", "ucs", "c_", ")_", "#", " ", "SAVE", " ", "IT", " ", "TO", " ", "GEN", "OME", " ", "MAPPING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ucs", "c\\u", "db_", "._", "clear", "\\u", "cache_", "(_", ")_", "#", " ", "not", " ", "reall", "y", " ", "necessar", "y", ";", " ", "cache", " ", "shou", "ld", " ", "auto", "GC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SHE", "LV", "E", " ", "SHO", "UL", "D", " ", "BE", " ", "EXPL", "ICIT", "LY", " ", "CLOSED", " ", "IN", " ", "ORDE", "R", " ", "TO", " ", "SAVE", " ", "CURREN", "T", " ", "CONTE", "NTS", "_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "slices_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "build_", "(_", ")_", "#", " ", "FINAL", "IZE", " ", "GEN", "OME", " ", "ALIGN", "MENT", " ", "INDE", "XE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "db_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "Mos", "t", " ", "Conse", "rve", "d", " ", "Element", "s", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "NL", "MS", "A", " ", "for", " ", "Mos", "t", " ", "Conse", "rve", "d", " ", "Element", "s", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "NL", "MS", "A", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "schema_", "=_", "pyg", "r_", "._", "Data_", "._", "Many", "To", "Many", "Relation_", "(_", "dm", "2_", ",_", "ucs", "c\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "Attrs_", "=_", "(_", "'", "element", "1", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "schema_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "Schema", " ", "for", " ", "UCS", "C", " ", "Mos", "t", " ", "Conse", "rve", "d", " ", "Element", "s", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Schema_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "NL", "MS", "A", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "clear", "\\u", "cache_", "(_", ")_", "#", " ", "force", " ", "resource", "s", " ", "to", " ", "relo", "ad", " ", "whe", "n", " ", "requested_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "QUE", "RY", " ", "TO", " ", "EX", "ON", " ", "AND", " ", "SPL", "ICE", "S", " ", "ANNOTAT", "ION", " ", "DATABASE_", "\\u\\u\\uNL\\u\\u\\u_", "dm", "2_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Seq", ".", "Genome", ".", "dm", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "msa", "_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "dm", "2", ".", "exon", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "msa", "_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "dm", "2", ".", "splice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conserv", "edm", "sa_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "NL", "MS", "A", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exons_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "dm", "2", ".", "exon", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "s_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "dm", "2", ".", "splice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "conserv", "ed_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OPEN", " ", "DM", "2", "\\u", "MULTI", "Z", "15", "WAY", " ", "NL", "MS", "A_", "\\u\\u\\uNL\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "msa", "Dir_", ",_", "'", "dm", "2", "\\u", "multi", "z", "15", "way", "'_", ")_", ",_", "'", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "try", "path_", "=_", "[_", "seq", "Dir_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exon", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "test", "Inp", "ut", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Annot", "ation", "\\u", "Conse", "rve", "d", "Element", "\\u", "Exo", "ns", "%", "s", "\\u", "dm", "2", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "small", "Sampl", "e", "Post", "fix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intron", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "test", "Inp", "ut", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Annot", "ation", "\\u", "Conse", "rve", "d", "Element", "\\u", "Intro", "ns", "%", "s", "\\u", "dm", "2", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "small", "Sampl", "e", "Post", "fix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newe", "xon", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "'", "new", "\\u", "Exo", "ns", "\\u", "dm", "2", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newi", "ntr", "on", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "'", "new", "\\u", "Intro", "ns", "\\u", "dm", "2", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "exon", "Annot", "File", "Name_", "=_", "self_", "._", "copy", "File_", "(_", "exon", "Annot", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "intron", "Annot", "File", "Name_", "=_", "self_", "._", "copy", "File_", "(_", "intron", "Annot", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "small", "Sampl", "e", "Key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chr", "List_", "=_", "[_", "small", "Sampl", "e", "Key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chr", "List_", "=_", "dm", "2_", "._", "seq", "Len", "Dict_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chr", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "newe", "xon", "Annot", "File", "Name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chr", "id_", "in_", "chr", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice_", "=_", "dm", "2_", "[_", "chr", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex", "1_", "=_", "exon", "msa", "_", "[_", "slice_", "]_", "\\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 ", " _", "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 ", " _", "ex", "list1_", "=_", "[_", "(_", "ix_", "._", "exon", "\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "ex", "1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ex", "list1_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ix", "x_", ",_", "exon_", "in_", "ex", "list1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "save", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "exon_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "exon_", "=_", "exons_", "[_", "exon_", "._", "exon", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmps", "lice", "_", "=_", "tmp", "exon_", "._", "sequence_", "#", " ", "FOR", " ", "REAL", " ", "EX", "ON", " ", "COORD", "INA", "TE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st1", "_", "=_", "'", "EX", "ON", "'_", ",_", "chr", "id_", ",_", "tmp", "exon_", "._", "exon", "\\u", "id_", ",_", "tmp", "exon_", "._", "gene", "\\u", "id_", ",_", "tmps", "lice", "_", "._", "start_", ",_", "tmps", "lice", "_", "._", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "out1_", "=_", "conserv", "edm", "sa_", "[_", "tmp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "element", "list_", "=_", "[_", "(_", "ix_", "._", "ucs", "c\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "out1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element", "list_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iy", "y_", ",_", "element_", "in_", "element", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "element_", "._", "stop_", "-_", "element_", "._", "start_", "<_", "100_", ":_", "\\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_", "score_", "=_", "int_", "(_", "string_", "._", "split_", "(_", "element_", "._", "gene", "\\u", "id_", ",_", "'='_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "score_", "<_", "100_", ":_", "\\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_", "tmp2_", "=_", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "element_", "=_", "most", "conserv", "ed_", "[_", "element_", "._", "ucs", "c\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FOR", " ", "REAL", " ", "ELEMENT", " ", "COORD", "INA", "TE_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "=_", "tmp", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st2", "_", "=_", "wli", "st1", "_", "+_", "(_", "tmp", "element_", "._", "ucs", "c\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "element_", "._", "gene", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "._", "start_", ",_", "tmps", "lice", "2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "start_", ",_", "slice", "end_", "=_", "max_", "(_", "tmp_", "._", "start_", ",_", "tmp2_", "._", "start_", ")_", ",_", "min_", "(_", "tmp_", "._", "stop_", ",_", "tmp2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp1", "_", "=_", "msa", "_", "._", "seq", "Dict_", "[_", "'", "dm", "2", ".'_", "+_", "chr", "id_", "]_", "[_", "slice", "start_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "msa", "_", "[_", "tmp1", "_", "]_", "._", "edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", ",_", "dest_", ",_", "e_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "src_", "._", "stop_", "-_", "src_", "._", "start_", "<_", "100_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "e_", "._", "p", "Aligned", "_", "(_", ")_", ",_", "e_", "._", "p", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pal", "ign_", "<_", "0.8_", "or_", "pid", "ent_", "<_", "0.8_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "'%", ".2", "f", "'_", "%_", "pal", "ign_", ",_", "'%", ".2", "f", "'_", "%_", "pid", "ent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st", "3_", "=_", "wli", "st2", "_", "+_", "(_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "src_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "src_", ")_", ",_", "src_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "._", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "dest_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "dest_", ")_", ",_", "dest_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "._", "stop_", ",_", "pal", "ign_", ",_", "pid", "ent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "List_", "._", "append_", "(_", "'\\\\", "t", "'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "wli", "st", "3_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "save", "line_", "in_", "save", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "outfile_", "._", "write_", "(_", "save", "line_", ")_", "\\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_", "outfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "._", "update_", "(_", "open_", "(_", "tmp", "exon", "Annot", "File", "Name_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "._", "update_", "(_", "open_", "(_", "newe", "xon", "Annot", "File", "Name_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "md5", "old_", "._", "digest_", "(_", ")_", "==_", "md5", "new_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "newi", "ntr", "on", "Annot", "File", "Name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chr", "id_", "in_", "chr", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice_", "=_", "dm", "2_", "[_", "chr", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp", "1_", "=_", "splice", "msa", "_", "[_", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spl", "ist", "1_", "=_", "[_", "(_", "ix_", "._", "splice", "\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "sp", "1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spl", "ist", "1_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ix", "x_", ",_", "splice", "_", "in_", "spl", "ist", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "save", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "splice", "_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmps", "pli", "ce_", "=_", "splice", "s_", "[_", "splice", "_", "._", "splice", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmps", "lice", "_", "=_", "tmps", "pli", "ce_", "._", "sequence_", "#", " ", "FOR", " ", "REAL", " ", "EX", "ON", " ", "COORD", "INA", "TE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st1", "_", "=_", "'", "INT", "RON", "'_", ",_", "chr", "id_", ",_", "tmps", "pli", "ce_", "._", "splice", "\\u", "id_", ",_", "tmps", "pli", "ce_", "._", "gene", "\\u", "id_", ",_", "tmps", "lice", "_", "._", "start_", ",_", "tmps", "lice", "_", "._", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "out1_", "=_", "conserv", "edm", "sa_", "[_", "tmp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "element", "list_", "=_", "[_", "(_", "ix_", "._", "ucs", "c\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "out1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element", "list_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iy", "y_", ",_", "element_", "in_", "element", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "element_", "._", "stop_", "-_", "element_", "._", "start_", "<_", "100_", ":_", "\\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_", "score_", "=_", "int_", "(_", "string_", "._", "split_", "(_", "element_", "._", "gene", "\\u", "id_", ",_", "'='_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "score_", "<_", "100_", ":_", "\\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_", "tmp2_", "=_", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "element_", "=_", "most", "conserv", "ed_", "[_", "element_", "._", "ucs", "c\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FOR", " ", "REAL", " ", "ELEMENT", " ", "COORD", "INA", "TE_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "=_", "tmp", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st2", "_", "=_", "wli", "st1", "_", "+_", "(_", "tmp", "element_", "._", "ucs", "c\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "element_", "._", "gene", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "._", "start_", ",_", "tmps", "lice", "2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "start_", ",_", "slice", "end_", "=_", "max_", "(_", "tmp_", "._", "start_", ",_", "tmp2_", "._", "start_", ")_", ",_", "min_", "(_", "tmp_", "._", "stop_", ",_", "tmp2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp1", "_", "=_", "msa", "_", "._", "seq", "Dict_", "[_", "'", "dm", "2", ".'_", "+_", "chr", "id_", "]_", "[_", "slice", "start_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "msa", "_", "[_", "tmp1", "_", "]_", "._", "edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", ",_", "dest_", ",_", "e_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "src_", "._", "stop_", "-_", "src_", "._", "start_", "<_", "100_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "e_", "._", "p", "Aligned", "_", "(_", ")_", ",_", "e_", "._", "p", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pal", "ign_", "<_", "0.8_", "or_", "pid", "ent_", "<_", "0.8_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "'%", ".2", "f", "'_", "%_", "pal", "ign_", ",_", "'%", ".2", "f", "'_", "%_", "pid", "ent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st", "3_", "=_", "wli", "st2", "_", "+_", "(_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "src_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "src_", ")_", ",_", "src_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "._", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "dest_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "dest_", ")_", ",_", "dest_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "._", "stop_", ",_", "pal", "ign_", ",_", "pid", "ent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "List_", "._", "append_", "(_", "'\\\\", "t", "'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "wli", "st", "3_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "save", "line_", "in_", "save", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "outfile_", "._", "write_", "(_", "save", "line_", ")_", "\\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_", "outfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "._", "update_", "(_", "open_", "(_", "tmp", "intron", "Annot", "File", "Name_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "._", "update_", "(_", "open_", "(_", "newi", "ntr", "on", "Annot", "File", "Name_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "md5", "old_", "._", "digest_", "(_", ")_", "==_", "md5", "new_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Build", "\\u", "Test_", "(_", "Pyg", "r", "Build", "NL", "MS", "AM", "ega", "base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mysql", "annot_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'", "Test", " ", "buildi", "ng", " ", "an", " ", "Annot", "ation", "DB", " ", "from", " ", "My", "SQL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyg", "r_", "import_", "seq", "db_", ",_", "cn", "este", "dlist", "_", ",_", "sql", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dm", "2_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Seq", ".", "Genome", ".", "dm", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BUILD", " ", "ANNOTAT", "ION", " ", "DATA", "BASE", " ", "FOR", " ", "REF", "SEQ", " ", "EX", "ONS", ":", " ", "MYSQL", " ", "VERSION_", "\\u\\u\\uNL\\u\\u\\u_", "exon", "\\u", "slices_", "=_", "sql", "graph_", "._", "SQL", "Table", "Cluster", "ed_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ".", "pyg", "r", "\\u", "ref", "Gene", "\\u", "exon", "Annot", "%", "s", "\\u", "dm", "2", "'_", "%_", "(_", "test", "Inp", "ut", "DB_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "small", "Sampl", "e", "Post", "fix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "Key_", "=_", "'", "chromo", "some", "'_", ",_", "max", "Cache_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "db_", "=_", "seq", "db_", "._", "Annot", "ation", "DB_", "(_", "exon", "\\u", "slices_", ",_", "dm", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "Attr", "Dict_", "=_", "dict_", "(_", "id_", "=_", "'", "chromo", "some", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "\\u", "id_", "=_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exon", "\\u", "id_", "=_", "'", "exon", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ref", "Gene", "\\u", "exon", "Annot", "\\u", "SQL", "\\u", "dm", "2", "'_", ")_", ",_", "'", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pairwise", "Mode_", "=_", "True_", ",_", "bidirect", "ional", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", "in_", "exon", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msa", "_", "._", "add", "Annotation_", "(_", "exon", "\\u", "db_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exon", "\\u", "db_", "._", "clear", "\\u", "cache_", "(_", ")_", "#", " ", "not", " ", "reall", "y", " ", "necessar", "y", ";", " ", "cache", " ", "shou", "ld", " ", "auto", "GC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "slices_", "._", "clear", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "db_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "Exo", "n", " ", "Annot", "ation", " ", "Databa", "se", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "SQL", ".", "dm", "2", ".", "exon", "s", "'_", ",_", "exon", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "NL", "MS", "A", " ", "Exo", "n", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "exon", "s", "'_", ",_", "msa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "schema_", "=_", "pyg", "r_", "._", "Data_", "._", "Many", "To", "Many", "Relation_", "(_", "dm", "2_", ",_", "exon", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "Attrs_", "=_", "(_", "'", "exon", "2", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "\\u", "schema_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "Exo", "n", " ", "Schema", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Schema_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "exon", "s", "'_", ",_", "exon", "\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BUILD", " ", "ANNOTAT", "ION", " ", "DATA", "BASE", " ", "FOR", " ", "REF", "SEQ", " ", "SPL", "ICE", "S", ":", " ", "MYSQL", " ", "VERSION_", "\\u\\u\\uNL\\u\\u\\u_", "splice", "\\u", "slices_", "=_", "sql", "graph_", "._", "SQL", "Table", "Cluster", "ed_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ".", "pyg", "r", "\\u", "ref", "Gene", "\\u", "splice", "Annot", "%", "s", "\\u", "dm", "2", "'_", "%_", "(_", "test", "Inp", "ut", "DB_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "small", "Sampl", "e", "Post", "fix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "Key_", "=_", "'", "chromo", "some", "'_", ",_", "max", "Cache_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "db_", "=_", "seq", "db_", "._", "Annot", "ation", "DB_", "(_", "splice", "\\u", "slices_", ",_", "dm", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "Attr", "Dict_", "=_", "dict_", "(_", "id_", "=_", "'", "chromo", "some", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "\\u", "id_", "=_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "splice", "\\u", "id_", "=_", "'", "splice", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ref", "Gene", "\\u", "splice", "Annot", "\\u", "SQL", "\\u", "dm", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "w", "'_", ",_", "pairwise", "Mode_", "=_", "True_", ",_", "bidirect", "ional", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", "in_", "splice", "\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msa", "_", "._", "add", "Annotation_", "(_", "splice", "\\u", "db_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "splice", "\\u", "db_", "._", "clear", "\\u", "cache_", "(_", ")_", "#", " ", "not", " ", "reall", "y", " ", "necessar", "y", ";", " ", "cache", " ", "shou", "ld", " ", "auto", "GC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "slices_", "._", "clear", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "db_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "Spl", "ice", " ", "Annot", "ation", " ", "Databa", "se", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "SQL", ".", "dm", "2", ".", "splice", "s", "'_", ",_", "splice", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "NL", "MS", "A", " ", "Spl", "ice", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "splice", "s", "'_", ",_", "msa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "schema_", "=_", "pyg", "r_", "._", "Data_", "._", "Many", "To", "Many", "Relation_", "(_", "dm", "2_", ",_", "splice", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "Attrs_", "=_", "(_", "'", "splice", "2", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "\\u", "schema_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "Spl", "ice", " ", "Schema", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Schema_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "splice", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "splice", "\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BUILD", " ", "ANNOTAT", "ION", " ", "DATA", "BASE", " ", "FOR", " ", "MOS", "T", " ", "CONS", "ERVE", "D", " ", "ELEMENT", "S", " ", "FROM", " ", "UCS", "C", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MYSQL", " ", "VERSION_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "slices_", "=_", "sql", "graph_", "._", "SQL", "Table", "Cluster", "ed_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ".", "pyg", "r", "\\u", "pha", "st", "Cons", "Element", "s1", "5", "way", "%", "s", "\\u", "dm", "2", "'_", "%_", "(_", "test", "Inp", "ut", "DB_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "small", "Sampl", "e", "Post", "fix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "Key_", "=_", "'", "chromo", "some", "'_", ",_", "max", "Cache_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "db_", "=_", "seq", "db_", "._", "Annot", "ation", "DB_", "(_", "ucs", "c\\u", "slices_", ",_", "dm", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "Attr", "Dict_", "=_", "dict_", "(_", "id_", "=_", "'", "chromo", "some", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gene", "\\u", "id_", "=_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "id_", "=_", "'", "ucs", "c\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pha", "st", "Cons", "Element", "s1", "5", "way", "\\u", "SQL", "\\u", "dm", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "w", "'_", ",_", "pairwise", "Mode_", "=_", "True_", ",_", "bidirect", "ional", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "id_", "in_", "ucs", "c\\u", "db_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msa", "_", "._", "add", "Annotation_", "(_", "ucs", "c\\u", "db_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ucs", "c\\u", "db_", "._", "clear", "\\u", "cache_", "(_", ")_", "#", " ", "not", " ", "reall", "y", " ", "necessar", "y", ";", " ", "cache", " ", "shou", "ld", " ", "auto", "GC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "slices_", "._", "clear", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "db_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "Mos", "t", " ", "Conse", "rve", "d", " ", "Element", "s", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "SQL", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msa", "_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "NL", "MS", "A", " ", "for", " ", "Mos", "t", " ", "Conse", "rve", "d", " ", "Element", "s", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Resource_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ",_", "msa", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "schema_", "=_", "pyg", "r_", "._", "Data_", "._", "Many", "To", "Many", "Relation_", "(_", "dm", "2_", ",_", "ucs", "c\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "Attrs_", "=_", "(_", "'", "element", "2", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ucs", "c\\u", "schema_", "._", "\\u\\u", "doc\\u\\u_", "=_", "'", "SQL", " ", "Schema", " ", "for", " ", "UCS", "C", " ", "Mos", "t", " ", "Conse", "rve", "d", " ", "Element", "s", " ", "for", " ", "dm", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "add", "Schema_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ucs", "c\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyg", "r_", "._", "Data_", "._", "clear", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "QUE", "RY", " ", "TO", " ", "EX", "ON", " ", "AND", " ", "SPL", "ICE", "S", " ", "ANNOTAT", "ION", " ", "DATABASE_", "\\u\\u\\uNL\\u\\u\\u_", "dm", "2_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Seq", ".", "Genome", ".", "dm", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exon", "msa", "_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "exon", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "msa", "_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "splice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conserv", "edm", "sa_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "NL", "MS", "A", ".", "SQL", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exons_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "SQL", ".", "dm", "2", ".", "exon", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "splice", "s_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "SQL", ".", "dm", "2", ".", "splice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "most", "conserv", "ed_", "=_", "pyg", "r_", "._", "Data_", "._", "get", "Resource_", "(_", "'", "TEST", ".", "Annot", "ation", ".", "UCS", "C", ".", "SQL", ".", "dm", "2", ".", "most", "conserv", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OPEN", " ", "DM", "2", "\\u", "MULTI", "Z", "15", "WAY", " ", "NL", "MS", "A_", "\\u\\u\\uNL\\u\\u\\u_", "msa", "_", "=_", "cn", "este", "dlist", "_", "._", "NL", "MS", "A_", "(_", "os_", "._", "path_", "._", "join_", "(_", "msa", "Dir_", ",_", "'", "dm", "2", "\\u", "multi", "z", "15", "way", "'_", ")_", ",_", "'", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "try", "path_", "=_", "[_", "seq", "Dir_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exon", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "test", "Inp", "ut", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Annot", "ation", "\\u", "Conse", "rve", "d", "Element", "\\u", "Exo", "ns", "%", "s", "\\u", "dm", "2", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "small", "Sampl", "e", "Post", "fix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intron", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "test", "Inp", "ut", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Annot", "ation", "\\u", "Conse", "rve", "d", "Element", "\\u", "Intro", "ns", "%", "s", "\\u", "dm", "2", ".", "txt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "small", "Sampl", "e", "Post", "fix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newe", "xon", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "'", "new", "\\u", "Exo", "ns", "\\u", "dm", "2", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newi", "ntr", "on", "Annot", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "'", "new", "\\u", "Intro", "ns", "\\u", "dm", "2", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "exon", "Annot", "File", "Name_", "=_", "self_", "._", "copy", "File_", "(_", "exon", "Annot", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "intron", "Annot", "File", "Name_", "=_", "self_", "._", "copy", "File_", "(_", "intron", "Annot", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "small", "Sampl", "e", "Key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chr", "List_", "=_", "[_", "small", "Sampl", "e", "Key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chr", "List_", "=_", "dm", "2_", "._", "seq", "Len", "Dict_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chr", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "newe", "xon", "Annot", "File", "Name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chr", "id_", "in_", "chr", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice_", "=_", "dm", "2_", "[_", "chr", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex", "1_", "=_", "exon", "msa", "_", "[_", "slice_", "]_", "\\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 ", " _", "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 ", " _", "ex", "list1_", "=_", "[_", "(_", "ix_", "._", "exon", "\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "ex", "1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ex", "list1_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ix", "x_", ",_", "exon_", "in_", "ex", "list1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "save", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "exon_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "exon_", "=_", "exons_", "[_", "exon_", "._", "exon", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmps", "lice", "_", "=_", "tmp", "exon_", "._", "sequence_", "#", " ", "FOR", " ", "REAL", " ", "EX", "ON", " ", "COORD", "INA", "TE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st1", "_", "=_", "'", "EX", "ON", "'_", ",_", "chr", "id_", ",_", "tmp", "exon_", "._", "exon", "\\u", "id_", ",_", "tmp", "exon_", "._", "gene", "\\u", "id_", ",_", "tmps", "lice", "_", "._", "start_", ",_", "tmps", "lice", "_", "._", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "out1_", "=_", "conserv", "edm", "sa_", "[_", "tmp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "element", "list_", "=_", "[_", "(_", "ix_", "._", "ucs", "c\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "out1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element", "list_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iy", "y_", ",_", "element_", "in_", "element", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "element_", "._", "stop_", "-_", "element_", "._", "start_", "<_", "100_", ":_", "\\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_", "score_", "=_", "int_", "(_", "string_", "._", "split_", "(_", "element_", "._", "gene", "\\u", "id_", ",_", "'='_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "score_", "<_", "100_", ":_", "\\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_", "tmp2_", "=_", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "element_", "=_", "most", "conserv", "ed_", "[_", "element_", "._", "ucs", "c\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FOR", " ", "REAL", " ", "ELEMENT", " ", "COORD", "INA", "TE_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "=_", "tmp", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st2", "_", "=_", "wli", "st1", "_", "+_", "(_", "tmp", "element_", "._", "ucs", "c\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "element_", "._", "gene", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "._", "start_", ",_", "tmps", "lice", "2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "start_", ",_", "slice", "end_", "=_", "max_", "(_", "tmp_", "._", "start_", ",_", "tmp2_", "._", "start_", ")_", ",_", "min_", "(_", "tmp_", "._", "stop_", ",_", "tmp2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp1", "_", "=_", "msa", "_", "._", "seq", "Dict_", "[_", "'", "dm", "2", ".'_", "+_", "chr", "id_", "]_", "[_", "slice", "start_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "msa", "_", "[_", "tmp1", "_", "]_", "._", "edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", ",_", "dest_", ",_", "e_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "src_", "._", "stop_", "-_", "src_", "._", "start_", "<_", "100_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "e_", "._", "p", "Aligned", "_", "(_", ")_", ",_", "e_", "._", "p", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pal", "ign_", "<_", "0.8_", "or_", "pid", "ent_", "<_", "0.8_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "'%", ".2", "f", "'_", "%_", "pal", "ign_", ",_", "'%", ".2", "f", "'_", "%_", "pid", "ent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st", "3_", "=_", "wli", "st2", "_", "+_", "(_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "src_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "src_", ")_", ",_", "src_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "._", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "dest_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "dest_", ")_", ",_", "dest_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "._", "stop_", ",_", "pal", "ign_", ",_", "pid", "ent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "List_", "._", "append_", "(_", "'\\\\", "t", "'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "wli", "st", "3_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "save", "line_", "in_", "save", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "outfile_", "._", "write_", "(_", "save", "line_", ")_", "\\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_", "outfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "._", "update_", "(_", "open_", "(_", "tmp", "exon", "Annot", "File", "Name_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "._", "update_", "(_", "open_", "(_", "newe", "xon", "Annot", "File", "Name_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "md5", "old_", "._", "digest_", "(_", ")_", "==_", "md5", "new_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "newi", "ntr", "on", "Annot", "File", "Name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chr", "id_", "in_", "chr", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice_", "=_", "dm", "2_", "[_", "chr", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp", "1_", "=_", "splice", "msa", "_", "[_", "slice_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spl", "ist", "1_", "=_", "[_", "(_", "ix_", "._", "splice", "\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "sp", "1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spl", "ist", "1_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ix", "x_", ",_", "splice", "_", "in_", "spl", "ist", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "save", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "splice", "_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmps", "pli", "ce_", "=_", "splice", "s_", "[_", "splice", "_", "._", "splice", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmps", "lice", "_", "=_", "tmps", "pli", "ce_", "._", "sequence_", "#", " ", "FOR", " ", "REAL", " ", "EX", "ON", " ", "COORD", "INA", "TE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st1", "_", "=_", "'", "INT", "RON", "'_", ",_", "chr", "id_", ",_", "tmps", "pli", "ce_", "._", "splice", "\\u", "id_", ",_", "tmps", "pli", "ce_", "._", "gene", "\\u", "id_", ",_", "tmps", "lice", "_", "._", "start_", ",_", "tmps", "lice", "_", "._", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "out1_", "=_", "conserv", "edm", "sa_", "[_", "tmp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "element", "list_", "=_", "[_", "(_", "ix_", "._", "ucs", "c\\u", "id_", ",_", "ix_", ")_", "for_", "ix_", "in_", "out1_", "._", "keys_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element", "list_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "iy", "y_", ",_", "element_", "in_", "element", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "element_", "._", "stop_", "-_", "element_", "._", "start_", "<_", "100_", ":_", "\\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_", "score_", "=_", "int_", "(_", "string_", "._", "split_", "(_", "element_", "._", "gene", "\\u", "id_", ",_", "'='_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "score_", "<_", "100_", ":_", "\\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_", "tmp2_", "=_", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "element_", "=_", "most", "conserv", "ed_", "[_", "element_", "._", "ucs", "c\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FOR", " ", "REAL", " ", "ELEMENT", " ", "COORD", "INA", "TE_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "=_", "tmp", "element_", "._", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st2", "_", "=_", "wli", "st1", "_", "+_", "(_", "tmp", "element_", "._", "ucs", "c\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "element_", "._", "gene", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmps", "lice", "2_", "._", "start_", ",_", "tmps", "lice", "2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "start_", ",_", "slice", "end_", "=_", "max_", "(_", "tmp_", "._", "start_", ",_", "tmp2_", "._", "start_", ")_", ",_", "min_", "(_", "tmp_", "._", "stop_", ",_", "tmp2_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp1", "_", "=_", "msa", "_", "._", "seq", "Dict_", "[_", "'", "dm", "2", ".'_", "+_", "chr", "id_", "]_", "[_", "slice", "start_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "slice", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "msa", "_", "[_", "tmp1", "_", "]_", "._", "edges_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", ",_", "dest_", ",_", "e_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "src_", "._", "stop_", "-_", "src_", "._", "start_", "<_", "100_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "e_", "._", "p", "Aligned", "_", "(_", ")_", ",_", "e_", "._", "p", "Identity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pal", "ign_", "<_", "0.8_", "or_", "pid", "ent_", "<_", "0.8_", ":_", "\\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_", "pal", "ign_", ",_", "pid", "ent_", "=_", "'%", ".2", "f", "'_", "%_", "pal", "ign_", ",_", "'%", ".2", "f", "'_", "%_", "pid", "ent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wli", "st", "3_", "=_", "wli", "st2", "_", "+_", "(_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "src_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "src_", ")_", ",_", "src_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "._", "stop_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "~_", "msa", "_", "._", "seq", "Dict_", ")_", "[_", "dest_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "dest_", ")_", ",_", "dest_", "._", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "._", "stop_", ",_", "pal", "ign_", ",_", "pid", "ent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "List_", "._", "append_", "(_", "'\\\\", "t", "'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "wli", "st", "3_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "List_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "save", "line_", "in_", "save", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "outfile_", "._", "write_", "(_", "save", "line_", ")_", "\\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_", "outfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "old_", "._", "update_", "(_", "open_", "(_", "tmp", "intron", "Annot", "File", "Name_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5", "new_", "._", "update_", "(_", "open_", "(_", "newi", "ntr", "on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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
sahana/eden/modules/unit_tests/s3/s3xml.py
[ { "content": " def testIncludeMaxBounds(self):\n\n xml = current.xml\n\n tree = xml.tree(None, maxbounds=True)\n root = tree.getroot()\n\n attrib = root.attrib\n self.assertEqual(root.tag, xml.TAG.root)\n self.assertEqual(len(attrib), 5)\n self.assertEqual(attrib[\"success\"], \"false\")\n self.assertTrue(\"latmin\" in attrib)\n self.assertTrue(\"latmax\" in attrib)\n self.assertTrue(\"lonmin\" in attrib)\n self.assertTrue(\"lonmax\" in attrib)", "metadata": "root.TreeBuilderTests.testIncludeMaxBounds", "header": "['class', 'TreeBuilderTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '___NL___', '# -------------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 37 }, { "content": " def testSelectedFields(self):\n\n include, exclude = self.stylesheet.get_fields(\"org_facility\")\n\n self.assertTrue(\"location_id\" in include)\n self.assertTrue(\"site_id\" in include)\n self.assertEqual(len(include), 2)\n\n self.assertEqual(exclude, [])", "metadata": "root.XMLFormatTests.testSelectedFields", "header": "['class', 'XMLFormatTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 219 }, { "content": " def testShowUIDs(self):\n \"\"\" Test options lookup with foreign key constraint including UIDs \"\"\"\n\n assertEqual = self.assertEqual\n assertTrue = self.assertTrue\n\n table = current.db.fotest_table\n\n xml = current.xml\n fo = xml.get_field_options(table, \"lookup\", show_uids=True)\n\n assertTrue(isinstance(fo, etree._Element))\n assertEqual(fo.tag, \"select\")\n\n ATTRIBUTE = xml.ATTRIBUTE\n VALUE = ATTRIBUTE.value\n UID = xml.UID\n options = self.records\n\n has_empty = False\n self.assertEqual(len(fo), len(options) + 1)\n for opt in fo:\n assertEqual(opt.tag, \"option\")\n\n attr = opt.attrib\n assertTrue(VALUE in attr)\n\n value = attr[VALUE]\n if value == \"\":\n has_empty = True\n self.assertFalse(UID in attr)\n assertEqual(opt.text, \"\")\n continue\n else:\n value = int(value)\n\n assertTrue(UID in attr)\n assertEqual(attr[UID], options[value][\"uuid\"])\n assertTrue(value in options)\n assertEqual(opt.text, options[value][\"name\"])\n\n assertTrue(has_empty, msg=\"Empty-option missing\")", "metadata": "root.GetFieldOptionsTests.testShowUIDs", "header": "['class', 'GetFieldOptionsTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 444 }, { "content": " def testWithHierarchyInfo(self):\n \"\"\" Test options lookup with foreign key constraint with hierarchy info \"\"\"\n\n assertEqual = self.assertEqual\n assertTrue = self.assertTrue\n\n db = current.db\n s3db = current.s3db\n table = db.fotest_lookup_table\n\n # Configure parent-field\n represent = S3Represent(lookup=\"fotest_lookup_table\")\n table.parent.requires = IS_EMPTY_OR(\n IS_ONE_OF(db,\n \"fotest_lookup_table.id\",\n represent,\n ))\n table.parent.requires = represent\n\n # Configure hierarchy\n s3db.configure(\"fotest_lookup_table\", hierarchy=\"parent\")\n S3Hierarchy.dirty(\"fotest_lookup_table\")\n\n # Insert a child node\n options = dict(self.records)\n child_node = {\"name\": \"option3\",\n \"uuid\": \"OPTION3\",\n \"parent\": options.keys()[0],\n }\n child_id = table.insert(**child_node)\n options[child_id] = child_node\n\n xml = current.xml\n table = db.fotest_table\n fo = xml.get_field_options(table, \"lookup\", show_uids=True, hierarchy=True)\n\n assertTrue(isinstance(fo, etree._Element))\n assertEqual(fo.tag, \"select\")\n\n ATTRIBUTE = xml.ATTRIBUTE\n VALUE = ATTRIBUTE.value\n PARENT = ATTRIBUTE.parent\n UID = xml.UID\n\n has_empty = False\n self.assertEqual(len(fo), len(options) + 1)\n for opt in fo:\n assertEqual(opt.tag, \"option\")\n\n attr = opt.attrib\n assertTrue(VALUE in attr)\n\n value = attr[VALUE]\n if value == \"\":\n has_empty = True\n self.assertFalse(UID in attr)\n assertEqual(opt.text, \"\")\n continue\n else:\n value = int(value)\n\n assertTrue(UID in attr)\n assertEqual(attr[UID], options[value][\"uuid\"])\n assertTrue(value in options)\n assertEqual(opt.text, options[value][\"name\"])\n\n if \"parent\" in options[value] and options[value][\"parent\"]:\n assertTrue(PARENT in attr)\n assertEqual(attr[PARENT], str(options[value][\"parent\"]))\n\n assertTrue(has_empty, msg=\"Empty-option missing\")", "metadata": "root.GetFieldOptionsTests.testWithHierarchyInfo", "header": "['class', 'GetFieldOptionsTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 488 }, { "content": " def testExportOptionsXML(self):\n \"\"\" Test Export Options (all options, XML) \"\"\"\n\n assertEqual = self.assertEqual\n assertTrue = self.assertTrue\n\n options = dict(self.records)\n\n # Request options\n resource = current.s3db.resource(\"fotest_table\")\n result = resource.export_options(fields=[\"lookup\"])\n fo = etree.XML(result)\n\n # Inspect result\n xml = current.xml\n ATTRIBUTE = xml.ATTRIBUTE\n VALUE = ATTRIBUTE.value\n UID = xml.UID\n\n has_empty = False\n self.assertEqual(len(fo), len(options) + 1)\n for opt in fo:\n assertEqual(opt.tag, \"option\")\n attr = opt.attrib\n assertTrue(VALUE in attr)\n value = attr[VALUE]\n if value == \"\":\n has_empty = True\n self.assertFalse(UID in attr)\n assertEqual(opt.text, None)\n continue\n else:\n value = int(value)\n assertTrue(value in options)\n assertEqual(opt.text, options[value][\"name\"])\n\n assertTrue(has_empty, msg=\"Empty-option missing\")", "metadata": "root.GetFieldOptionsTests.testExportOptionsXML", "header": "['class', 'GetFieldOptionsTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 561 }, { "content": " def testExportOptionsXMLHierarchy(self):\n \"\"\" Test Export Options (all options, XML+hierarchy) \"\"\"\n\n assertEqual = self.assertEqual\n assertTrue = self.assertTrue\n\n # Configure parent-field\n db = current.db\n table = db.fotest_lookup_table\n represent = S3Represent(lookup=\"fotest_lookup_table\")\n table.parent.requires = IS_EMPTY_OR(\n IS_ONE_OF(db,\n \"fotest_lookup_table.id\",\n represent,\n ))\n table.parent.requires = represent\n\n # Configure hierarchy\n s3db = current.s3db\n s3db.configure(\"fotest_lookup_table\", hierarchy=\"parent\")\n S3Hierarchy.dirty(\"fotest_lookup_table\")\n\n # Insert a child node\n options = dict(self.records)\n child_node = {\"name\": \"option3\",\n \"uuid\": \"OPTION3\",\n \"parent\": options.keys()[0],\n }\n child_id = table.insert(**child_node)\n options[child_id] = child_node\n\n # Request options\n resource = s3db.resource(\"fotest_table\")\n result = resource.export_options(fields=[\"lookup\"], hierarchy=True)\n fo = etree.XML(result)\n\n # Inspect result\n xml = current.xml\n ATTRIBUTE = xml.ATTRIBUTE\n VALUE = ATTRIBUTE.value\n PARENT = ATTRIBUTE.parent\n UID = xml.UID\n\n has_empty = False\n self.assertEqual(len(fo), len(options) + 1)\n for opt in fo:\n assertEqual(opt.tag, \"option\")\n\n attr = opt.attrib\n assertTrue(VALUE in attr)\n\n value = attr[VALUE]\n if value == \"\":\n has_empty = True\n self.assertFalse(UID in attr)\n assertEqual(opt.text, None)\n continue\n else:\n value = int(value)\n\n assertTrue(value in options)\n assertEqual(opt.text, options[value][\"name\"])\n\n if \"parent\" in options[value] and options[value][\"parent\"]:\n assertTrue(PARENT in attr)\n assertEqual(attr[PARENT], str(options[value][\"parent\"]))\n\n assertTrue(has_empty, msg=\"Empty-option missing\")", "metadata": "root.GetFieldOptionsTests.testExportOptionsXMLHierarchy", "header": "['class', 'GetFieldOptionsTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 600 }, { "content": " def testExportOptionsAllOptsJSON(self):\n \"\"\" Test export options, JSON, all options \"\"\"\n\n assertEqual = self.assertEqual\n assertTrue = self.assertTrue\n\n options = dict(self.records)\n\n # Request options\n resource = current.s3db.resource(\"fotest_table\")\n result = resource.export_options(fields=[\"lookup\"],\n as_json=True)\n fo = json.loads(result)\n\n # Inspect result\n has_empty = False\n assertTrue(isinstance(fo, dict))\n assertTrue(\"option\" in fo)\n assertTrue(isinstance(fo[\"option\"], list))\n assertEqual(len(fo[\"option\"]), len(options) + 1)\n for opt in fo[\"option\"]:\n value = opt[\"@value\"]\n if value == \"\":\n has_empty = True\n self.assertFalse(\"$\" in opt)\n continue\n else:\n value = int(value)\n assertTrue(value in options)\n assertEqual(opt[\"$\"], options[value][\"name\"])\n assertTrue(has_empty, msg=\"Empty-option missing\")", "metadata": "root.GetFieldOptionsTests.testExportOptionsAllOptsJSON", "header": "['class', 'GetFieldOptionsTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 670 }, { "content": " def testExportOptionsAllOptsJSONHierarchy(self):\n \"\"\" Test export options, JSON, all options+hierarchy \"\"\"\n\n assertEqual = self.assertEqual\n assertTrue = self.assertTrue\n\n # Configure parent-field\n db = current.db\n table = db.fotest_lookup_table\n represent = S3Represent(lookup=\"fotest_lookup_table\")\n table.parent.requires = IS_EMPTY_OR(\n IS_ONE_OF(db,\n \"fotest_lookup_table.id\",\n represent,\n ))\n table.parent.requires = represent\n\n # Configure hierarchy\n s3db = current.s3db\n s3db.configure(\"fotest_lookup_table\", hierarchy=\"parent\")\n S3Hierarchy.dirty(\"fotest_lookup_table\")\n\n # Insert a child node\n options = dict(self.records)\n child_node = {\"name\": \"option3\",\n \"uuid\": \"OPTION3\",\n \"parent\": options.keys()[0],\n }\n child_id = table.insert(**child_node)\n options[child_id] = child_node\n\n # Request options\n resource = s3db.resource(\"fotest_table\")\n result = resource.export_options(fields=[\"lookup\"],\n hierarchy=True,\n as_json=True)\n fo = json.loads(result)\n\n # Inspect result\n has_empty = False\n assertTrue(isinstance(fo, dict))\n assertTrue(\"option\" in fo)\n assertTrue(isinstance(fo[\"option\"], list))\n assertEqual(len(fo[\"option\"]), len(options) + 1)\n for opt in fo[\"option\"]:\n value = opt[\"@value\"]\n if value == \"\":\n has_empty = True\n self.assertFalse(\"$\" in opt)\n continue\n else:\n value = int(value)\n assertTrue(value in options)\n assertEqual(opt[\"$\"], options[value][\"name\"])\n if \"parent\" in options[value] and options[value][\"parent\"]:\n assertTrue(\"@parent\" in opt)\n assertEqual(opt[\"@parent\"], str(options[value][\"parent\"]))\n\n assertTrue(has_empty, msg=\"Empty-option missing\")", "metadata": "root.GetFieldOptionsTests.testExportOptionsAllOptsJSONHierarchy", "header": "['class', 'GetFieldOptionsTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 703 } ]
[ { "span": "self.assertTrue(\"latmin\" in attrib)", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 43 }, { "span": "self.assertTrue(\"latmax\" in attrib)", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 43 }, { "span": "self.assertTrue(\"lonmin\" in attrib)", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 43 }, { "span": "self.assertTrue(\"lonmax\" in attrib)", "start_line": 51, "start_column": 8, "end_line": 51, "end_column": 43 }, { "span": "self.assertTrue(\"location_id\" in include)", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 49 }, { "span": "self.assertTrue(\"site_id\" in include)", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 45 }, { "span": "self.assertFalse(UID in attr)", "start_line": 474, "start_column": 16, "end_line": 474, "end_column": 45 }, { "span": "self.assertFalse(UID in attr)", "start_line": 543, "start_column": 16, "end_line": 543, "end_column": 45 }, { "span": "self.assertFalse(UID in attr)", "start_line": 589, "start_column": 16, "end_line": 589, "end_column": 45 }, { "span": "self.assertFalse(UID in attr)", "start_line": 654, "start_column": 16, "end_line": 654, "end_column": 45 }, { "span": "self.assertFalse(\"$\" in opt)", "start_line": 694, "start_column": 16, "end_line": 694, "end_column": 44 }, { "span": "self.assertFalse(\"$\" in opt)", "start_line": 751, "start_column": 16, "end_line": 751, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Tree", "Build", "er", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Include", "Max", "Bounds_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml_", "=_", "current_", "._", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tree_", "=_", "xml_", "._", "tree_", "(_", "None_", ",_", "max", "bounds_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "tree_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attrib_", "=_", "root_", "._", "attrib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "root_", "._", "tag_", ",_", "xml_", "._", "TAG_", "._", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "attrib_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "attrib_", "[_", "\"", "success", "\"_", "]_", ",_", "\"", "fal", "se", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "lat", "min", "\"_", "in_", "attrib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "lat", "max", "\"_", "in_", "attrib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "lon", "min", "\"_", "in_", "attrib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "lon", "max", "\"_", "in_", "attrib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XML", "Format", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Select", "ed", "Fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include_", ",_", "exclude_", "=_", "self_", "._", "stylesheet", "_", "._", "get", "\\u", "fields_", "(_", "\"", "org", "\\u", "facilit", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "location", "\\u", "id", "\"_", "in_", "include_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "site", "\\u", "id", "\"_", "in_", "include_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "include_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclude_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Field", "Optio", "ns", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Show", "UI", "Ds_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "options", " ", "look", "up", " ", "with", " ", "foreign", " ", "key", " ", "constraint", " ", "inclu", "ding", " ", "UI", "Ds", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Equal_", "=_", "self_", "._", "assert", "Equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "=_", "self_", "._", "assert", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "current_", "._", "db_", "._", "fot", "est", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "current_", "._", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "xml_", "._", "get", "\\u", "field", "\\u", "options_", "(_", "table_", ",_", "\"", "look", "up", "\"_", ",_", "show", "\\u", "uids_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "True_", "(_", "isinstance_", "(_", "fo_", ",_", "etree_", "._", "\\u", "Element_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "fo_", "._", "tag_", ",_", "\"", "select", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ATTRIBUTE_", "=_", "xml_", "._", "ATTRIBUTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALUE_", "=_", "ATTRIBUTE_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UID_", "=_", "xml_", "._", "UID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "self_", "._", "records_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "empty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "fo_", ")_", ",_", "len_", "(_", "options_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "fo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "Equal_", "(_", "opt_", "._", "tag_", ",_", "\"", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attr_", "=_", "opt_", "._", "attrib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "VALUE_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "attr_", "[_", "VALUE_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "empty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "UID_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "\"\"_", ")_", "\\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 ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "UID_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "attr_", "[_", "UID_", "]_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "uuid", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "value_", "in_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "has", "\\u", "empty_", ",_", "msg_", "=_", "\"", "Emp", "ty", "-", "option", " ", "missi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Field", "Optio", "ns", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "With", "Hier", "arch", "y", "Info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "options", " ", "look", "up", " ", "with", " ", "foreign", " ", "key", " ", "constraint", " ", "with", " ", "hier", "arch", "y", " ", "info", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Equal_", "=_", "self_", "._", "assert", "Equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "=_", "self_", "._", "assert", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3db_", "=_", "current_", "._", "s3db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "db_", "._", "fot", "est", "\\u", "look", "up", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "parent", "-", "field_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "S", "3", "Represent", "_", "(_", "lookup_", "=_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "parent_", "._", "requires_", "=_", "IS", "\\u", "EMP", "TY", "\\u", "OR_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IS", "\\u", "ONE", "\\u", "OF_", "(_", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", ".", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "parent_", "._", "requires_", "=_", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "hierarchy_", "\\u\\u\\uNL\\u\\u\\u_", "s3db_", "._", "configure_", "(_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ",_", "hierarchy_", "=_", "\"", "parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "3", "Hier", "arch", "y_", "._", "dirty_", "(_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "a", " ", "child", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "dict_", "(_", "self_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "node_", "=_", "{_", "\"", "name", "\"_", ":_", "\"", "option", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "\"", "OPTION", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parent", "\"_", ":_", "options_", "._", "keys_", "(_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "id_", "=_", "table_", "._", "insert_", "(_", "**_", "child", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "child", "\\u", "id_", "]_", "=_", "child", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "current_", "._", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "db_", "._", "fot", "est", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "xml_", "._", "get", "\\u", "field", "\\u", "options_", "(_", "table_", ",_", "\"", "look", "up", "\"_", ",_", "show", "\\u", "uids_", "=_", "True_", ",_", "hierarchy_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "True_", "(_", "isinstance_", "(_", "fo_", ",_", "etree_", "._", "\\u", "Element_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "fo_", "._", "tag_", ",_", "\"", "select", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ATTRIBUTE_", "=_", "xml_", "._", "ATTRIBUTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALUE_", "=_", "ATTRIBUTE_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PARENT", "_", "=_", "ATTRIBUTE_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UID_", "=_", "xml_", "._", "UID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "empty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "fo_", ")_", ",_", "len_", "(_", "options_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "fo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "Equal_", "(_", "opt_", "._", "tag_", ",_", "\"", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attr_", "=_", "opt_", "._", "attrib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "VALUE_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "attr_", "[_", "VALUE_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "empty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "UID_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "\"\"_", ")_", "\\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 ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "UID_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "attr_", "[_", "UID_", "]_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "uuid", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "value_", "in_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "parent", "\"_", "in_", "options_", "[_", "value_", "]_", "and_", "options_", "[_", "value_", "]_", "[_", "\"", "parent", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "True_", "(_", "PARENT", "_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "attr_", "[_", "PARENT", "_", "]_", ",_", "str_", "(_", "options_", "[_", "value_", "]_", "[_", "\"", "parent", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "has", "\\u", "empty_", ",_", "msg_", "=_", "\"", "Emp", "ty", "-", "option", " ", "missi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Field", "Optio", "ns", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Export", "Optio", "ns", "XML_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "Export", " ", "Optio", "ns", " ", "(", "all", " ", "options", ",", " ", "XML", ")", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Equal_", "=_", "self_", "._", "assert", "Equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "=_", "self_", "._", "assert", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "dict_", "(_", "self_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "current_", "._", "s3db_", "._", "resource_", "(_", "\"", "fot", "est", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "resource_", "._", "export", "\\u", "options_", "(_", "fields_", "=_", "[_", "\"", "look", "up", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "etree_", "._", "XML_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inspect", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "current_", "._", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ATTRIBUTE_", "=_", "xml_", "._", "ATTRIBUTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALUE_", "=_", "ATTRIBUTE_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UID_", "=_", "xml_", "._", "UID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "empty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "fo_", ")_", ",_", "len_", "(_", "options_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "fo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "Equal_", "(_", "opt_", "._", "tag_", ",_", "\"", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr_", "=_", "opt_", "._", "attrib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "VALUE_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "attr_", "[_", "VALUE_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "empty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "UID_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "None_", ")_", "\\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 ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "value_", "in_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "has", "\\u", "empty_", ",_", "msg_", "=_", "\"", "Emp", "ty", "-", "option", " ", "missi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Field", "Optio", "ns", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Export", "Optio", "ns", "XML", "Hier", "arch", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "Export", " ", "Optio", "ns", " ", "(", "all", " ", "options", ",", " ", "XML", "+", "hier", "arch", "y", ")", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Equal_", "=_", "self_", "._", "assert", "Equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "=_", "self_", "._", "assert", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "parent", "-", "field_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "db_", "._", "fot", "est", "\\u", "look", "up", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "represent_", "=_", "S", "3", "Represent", "_", "(_", "lookup_", "=_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "parent_", "._", "requires_", "=_", "IS", "\\u", "EMP", "TY", "\\u", "OR_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IS", "\\u", "ONE", "\\u", "OF_", "(_", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", ".", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "parent_", "._", "requires_", "=_", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "hierarchy_", "\\u\\u\\uNL\\u\\u\\u_", "s3db_", "=_", "current_", "._", "s3db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3db_", "._", "configure_", "(_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ",_", "hierarchy_", "=_", "\"", "parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "3", "Hier", "arch", "y_", "._", "dirty_", "(_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "a", " ", "child", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "dict_", "(_", "self_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "node_", "=_", "{_", "\"", "name", "\"_", ":_", "\"", "option", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "\"", "OPTION", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parent", "\"_", ":_", "options_", "._", "keys_", "(_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "id_", "=_", "table_", "._", "insert_", "(_", "**_", "child", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "child", "\\u", "id_", "]_", "=_", "child", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "s3db_", "._", "resource_", "(_", "\"", "fot", "est", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "resource_", "._", "export", "\\u", "options_", "(_", "fields_", "=_", "[_", "\"", "look", "up", "\"_", "]_", ",_", "hierarchy_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "etree_", "._", "XML_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inspect", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "current_", "._", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ATTRIBUTE_", "=_", "xml_", "._", "ATTRIBUTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALUE_", "=_", "ATTRIBUTE_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PARENT", "_", "=_", "ATTRIBUTE_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UID_", "=_", "xml_", "._", "UID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "empty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "fo_", ")_", ",_", "len_", "(_", "options_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "fo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "Equal_", "(_", "opt_", "._", "tag_", ",_", "\"", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attr_", "=_", "opt_", "._", "attrib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "VALUE_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "attr_", "[_", "VALUE_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "empty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "UID_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "None_", ")_", "\\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 ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "value_", "in_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "._", "text_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "parent", "\"_", "in_", "options_", "[_", "value_", "]_", "and_", "options_", "[_", "value_", "]_", "[_", "\"", "parent", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "True_", "(_", "PARENT", "_", "in_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "attr_", "[_", "PARENT", "_", "]_", ",_", "str_", "(_", "options_", "[_", "value_", "]_", "[_", "\"", "parent", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "has", "\\u", "empty_", ",_", "msg_", "=_", "\"", "Emp", "ty", "-", "option", " ", "missi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Field", "Optio", "ns", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Export", "Optio", "ns", "All", "Opt", "s", "JSON_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "export", " ", "options", ",", " ", "JSO", "N", ",", " ", "all", " ", "options", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Equal_", "=_", "self_", "._", "assert", "Equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "=_", "self_", "._", "assert", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "dict_", "(_", "self_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "current_", "._", "s3db_", "._", "resource_", "(_", "\"", "fot", "est", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "resource_", "._", "export", "\\u", "options_", "(_", "fields_", "=_", "[_", "\"", "look", "up", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "\\u", "json_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "json_", "._", "loads_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inspect", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "empty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "isinstance_", "(_", "fo_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "\"", "option", "\"_", "in_", "fo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "isinstance_", "(_", "fo_", "[_", "\"", "option", "\"_", "]_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "len_", "(_", "fo_", "[_", "\"", "option", "\"_", "]_", ")_", ",_", "len_", "(_", "options_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "fo_", "[_", "\"", "option", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "opt_", "[_", "\"@", "value", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "empty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"$\"_", "in_", "opt_", ")_", "\\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 ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "value_", "in_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "[_", "\"$\"_", "]_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "has", "\\u", "empty_", ",_", "msg_", "=_", "\"", "Emp", "ty", "-", "option", " ", "missi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Field", "Optio", "ns", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Export", "Optio", "ns", "All", "Opt", "s", "JSO", "NH", "ier", "arch", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "export", " ", "options", ",", " ", "JSO", "N", ",", " ", "all", " ", "options", "+", "hier", "arch", "y", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "Equal_", "=_", "self_", "._", "assert", "Equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "=_", "self_", "._", "assert", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "parent", "-", "field_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "db_", "._", "fot", "est", "\\u", "look", "up", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "represent_", "=_", "S", "3", "Represent", "_", "(_", "lookup_", "=_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "parent_", "._", "requires_", "=_", "IS", "\\u", "EMP", "TY", "\\u", "OR_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IS", "\\u", "ONE", "\\u", "OF_", "(_", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", ".", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "parent_", "._", "requires_", "=_", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "hierarchy_", "\\u\\u\\uNL\\u\\u\\u_", "s3db_", "=_", "current_", "._", "s3db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3db_", "._", "configure_", "(_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ",_", "hierarchy_", "=_", "\"", "parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "3", "Hier", "arch", "y_", "._", "dirty_", "(_", "\"", "fot", "est", "\\u", "look", "up", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "a", " ", "child", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "dict_", "(_", "self_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "node_", "=_", "{_", "\"", "name", "\"_", ":_", "\"", "option", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "\"", "OPTION", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parent", "\"_", ":_", "options_", "._", "keys_", "(_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "\\u", "id_", "=_", "table_", "._", "insert_", "(_", "**_", "child", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "child", "\\u", "id_", "]_", "=_", "child", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "s3db_", "._", "resource_", "(_", "\"", "fot", "est", "\\u", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "resource_", "._", "export", "\\u", "options_", "(_", "fields_", "=_", "[_", "\"", "look", "up", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hierarchy_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "\\u", "json_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fo_", "=_", "json_", "._", "loads_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inspect", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "empty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "isinstance_", "(_", "fo_", ",_", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "\"", "option", "\"_", "in_", "fo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "True_", "(_", "isinstance_", "(_", "fo_", "[_", "\"", "option", "\"_", "]_", ",_", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "len_", "(_", "fo_", "[_", "\"", "option", "\"_", "]_", ")_", ",_", "len_", "(_", "options_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", "in_", "fo_", "[_", "\"", "option", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "opt_", "[_", "\"@", "value", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "empty_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"$\"_", "in_", "opt_", ")_", "\\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 ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "True_", "(_", "value_", "in_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "[_", "\"$\"_", "]_", ",_", "options_", "[_", "value_", "]_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "parent", "\"_", "in_", "options_", "[_", "value_", "]_", "and_", "options_", "[_", "value_", "]_", "[_", "\"", "parent", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "True_", "(_", "\"@", "parent", "\"_", "in_", "opt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "Equal_", "(_", "opt_", "[_", "\"@", "parent", "\"_", "]_", ",_", "str_", "(_", "options_", "[_", "value_", "]_", "[_", "\"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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
lalinsky/acoustid-server/acoustid/data/track.py
[ { "content": "# Copyright (C) 2011 Lukas Lalinsky\n# Distributed under the MIT license, see the LICENSE file for details.\n\nimport logging\nimport uuid\nfrom sqlalchemy import sql\nfrom acoustid import tables as schema, const\nfrom acoustid.data.fingerprint import lookup_fingerprint, insert_fingerprint, inc_fingerprint_submission_count, FingerprintSearcher\nfrom acoustid.data.musicbrainz import resolve_mbid_redirect\n\nlogger = logging.getLogger(__name__)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def resolve_track_gid(conn, gid):\n query = sql.select([schema.track.c.id, schema.track.c.new_id],\n schema.track.c.gid == gid)\n row = conn.execute(query).first()\n if row is None:\n return None\n track_id, new_track_id = row\n if new_track_id is None:\n return track_id\n query = sql.select([schema.track.c.id],\n schema.track.c.id == new_track_id)\n return conn.execute(query).scalar()", "metadata": "root.resolve_track_gid", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def lookup_mbids(conn, track_ids):\n \"\"\"\n Lookup MBIDs for the specified AcoustID track IDs.\n \"\"\"\n if not track_ids:\n return {}\n query = sql.select([\n schema.track_mbid.c.track_id,\n schema.track_mbid.c.mbid,\n schema.track_mbid.c.submission_count,\n ])\n query = query.where(sql.and_(schema.track_mbid.c.track_id.in_(track_ids), schema.track_mbid.c.disabled == False))\n query = query.order_by(schema.track_mbid.c.mbid)\n results = {}\n for track_id, mbid, sources in conn.execute(query):\n results.setdefault(track_id, []).append((mbid, sources))\n return results", "metadata": "root.lookup_mbids", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def lookup_meta_ids(conn, track_ids):\n if not track_ids:\n return {}\n query = sql.select(\n [schema.track_meta.c.track_id, schema.track_meta.c.meta_id],\n sql.and_(schema.track_meta.c.track_id.in_(track_ids))).order_by(schema.track_meta.c.meta_id)\n results = {}\n for track_id, meta_id in conn.execute(query):\n results.setdefault(track_id, []).append(meta_id)\n return results", "metadata": "root.lookup_meta_ids", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def lookup_tracks(conn, mbids):\n if not mbids:\n return {}\n query = sql.select(\n [schema.track_mbid.c.track_id, schema.track.c.gid, schema.track_mbid.c.mbid],\n sql.and_(schema.track_mbid.c.mbid.in_(mbids), schema.track_mbid.c.disabled == False),\n from_obj=schema.track_mbid.join(schema.track, schema.track_mbid.c.track_id == schema.track.c.id)). \\\n order_by(schema.track_mbid.c.track_id)\n results = {}\n for track_id, track_gid, mbid in conn.execute(query):\n results.setdefault(mbid, []).append({'id': track_id, 'gid': track_gid})\n return results", "metadata": "root.lookup_tracks", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def merge_mbids(conn, target_mbid, source_mbids):\n \"\"\"\n Merge the specified MBIDs.\n \"\"\"\n logger.info(\"Merging MBIDs %s into %s\", ', '.join(source_mbids), target_mbid)\n with conn.begin():\n query = sql.select(\n [\n sql.func.min(schema.track_mbid.c.id).label('id'),\n sql.func.array_agg(schema.track_mbid.c.id).label('all_ids'),\n schema.track_mbid.c.track_id,\n sql.func.every(schema.track_mbid.c.disabled).label('all_disabled'),\n sql.func.sum(schema.track_mbid.c.submission_count).label('count'),\n ],\n schema.track_mbid.c.mbid.in_(source_mbids + [target_mbid]),\n group_by=schema.track_mbid.c.track_id)\n rows = conn.execute(query).fetchall()\n to_delete = set()\n to_update = []\n for row in rows:\n old_ids = set(row['all_ids'])\n old_ids.remove(row['id'])\n to_delete.update(old_ids)\n to_update.append((old_ids, row))\n if old_ids:\n update_stmt = schema.track_mbid_source.update().where(schema.track_mbid_source.c.track_mbid_id.in_(old_ids))\n conn.execute(update_stmt.values(track_mbid_id=row['id']))\n update_stmt = schema.track_mbid_change.update().where(schema.track_mbid_change.c.track_mbid_id.in_(old_ids))\n conn.execute(update_stmt.values(track_mbid_id=row['id']))\n update_stmt = schema.track_mbid_flag.update().where(schema.track_mbid_flag.c.track_mbid_id.in_(old_ids))\n conn.execute(update_stmt.values(track_mbid_id=row['id']))\n if to_delete:\n delete_stmt = schema.track_mbid.delete().where(\n schema.track_mbid.c.id.in_(to_delete))\n conn.execute(delete_stmt)\n for old_ids, row in to_update:\n update_stmt = schema.track_mbid.update().where(schema.track_mbid.c.id == row['id'])\n conn.execute(update_stmt.values(submission_count=row['count'],\n mbid=target_mbid, disabled=row['all_disabled']))", "metadata": "root.merge_mbids", "header": "['module', '___EOS___']", "index": 72 }, { "content": "def merge_missing_mbids(conn):\n \"\"\"\n Lookup which MBIDs has been merged in MusicBrainz and merge then\n in the AcoustID database as well.\n \"\"\"\n logger.debug(\"Merging missing MBIDs\")\n results = conn.execute(\"\"\"\n SELECT DISTINCT tm.mbid AS old_mbid, mt.gid AS new_mbid\n FROM track_mbid tm\n JOIN musicbrainz.recording_gid_redirect mgr ON tm.mbid = mgr.gid\n JOIN musicbrainz.recording mt ON mt.id = mgr.new_id\n \"\"\")\n merge = {}\n for old_mbid, new_mbid in results:\n merge.setdefault(new_mbid, []).append(old_mbid)\n for new_mbid, old_mbids in merge.iteritems():\n merge_mbids(conn, new_mbid, old_mbids)", "metadata": "root.merge_missing_mbids", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def _merge_tracks_gids(conn, name_with_id, target_id, source_ids):\n name = name_with_id.replace('_id', '')\n tab = schema.metadata.tables['track_%s' % name]\n col = tab.columns[name_with_id]\n tab_src = schema.metadata.tables['track_%s_source' % name]\n col_src = tab_src.columns['track_%s_id' % name]\n if name == 'mbid':\n tab_chg = schema.metadata.tables['track_%s_change' % name]\n col_chg = tab_chg.columns['track_%s_id' % name]\n tab_flag = schema.metadata.tables['track_%s_flag' % name]\n col_flag = tab_flag.columns['track_%s_id' % name]\n columns = [\n sql.func.min(tab.c.id).label('id'),\n sql.func.array_agg(tab.c.id).label('all_ids'),\n sql.func.sum(tab.c.submission_count).label('count'),\n ]\n if name == 'mbid':\n columns.append(sql.func.every(schema.track_mbid.c.disabled).label('all_disabled'))\n query = sql.select(columns, tab.c.track_id.in_(source_ids + [target_id]), group_by=col)\n rows = conn.execute(query).fetchall()\n to_delete = set()\n to_update = []\n for row in rows:\n old_ids = set(row['all_ids'])\n old_ids.remove(row['id'])\n to_delete.update(old_ids)\n to_update.append((old_ids, row))\n if old_ids:\n update_stmt = tab_src.update().where(col_src.in_(old_ids))\n conn.execute(update_stmt.values({col_src: row['id']}))\n if name == 'mbid':\n update_stmt = tab_chg.update().where(col_chg.in_(old_ids))\n conn.execute(update_stmt.values({col_chg: row['id']}))\n update_stmt = tab_flag.update().where(col_flag.in_(old_ids))\n conn.execute(update_stmt.values({col_flag: row['id']}))\n if to_delete:\n delete_stmt = tab.delete().where(tab.c.id.in_(to_delete))\n conn.execute(delete_stmt)\n for old_ids, row in to_update:\n update_stmt = tab.update().where(tab.c.id == row['id'])\n if name == 'mbid':\n conn.execute(update_stmt.values(submission_count=row['count'], track_id=target_id, disabled=row['all_disabled']))\n else:\n conn.execute(update_stmt.values(submission_count=row['count'], track_id=target_id))", "metadata": "root._merge_tracks_gids", "header": "['module', '___EOS___']", "index": 132 }, { "content": "def merge_tracks(conn, target_id, source_ids):\n \"\"\"\n Merge the specified tracks.\n \"\"\"\n logger.info(\"Merging tracks %s into %s\", ', '.join(map(str, source_ids)), target_id)\n with conn.begin():\n _merge_tracks_gids(conn, 'mbid', target_id, source_ids)\n _merge_tracks_gids(conn, 'puid', target_id, source_ids)\n _merge_tracks_gids(conn, 'meta_id', target_id, source_ids)\n _merge_tracks_gids(conn, 'foreignid_id', target_id, source_ids)\n # XXX don't move duplicate fingerprints\n update_stmt = schema.fingerprint.update().where(\n schema.fingerprint.c.track_id.in_(source_ids))\n conn.execute(update_stmt.values(track_id=target_id))\n update_stmt = schema.track.update().where(\n sql.or_(schema.track.c.id.in_(source_ids),\n schema.track.c.new_id.in_(source_ids)))\n conn.execute(update_stmt.values(new_id=target_id))", "metadata": "root.merge_tracks", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def insert_track(conn):\n \"\"\"\n Insert a new track into the database\n \"\"\"\n insert_stmt = schema.track.insert().values({'gid': str(uuid.uuid4())})\n id = conn.execute(insert_stmt).inserted_primary_key[0]\n logger.debug(\"Inserted track %r\", id)\n return id", "metadata": "root.insert_track", "header": "['module', '___EOS___']", "index": 198 }, { "content": "def _insert_gid(conn, tab, tab_src, col, name, track_id, gid, submission_id=None, source_id=None):\n cond = sql.and_(tab.c.track_id == track_id, col == gid)\n query = sql.select([tab.c.id], cond)\n id = conn.execute(query).scalar()\n if id is not None:\n update_stmt = tab.update().where(cond)\n values = {'submission_count': sql.text('submission_count+1')}\n conn.execute(update_stmt.values(**values))\n else:\n insert_stmt = tab.insert().values({\n 'track_id': track_id, name: gid,\n 'submission_count': 1})\n id = conn.execute(insert_stmt).inserted_primary_key[0]\n logger.debug(\"Added %s %s to track %d\", name.upper(), gid, track_id)\n insert_stmt = tab_src.insert().values({\n 'track_%s_id' % name.replace('_id', ''): id,\n 'submission_id': submission_id,\n 'source_id': source_id,\n })\n conn.execute(insert_stmt)\n return True", "metadata": "root._insert_gid", "header": "['module', '___EOS___']", "index": 208 }, { "content": "def insert_mbid(conn, track_id, mbid, submission_id=None, source_id=None):\n return _insert_gid(conn, schema.track_mbid, schema.track_mbid_source,\n schema.track_mbid.c.mbid, 'mbid', track_id, mbid, submission_id, source_id)", "metadata": "root.insert_mbid", "header": "['module', '___EOS___']", "index": 231 }, { "content": "def insert_puid(conn, track_id, puid, submission_id=None, source_id=None):\n return _insert_gid(conn, schema.track_puid, schema.track_puid_source,\n schema.track_puid.c.puid, 'puid', track_id, puid, submission_id, source_id)", "metadata": "root.insert_puid", "header": "['module', '___EOS___']", "index": 236 }, { "content": "def insert_track_foreignid(conn, track_id, foreignid_id, submission_id=None, source_id=None):\n return _insert_gid(conn, schema.track_foreignid, schema.track_foreignid_source,\n schema.track_foreignid.c.foreignid_id, 'foreignid_id', track_id, foreignid_id,\n submission_id, source_id)", "metadata": "root.insert_track_foreignid", "header": "['module', '___EOS___']", "index": 241 }, { "content": "def insert_track_meta(conn, track_id, meta_id, submission_id=None, source_id=None):\n return _insert_gid(conn, schema.track_meta, schema.track_meta_source,\n schema.track_meta.c.meta_id, 'meta_id', track_id, meta_id, submission_id, source_id)", "metadata": "root.insert_track_meta", "header": "['module', '___EOS___']", "index": 247 }, { "content": "def calculate_fingerprint_similarity_matrix(conn, track_ids):\n fp1 = schema.fingerprint.alias('fp1')\n fp2 = schema.fingerprint.alias('fp2')\n src = fp1.join(fp2, fp1.c.id < fp2.c.id)\n cond = sql.and_(fp1.c.track_id.in_(track_ids), fp2.c.track_id.in_(track_ids))\n query = sql.select([\n fp1.c.id, fp2.c.id,\n sql.func.acoustid_compare2(fp1.c.fingerprint, fp2.c.fingerprint, const.TRACK_MAX_OFFSET),\n ], cond, from_obj=src).order_by(fp1.c.id, fp2.c.id)\n result = {}\n for fp1_id, fp2_id, score in conn.execute(query):\n result.setdefault(fp1_id, {})[fp2_id] = score\n result.setdefault(fp2_id, {})[fp1_id] = score\n result.setdefault(fp1_id, {})[fp1_id] = 1.0\n result.setdefault(fp2_id, {})[fp2_id] = 1.0\n return result", "metadata": "root.calculate_fingerprint_similarity_matrix", "header": "['module', '___EOS___']", "index": 252 }, { "content": "def can_merge_tracks(conn, track_ids):\n fp1 = schema.fingerprint.alias('fp1')\n fp2 = schema.fingerprint.alias('fp2')\n join_cond = sql.and_(fp1.c.id < fp2.c.id, fp1.c.track_id < fp2.c.track_id)\n src = fp1.join(fp2, join_cond)\n cond = sql.and_(fp1.c.track_id.in_(track_ids), fp2.c.track_id.in_(track_ids))\n query = sql.select([\n fp1.c.track_id, fp2.c.track_id,\n sql.func.max(sql.func.abs(fp1.c.length - fp2.c.length)),\n sql.func.min(sql.func.acoustid_compare2(fp1.c.fingerprint, fp2.c.fingerprint, const.TRACK_MAX_OFFSET)),\n ], cond, from_obj=src).group_by(fp1.c.track_id, fp2.c.track_id).order_by(fp1.c.track_id, fp2.c.track_id)\n rows = conn.execute(query)\n merges = {}\n for fp1_id, fp2_id, length_diff, score in rows:\n if score < const.TRACK_GROUP_MERGE_THRESHOLD:\n continue\n if length_diff > const.FINGERPRINT_MAX_LENGTH_DIFF:\n continue\n group = fp1_id\n if group in merges:\n group = merges[group]\n merges[fp2_id] = group\n result = []\n for group in set(merges.values()):\n result.append(set([group] + [i for i in merges if merges[i] == group]))\n return result", "metadata": "root.can_merge_tracks", "header": "['module', '___EOS___']", "index": 270 }, { "content": "def can_add_fp_to_track(conn, track_id, fingerprint, length):\n cond = schema.fingerprint.c.track_id == track_id\n query = sql.select([\n sql.func.acoustid_compare2(schema.fingerprint.c.fingerprint, fingerprint, const.TRACK_MAX_OFFSET),\n schema.fingerprint.c.length,\n ], cond, from_obj=schema.fingerprint)\n for fp_score, fp_length in conn.execute(query):\n if fp_score < const.TRACK_GROUP_MERGE_THRESHOLD:\n return False\n if abs(fp_length - length) > const.FINGERPRINT_MAX_LENGTH_DIFF:\n return False\n return True", "metadata": "root.can_add_fp_to_track", "header": "['module', '___EOS___']", "index": 298 }, { "content": "def find_track_duplicates(conn, fingerprint, index=None):\n with conn.begin():\n searcher = FingerprintSearcher(conn, index)\n searcher.min_score = const.TRACK_MERGE_THRESHOLD\n matches = searcher.search(fingerprint['fingerprint'], fingerprint['length'])\n if not matches:\n logger.debug(\"Not matched itself!\")\n return\n logged = False\n match = matches[0]\n all_track_ids = set()\n possible_track_ids = set()\n for m in matches:\n if m['track_id'] in all_track_ids:\n continue\n all_track_ids.add(m['track_id'])\n if can_add_fp_to_track(conn, m['track_id'], fingerprint['fingerprint'], fingerprint['length']):\n if m['id'] != fingerprint['id']:\n if not logged:\n logger.debug(\"Deduplicating fingerprint %d\", fingerprint['id'])\n logged = True\n logger.debug(\"Fingerprint %d with track %d is %d%% similar\", m['id'], m['track_id'], m['score'] * 100)\n possible_track_ids.add(m['track_id'])\n if len(possible_track_ids) > 1:\n for group in can_merge_tracks(conn, possible_track_ids):\n if len(group) > 1:\n target_track_id = min(group)\n group.remove(target_track_id)\n #logger.debug(\"Would like to merge tracks %r into %d\", list(group), target_track_id)\n merge_tracks(conn, target_track_id, list(group))\n #raise Exception(1)\n break\n conn.execute(\"INSERT INTO fingerprint_deduplicate (id) VALUES (%s)\", fingerprint['id'])", "metadata": "root.find_track_duplicates", "header": "['module', '___EOS___']", "index": 312 }, { "content": "def find_duplicates(conn, limit=50, index=None):\n query = \"SELECT f.id, fingerprint, length FROM fingerprint f LEFT JOIN fingerprint_deduplicate d ON f.id=d.id WHERE d.id IS NULL ORDER BY f.id LIMIT 1000\"\n for fingerprint in conn.execute(query):\n find_track_duplicates(conn, fingerprint, index=index)", "metadata": "root.find_duplicates", "header": "['module', '___EOS___']", "index": 347 } ]
[ { "span": "from acoustid.data.fingerprint import lookup_fingerprint, insert_fingerprint, inc_fingerprint_submission_count, FingerprintSearcher", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 131 }, { "span": "from acoustid.data.musicbrainz import resolve_mbid_redirect", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 59 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", " ", "Lu", "kas", " ", "La", "lins", "ky_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "MIT", " ", "license", ",", " ", "see", " ", "the", " ", "LICENSE", " ", "file", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "sql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "import_", "tables_", "as_", "schema_", ",_", "const_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "fingerprint_", "import_", "look", "up", "\\u", "fingerprint_", ",_", "insert", "\\u", "fingerprint_", ",_", "inc", "\\u", "fingerprint", "\\u", "subm", "ission", "\\u", "count_", ",_", "Fingerprint", "Searche", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "musicb", "rain", "z_", "import_", "resolve", "\\u", "mbid", "\\u", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\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", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "resolve", "\\u", "track", "\\u", "gid_", "(_", "conn_", ",_", "gid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "sql_", "._", "select_", "(_", "[_", "schema_", "._", "track_", "._", "c_", "._", "id_", ",_", "schema_", "._", "track_", "._", "c_", "._", "new", "\\u", "id_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track_", "._", "c_", "._", "gid_", "==_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "conn_", "._", "execute_", "(_", "query_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "track", "\\u", "id_", ",_", "new", "\\u", "track", "\\u", "id_", "=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "track", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "track", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "sql_", "._", "select_", "(_", "[_", "schema_", "._", "track_", "._", "c_", "._", "id_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track_", "._", "c_", "._", "id_", "==_", "new", "\\u", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conn_", "._", "execute_", "(_", "query_", ")_", "._", "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_", "def_", "look", "up", "\\u", "mbid", "s_", "(_", "conn_", ",_", "track", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Look", "up", " ", "MB", "ID", "s", " ", "for", " ", "the", " ", "specified", " ", "Aco", "ust", "ID", " ", "track", " ", "ID", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "track", "\\u", "ids_", ":_", "\\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_", "query_", "=_", "sql_", "._", "select_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "track", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "mbid", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "subm", "ission", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "where_", "(_", "sql_", "._", "and\\u_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "track", "\\u", "ids_", ")_", ",_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "disabled_", "==_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "order", "\\u", "by_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "mbid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "mbid", "_", ",_", "sources_", "in_", "conn_", "._", "execute_", "(_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "setdefault_", "(_", "track", "\\u", "id_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "(_", "mbid", "_", ",_", "sources_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "look", "up", "\\u", "meta", "\\u", "ids_", "(_", "conn_", ",_", "track", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "track", "\\u", "ids_", ":_", "\\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_", "query_", "=_", "sql_", "._", "select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "schema_", "._", "track", "\\u", "meta_", "._", "c_", "._", "track", "\\u", "id_", ",_", "schema_", "._", "track", "\\u", "meta_", "._", "c_", "._", "meta", "\\u", "id_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "and\\u_", "(_", "schema_", "._", "track", "\\u", "meta_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "track", "\\u", "ids_", ")_", ")_", ")_", "._", "order", "\\u", "by_", "(_", "schema_", "._", "track", "\\u", "meta_", "._", "c_", "._", "meta", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "meta", "\\u", "id_", "in_", "conn_", "._", "execute_", "(_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "setdefault_", "(_", "track", "\\u", "id_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "meta", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "look", "up", "\\u", "tracks_", "(_", "conn_", ",_", "mbid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "mbid", "s_", ":_", "\\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_", "query_", "=_", "sql_", "._", "select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "track", "\\u", "id_", ",_", "schema_", "._", "track_", "._", "c_", "._", "gid_", ",_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "mbid", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "and\\u_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "mbid", "_", "._", "in\\u_", "(_", "mbid", "s_", ")_", ",_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "disabled_", "==_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "\\u", "obj_", "=_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "join_", "(_", "schema_", "._", "track_", ",_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "track", "\\u", "id_", "==_", "schema_", "._", "track_", "._", "c_", "._", "id_", ")_", ")_", "._", "order", "\\u", "by_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "track", "\\u", "gid_", ",_", "mbid", "_", "in_", "conn_", "._", "execute_", "(_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "setdefault_", "(_", "mbid", "_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "track", "\\u", "id_", ",_", "'", "gid", "'_", ":_", "track", "\\u", "gid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "merge", "\\u", "mbid", "s_", "(_", "conn_", ",_", "target", "\\u", "mbid", "_", ",_", "source", "\\u", "mbid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Merge", " ", "the", " ", "specified", " ", "MB", "ID", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Mer", "ging", " ", "MB", "ID", "s", " ", "%", "s", " ", "int", "o", " ", "%", "s", "\"_", ",_", "',", " ", "'_", "._", "join_", "(_", "source", "\\u", "mbid", "s_", ")_", ",_", "target", "\\u", "mbid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "conn_", "._", "begin_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "sql_", "._", "select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "min_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "id_", ")_", "._", "label_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "array", "\\u", "agg_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "id_", ")_", "._", "label_", "(_", "'", "all", "\\u", "ids", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "track", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "every_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "disabled_", ")_", "._", "label_", "(_", "'", "all", "\\u", "disable", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "sum_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "subm", "ission", "\\u", "count_", ")_", "._", "label_", "(_", "'", "count", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "mbid", "_", "._", "in\\u_", "(_", "source", "\\u", "mbid", "s_", "+_", "[_", "target", "\\u", "mbid", "_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group", "\\u", "by_", "=_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "conn_", "._", "execute_", "(_", "query_", ")_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "delete_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "update_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "ids_", "=_", "set_", "(_", "row_", "[_", "'", "all", "\\u", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "ids_", "._", "remove_", "(_", "row_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "delete_", "._", "update_", "(_", "old", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "update_", "._", "append_", "(_", "(_", "old", "\\u", "ids_", ",_", "row_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "stmt_", "=_", "schema_", "._", "track", "\\u", "mbid", "\\u", "source_", "._", "update_", "(_", ")_", "._", "where_", "(_", "schema_", "._", "track", "\\u", "mbid", "\\u", "source_", "._", "c_", "._", "track", "\\u", "mbid", "\\u", "id_", "._", "in\\u_", "(_", "old", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "track", "\\u", "mbid", "\\u", "id_", "=_", "row_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "stmt_", "=_", "schema_", "._", "track", "\\u", "mbid", "\\u", "change_", "._", "update_", "(_", ")_", "._", "where_", "(_", "schema_", "._", "track", "\\u", "mbid", "\\u", "change_", "._", "c_", "._", "track", "\\u", "mbid", "\\u", "id_", "._", "in\\u_", "(_", "old", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "track", "\\u", "mbid", "\\u", "id_", "=_", "row_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "stmt_", "=_", "schema_", "._", "track", "\\u", "mbid", "\\u", "flag_", "._", "update_", "(_", ")_", "._", "where_", "(_", "schema_", "._", "track", "\\u", "mbid", "\\u", "flag_", "._", "c_", "._", "track", "\\u", "mbid", "\\u", "id_", "._", "in\\u_", "(_", "old", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "track", "\\u", "mbid", "\\u", "id_", "=_", "row_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "to", "\\u", "delete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "\\u", "stmt_", "=_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "delete_", "(_", ")_", "._", "where_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "id_", "._", "in\\u_", "(_", "to", "\\u", "delete_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "delete", "\\u", "stmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "old", "\\u", "ids_", ",_", "row_", "in_", "to", "\\u", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "stmt_", "=_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "update_", "(_", ")_", "._", "where_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "id_", "==_", "row_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "subm", "ission", "\\u", "count_", "=_", "row_", "[_", "'", "count", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mbid", "_", "=_", "target", "\\u", "mbid", "_", ",_", "disabled_", "=_", "row_", "[_", "'", "all", "\\u", "disable", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge", "\\u", "missi", "ng", "\\u", "mbid", "s_", "(_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Look", "up", " ", "whi", "ch", " ", "MB", "ID", "s", " ", "has", " ", "bee", "n", " ", "merge", "d", " ", "in", " ", "Music", "Brain", "z", " ", "and", " ", "merge", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "Aco", "ust", "ID", " ", "databa", "se", " ", "as", " ", "well", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Mer", "ging", " ", "missi", "ng", " ", "MB", "ID", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "conn_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "DIST", "INC", "T", " ", "tm", ".", "mbid", " ", "AS", " ", "old", "\\u", "mbid", ",", " ", "mt", ".", "gid", " ", "AS", " ", "new", "\\u", "mbid", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "track", "\\u", "mbid", " ", "tm", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "musicb", "rain", "z", ".", "record", "ing", "\\u", "gid", "\\u", "redirec", "t", " ", "mgr", " ", "ON", " ", "tm", ".", "mbid", " ", "=", " ", "mgr", ".", "gid", "\\", "10", ";", " ", " ", " ", " ", "JOIN", " ", "musicb", "rain", "z", ".", "record", "ing", " ", "mt", " ", "ON", " ", "mt", ".", "id", " ", "=", " ", "mgr", ".", "new", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "old", "\\u", "mbid", "_", ",_", "new", "\\u", "mbid", "_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merge_", "._", "setdefault_", "(_", "new", "\\u", "mbid", "_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "old", "\\u", "mbid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "new", "\\u", "mbid", "_", ",_", "old", "\\u", "mbid", "s_", "in_", "merge_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merge", "\\u", "mbid", "s_", "(_", "conn_", ",_", "new", "\\u", "mbid", "_", ",_", "old", "\\u", "mbid", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "merge", "\\u", "tracks", "\\u", "gid", "s_", "(_", "conn_", ",_", "name", "\\u", "with", "\\u", "id_", ",_", "target", "\\u", "id_", ",_", "source", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name", "\\u", "with", "\\u", "id_", "._", "replace_", "(_", "'\\u", "id", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab_", "=_", "schema_", "._", "metadata_", "._", "tables_", "[_", "'", "track", "\\u", "%", "s", "'_", "%_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "tab_", "._", "columns_", "[_", "name", "\\u", "with", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "\\u", "src_", "=_", "schema_", "._", "metadata_", "._", "tables_", "[_", "'", "track", "\\u", "%", "s", "\\u", "source", "'_", "%_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "src_", "=_", "tab", "\\u", "src_", "._", "columns_", "[_", "'", "track", "\\u", "%", "s", "\\u", "id", "'_", "%_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "mbid", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab", "\\u", "chg", "_", "=_", "schema_", "._", "metadata_", "._", "tables_", "[_", "'", "track", "\\u", "%", "s", "\\u", "change", "'_", "%_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "chg", "_", "=_", "tab", "\\u", "chg", "_", "._", "columns_", "[_", "'", "track", "\\u", "%", "s", "\\u", "id", "'_", "%_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "\\u", "flag_", "=_", "schema_", "._", "metadata_", "._", "tables_", "[_", "'", "track", "\\u", "%", "s", "\\u", "flag", "'_", "%_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "flag_", "=_", "tab", "\\u", "flag_", "._", "columns_", "[_", "'", "track", "\\u", "%", "s", "\\u", "id", "'_", "%_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "columns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "min_", "(_", "tab_", "._", "c_", "._", "id_", ")_", "._", "label_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "array", "\\u", "agg_", "(_", "tab_", "._", "c_", "._", "id_", ")_", "._", "label_", "(_", "'", "all", "\\u", "ids", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "sum_", "(_", "tab_", "._", "c_", "._", "subm", "ission", "\\u", "count_", ")_", "._", "label_", "(_", "'", "count", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "mbid", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "._", "append_", "(_", "sql_", "._", "func_", "._", "every_", "(_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "disabled_", ")_", "._", "label_", "(_", "'", "all", "\\u", "disable", "d", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "sql_", "._", "select_", "(_", "columns_", ",_", "tab_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "source", "\\u", "ids_", "+_", "[_", "target", "\\u", "id_", "]_", ")_", ",_", "group", "\\u", "by_", "=_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "conn_", "._", "execute_", "(_", "query_", ")_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "delete_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "update_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "ids_", "=_", "set_", "(_", "row_", "[_", "'", "all", "\\u", "ids", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "ids_", "._", "remove_", "(_", "row_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "delete_", "._", "update_", "(_", "old", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "update_", "._", "append_", "(_", "(_", "old", "\\u", "ids_", ",_", "row_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "stmt_", "=_", "tab", "\\u", "src_", "._", "update_", "(_", ")_", "._", "where_", "(_", "col", "\\u", "src_", "._", "in\\u_", "(_", "old", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "{_", "col", "\\u", "src_", ":_", "row_", "[_", "'", "id", "'_", "]_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "mbid", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "stmt_", "=_", "tab", "\\u", "chg", "_", "._", "update_", "(_", ")_", "._", "where_", "(_", "col", "\\u", "chg", "_", "._", "in\\u_", "(_", "old", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "{_", "col", "\\u", "chg", "_", ":_", "row_", "[_", "'", "id", "'_", "]_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "stmt_", "=_", "tab", "\\u", "flag_", "._", "update_", "(_", ")_", "._", "where_", "(_", "col", "\\u", "flag_", "._", "in\\u_", "(_", "old", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "{_", "col", "\\u", "flag_", ":_", "row_", "[_", "'", "id", "'_", "]_", "}_", ")_", ")_", "\\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_", "to", "\\u", "delete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delete", "\\u", "stmt_", "=_", "tab_", "._", "delete_", "(_", ")_", "._", "where_", "(_", "tab_", "._", "c_", "._", "id_", "._", "in\\u_", "(_", "to", "\\u", "delete_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "delete", "\\u", "stmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "old", "\\u", "ids_", ",_", "row_", "in_", "to", "\\u", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "stmt_", "=_", "tab_", "._", "update_", "(_", ")_", "._", "where_", "(_", "tab_", "._", "c_", "._", "id_", "==_", "row_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "mbid", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "subm", "ission", "\\u", "count_", "=_", "row_", "[_", "'", "count", "'_", "]_", ",_", "track", "\\u", "id_", "=_", "target", "\\u", "id_", ",_", "disabled_", "=_", "row_", "[_", "'", "all", "\\u", "disable", "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 ", " _", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "subm", "ission", "\\u", "count_", "=_", "row_", "[_", "'", "count", "'_", "]_", ",_", "track", "\\u", "id_", "=_", "target", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge", "\\u", "tracks_", "(_", "conn_", ",_", "target", "\\u", "id_", ",_", "source", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Merge", " ", "the", " ", "specified", " ", "tracks", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Mer", "ging", " ", "tracks", " ", "%", "s", " ", "int", "o", " ", "%", "s", "\"_", ",_", "',", " ", "'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "source", "\\u", "ids_", ")_", ")_", ",_", "target", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "conn_", "._", "begin_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "merge", "\\u", "tracks", "\\u", "gid", "s_", "(_", "conn_", ",_", "'", "mbid", "'_", ",_", "target", "\\u", "id_", ",_", "source", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "merge", "\\u", "tracks", "\\u", "gid", "s_", "(_", "conn_", ",_", "'", "pu", "id", "'_", ",_", "target", "\\u", "id_", ",_", "source", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "merge", "\\u", "tracks", "\\u", "gid", "s_", "(_", "conn_", ",_", "'", "meta", "\\u", "id", "'_", ",_", "target", "\\u", "id_", ",_", "source", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "merge", "\\u", "tracks", "\\u", "gid", "s_", "(_", "conn_", ",_", "'", "foreign", "id", "\\u", "id", "'_", ",_", "target", "\\u", "id_", ",_", "source", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "don", "'", "t", " ", "move", " ", "duplicat", "e", " ", "fingerprint", "s_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "stmt_", "=_", "schema_", "._", "fingerprint_", "._", "update_", "(_", ")_", "._", "where_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "fingerprint_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "source", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "track", "\\u", "id_", "=_", "target", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "stmt_", "=_", "schema_", "._", "track_", "._", "update_", "(_", ")_", "._", "where_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "or\\u_", "(_", "schema_", "._", "track_", "._", "c_", "._", "id_", "._", "in\\u_", "(_", "source", "\\u", "ids_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track_", "._", "c_", "._", "new", "\\u", "id_", "._", "in\\u_", "(_", "source", "\\u", "ids_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "new", "\\u", "id_", "=_", "target", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "track_", "(_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Insert", " ", "a", " ", "new", " ", "track", " ", "int", "o", " ", "the", " ", "databa", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert", "\\u", "stmt_", "=_", "schema_", "._", "track_", "._", "insert_", "(_", ")_", "._", "values_", "(_", "{_", "'", "gid", "'_", ":_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "conn_", "._", "execute_", "(_", "insert", "\\u", "stmt_", ")_", "._", "inserted", "\\u", "primary", "\\u", "key_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Insert", "ed", " ", "track", " ", "%", "r", "\"_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "insert", "\\u", "gid_", "(_", "conn_", ",_", "tab_", ",_", "tab", "\\u", "src_", ",_", "col_", ",_", "name_", ",_", "track", "\\u", "id_", ",_", "gid_", ",_", "subm", "ission", "\\u", "id_", "=_", "None_", ",_", "source", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "=_", "sql_", "._", "and\\u_", "(_", "tab_", "._", "c_", "._", "track", "\\u", "id_", "==_", "track", "\\u", "id_", ",_", "col_", "==_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "sql_", "._", "select_", "(_", "[_", "tab_", "._", "c_", "._", "id_", "]_", ",_", "cond_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "conn_", "._", "execute_", "(_", "query_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "stmt_", "=_", "tab_", "._", "update_", "(_", ")_", "._", "where_", "(_", "cond_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "'", "subm", "ission", "\\u", "count", "'_", ":_", "sql_", "._", "text_", "(_", "'", "subm", "ission", "\\u", "count", "+", "1", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "update", "\\u", "stmt_", "._", "values_", "(_", "**_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insert", "\\u", "stmt_", "=_", "tab_", "._", "insert_", "(_", ")_", "._", "values_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "track", "\\u", "id", "'_", ":_", "track", "\\u", "id_", ",_", "name_", ":_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subm", "ission", "\\u", "count", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "conn_", "._", "execute_", "(_", "insert", "\\u", "stmt_", ")_", "._", "inserted", "\\u", "primary", "\\u", "key_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Added", " ", "%", "s", " ", "%", "s", " ", "to", " ", "track", " ", "%", "d", "\"_", ",_", "name_", "._", "upper_", "(_", ")_", ",_", "gid_", ",_", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "insert", "\\u", "stmt_", "=_", "tab", "\\u", "src_", "._", "insert_", "(_", ")_", "._", "values_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "track", "\\u", "%", "s", "\\u", "id", "'_", "%_", "name_", "._", "replace_", "(_", "'\\u", "id", "'_", ",_", "''_", ")_", ":_", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subm", "ission", "\\u", "id", "'_", ":_", "subm", "ission", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "id", "'_", ":_", "source", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "insert", "\\u", "stmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "mbid", "_", "(_", "conn_", ",_", "track", "\\u", "id_", ",_", "mbid", "_", ",_", "subm", "ission", "\\u", "id_", "=_", "None_", ",_", "source", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "insert", "\\u", "gid_", "(_", "conn_", ",_", "schema_", "._", "track", "\\u", "mbid", "_", ",_", "schema_", "._", "track", "\\u", "mbid", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "mbid", "_", "._", "c_", "._", "mbid", "_", ",_", "'", "mbid", "'_", ",_", "track", "\\u", "id_", ",_", "mbid", "_", ",_", "subm", "ission", "\\u", "id_", ",_", "source", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "pu", "id_", "(_", "conn_", ",_", "track", "\\u", "id_", ",_", "pu", "id_", ",_", "subm", "ission", "\\u", "id_", "=_", "None_", ",_", "source", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "insert", "\\u", "gid_", "(_", "conn_", ",_", "schema_", "._", "track", "\\u", "pu", "id_", ",_", "schema_", "._", "track", "\\u", "pu", "id", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "pu", "id_", "._", "c_", "._", "pu", "id_", ",_", "'", "pu", "id", "'_", ",_", "track", "\\u", "id_", ",_", "pu", "id_", ",_", "subm", "ission", "\\u", "id_", ",_", "source", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "track", "\\u", "foreign", "id_", "(_", "conn_", ",_", "track", "\\u", "id_", ",_", "foreign", "id", "\\u", "id_", ",_", "subm", "ission", "\\u", "id_", "=_", "None_", ",_", "source", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "insert", "\\u", "gid_", "(_", "conn_", ",_", "schema_", "._", "track", "\\u", "foreign", "id_", ",_", "schema_", "._", "track", "\\u", "foreign", "id", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "foreign", "id_", "._", "c_", "._", "foreign", "id", "\\u", "id_", ",_", "'", "foreign", "id", "\\u", "id", "'_", ",_", "track", "\\u", "id_", ",_", "foreign", "id", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subm", "ission", "\\u", "id_", ",_", "source", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "track", "\\u", "meta_", "(_", "conn_", ",_", "track", "\\u", "id_", ",_", "meta", "\\u", "id_", ",_", "subm", "ission", "\\u", "id_", "=_", "None_", ",_", "source", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "insert", "\\u", "gid_", "(_", "conn_", ",_", "schema_", "._", "track", "\\u", "meta_", ",_", "schema_", "._", "track", "\\u", "meta", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "track", "\\u", "meta_", "._", "c_", "._", "meta", "\\u", "id_", ",_", "'", "meta", "\\u", "id", "'_", ",_", "track", "\\u", "id_", ",_", "meta", "\\u", "id_", ",_", "subm", "ission", "\\u", "id_", ",_", "source", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calcul", "ate", "\\u", "fingerprint", "\\u", "similar", "it", "y", "\\u", "matrix_", "(_", "conn_", ",_", "track", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp", "1_", "=_", "schema_", "._", "fingerprint_", "._", "alias_", "(_", "'", "fp", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "2_", "=_", "schema_", "._", "fingerprint_", "._", "alias_", "(_", "'", "fp", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "fp", "1_", "._", "join_", "(_", "fp", "2_", ",_", "fp", "1_", "._", "c_", "._", "id_", "<_", "fp", "2_", "._", "c_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond_", "=_", "sql_", "._", "and\\u_", "(_", "fp", "1_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "track", "\\u", "ids_", ")_", ",_", "fp", "2_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "track", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "sql_", "._", "select_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "fp", "1_", "._", "c_", "._", "id_", ",_", "fp", "2_", "._", "c_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "aco", "usti", "d\\u", "compare", "2_", "(_", "fp", "1_", "._", "c_", "._", "fingerprint_", ",_", "fp", "2_", "._", "c_", "._", "fingerprint_", ",_", "const_", "._", "TRACK", "\\u", "MAX", "\\u", "OFFSET_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "cond_", ",_", "from", "\\u", "obj_", "=_", "src_", ")_", "._", "order", "\\u", "by_", "(_", "fp", "1_", "._", "c_", "._", "id_", ",_", "fp", "2_", "._", "c_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fp", "1", "\\u", "id_", ",_", "fp", "2", "\\u", "id_", ",_", "score_", "in_", "conn_", "._", "execute_", "(_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "setdefault_", "(_", "fp", "1", "\\u", "id_", ",_", "{_", "}_", ")_", "[_", "fp", "2", "\\u", "id_", "]_", "=_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "fp", "2", "\\u", "id_", ",_", "{_", "}_", ")_", "[_", "fp", "1", "\\u", "id_", "]_", "=_", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "fp", "1", "\\u", "id_", ",_", "{_", "}_", ")_", "[_", "fp", "1", "\\u", "id_", "]_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "fp", "2", "\\u", "id_", ",_", "{_", "}_", ")_", "[_", "fp", "2", "\\u", "id_", "]_", "=_", "1.0_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "can", "\\u", "merge", "\\u", "tracks_", "(_", "conn_", ",_", "track", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp", "1_", "=_", "schema_", "._", "fingerprint_", "._", "alias_", "(_", "'", "fp", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp", "2_", "=_", "schema_", "._", "fingerprint_", "._", "alias_", "(_", "'", "fp", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "join", "\\u", "cond_", "=_", "sql_", "._", "and\\u_", "(_", "fp", "1_", "._", "c_", "._", "id_", "<_", "fp", "2_", "._", "c_", "._", "id_", ",_", "fp", "1_", "._", "c_", "._", "track", "\\u", "id_", "<_", "fp", "2_", "._", "c_", "._", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "fp", "1_", "._", "join_", "(_", "fp", "2_", ",_", "join", "\\u", "cond_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond_", "=_", "sql_", "._", "and\\u_", "(_", "fp", "1_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "track", "\\u", "ids_", ")_", ",_", "fp", "2_", "._", "c_", "._", "track", "\\u", "id_", "._", "in\\u_", "(_", "track", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "sql_", "._", "select_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "fp", "1_", "._", "c_", "._", "track", "\\u", "id_", ",_", "fp", "2_", "._", "c_", "._", "track", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "max_", "(_", "sql_", "._", "func_", "._", "abs_", "(_", "fp", "1_", "._", "c_", "._", "length_", "-_", "fp", "2_", "._", "c_", "._", "length_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "min_", "(_", "sql_", "._", "func_", "._", "aco", "usti", "d\\u", "compare", "2_", "(_", "fp", "1_", "._", "c_", "._", "fingerprint_", ",_", "fp", "2_", "._", "c_", "._", "fingerprint_", ",_", "const_", "._", "TRACK", "\\u", "MAX", "\\u", "OFFSET_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "cond_", ",_", "from", "\\u", "obj_", "=_", "src_", ")_", "._", "group", "\\u", "by_", "(_", "fp", "1_", "._", "c_", "._", "track", "\\u", "id_", ",_", "fp", "2_", "._", "c_", "._", "track", "\\u", "id_", ")_", "._", "order", "\\u", "by_", "(_", "fp", "1_", "._", "c_", "._", "track", "\\u", "id_", ",_", "fp", "2_", "._", "c_", "._", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "conn_", "._", "execute_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merges", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fp", "1", "\\u", "id_", ",_", "fp", "2", "\\u", "id_", ",_", "length", "\\u", "diff_", ",_", "score_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "score_", "<_", "const_", "._", "TRACK", "\\u", "GROU", "P", "\\u", "MERGE", "\\u", "THRESHOLD_", ":_", "\\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_", "length", "\\u", "diff_", ">_", "const_", "._", "FIN", "GER", "PRINT", "\\u", "MAX", "\\u", "LENGTH", "\\u", "DIFF", "_", ":_", "\\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_", "group_", "=_", "fp", "1", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "group_", "in_", "merges", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "=_", "merges", "_", "[_", "group_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merges", "_", "[_", "fp", "2", "\\u", "id_", "]_", "=_", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group_", "in_", "set_", "(_", "merges", "_", "._", "values_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "set_", "(_", "[_", "group_", "]_", "+_", "[_", "i_", "for_", "i_", "in_", "merges", "_", "if_", "merges", "_", "[_", "i_", "]_", "==_", "group_", "]_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "can", "\\u", "add", "\\u", "fp", "\\u", "to", "\\u", "track_", "(_", "conn_", ",_", "track", "\\u", "id_", ",_", "fingerprint_", ",_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "=_", "schema_", "._", "fingerprint_", "._", "c_", "._", "track", "\\u", "id_", "==_", "track", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "sql_", "._", "select_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "._", "func_", "._", "aco", "usti", "d\\u", "compare", "2_", "(_", "schema_", "._", "fingerprint_", "._", "c_", "._", "fingerprint_", ",_", "fingerprint_", ",_", "const_", "._", "TRACK", "\\u", "MAX", "\\u", "OFFSET_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "._", "fingerprint_", "._", "c_", "._", "length_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "cond_", ",_", "from", "\\u", "obj_", "=_", "schema_", "._", "fingerprint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fp", "\\u", "score_", ",_", "fp", "\\u", "length_", "in_", "conn_", "._", "execute_", "(_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fp", "\\u", "score_", "<_", "const_", "._", "TRACK", "\\u", "GROU", "P", "\\u", "MERGE", "\\u", "THRESHOLD_", ":_", "\\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_", "abs_", "(_", "fp", "\\u", "length_", "-_", "length_", ")_", ">_", "const_", "._", "FIN", "GER", "PRINT", "\\u", "MAX", "\\u", "LENGTH", "\\u", "DIFF", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "track", "\\u", "duplicates_", "(_", "conn_", ",_", "fingerprint_", ",_", "index_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "conn_", "._", "begin_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "searcher_", "=_", "Fingerprint", "Searche", "r_", "(_", "conn_", ",_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "searcher_", "._", "min", "\\u", "score_", "=_", "const_", "._", "TRACK", "\\u", "MERGE", "\\u", "THRESHOLD_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matches_", "=_", "searcher_", "._", "search_", "(_", "fingerprint_", "[_", "'", "fingerprint", "'_", "]_", ",_", "fingerprint_", "[_", "'", "length", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "Not", " ", "matche", "d", " ", "its", "elf", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logged", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "matches_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "track", "\\u", "ids_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "possib", "le", "\\u", "track", "\\u", "ids_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m_", "[_", "'", "track", "\\u", "id", "'_", "]_", "in_", "all", "\\u", "track", "\\u", "ids_", ":_", "\\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_", "all", "\\u", "track", "\\u", "ids_", "._", "add_", "(_", "m_", "[_", "'", "track", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "can", "\\u", "add", "\\u", "fp", "\\u", "to", "\\u", "track_", "(_", "conn_", ",_", "m_", "[_", "'", "track", "\\u", "id", "'_", "]_", ",_", "fingerprint_", "[_", "'", "fingerprint", "'_", "]_", ",_", "fingerprint_", "[_", "'", "length", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m_", "[_", "'", "id", "'_", "]_", "!=_", "fingerprint_", "[_", "'", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "logged", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "debug_", "(_", "\"", "Ded", "upli", "cati", "ng", " ", "fingerprint", " ", "%", "d", "\"_", ",_", "fingerprint_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logged", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Fingerprint", " ", "%", "d", " ", "with", " ", "track", " ", "%", "d", " ", "is", " ", "%", "d", "%%", " ", "similar", "\"_", ",_", "m_", "[_", "'", "id", "'_", "]_", ",_", "m_", "[_", "'", "track", "\\u", "id", "'_", "]_", ",_", "m_", "[_", "'", "score", "'_", "]_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "possib", "le", "\\u", "track", "\\u", "ids_", "._", "add_", "(_", "m_", "[_", "'", "track", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "possib", "le", "\\u", "track", "\\u", "ids_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "group_", "in_", "can", "\\u", "merge", "\\u", "tracks_", "(_", "conn_", ",_", "possib", "le", "\\u", "track", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "group_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "track", "\\u", "id_", "=_", "min_", "(_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "._", "remove_", "(_", "target", "\\u", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "debug", "(\"", "Wo", "ul", "d", " ", "like", " ", "to", " ", "merge", " ", "tracks", " ", "%", "r", " ", "int", "o", " ", "%", "d", "\",", " ", "list", "(", "group", "),", " ", "target", "\\u", "track", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "tracks_", "(_", "conn_", ",_", "target", "\\u", "track", "\\u", "id_", ",_", "list_", "(_", "group_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Except", "ion", "(", "1", ")_", "\\u\\u\\uNL\\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_", "conn_", "._", "execute_", "(_", "\"", "INSERT", " ", "INT", "O", " ", "fingerprint", "\\u", "dedup", "licat", "e", " ", "(", "id", ")", " ", "VALU", "ES", " ", "(%", "s", ")\"_", ",_", "fingerprint_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "duplicates_", "(_", "conn_", ",_", "limit_", "=_", "50_", ",_", "index_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"", "SELECT", " ", "f", ".", "id", ",", " ", "fingerprint", ",", " ", "length", " ", "FROM", " ", "fingerprint", " ", "f", " ", "LEF", "T", " ", "JOIN", " ", "fingerprint", "\\u", "dedup", "licat", "e", " ", "d", " ", "ON", " ", "f", ".", "id", "=", "d", ".", "id", " ", "WHE", "RE", " ", "d", ".", "id", " ", "IS", " ", "NULL", " ", "ORDE", "R", " ", "BY", " ", "f", ".", "id", " ", "LIMIT", " ", "1000", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fingerprint_", "in_", "conn_", "._", "execute_", "(_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "find", "\\u", "track", "\\u", "duplicates_", "(_", "conn_", ",_", "fingerprint_", ",_", "index_", "=_", "index_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
omab/django-social-auth/social_auth/backends/contrib/live.py
[ { "content": "from social.backends.live import LiveOAuth2 as LiveBackend\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from social.backends.live import LiveOAuth2 as LiveBackend", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 58 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "social", "_", "._", "backends_", "._", "live_", "import_", "Live", "OA", "uth", "2_", "as_", "Live", "Backend_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unreachable code
bchew/dynamodump/dynamodump.py
[ { "content": "def delete_table(conn, sleep_interval, table_name):\n if not args.dataOnly:\n while True:\n # delete table if exists\n table_exist = True\n try:\n conn.delete_table(table_name)\n except boto.exception.JSONResponseError, e:\n if e.body[\"__type\"] == \"com.amazonaws.dynamodb.v20120810#ResourceNotFoundException\":\n table_exist = False\n logging.info(table_name + \" table deleted!\")\n break\n elif e.body[\"__type\"] == \"com.amazonaws.dynamodb.v20120810#LimitExceededException\":\n logging.info(\"Limit exceeded, retrying deletion of \" + table_name + \"..\")\n time.sleep(sleep_interval)\n elif e.body[\"__type\"] == \"com.amazon.coral.availability#ThrottlingException\":\n logging.info(\"Control plane limit exceeded, retrying deletion of \" + table_name + \"..\")\n time.sleep(sleep_interval)\n elif e.body[\"__type\"] == \"com.amazonaws.dynamodb.v20120810#ResourceInUseException\":\n logging.info(table_name + \" table is being deleted..\")\n time.sleep(sleep_interval)\n else:\n logging.exception(e)\n sys.exit(1)\n\n # if table exists, wait till deleted\n if table_exist:\n try:\n while True:\n logging.info(\"Waiting for \" + table_name + \" table to be deleted.. [\" + conn.describe_table(table_name)[\"Table\"][\"TableStatus\"] +\"]\")\n time.sleep(sleep_interval)\n except boto.exception.JSONResponseError, e:\n if e.body[\"__type\"] == \"com.amazonaws.dynamodb.v20120810#ResourceNotFoundException\":\n logging.info(table_name + \" table deleted.\")\n pass\n else:\n logging.exception(e)\n sys.exit(1)", "metadata": "root.delete_table", "header": "['module', '___EOS___']", "index": 71 } ]
[ { "span": "try:", "start_line": 98, "start_column": 6, "end_line": 98, "end_column": 10 } ]
[]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "table_", "(_", "conn_", ",_", "sleep", "\\u", "interval_", ",_", "table", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "args_", "._", "data", "Only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "table", " ", "if", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "exist_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "exception_", "._", "JSONR", "esp", "ons", "e", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "body_", "[_", "\"\\u\\u", "type", "\"_", "]_", "==_", "\"", "com", ".", "amaz", "ona", "ws", ".", "dynamodb", ".", "v2", "0120", "810", "#", "Reso", "urc", "e", "Not", "Foun", "d", "Except", "ion", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "exist_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "table", "\\u", "name_", "+_", "\"", " ", "table", " ", "delete", "d", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "body_", "[_", "\"\\u\\u", "type", "\"_", "]_", "==_", "\"", "com", ".", "amaz", "ona", "ws", ".", "dynamodb", ".", "v2", "0120", "810", "#", "Limit", "Exce", "eded", "Except", "ion", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Limit", " ", "exceed", "ed", ",", " ", "retrying", " ", "deletion", " ", "of", " ", "\"_", "+_", "table", "\\u", "name_", "+_", "\"..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "sleep", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "body_", "[_", "\"\\u\\u", "type", "\"_", "]_", "==_", "\"", "com", ".", "amaz", "on", ".", "cora", "l", ".", "avail", "abilit", "y", "#", "Thr", "ott", "ling", "Except", "ion", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Control", " ", "plane", " ", "limit", " ", "exceed", "ed", ",", " ", "retrying", " ", "deletion", " ", "of", " ", "\"_", "+_", "table", "\\u", "name_", "+_", "\"..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "sleep", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "body_", "[_", "\"\\u\\u", "type", "\"_", "]_", "==_", "\"", "com", ".", "amaz", "ona", "ws", ".", "dynamodb", ".", "v2", "0120", "810", "#", "Reso", "urc", "e", "In", "Us", "e", "Except", "ion", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "table", "\\u", "name_", "+_", "\"", " ", "table", " ", "is", " ", "bei", "ng", " ", "delete", "d", "..\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "sleep", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "table", " ", "exist", "s", ",", " ", "wait", " ", "till", " ", "deleted_", "\\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_", "table", "\\u", "exist_", ":_", "\\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 ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Wait", "ing", " ", "for", " ", "\"_", "+_", "table", "\\u", "name_", "+_", "\"", " ", "table", " ", "to", " ", "be", " ", "delete", "d", "..", " ", "[\"_", "+_", "conn_", "._", "descri", "be", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "[_", "\"", "Table", "\"_", "]_", "[_", "\"", "Table", "Status", "\"_", "]_", "+_", "\"]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "sleep", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "exception_", "._", "JSONR", "esp", "ons", "e", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "body_", "[_", "\"\\u\\u", "type", "\"_", "]_", "==_", "\"", "com", ".", "amaz", "ona", "ws", ".", "dynamodb", ".", "v2", "0120", "810", "#", "Reso", "urc", "e", "Not", "Foun", "d", "Except", "ion", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "table", "\\u", "name_", "+_", "\"", " ", "table", " ", "delete", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "logging_", "._", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
gdanezis/petlib/petlib/cipher.py
[ { "content": "def test_errors():\n with pytest.raises(Exception) as excinfo:\n aes = Cipher(\"AES-128-XXF\")\n assert 'Unknown' in str(excinfo.value)", "metadata": "root.test_errors", "header": "['module', '___EOS___']", "index": 350 }, { "content": "def test_aes_gcm_encrypt():\n aes = Cipher.aes_128_gcm()\n assert aes.gcm\n\n enc = aes.op(key=b\"A\"*16, iv=b\"A\"*16)\n\n enc.update_associated(b\"Hello\")\n ciphertext = enc.update(b\"World!\")\n c2 = enc.finalize()\n assert c2 == b''\n\n tag = enc.get_tag(16)\n assert len(tag) == 16", "metadata": "root.test_aes_gcm_encrypt", "header": "['module', '___EOS___']", "index": 397 }, { "content": "def test_aes_gcm_encrypt_192():\n aes = Cipher.aes_192_gcm()\n assert aes.gcm\n\n enc = aes.op(key=b\"A\"*24, iv=b\"A\"*16)\n\n enc.update_associated(b\"Hello\")\n ciphertext = enc.update(b\"World!\")\n c2 = enc.finalize()\n assert c2 == b''\n\n tag = enc.get_tag(16)\n assert len(tag) == 16", "metadata": "root.test_aes_gcm_encrypt_192", "header": "['module', '___EOS___']", "index": 411 }, { "content": "def test_aes_gcm_encrypt_256():\n aes = Cipher.aes_256_gcm()\n assert aes.gcm\n\n enc = aes.op(key=b\"A\"*32, iv=b\"A\"*16)\n\n enc.update_associated(b\"Hello\")\n ciphertext = enc.update(b\"World!\")\n c2 = enc.finalize()\n assert c2 == b''\n\n tag = enc.get_tag(16)\n assert len(tag) == 16", "metadata": "root.test_aes_gcm_encrypt_256", "header": "['module', '___EOS___']", "index": 426 }, { "content": "def test_gcm_dec_badassoc(aesenc):\n aes, enc, ciphertext, tag = aesenc\n\n dec = aes.dec(key=b\"A\"*16, iv=b\"A\"*16)\n dec.update_associated(b\"H4llo\")\n plaintext = dec.update(ciphertext)\n\n dec.set_tag(tag)\n\n with pytest.raises(Exception) as excinfo:\n dec.finalize()\n assert \"Cipher\" in str(excinfo.value)", "metadata": "root.test_gcm_dec_badassoc", "header": "['module', '___EOS___']", "index": 470 }, { "content": "def test_gcm_dec_badkey(aesenc):\n aes, enc, ciphertext, tag = aesenc\n\n dec = aes.dec(key=b\"B\"*16, iv=b\"A\"*16)\n dec.update_associated(b\"Hello\")\n plaintext = dec.update(ciphertext)\n\n dec.set_tag(tag)\n\n with pytest.raises(Exception) as excinfo:\n dec.finalize()\n assert \"Cipher\" in str(excinfo.value)", "metadata": "root.test_gcm_dec_badkey", "header": "['module', '___EOS___']", "index": 483 }, { "content": "def test_gcm_dec_badiv(aesenc):\n aes, enc, ciphertext, tag = aesenc\n dec = aes.dec(key=b\"A\"*16, iv=b\"B\"*16)\n dec.update_associated(b\"Hello\")\n plaintext = dec.update(ciphertext)\n\n dec.set_tag(tag)\n\n with pytest.raises(Exception) as excinfo:\n dec.finalize()\n assert \"Cipher\" in str(excinfo.value)", "metadata": "root.test_gcm_dec_badiv", "header": "['module', '___EOS___']", "index": 496 }, { "content": "def test_aes_gcm_different_IV():\n aes = Cipher(\"aes-128-gcm\")\n\n enc = aes.op(key=b\"A\"*16, iv=b\"A\"*16)\n enc.update_associated(b\"Hello\")\n ciphertext = enc.update(b\"World!\")\n c2 = enc.finalize()\n tag = enc.get_tag(16)\n\n enc = aes.op(key=b\"A\"*16, iv=b\"A\"*16)\n enc.update_associated(b\"Hello\")\n ciphertext2 = enc.update(b\"World!\")\n c2 = enc.finalize()\n tag2 = enc.get_tag(16)\n\n enc = aes.op(key=b\"A\"*16, iv=b\"B\"*16)\n enc.update_associated(b\"Hello\")\n ciphertext3 = enc.update(b\"World!\")\n c2 = enc.finalize()\n tag3 = enc.get_tag(16)\n\n assert ciphertext == ciphertext2\n assert ciphertext != ciphertext3", "metadata": "root.test_aes_gcm_different_IV", "header": "['module', '___EOS___']", "index": 532 } ]
[ { "span": "aes ", "start_line": 352, "start_column": 8, "end_line": 352, "end_column": 11 }, { "span": "ciphertext ", "start_line": 404, "start_column": 4, "end_line": 404, "end_column": 14 }, { "span": "ciphertext ", "start_line": 418, "start_column": 4, "end_line": 418, "end_column": 14 }, { "span": "ciphertext ", "start_line": 433, "start_column": 4, "end_line": 433, "end_column": 14 }, { "span": "plaintext ", "start_line": 475, "start_column": 4, "end_line": 475, "end_column": 13 }, { "span": "plaintext ", "start_line": 488, "start_column": 4, "end_line": 488, "end_column": 13 }, { "span": "plaintext ", "start_line": 500, "start_column": 4, "end_line": 500, "end_column": 13 }, { "span": "tag ", "start_line": 539, "start_column": 4, "end_line": 539, "end_column": 7 }, { "span": "tag2 ", "start_line": 545, "start_column": 4, "end_line": 545, "end_column": 8 }, { "span": "c2 ", "start_line": 550, "start_column": 4, "end_line": 550, "end_column": 6 }, { "span": "tag3 ", "start_line": 551, "start_column": 4, "end_line": 551, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "errors_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Exception_", ")_", "as_", "excinfo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", "=_", "Cipher_", "(_", "\"", "AE", "S", "-1", "2", "8", "-", "XX", "F", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "'", "Un", "know", "n", "'_", "in_", "str_", "(_", "excinfo_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "aes", "\\u", "gcm", "\\u", "encrypt_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", "=_", "Cipher_", "._", "aes", "\\u", "128", "\\u", "gcm", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "aes", "_", "._", "gcm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "=_", "aes", "_", "._", "op_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ",_", "iv_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ciphertext_", "=_", "enc_", "._", "update_", "(_", "b", "\"", "Wor", "ld", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "enc_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c2_", "==_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "enc_", "._", "get", "\\u", "tag_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "tag_", ")_", "==_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "aes", "\\u", "gcm", "\\u", "encrypt", "\\u", "192_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", "=_", "Cipher_", "._", "aes", "\\u", "192", "\\u", "gcm", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "aes", "_", "._", "gcm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "=_", "aes", "_", "._", "op_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "24_", ",_", "iv_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ciphertext_", "=_", "enc_", "._", "update_", "(_", "b", "\"", "Wor", "ld", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "enc_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c2_", "==_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "enc_", "._", "get", "\\u", "tag_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "tag_", ")_", "==_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "aes", "\\u", "gcm", "\\u", "encrypt", "\\u", "256_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", "=_", "Cipher_", "._", "aes", "\\u", "256", "\\u", "gcm", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "aes", "_", "._", "gcm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "=_", "aes", "_", "._", "op_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "32_", ",_", "iv_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ciphertext_", "=_", "enc_", "._", "update_", "(_", "b", "\"", "Wor", "ld", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "enc_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c2_", "==_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "enc_", "._", "get", "\\u", "tag_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "tag_", ")_", "==_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gcm", "\\u", "dec", "\\u", "bad", "assoc_", "(_", "aes", "enc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", ",_", "enc_", ",_", "ciphertext_", ",_", "tag_", "=_", "aes", "enc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dec_", "=_", "aes", "_", "._", "dec_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ",_", "iv_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "H", "4", "llo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plaintext_", "=_", "dec_", "._", "update_", "(_", "ciphertext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dec_", "._", "set\\u", "tag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Exception_", ")_", "as_", "excinfo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dec_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "\"", "Ci", "pher", "\"_", "in_", "str_", "(_", "excinfo_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gcm", "\\u", "dec", "\\u", "bad", "key_", "(_", "aes", "enc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", ",_", "enc_", ",_", "ciphertext_", ",_", "tag_", "=_", "aes", "enc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dec_", "=_", "aes", "_", "._", "dec_", "(_", "key_", "=_", "b", "\"", "B", "\"_", "*_", "16_", ",_", "iv_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plaintext_", "=_", "dec_", "._", "update_", "(_", "ciphertext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dec_", "._", "set\\u", "tag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Exception_", ")_", "as_", "excinfo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dec_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "\"", "Ci", "pher", "\"_", "in_", "str_", "(_", "excinfo_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gcm", "\\u", "dec", "\\u", "bad", "iv_", "(_", "aes", "enc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", ",_", "enc_", ",_", "ciphertext_", ",_", "tag_", "=_", "aes", "enc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "=_", "aes", "_", "._", "dec_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ",_", "iv_", "=_", "b", "\"", "B", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plaintext_", "=_", "dec_", "._", "update_", "(_", "ciphertext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dec_", "._", "set\\u", "tag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Exception_", ")_", "as_", "excinfo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dec_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "\"", "Ci", "pher", "\"_", "in_", "str_", "(_", "excinfo_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "aes", "\\u", "gcm", "\\u", "different", "\\u", "IV", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aes", "_", "=_", "Cipher_", "(_", "\"", "aes", "-1", "2", "8", "-", "gcm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "=_", "aes", "_", "._", "op_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ",_", "iv_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ciphertext_", "=_", "enc_", "._", "update_", "(_", "b", "\"", "Wor", "ld", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "enc_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "enc_", "._", "get", "\\u", "tag_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "=_", "aes", "_", "._", "op_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ",_", "iv_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cipher", "text2_", "=_", "enc_", "._", "update_", "(_", "b", "\"", "Wor", "ld", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "enc_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "2_", "=_", "enc_", "._", "get", "\\u", "tag_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enc_", "=_", "aes", "_", "._", "op_", "(_", "key_", "=_", "b", "\"", "A", "\"_", "*_", "16_", ",_", "iv_", "=_", "b", "\"", "B", "\"_", "*_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc_", "._", "update", "\\u", "associate", "d_", "(_", "b", "\"", "Hell", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cipher", "text", "3_", "=_", "enc_", "._", "update_", "(_", "b", "\"", "Wor", "ld", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "enc_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "3_", "=_", "enc_", "._", "get", "\\u", "tag_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ciphertext_", "==_", "cipher", "text2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ciphertext_", "!=_", "cipher", "text", "3_", "\\u\\u\\uNEWLINE\\u\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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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 ]
Unused import
AppScale/appscale/AppServer/google/appengine/ext/preload/__init__.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\n\n\n\"\"\"Preloads many modules to reduce loading time of third-party code.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport os\n_original_os_urandom = os.urandom\nos.urandom = os_urandom_replacement\nimport random\n\n\n\nos.urandom = _original_os_urandom\nrandom._urandom = _original_os_urandom\n\n\nimport BaseHTTPServer\nimport Bastion\nimport CGIHTTPServer\nimport ConfigParser\nimport Cookie\nimport DocXMLRPCServer\nimport HTMLParser\nimport MimeWriter\nimport Queue\nimport SimpleHTTPServer\nimport SimpleXMLRPCServer\nimport SocketServer\nimport StringIO\nimport UserDict\nimport UserList\nimport UserString\nimport aifc\nimport anydbm\n\n\nimport atexit\nimport audiodev\nimport base64\nimport bdb\nimport binhex\nimport bisect\nimport bz2\n\nimport calendar\nimport cgi\nimport cgitb\nimport chunk\nimport cmd\nimport code\nimport codecs\nimport codeop\nimport colorsys\nimport commands\n\n\nimport cookielib\nimport copy\nimport copy_reg\nimport csv\nimport datetime\n\n\nimport difflib\nimport dircache\nimport dis\nimport doctest\nimport dumbdbm\nimport filecmp\nimport fileinput\nimport fnmatch\nimport formatter\nimport fpformat\nimport ftplib\n\nimport getopt\nimport getpass\nimport gettext\nimport glob\n\nimport gzip\n\nimport heapq\nimport hmac\nimport htmlentitydefs\nimport htmllib\nimport httplib\n\nimport imaplib\nimport imghdr\nimport imputil\nimport inspect\nimport keyword\nimport linecache\nimport locale\nimport logging\nimport macpath\nimport macurl2path\nimport mailbox\nimport mailcap\nimport markupbase\nimport math\nimport md5\nimport mhlib\nimport mimetools\nimport mimetypes\n\nimport modulefinder\nimport multifile\nimport mutex\nimport netrc\nimport new\nimport nntplib\nimport ntpath\nimport nturl2path\nimport opcode\nimport optparse\nimport os2emxpath\nimport pdb\nimport pickle\nimport pickletools\nimport pipes\nimport pkgutil\n\nimport popen2\nimport poplib\n\nimport posixpath\nimport pprint\nimport profile\nimport pstats\n\n\nimport pyclbr\nimport pydoc\nimport quopri\nimport re\nimport repr\n\nimport rfc822\n\nimport robotparser\n\nimport sched\nimport sets\nimport sgmllib\nimport sha\nimport shelve\nimport shlex\nimport shutil\nimport site\n\nimport smtplib\nimport sndhdr\nimport socket\n\n\n\n\nimport stat\nimport statvfs\nimport string\nimport stringold\nimport stringprep\nimport struct\n\nimport sunau\nimport sunaudio\nimport symbol\n\nimport sys\nimport tabnanny\nimport tarfile\nimport telnetlib\nimport tempfile\nimport textwrap\n\nimport time\nimport timeit\nimport toaiff\nimport token\nimport tokenize\nimport trace\nimport traceback\n\nimport types\nimport unittest\nimport urllib\nimport urllib2\nimport urlparse\n\nimport uu\nimport uuid\nimport warnings\nimport wave\nimport weakref\n\nimport whichdb\nimport xdrlib\nimport xml.parsers.expat\nimport xml.dom\nimport xml.sax\n\nimport xmlrpclib\nimport zipfile\nimport zlib\n\n\n\nimport neo_cs\nimport neo_util\nimport webob\nimport wsgiref.handlers\n\n\nfrom google.appengine.api import datastore\nfrom google.appengine.api import files\nfrom google.appengine.api import images\nfrom google.appengine.api import mail\nfrom google.appengine.api import memcache\nfrom google.appengine.api import runtime\nfrom google.appengine.api import taskqueue\nfrom google.appengine.api import urlfetch\nfrom google.appengine.api import users\n\n\nfrom google.appengine.ext import bulkload\nfrom google.appengine.ext import db\nfrom google.appengine.ext import gql\nfrom google.appengine.ext import search\nfrom google.appengine.ext import webapp\n\n\nfrom google.appengine.runtime import apiproxy\n\nif __name__ == '__main__':\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def os_urandom_replacement(n):\n raise NotImplementedError", "metadata": "root.os_urandom_replacement", "header": "['module', '___EOS___']", "index": 38 } ]
[ { "span": "import BaseHTTPServer", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 21 }, { "span": "import Bastion", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 14 }, { "span": "import CGIHTTPServer", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 20 }, { "span": "import ConfigParser", "start_line": 52, "start_column": 0, "end_line": 52, "end_column": 19 }, { "span": "import Cookie", "start_line": 53, "start_column": 0, "end_line": 53, "end_column": 13 }, { "span": "import DocXMLRPCServer", "start_line": 54, "start_column": 0, "end_line": 54, "end_column": 22 }, { "span": "import HTMLParser", "start_line": 55, "start_column": 0, "end_line": 55, "end_column": 17 }, { "span": "import MimeWriter", "start_line": 56, "start_column": 0, "end_line": 56, "end_column": 17 }, { "span": "import Queue", "start_line": 57, "start_column": 0, "end_line": 57, "end_column": 12 }, { "span": "import SimpleHTTPServer", "start_line": 58, "start_column": 0, "end_line": 58, "end_column": 23 }, { "span": "import SimpleXMLRPCServer", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 25 }, { "span": "import SocketServer", "start_line": 60, "start_column": 0, "end_line": 60, "end_column": 19 }, { "span": "import StringIO", "start_line": 61, "start_column": 0, "end_line": 61, "end_column": 15 }, { "span": "import UserDict", "start_line": 62, "start_column": 0, "end_line": 62, "end_column": 15 }, { "span": "import UserList", "start_line": 63, "start_column": 0, "end_line": 63, "end_column": 15 }, { "span": "import UserString", "start_line": 64, "start_column": 0, "end_line": 64, "end_column": 17 }, { "span": "import aifc", "start_line": 65, "start_column": 0, "end_line": 65, "end_column": 11 }, { "span": "import anydbm", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 13 }, { "span": "import atexit", "start_line": 69, "start_column": 0, "end_line": 69, "end_column": 13 }, { "span": "import audiodev", "start_line": 70, "start_column": 0, "end_line": 70, "end_column": 15 }, { "span": "import base64", "start_line": 71, "start_column": 0, "end_line": 71, "end_column": 13 }, { "span": "import bdb", "start_line": 72, "start_column": 0, "end_line": 72, "end_column": 10 }, { "span": "import binhex", "start_line": 73, "start_column": 0, "end_line": 73, "end_column": 13 }, { "span": "import bisect", "start_line": 74, "start_column": 0, "end_line": 74, "end_column": 13 }, { "span": "import bz2", "start_line": 75, "start_column": 0, "end_line": 75, "end_column": 10 }, { "span": "import calendar", "start_line": 77, "start_column": 0, "end_line": 77, "end_column": 15 }, { "span": "import cgi", "start_line": 78, "start_column": 0, "end_line": 78, "end_column": 10 }, { "span": "import cgitb", "start_line": 79, "start_column": 0, "end_line": 79, "end_column": 12 }, { "span": "import chunk", "start_line": 80, "start_column": 0, "end_line": 80, "end_column": 12 }, { "span": "import cmd", "start_line": 81, "start_column": 0, "end_line": 81, "end_column": 10 }, { "span": "import code", "start_line": 82, "start_column": 0, "end_line": 82, "end_column": 11 }, { "span": "import codecs", "start_line": 83, "start_column": 0, "end_line": 83, "end_column": 13 }, { "span": "import codeop", "start_line": 84, "start_column": 0, "end_line": 84, "end_column": 13 }, { "span": "import colorsys", "start_line": 85, "start_column": 0, "end_line": 85, "end_column": 15 }, { "span": "import commands", "start_line": 86, "start_column": 0, "end_line": 86, "end_column": 15 }, { "span": "import cookielib", "start_line": 89, "start_column": 0, "end_line": 89, "end_column": 16 }, { "span": "import copy", "start_line": 90, "start_column": 0, "end_line": 90, "end_column": 11 }, { "span": "import copy_reg", "start_line": 91, "start_column": 0, "end_line": 91, "end_column": 15 }, { "span": "import csv", "start_line": 92, "start_column": 0, "end_line": 92, "end_column": 10 }, { "span": "import datetime", "start_line": 93, "start_column": 0, "end_line": 93, "end_column": 15 }, { "span": "import difflib", "start_line": 96, "start_column": 0, "end_line": 96, "end_column": 14 }, { "span": "import dircache", "start_line": 97, "start_column": 0, "end_line": 97, "end_column": 15 }, { "span": "import dis", "start_line": 98, "start_column": 0, "end_line": 98, "end_column": 10 }, { "span": "import doctest", "start_line": 99, "start_column": 0, "end_line": 99, "end_column": 14 }, { "span": "import dumbdbm", "start_line": 100, "start_column": 0, "end_line": 100, "end_column": 14 }, { "span": "import filecmp", "start_line": 101, "start_column": 0, "end_line": 101, "end_column": 14 }, { "span": "import fileinput", "start_line": 102, "start_column": 0, "end_line": 102, "end_column": 16 }, { "span": "import fnmatch", "start_line": 103, "start_column": 0, "end_line": 103, "end_column": 14 }, { "span": "import formatter", "start_line": 104, "start_column": 0, "end_line": 104, "end_column": 16 }, { "span": "import fpformat", "start_line": 105, "start_column": 0, "end_line": 105, "end_column": 15 }, { "span": "import ftplib", "start_line": 106, "start_column": 0, "end_line": 106, "end_column": 13 }, { "span": "import getopt", "start_line": 108, "start_column": 0, "end_line": 108, "end_column": 13 }, { "span": "import getpass", "start_line": 109, "start_column": 0, "end_line": 109, "end_column": 14 }, { "span": "import gettext", "start_line": 110, "start_column": 0, "end_line": 110, "end_column": 14 }, { "span": "import glob", "start_line": 111, "start_column": 0, "end_line": 111, "end_column": 11 }, { "span": "import gzip", "start_line": 113, "start_column": 0, "end_line": 113, "end_column": 11 }, { "span": "import heapq", "start_line": 115, "start_column": 0, "end_line": 115, "end_column": 12 }, { "span": "import hmac", "start_line": 116, "start_column": 0, "end_line": 116, "end_column": 11 }, { "span": "import htmlentitydefs", "start_line": 117, "start_column": 0, "end_line": 117, "end_column": 21 }, { "span": "import htmllib", "start_line": 118, "start_column": 0, "end_line": 118, "end_column": 14 }, { "span": "import httplib", "start_line": 119, "start_column": 0, "end_line": 119, "end_column": 14 }, { "span": "import imaplib", "start_line": 121, "start_column": 0, "end_line": 121, "end_column": 14 }, { "span": "import imghdr", "start_line": 122, "start_column": 0, "end_line": 122, "end_column": 13 }, { "span": "import imputil", "start_line": 123, "start_column": 0, "end_line": 123, "end_column": 14 }, { "span": "import inspect", "start_line": 124, "start_column": 0, "end_line": 124, "end_column": 14 }, { "span": "import keyword", "start_line": 125, "start_column": 0, "end_line": 125, "end_column": 14 }, { "span": "import linecache", "start_line": 126, "start_column": 0, "end_line": 126, "end_column": 16 }, { "span": "import locale", "start_line": 127, "start_column": 0, "end_line": 127, "end_column": 13 }, { "span": "import logging", "start_line": 128, "start_column": 0, "end_line": 128, "end_column": 14 }, { "span": "import macpath", "start_line": 129, "start_column": 0, "end_line": 129, "end_column": 14 }, { "span": "import macurl2path", "start_line": 130, "start_column": 0, "end_line": 130, "end_column": 18 }, { "span": "import mailbox", "start_line": 131, "start_column": 0, "end_line": 131, "end_column": 14 }, { "span": "import mailcap", "start_line": 132, "start_column": 0, "end_line": 132, "end_column": 14 }, { "span": "import markupbase", "start_line": 133, "start_column": 0, "end_line": 133, "end_column": 17 }, { "span": "import math", "start_line": 134, "start_column": 0, "end_line": 134, "end_column": 11 }, { "span": "import md5", "start_line": 135, "start_column": 0, "end_line": 135, "end_column": 10 }, { "span": "import mhlib", "start_line": 136, "start_column": 0, "end_line": 136, "end_column": 12 }, { "span": "import mimetools", "start_line": 137, "start_column": 0, "end_line": 137, "end_column": 16 }, { "span": "import mimetypes", "start_line": 138, "start_column": 0, "end_line": 138, "end_column": 16 }, { "span": "import modulefinder", "start_line": 140, "start_column": 0, "end_line": 140, "end_column": 19 }, { "span": "import multifile", "start_line": 141, "start_column": 0, "end_line": 141, "end_column": 16 }, { "span": "import mutex", "start_line": 142, "start_column": 0, "end_line": 142, "end_column": 12 }, { "span": "import netrc", "start_line": 143, "start_column": 0, "end_line": 143, "end_column": 12 }, { "span": "import new", "start_line": 144, "start_column": 0, "end_line": 144, "end_column": 10 }, { "span": "import nntplib", "start_line": 145, "start_column": 0, "end_line": 145, "end_column": 14 }, { "span": "import ntpath", "start_line": 146, "start_column": 0, "end_line": 146, "end_column": 13 }, { "span": "import nturl2path", "start_line": 147, "start_column": 0, "end_line": 147, "end_column": 17 }, { "span": "import opcode", "start_line": 148, "start_column": 0, "end_line": 148, "end_column": 13 }, { "span": "import optparse", "start_line": 149, "start_column": 0, "end_line": 149, "end_column": 15 }, { "span": "import os2emxpath", "start_line": 150, "start_column": 0, "end_line": 150, "end_column": 17 }, { "span": "import pdb", "start_line": 151, "start_column": 0, "end_line": 151, "end_column": 10 }, { "span": "import pickle", "start_line": 152, "start_column": 0, "end_line": 152, "end_column": 13 }, { "span": "import pickletools", "start_line": 153, "start_column": 0, "end_line": 153, "end_column": 18 }, { "span": "import pipes", "start_line": 154, "start_column": 0, "end_line": 154, "end_column": 12 }, { "span": "import pkgutil", "start_line": 155, "start_column": 0, "end_line": 155, "end_column": 14 }, { "span": "import popen2", "start_line": 157, "start_column": 0, "end_line": 157, "end_column": 13 }, { "span": "import poplib", "start_line": 158, "start_column": 0, "end_line": 158, "end_column": 13 }, { "span": "import posixpath", "start_line": 160, "start_column": 0, "end_line": 160, "end_column": 16 }, { "span": "import pprint", "start_line": 161, "start_column": 0, "end_line": 161, "end_column": 13 }, { "span": "import profile", "start_line": 162, "start_column": 0, "end_line": 162, "end_column": 14 }, { "span": "import pstats", "start_line": 163, "start_column": 0, "end_line": 163, "end_column": 13 }, { "span": "import pyclbr", "start_line": 166, "start_column": 0, "end_line": 166, "end_column": 13 }, { "span": "import pydoc", "start_line": 167, "start_column": 0, "end_line": 167, "end_column": 12 }, { "span": "import quopri", "start_line": 168, "start_column": 0, "end_line": 168, "end_column": 13 }, { "span": "import re", "start_line": 169, "start_column": 0, "end_line": 169, "end_column": 9 }, { "span": "import repr", "start_line": 170, "start_column": 0, "end_line": 170, "end_column": 11 }, { "span": "import rfc822", "start_line": 172, "start_column": 0, "end_line": 172, "end_column": 13 }, { "span": "import robotparser", "start_line": 174, "start_column": 0, "end_line": 174, "end_column": 18 }, { "span": "import sched", "start_line": 176, "start_column": 0, "end_line": 176, "end_column": 12 }, { "span": "import sets", "start_line": 177, "start_column": 0, "end_line": 177, "end_column": 11 }, { "span": "import sgmllib", "start_line": 178, "start_column": 0, "end_line": 178, "end_column": 14 }, { "span": "import sha", "start_line": 179, "start_column": 0, "end_line": 179, "end_column": 10 }, { "span": "import shelve", "start_line": 180, "start_column": 0, "end_line": 180, "end_column": 13 }, { "span": "import shlex", "start_line": 181, "start_column": 0, "end_line": 181, "end_column": 12 }, { "span": "import shutil", "start_line": 182, "start_column": 0, "end_line": 182, "end_column": 13 }, { "span": "import site", "start_line": 183, "start_column": 0, "end_line": 183, "end_column": 11 }, { "span": "import smtplib", "start_line": 185, "start_column": 0, "end_line": 185, "end_column": 14 }, { "span": "import sndhdr", "start_line": 186, "start_column": 0, "end_line": 186, "end_column": 13 }, { "span": "import socket", "start_line": 187, "start_column": 0, "end_line": 187, "end_column": 13 }, { "span": "import stat", "start_line": 192, "start_column": 0, "end_line": 192, "end_column": 11 }, { "span": "import statvfs", "start_line": 193, "start_column": 0, "end_line": 193, "end_column": 14 }, { "span": "import string", "start_line": 194, "start_column": 0, "end_line": 194, "end_column": 13 }, { "span": "import stringold", "start_line": 195, "start_column": 0, "end_line": 195, "end_column": 16 }, { "span": "import stringprep", "start_line": 196, "start_column": 0, "end_line": 196, "end_column": 17 }, { "span": "import struct", "start_line": 197, "start_column": 0, "end_line": 197, "end_column": 13 }, { "span": "import sunau", "start_line": 199, "start_column": 0, "end_line": 199, "end_column": 12 }, { "span": "import sunaudio", "start_line": 200, "start_column": 0, "end_line": 200, "end_column": 15 }, { "span": "import symbol", "start_line": 201, "start_column": 0, "end_line": 201, "end_column": 13 }, { "span": "import sys", "start_line": 203, "start_column": 0, "end_line": 203, "end_column": 10 }, { "span": "import tabnanny", "start_line": 204, "start_column": 0, "end_line": 204, "end_column": 15 }, { "span": "import tarfile", "start_line": 205, "start_column": 0, "end_line": 205, "end_column": 14 }, { "span": "import telnetlib", "start_line": 206, "start_column": 0, "end_line": 206, "end_column": 16 }, { "span": "import tempfile", "start_line": 207, "start_column": 0, "end_line": 207, "end_column": 15 }, { "span": "import textwrap", "start_line": 208, "start_column": 0, "end_line": 208, "end_column": 15 }, { "span": "import time", "start_line": 210, "start_column": 0, "end_line": 210, "end_column": 11 }, { "span": "import timeit", "start_line": 211, "start_column": 0, "end_line": 211, "end_column": 13 }, { "span": "import toaiff", "start_line": 212, "start_column": 0, "end_line": 212, "end_column": 13 }, { "span": "import token", "start_line": 213, "start_column": 0, "end_line": 213, "end_column": 12 }, { "span": "import tokenize", "start_line": 214, "start_column": 0, "end_line": 214, "end_column": 15 }, { "span": "import trace", "start_line": 215, "start_column": 0, "end_line": 215, "end_column": 12 }, { "span": "import traceback", "start_line": 216, "start_column": 0, "end_line": 216, "end_column": 16 }, { "span": "import types", "start_line": 218, "start_column": 0, "end_line": 218, "end_column": 12 }, { "span": "import unittest", "start_line": 219, "start_column": 0, "end_line": 219, "end_column": 15 }, { "span": "import urllib", "start_line": 220, "start_column": 0, "end_line": 220, "end_column": 13 }, { "span": "import urllib2", "start_line": 221, "start_column": 0, "end_line": 221, "end_column": 14 }, { "span": "import urlparse", "start_line": 222, "start_column": 0, "end_line": 222, "end_column": 15 }, { "span": "import uu", "start_line": 224, "start_column": 0, "end_line": 224, "end_column": 9 }, { "span": "import uuid", "start_line": 225, "start_column": 0, "end_line": 225, "end_column": 11 }, { "span": "import warnings", "start_line": 226, "start_column": 0, "end_line": 226, "end_column": 15 }, { "span": "import wave", "start_line": 227, "start_column": 0, "end_line": 227, "end_column": 11 }, { "span": "import weakref", "start_line": 228, "start_column": 0, "end_line": 228, "end_column": 14 }, { "span": "import whichdb", "start_line": 230, "start_column": 0, "end_line": 230, "end_column": 14 }, { "span": "import xdrlib", "start_line": 231, "start_column": 0, "end_line": 231, "end_column": 13 }, { "span": "import xml.parsers.expat", "start_line": 232, "start_column": 0, "end_line": 232, "end_column": 24 }, { "span": "import xml.dom", "start_line": 233, "start_column": 0, "end_line": 233, "end_column": 14 }, { "span": "import xml.sax", "start_line": 234, "start_column": 0, "end_line": 234, "end_column": 14 }, { "span": "import xmlrpclib", "start_line": 236, "start_column": 0, "end_line": 236, "end_column": 16 }, { "span": "import zipfile", "start_line": 237, "start_column": 0, "end_line": 237, "end_column": 14 }, { "span": "import zlib", "start_line": 238, "start_column": 0, "end_line": 238, "end_column": 11 }, { "span": "import neo_cs", "start_line": 242, "start_column": 0, "end_line": 242, "end_column": 13 }, { "span": "import neo_util", "start_line": 243, "start_column": 0, "end_line": 243, "end_column": 15 }, { "span": "import webob", "start_line": 244, "start_column": 0, "end_line": 244, "end_column": 12 }, { "span": "import wsgiref.handlers", "start_line": 245, "start_column": 0, "end_line": 245, "end_column": 23 }, { "span": "from google.appengine.api import datastore", "start_line": 248, "start_column": 0, "end_line": 248, "end_column": 42 }, { "span": "from google.appengine.api import files", "start_line": 249, "start_column": 0, "end_line": 249, "end_column": 38 }, { "span": "from google.appengine.api import images", "start_line": 250, "start_column": 0, "end_line": 250, "end_column": 39 }, { "span": "from google.appengine.api import mail", "start_line": 251, "start_column": 0, "end_line": 251, "end_column": 37 }, { "span": "from google.appengine.api import memcache", "start_line": 252, "start_column": 0, "end_line": 252, "end_column": 41 }, { "span": "from google.appengine.api import runtime", "start_line": 253, "start_column": 0, "end_line": 253, "end_column": 40 }, { "span": "from google.appengine.api import taskqueue", "start_line": 254, "start_column": 0, "end_line": 254, "end_column": 42 }, { "span": "from google.appengine.api import urlfetch", "start_line": 255, "start_column": 0, "end_line": 255, "end_column": 41 }, { "span": "from google.appengine.api import users", "start_line": 256, "start_column": 0, "end_line": 256, "end_column": 38 }, { "span": "from google.appengine.ext import bulkload", "start_line": 259, "start_column": 0, "end_line": 259, "end_column": 41 }, { "span": "from google.appengine.ext import db", "start_line": 260, "start_column": 0, "end_line": 260, "end_column": 35 }, { "span": "from google.appengine.ext import gql", "start_line": 261, "start_column": 0, "end_line": 261, "end_column": 36 }, { "span": "from google.appengine.ext import search", "start_line": 262, "start_column": 0, "end_line": 262, "end_column": 39 }, { "span": "from google.appengine.ext import webapp", "start_line": 263, "start_column": 0, "end_line": 263, "end_column": 39 }, { "span": "from google.appengine.runtime import apiproxy", "start_line": 266, "start_column": 0, "end_line": 266, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Pre", "load", "s", " ", "many", " ", "module", "s", " ", "to", " ", "reduce", " ", "load", "ing", " ", "time", " ", "of", " ", "third", "-", "part", "y", " ", "code", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "original", "\\u", "os", "\\u", "urandom_", "=_", "os_", "._", "urandom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "urandom_", "=_", "os", "\\u", "uran", "dom", "\\u", "replacement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "urandom_", "=_", "\\u", "original", "\\u", "os", "\\u", "urandom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "\\u", "urandom_", "=_", "\\u", "original", "\\u", "os", "\\u", "urandom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Base", "HTTP", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Bas", "tion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "CGI", "HTTP", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Cookie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Doc", "XMLRPC", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "HTM", "LP", "arser", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Mim", "e", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Simple", "HTTP", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Simple", "XMLRPC", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Sock", "et", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "User", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "User", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "User", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "aif", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "any", "dbm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "atexit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "audio", "dev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bdb", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bin", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bisect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bz2", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "calendar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cgi", "tb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chunk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "code", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "colors", "ys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "commands_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cookie", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy", "\\u", "reg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "difflib", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dir", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dumb", "dbm", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "filec", "mp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fileinput_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fnmatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "formatter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fp", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ftp", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gettext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "heapq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hmac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "html", "entity", "defs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "html", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "imap", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "img", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imput", "il_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "linec", "ache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mac", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mac", "url2", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mailbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mail", "cap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "markup", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mh", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mime", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "module", "finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multi", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mutex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "net", "rc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nn", "tpl", "ib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ntpath", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ntu", "rl", "2p", "ath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "opcode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os", "2e", "mx", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pipes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "popen", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pop", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "posixpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pstat", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyc", "lbr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pydo", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "quo", "pri", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "repr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "rfc", "822", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "robot", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sched_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sg", "ml", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shelve", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shlex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "smtplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "snd", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stat", "vfs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string", "old_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string", "prep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sun", "au_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sun", "audio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tab", "nan", "ny_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tarfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "telnet", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "timeit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "toa", "iff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tokenize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "trace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "uu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wave_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "weakref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "whi", "chd", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xdr", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "parsers_", "._", "expa", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "sax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "xmlrpclib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "neo", "\\u", "cs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "neo", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wsgi", "ref_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datastore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "memcache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "runtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "task", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "urlf", "etch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "bul", "kl", "oad", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "gq", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "webapp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "runtime_", "import_", "api", "proxy_", "\\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 ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "os", "\\u", "uran", "dom", "\\u", "replacement_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\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, 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1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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, 4, 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
BD2KGenomics/toil/src/toil/test/src/resourceTest.py
[ { "content": " def _testExternal(self, moduleName, pyFiles):\n dirPath = self._createTempDir()\n pycFiles = set(pyFile + 'c' for pyFile in pyFiles)\n for relPath in pyFiles:\n path = os.path.join(dirPath, relPath)\n mkdir_p(os.path.dirname(path))\n with open(path, 'w') as f:\n f.write('pass\\n')\n sys.path.append(dirPath)\n try:\n userScript = importlib.import_module(moduleName)\n try:\n self._test(userScript.__name__, expectedContents=pycFiles)\n finally:\n del userScript\n del sys.modules[moduleName]\n self.assertFalse(moduleName in sys.modules)\n finally:\n sys.path.remove(dirPath)", "metadata": "root.ResourceTest._testExternal", "header": "['class', 'ResourceTest', '(', 'ToilTest', ')', ':', '___EOS___']", "index": 50 } ]
[ { "span": "self.assertFalse(moduleName in sys.modules)", "start_line": 66, "start_column": 12, "end_line": 66, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Reso", "urc", "e", "Test_", "(_", "To", "il", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Exter", "nal_", "(_", "self_", ",_", "module", "Name_", ",_", "py", "Files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dir", "Path_", "=_", "self_", "._", "\\u", "create", "Temp", "Dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyc", "Files_", "=_", "set_", "(_", "py", "File_", "+_", "'", "c", "'_", "for_", "py", "File_", "in_", "py", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rel", "Path_", "in_", "py", "Files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir", "Path_", ",_", "rel", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mkd", "ir", "\\u", "p_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'", "pass", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "dir", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Script_", "=_", "importlib_", "._", "import", "\\u", "module_", "(_", "module", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "test_", "(_", "user", "Script_", "._", "\\u\\u", "name\\u\\u_", ",_", "expected", "Contents_", "=_", "pyc", "Files_", ")_", "\\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 ", " _", "del_", "user", "Script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "sys_", "._", "modules_", "[_", "module", "Name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "module", "Name_", "in_", "sys_", "._", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "remove_", "(_", "dir", "Path_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
albatrossandco/brubeck_cms/brubeck/blogs/search_indexes.py
[ { "content": " def\tprepare_byline(self, obj):\n try:\n \t return \"%s %s\" % (obj.byline.first_name, obj.byline.last_name)\n except:\n return None", "metadata": "root.EntryIndex.prepare_byline", "header": "['class', 'EntryIndex', '(', 'indexes', '.', 'SearchIndex', ')', ':', '___EOS___']", "index": 29 }, { "content": " def\tprepare_byline_exact(self, obj):\n try:\n \t return \"%s %s\" % (obj.byline.first_name, obj.byline.last_name)\n except:\n return None", "metadata": "root.EntryIndex.prepare_byline_exact", "header": "['class', 'EntryIndex', '(', 'indexes', '.', 'SearchIndex', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "except:", "start_line": 32, "start_column": 8, "end_line": 32, "end_column": 15 }, { "span": "except:", "start_line": 38, "start_column": 8, "end_line": 38, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Entr", "y", "Index_", "(_", "indexes_", "._", "Sear", "ch", "Index_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "by", "line_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", "\t _", "return_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "obj_", "._", "by", "line_", "._", "first", "\\u", "name_", ",_", "obj_", "._", "by", "line_", "._", "last", "\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Entr", "y", "Index_", "(_", "indexes_", "._", "Sear", "ch", "Index_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "by", "line", "\\u", "exact_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", "\t _", "return_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "obj_", "._", "by", "line_", "._", "first", "\\u", "name_", ",_", "obj_", "._", "by", "line_", "._", "last", "\\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 ", " _", "return_", "None_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused local variable
sassoftware/conary/conary_test/localtest/deptabletest.py
[ { "content": " def testGetLocalProvides(self):\n db = self.openDatabase()\n baz = self.addDbComponent(db, 'baz:run', '1', '',\n provides=parseDep('trove:foo:run'))\n foo2 = self.addDbComponent(db, 'foo:run', '2', '',\n provides=parseDep('trove:foo:run'),\n requires=parseDep('trove:baz:run'))\n foo1 = self.addDbComponent(db, 'foo:run', '1', '',\n provides=parseDep('trove:foo:run'),\n requires=parseDep('trove:baz:run'))\n bar = self.addDbComponent(db, 'bar:run', '1', '',\n provides=parseDep('trove:bar:run'),\n requires=parseDep('trove:foo:run'))\n bam = self.addDbComponent(db, 'bam:run', '1', '',\n provides=parseDep('trove:bam:run'),\n requires=parseDep('trove:foo:run'))\n depSet = parseDep('trove:bam:run trove:bar:run')\n sols = db.getTrovesWithProvides([depSet], True)\n assert(sols[depSet] == [[bam.getNameVersionFlavor()],\n [bar.getNameVersionFlavor()]])", "metadata": "root.DepTableTestWithHelper.testGetLocalProvides", "header": "['class', 'DepTableTestWithHelper', '(', 'rephelp', '.', 'RepositoryHelper', ')', ':', '___EOS___']", "index": 277 } ]
[ { "span": "baz ", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 11 }, { "span": "foo2 ", "start_line": 281, "start_column": 8, "end_line": 281, "end_column": 12 }, { "span": "foo1 ", "start_line": 284, "start_column": 8, "end_line": 284, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Dep", "Table", "Test", "With", "Helper_", "(_", "rep", "help_", "._", "Repos", "itor", "y", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Get", "Local", "Prov", "ides", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "=_", "self_", "._", "open", "Database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baz_", "=_", "self_", "._", "add", "Db", "Component_", "(_", "db_", ",_", "'", "ba", "z", ":", "run", "'_", ",_", "'", "1", "'_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "foo", ":", "run", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "2_", "=_", "self_", "._", "add", "Db", "Component_", "(_", "db_", ",_", "'", "foo", ":", "run", "'_", ",_", "'", "2", "'_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "foo", ":", "run", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "ba", "z", ":", "run", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "1_", "=_", "self_", "._", "add", "Db", "Component_", "(_", "db_", ",_", "'", "foo", ":", "run", "'_", ",_", "'", "1", "'_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "foo", ":", "run", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "ba", "z", ":", "run", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar_", "=_", "self_", "._", "add", "Db", "Component_", "(_", "db_", ",_", "'", "bar", ":", "run", "'_", ",_", "'", "1", "'_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "bar", ":", "run", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "foo", ":", "run", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bam_", "=_", "self_", "._", "add", "Db", "Component_", "(_", "db_", ",_", "'", "bam", ":", "run", "'_", ",_", "'", "1", "'_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "bam", ":", "run", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "foo", ":", "run", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dep", "Set_", "=_", "parse", "Dep", "_", "(_", "'", "trove", ":", "bam", ":", "run", " ", "trove", ":", "bar", ":", "run", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sol", "s_", "=_", "db_", "._", "get", "Trove", "s", "With", "Prov", "ides", "_", "(_", "[_", "dep", "Set_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "sol", "s_", "[_", "dep", "Set_", "]_", "==_", "[_", "[_", "bam_", "._", "get", "Name", "Version", "Flavor_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "bar_", "._", "get", "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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 ]
Imprecise assert
bndr/pipreqs/tests/test_pipreqs.py
[ { "content": " def test_get_all_imports(self):\n imports = pipreqs.get_all_imports(self.project)\n self.assertEqual(len(imports), 13)\n for item in imports:\n self.assertTrue(\n item.lower() in self.modules, \"Import is missing: \" + item)\n self.assertFalse(\"time\" in imports)\n self.assertFalse(\"logging\" in imports)\n self.assertFalse(\"curses\" in imports)\n self.assertFalse(\"__future__\" in imports)\n self.assertFalse(\"django\" in imports)\n self.assertFalse(\"models\" in imports)", "metadata": "root.TestPipreqs.test_get_all_imports", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def test_deduplicate_dependencies(self):\n imports = pipreqs.get_all_imports(self.project_with_duplicated_deps)\n pkgs = pipreqs.get_pkg_names(imports)\n self.assertEqual(len(pkgs), 1)\n self.assertTrue(\"pymongo\" in pkgs)", "metadata": "root.TestPipreqs.test_deduplicate_dependencies", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_get_use_local_only(self):\n \"\"\"\n Test without checking PyPI, check to see if names of local imports matches what we expect\n\n - Note even though pyflakes isn't in requirements.txt,\n It's added to locals since it is a development dependency for testing\n \"\"\"\n # should find only docopt and requests\n imports_with_info = pipreqs.get_import_local(self.modules)\n for item in imports_with_info:\n self.assertTrue(item['name'].lower() in self.local)", "metadata": "root.TestPipreqs.test_get_use_local_only", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_init(self):\n \"\"\"\n Test that all modules we will test upon, are in requirements file\n \"\"\"\n pipreqs.init({'<path>': self.project, '--savepath': None,\n '--use-local': None, '--force': True, '--proxy':None, '--pypi-server':None})\n assert os.path.exists(self.requirements_path) == 1\n with open(self.requirements_path, \"r\") as f:\n data = f.read().lower()\n for item in self.modules[:-3]:\n self.assertTrue(item.lower() in data)", "metadata": "root.TestPipreqs.test_init", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 83 }, { "content": " def test_init_local_only(self):\n \"\"\"\n Test that items listed in requirements.text are the same as locals expected\n \"\"\"\n pipreqs.init({'<path>': self.project, '--savepath': None,\n '--use-local': True, '--force': True, '--proxy':None, '--pypi-server':None})\n assert os.path.exists(self.requirements_path) == 1\n with open(self.requirements_path, \"r\") as f:\n data = f.readlines()\n for item in data:\n item = item.strip().split(\" == \")\n self.assertTrue(item[0].lower() in self.local)", "metadata": "root.TestPipreqs.test_init_local_only", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_init_savepath(self):\n \"\"\"\n Test that we can save requiremnts.tt correctly to a different path\n \"\"\"\n pipreqs.init({'<path>': self.project, '--savepath':\n self.alt_requirement_path, '--use-local': None, '--proxy':None, '--pypi-server':None})\n assert os.path.exists(self.alt_requirement_path) == 1\n with open(self.alt_requirement_path, \"r\") as f:\n data = f.read().lower()\n for item in self.modules[:-3]:\n self.assertTrue(item.lower() in data)\n for item in self.modules2:\n self.assertTrue(item.lower() in data)", "metadata": "root.TestPipreqs.test_init_savepath", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 108 }, { "content": " def test_ignored_directory(self):\n \"\"\"\n Test --ignore parameter\n \"\"\"\n pipreqs.init(\n {'<path>': self.project_with_ignore_directory, '--savepath': None,\n '--use-local': None, '--force': True,\n '--proxy':None,\n '--pypi-server':None,\n '--ignore':'.ignored_dir,.ignore_second'\n }\n )\n with open(os.path.join(self.project_with_ignore_directory, \"requirements.txt\"), \"r\") as f:\n data = f.read().lower()\n for item in ['click', 'getpass']:\n self.assertFalse(item.lower() in data)", "metadata": "root.TestPipreqs.test_ignored_directory", "header": "['class', 'TestPipreqs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 154 } ]
[ { "span": "self.assertFalse(\"time\" in imports)", "start_line": 39, "start_column": 8, "end_line": 39, "end_column": 43 }, { "span": "self.assertFalse(\"logging\" in imports)", "start_line": 40, "start_column": 8, "end_line": 40, "end_column": 46 }, { "span": "self.assertFalse(\"curses\" in imports)", "start_line": 41, "start_column": 8, "end_line": 41, "end_column": 45 }, { "span": "self.assertFalse(\"__future__\" in imports)", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 49 }, { "span": "self.assertFalse(\"django\" in imports)", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 45 }, { "span": "self.assertFalse(\"models\" in imports)", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 45 }, { "span": "self.assertTrue(\"pymongo\" in pkgs)", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 42 }, { "span": "self.assertTrue(item['name'].lower() in self.local)", "start_line": 81, "start_column": 12, "end_line": 81, "end_column": 63 }, { "span": "self.assertTrue(item.lower() in data)", "start_line": 93, "start_column": 16, "end_line": 93, "end_column": 53 }, { "span": "self.assertTrue(item[0].lower() in self.local)", "start_line": 106, "start_column": 16, "end_line": 106, "end_column": 62 }, { "span": "self.assertTrue(item.lower() in data)", "start_line": 118, "start_column": 16, "end_line": 118, "end_column": 53 }, { "span": "self.assertTrue(item.lower() in data)", "start_line": 120, "start_column": 16, "end_line": 120, "end_column": 53 }, { "span": "self.assertFalse(item.lower() in data)", "start_line": 169, "start_column": 16, "end_line": 169, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "all", "\\u", "imports_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "imports_", "=_", "pip", "reqs_", "._", "get", "\\u", "all", "\\u", "imports_", "(_", "self_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "imports_", ")_", ",_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "imports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "item_", "._", "lower_", "(_", ")_", "in_", "self_", "._", "modules_", ",_", "\"", "Import", " ", "is", " ", "missi", "ng", ":", " ", "\"_", "+_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "time", "\"_", "in_", "imports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "logg", "ing", "\"_", "in_", "imports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "curse", "s", "\"_", "in_", "imports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"\\u\\u", "future", "\\u\\u\"_", "in_", "imports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "django", "\"_", "in_", "imports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "model", "s", "\"_", "in_", "imports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dedup", "licat", "e\\u", "dependencies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "imports_", "=_", "pip", "reqs_", "._", "get", "\\u", "all", "\\u", "imports_", "(_", "self_", "._", "project", "\\u", "with", "\\u", "duplicated", "\\u", "deps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkgs_", "=_", "pip", "reqs_", "._", "get", "\\u", "pkg", "\\u", "names_", "(_", "imports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "pkgs_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "pymong", "o", "\"_", "in_", "pkgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "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", "get", "\\u", "use", "\\u", "local", "\\u", "only_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "with", "out", " ", "checking", " ", "Py", "PI", ",", " ", "check", " ", "to", " ", "see", " ", "if", " ", "names", " ", "of", " ", "local", " ", "import", "s", " ", "matche", "s", " ", "what", " ", "we", " ", "expect", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Not", "e", " ", "even", " ", "tho", "ugh", " ", "pyfl", "ake", "s", " ", "isn", "'", "t", " ", "in", " ", "require", "ment", "s", ".", "txt", ",", "\\", "10", ";", " ", " ", "It", "'", "s", " ", "adde", "d", " ", "to", " ", "locals", " ", "sinc", "e", " ", "it", " ", "is", " ", "a", " ", "develop", "ment", " ", "dependen", "cy", " ", "for", " ", "testi", "ng", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shou", "ld", " ", "find", " ", "only", " ", "doc", "opt", " ", "and", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "import", "s", "\\u", "with", "\\u", "info_", "=_", "pip", "reqs_", "._", "get", "\\u", "import", "\\u", "local_", "(_", "self_", "._", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "import", "s", "\\u", "with", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "item_", "[_", "'", "name", "'_", "]_", "._", "lower_", "(_", ")_", "in_", "self_", "._", "local_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "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", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "all", " ", "module", "s", " ", "we", " ", "will", " ", "test", " ", "upo", "n", ",", " ", "are", " ", "in", " ", "require", "ment", "s", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pip", "reqs_", "._", "init_", "(_", "{_", "'<", "path", ">'_", ":_", "self_", "._", "project_", ",_", "'--", "savep", "ath", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "use", "-", "local", "'_", ":_", "None_", ",_", "'--", "force", "'_", ":_", "True_", ",_", "'--", "proxy", "'_", ":_", "None_", ",_", "'--", "pypi", "-", "server", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "require", "ment", "s", "\\u", "path_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "require", "ment", "s", "\\u", "path_", ",_", "\"", "r", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "f_", "._", "read_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "self_", "._", "modules_", "[_", ":_", "-_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "item_", "._", "lower_", "(_", ")_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "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\\u", "init", "\\u", "local", "\\u", "only_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "items", " ", "liste", "d", " ", "in", " ", "require", "ment", "s", ".", "text", " ", "are", " ", "the", " ", "same", " ", "as", " ", "locals", " ", "expected", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pip", "reqs_", "._", "init_", "(_", "{_", "'<", "path", ">'_", ":_", "self_", "._", "project_", ",_", "'--", "savep", "ath", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "use", "-", "local", "'_", ":_", "True_", ",_", "'--", "force", "'_", ":_", "True_", ",_", "'--", "proxy", "'_", ":_", "None_", ",_", "'--", "pypi", "-", "server", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "require", "ment", "s", "\\u", "path_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "require", "ment", "s", "\\u", "path_", ",_", "\"", "r", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "f_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "item_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "\"", " ", "==", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "item_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "in_", "self_", "._", "local_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "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\\u", "init", "\\u", "savep", "ath_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "we", " ", "can", " ", "save", " ", "require", "mnt", "s", ".", "tt", " ", "correct", "ly", " ", "to", " ", "a", " ", "different", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pip", "reqs_", "._", "init_", "(_", "{_", "'<", "path", ">'_", ":_", "self_", "._", "project_", ",_", "'--", "savep", "ath", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "alt", "\\u", "require", "ment", "\\u", "path_", ",_", "'--", "use", "-", "local", "'_", ":_", "None_", ",_", "'--", "proxy", "'_", ":_", "None_", ",_", "'--", "pypi", "-", "server", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "alt", "\\u", "require", "ment", "\\u", "path_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "alt", "\\u", "require", "ment", "\\u", "path_", ",_", "\"", "r", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "f_", "._", "read_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "self_", "._", "modules_", "[_", ":_", "-_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "item_", "._", "lower_", "(_", ")_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "self_", "._", "module", "s2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "item_", "._", "lower_", "(_", ")_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pi", "pre", "qs_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ignore", "d\\u", "directory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "--", "ignore", " ", "parameter", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pip", "reqs_", "._", "init_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'<", "path", ">'_", ":_", "self_", "._", "project", "\\u", "with", "\\u", "ignore", "\\u", "directory_", ",_", "'--", "savep", "ath", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "use", "-", "local", "'_", ":_", "None_", ",_", "'--", "force", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "proxy", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "pypi", "-", "server", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "ignore", "'_", ":_", "'.", "ignore", "d\\u", "dir", ",.", "ignore", "\\u", "second", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "project", "\\u", "with", "\\u", "ignore", "\\u", "directory_", ",_", "\"", "require", "ment", "s", ".", "txt", "\"_", ")_", ",_", "\"", "r", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "f_", "._", "read_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "[_", "'", "click", "'_", ",_", "'", "getpa", "ss", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "item_", "._", "lower_", "(_", ")_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 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1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
hcook/gmm/tests/em_convert_from_pickle_dump_to_csv.py
[ { "content": "import asp.jit.asp_module as asp_module\nimport numpy as np\nfrom em import *\nimport pickle\nimport sys\n\nparam_type_map = {\n 'num_blocks_estep': ('cardinal','variant'),\n 'num_threads_estep': ('cardinal','variant'),\n 'num_threads_mstep': ('cardinal','variant'),\n 'num_event_blocks': ('cardinal','variant'),\n 'max_num_dimensions': ('cardinal','variant'),\n 'max_num_components': ('cardinal','variant'),\n 'max_num_dimensions_covar_v3': ('cardinal','variant'),\n 'max_num_components_covar_v3': ('cardinal','variant'),\n 'diag_only': ('binary','variant'),\n 'max_iters': ('cardinal','variant'),\n 'min_iters': ('cardinal','variant'),\n 'covar_version_name': ('nominal','variant'),\n 'supports_32b_floating_point_atomics': ('nominal','machine'),\n 'max_xy_grid_dim': ('cardinal','machine'),\n 'max_threads_per_block': ('cardinal','machine'),\n 'max_shared_memory_capacity_per_SM': ('cardinal','machine')\n}\n\nif __name__ == '__main__': \n ifile_name = sys.argv[1]\n ofile_name = sys.argv[2]\n func_name = sys.argv[3]\n device_id = sys.argv[4]\n gmm = GMM(1,1)\n mod = gmm.get_asp_mod()\n mod.restore_method_timings(func_name,ifile_name)\n var_names = mod.compiled_methods[func_name].v_id_list\n param_names = mod.compiled_methods[func_name].param_names\n var_times = mod.compiled_methods[func_name].database.variant_times\n f = file(ofile_name, 'a')\n f.write(\"Heading, Function Name, Device Name, Input Params,,,Variant Params\"+\",\"*len(param_names)+\"Time\\n\")\n f.write(\"Name,function,device,M,D,N,%s,Time\\n\" % ','.join(param_names))\n f.write(\"Type,nominal,nominal,cardinal,cardinal,cardinal,%s,real\\n\" % \n ','.join([param_type_map.get(n,'unknown')[0] for n in param_names]))\n f.write(\"Prefix,problem,machine,problem,problem,problem,%s,performance\\n\" % \n ','.join([param_type_map.get(n,'unknown')[1] for n in param_names]))\n for size, times in var_times.items():\n for name in var_names:\n time = times[name]\n f.write(\",%s,%s,%s,%s,%s\\n\" % ( func_name, \n device_id, \n ','.join([str(p) for p in size[1:]]),\n ','.join(name.split('_')[1:]),\n time ) )\n f.close()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import asp.jit.asp_module as asp_module", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 39 }, { "span": "import numpy as np", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 18 }, { "span": "import pickle", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "asp", "_", "._", "jit_", "._", "asp", "\\u", "module_", "as_", "asp", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "em_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "type", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "blocks", "\\u", "este", "p", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "thread", "s", "\\u", "este", "p", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "thread", "s", "\\u", "mst", "ep", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "event", "\\u", "blocks", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "num", "\\u", "dimension", "s", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "num", "\\u", "component", "s", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "num", "\\u", "dimension", "s", "\\u", "covar", "\\u", "v", "3", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "num", "\\u", "component", "s", "\\u", "covar", "\\u", "v", "3", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "diag", "\\u", "only", "'_", ":_", "(_", "'", "binar", "y", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "iters", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "min", "\\u", "iters", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "covar", "\\u", "version", "\\u", "name", "'_", ":_", "(_", "'", "nominal", "'_", ",_", "'", "variant", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "support", "s", "\\u", "32", "b", "\\u", "float", "ing", "\\u", "point", "\\u", "atomi", "cs", "'_", ":_", "(_", "'", "nominal", "'_", ",_", "'", "machine", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "xy", "\\u", "grid", "\\u", "dim", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "machine", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "thread", "s", "\\u", "per", "\\u", "block", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "machine", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "shared", "\\u", "memory", "\\u", "capacit", "y", "\\u", "per", "\\u", "SM", "'_", ":_", "(_", "'", "cardi", "nal", "'_", ",_", "'", "machine", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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 ", " _", "ifi", "le", "\\u", "name_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ofi", "le", "\\u", "name_", "=_", "sys_", "._", "argv_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "name_", "=_", "sys_", "._", "argv_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "id_", "=_", "sys_", "._", "argv_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gmm", "_", "=_", "GM", "M_", "(_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "gmm", "_", "._", "get", "\\u", "asp", "\\u", "mod_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "restore", "\\u", "method", "\\u", "timings", "_", "(_", "func", "\\u", "name_", ",_", "ifi", "le", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "names_", "=_", "mod_", "._", "compile", "d\\u", "methods_", "[_", "func", "\\u", "name_", "]_", "._", "v", "\\u", "id", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "names_", "=_", "mod_", "._", "compile", "d\\u", "methods_", "[_", "func", "\\u", "name_", "]_", "._", "param", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "times_", "=_", "mod_", "._", "compile", "d\\u", "methods_", "[_", "func", "\\u", "name_", "]_", "._", "database_", "._", "variant", "\\u", "times_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "file_", "(_", "ofi", "le", "\\u", "name_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "Head", "ing", ",", " ", "Function", " ", "Name", ",", " ", "Dev", "ice", " ", "Name", ",", " ", "Inp", "ut", " ", "Param", "s", ",,,", "Varia", "nt", " ", "Param", "s", "\"_", "+_", "\",\"_", "*_", "len_", "(_", "param", "\\u", "names_", ")_", "+_", "\"", "Time", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "Name", ",", "function", ",", "device", ",", "M", ",", "D", ",", "N", ",%", "s", ",", "Time", "\\\\", "n", "\"_", "%_", "','_", "._", "join_", "(_", "param", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "Type", ",", "nominal", ",", "nominal", ",", "cardi", "nal", ",", "cardi", "nal", ",", "cardi", "nal", ",%", "s", ",", "real", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "','_", "._", "join_", "(_", "[_", "param", "\\u", "type", "\\u", "map_", "._", "get_", "(_", "n_", ",_", "'", "unknown", "'_", ")_", "[_", "0_", "]_", "for_", "n_", "in_", "param", "\\u", "names_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "Pref", "ix", ",", "problem", ",", "machine", ",", "problem", ",", "problem", ",", "problem", ",%", "s", ",", "perform", "anc", "e", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "','_", "._", "join_", "(_", "[_", "param", "\\u", "type", "\\u", "map_", "._", "get_", "(_", "n_", ",_", "'", "unknown", "'_", ")_", "[_", "1_", "]_", "for_", "n_", "in_", "param", "\\u", "names_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "size_", ",_", "times_", "in_", "var", "\\u", "times_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", "in_", "var", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "=_", "times_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\",", "%", "s", ",%", "s", ",%", "s", ",%", "s", ",%", "s", "\\\\", "n", "\"_", "%_", "(_", "func", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "p_", ")_", "for_", "p_", "in_", "size_", "[_", "1_", ":_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "','_", "._", "join_", "(_", "name_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "1_", ":_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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
ustuehler/git-cvs/cvsgit/meta.py
[ { "content": "\"\"\"Metadata for CVSGit about a pair of CVS and Git repositories.\"\"\"\n\nimport os.path\nimport re\nimport sqlite3\n\nfrom cvsgit.changeset import Change, ChangeSet\nfrom cvsgit.i18n import _\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MetaDb(object):\n \"\"\"Database of CVS revisions (changes) and combined changesets.\n\n The database contains revisions from the CVS repository that are\n pending or already grouped into changesets and a mark indicating\n whether a changeset was already processed. For Git, the mark is\n the SHA1 commit hash. Unprocessed changesets have the mark None.\n \"\"\"\n\n\n \n dbh = property(get_dbh)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MetaDb", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __init__(self, filename):\n self.filename = filename\n self._dbh = None", "metadata": "root.MetaDb.__init__", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 18 }, { "content": " def get_dbh(self):\n if self._dbh is None:\n dbh = sqlite3.connect(self.filename)\n\n # http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html\n dbh.execute(\"PRAGMA synchronous=OFF\")\n dbh.execute(\"PRAGMA count_changes=OFF\")\n #dbh.execute(\"PRAGMA cache_size=4000\")\n\n # This should also help, but causes the behaviour of the\n # ROLLBACK command to become undefined.\n dbh.execute(\"PRAGMA journal_mode=OFF\")\n\n # This helps for the temporary table which we create when\n # iterating over changes for changeset generation, but\n # bloats the process image a lot.\n #dbh.execute(\"PRAGMA temp_store=MEMORY\")\n\n # Create the table that contains changes pulled from CVS.\n #\n # 'changeset_id' is NULL until a change is associated with\n # a complete changeset.\n sql = 'CREATE TABLE IF NOT EXISTS change (' \\\n 'timestamp DATETIME NOT NULL, ' \\\n 'author VARCHAR NOT NULL, ' \\\n 'log TEXT NOT NULL, ' \\\n 'filestatus CHAR(1) NOT NULL, ' \\\n 'filename VARCHAR NOT NULL, ' \\\n 'revision VARCHAR NOT NULL, ' \\\n 'state VARCHAR(8) NOT NULL, ' \\\n 'mode CHAR(1) NOT NULL, ' \\\n 'changeset_id INTEGER, ' \\\n 'PRIMARY KEY (filename, revision))'\n dbh.execute(sql)\n sql = 'CREATE INDEX IF NOT EXISTS change__changeset_id ' \\\n 'ON change (changeset_id)'\n dbh.execute(sql)\n dbh.execute(\"\"\"\n CREATE INDEX IF NOT EXISTS change__timestamp\n ON change (timestamp)\"\"\")\n\n # Create the table that defines the attributes of complete\n # changesets. 'id' will be referenced by one or more rows\n # in the 'change' table.\n sql = 'CREATE TABLE IF NOT EXISTS changeset (' \\\n 'id INTEGER PRIMARY KEY, ' \\\n 'start_time DATETIME NOT NULL, ' \\\n 'end_time DATETIME NOT NULL, ' \\\n 'mark VARCHAR)'\n dbh.execute(sql)\n sql = 'CREATE UNIQUE INDEX IF NOT EXISTS ' \\\n 'changeset__id__start_time__mark ' \\\n 'ON changeset (id, start_time, mark)'\n dbh.execute(sql)\n\n # Create the table that stores stat() information for all\n # paths in the CVS repository. This allows the CVS change\n # scanner to skip unmodified RCS files and directories.\n dbh.execute(\"\"\"\n CREATE TABLE IF NOT EXISTS statcache (\n path VARCHAR PRIMARY KEY,\n mtime INTEGER NOT NULL,\n size INTEGER NOT NULL)\"\"\")\n # With this index, I haven't observed any speed gain.\n #dbh.execute(\"\"\"\n # CREATE INDEX IF NOT EXISTS statcache_index\n # ON statcache (path, mtime, size)\"\"\")\n\n self._dbh = dbh\n return self._dbh", "metadata": "root.MetaDb.get_dbh", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def load_statcache(self):\n \"\"\"Load the complete stat() cache and return it as a dictionary\n of the form {path:(mtime, size)}.\n \"\"\"\n sql = 'SELECT path, mtime, size FROM statcache'\n statcache = {}\n for row in self.dbh.execute(sql):\n statcache[row[0]] = row[1:]\n return statcache", "metadata": "root.MetaDb.load_statcache", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def update_statcache(self, statcache):\n \"\"\"'statcache' is a dictionary of {path:(mtime, size)} to insert\n into or update in the meta database's stat() cache.\n \"\"\"\n sql = 'INSERT OR REPLACE INTO statcache ' \\\n '(path, mtime, size) VALUES (?,?,?)'\n for path in statcache.keys():\n values = (path,) + statcache[path]\n self.dbh.execute(sql, values)", "metadata": "root.MetaDb.update_statcache", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 105 }, { "content": " def add_change(self, change):\n \"\"\"Insert a single file change into the database.\n\n If a record for the specified file and revision exists it is\n assumed to be identical and the change will be ignored.\n\n Note that multiple updates to the database may be grouped into\n a larger transaction for performance, but the caller can use\n commit() to ensure that the changes get flushed to disk.\n \"\"\"\n self.dbh.execute(\"\"\"\n INSERT OR IGNORE INTO change\n (timestamp, author, log, filestatus, filename,\n revision, state, mode)\n VALUES (?,?,?,?,?,?,?,?)\"\"\",\n (change.timestamp, change.author, change.log,\n change.filestatus, change.filename, change.revision,\n change.state, change.mode,))", "metadata": "root.MetaDb.add_change", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " def add_changeset(self, changeset):\n \"\"\"Record the attributes of 'changeset' and mark the\n referenced changes as belonging to this changeset.\n\n Associating changes with a changeset can be considered an\n atomic operation from the caller's perspective.\n \"\"\"\n id = self.dbh.execute(\"\"\"\n INSERT INTO changeset (start_time, end_time) VALUES (?,?)\n \"\"\", (changeset.start_time, changeset.end_time,)).lastrowid\n try:\n self.dbh.executemany(\"\"\"\n UPDATE change SET changeset_id=%d\n WHERE filename=? AND revision=?\n \"\"\" % id, map(lambda c: (c.filename, c.revision),\n changeset.changes))\n except:\n self.dbh.execute(\"\"\"\n UPDATE change SET changeset_id=NULL\n WHERE changeset_id=%dfilename=? AND revision=?\n \"\"\" % id)\n raise", "metadata": "root.MetaDb.add_changeset", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 134 }, { "content": " def mark_changeset(self, id, mark):\n \"\"\"Mark 'changeset' as having been integrated.\n \"\"\"\n assert(id != None)\n sql = 'UPDATE changeset SET mark=? WHERE id=?'\n self.dbh.execute(sql, (mark, id,))\n self.dbh.commit()", "metadata": "root.MetaDb.mark_changeset", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 157 }, { "content": " def begin_transaction(self):\n \"\"\"Starts a new transaction (disables autocommit).\n \"\"\"\n self.dbh.execute('BEGIN TRANSACTION')", "metadata": "root.MetaDb.begin_transaction", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 165 }, { "content": " def commit(self):\n \"\"\"Commits the current transaction.\n \"\"\"\n self.dbh.commit()", "metadata": "root.MetaDb.commit", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 170 }, { "content": " def end_transaction(self):\n \"\"\"Ends a new transaction (enables autocommit).\n \"\"\"\n self.dbh.execute('END TRANSACTION')", "metadata": "root.MetaDb.end_transaction", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " def count_changes(self):\n \"\"\"Return the number of free changes (not bound in a changeset).\n \"\"\"\n return self.dbh.execute(\"\"\"\n SELECT COUNT(*)\n FROM change\n WHERE changeset_id IS NULL\"\"\").fetchone()[0]", "metadata": "root.MetaDb.count_changes", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 180 }, { "content": " def changes_by_timestamp(self, processed=None, reentrant=True):\n \"\"\"Yields a list of changes recorded in the database.\n\n The 'processed' keyword determines wheather changes which are\n already included in a changeset are to be included or not. If\n the value is neuter True nor False, all changes are included.\n \"\"\"\n if processed == True:\n where = 'changeset_id IS NOT NULL'\n elif processed == False:\n where = 'changeset_id IS NULL'\n else:\n where = '1'\n\n def mkchange(row):\n return Change(timestamp=row[0], author=row[1], log=row[2],\n filestatus=row[3], filename=row[4],\n revision=row[5], state=row[6], mode=row[7])\n\n if not reentrant:\n for row in self.dbh.execute(\"\"\"\n SELECT timestamp, author, log, filestatus, filename,\n revision, state, mode\n FROM change\n WHERE %s\n ORDER BY timestamp, filename, revision\"\"\" % where):\n yield(mkchange(row))\n return\n\n self.dbh.execute(\"\"\"\n CREATE TEMPORARY TABLE free_change AS\n SELECT timestamp, author, log, filestatus, filename,\n revision, state, mode\n FROM change\n LIMIT 0\"\"\")\n self.dbh.execute(\"\"\"\n CREATE INDEX free_change__timestamp\n ON free_change (timestamp)\"\"\")\n self.dbh.execute(\"\"\"\n CREATE INDEX free_change__filename__revision\n ON free_change (filename, revision)\"\"\")\n self.dbh.execute(\"\"\"\n INSERT INTO free_change\n SELECT timestamp, author, log, filestatus, filename,\n revision, state, mode\n FROM change\n WHERE %s\"\"\" % where)\n\n try:\n while True:\n rows = self.dbh.execute(\"\"\"\n SELECT timestamp, author, log, filestatus, filename,\n revision, state, mode\n FROM free_change\n ORDER BY timestamp\n LIMIT 1000\"\"\").fetchall()\n if len(rows) == 0:\n break\n for row in rows:\n change = mkchange(row)\n yield(change)\n self.dbh.execute(\"\"\"\n DELETE FROM free_change\n WHERE filename = ? AND revision = ?\"\"\",\n (change.filename, change.revision,))\n finally:\n self.dbh.execute('DROP TABLE IF EXISTS free_change')", "metadata": "root.MetaDb.changes_by_timestamp", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 188 }, { "content": " def count_changesets(self):\n \"\"\"Return the number of unmarked changesets (not imported).\n \"\"\"\n sql = 'SELECT COUNT(*) FROM changeset WHERE mark IS NULL'\n return self.dbh.execute(sql).fetchone()[0]", "metadata": "root.MetaDb.count_changesets", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 256 }, { "content": " def _select_changesets(self, where):\n where = where % {'changeset':'cs'}\n sql = \"\"\"\n SELECT cs.id, cs.start_time, cs.end_time, c.timestamp,\n c.author, c.log, c.filestatus, c.filename,\n c.revision, c.state, c.mode\n FROM changeset cs\n INNER JOIN change c ON c.changeset_id = cs.id\n WHERE %s\n ORDER BY cs.end_time, cs.id\"\"\" % where\n\n changeset = None\n for row in self.dbh.execute(sql):\n change = Change(timestamp=row[3],\n author=row[4],\n log=row[5],\n filestatus=row[6],\n filename=row[7],\n revision=row[8],\n state=row[9],\n mode=row[10])\n\n if changeset is None or changeset.id != row[0]:\n if changeset:\n yield(changeset)\n\n changeset = ChangeSet(change, id=row[0])\n changeset.provider = self\n changeset.start_time = row[1]\n changeset.end_time = row[2]\n else:\n changeset.changes.append(change)\n\n if changeset:\n yield(changeset)", "metadata": "root.MetaDb._select_changesets", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def head_changeset(self):\n \"\"\"Return the \"head\" changeset, the one with the highest value\n of 'id' ('mark' is ignored) or None if there is no changeset.\n \"\"\"\n where = '%(changeset)s.id IS MAX(%(changeset)s.id)'\n for cs in self._select_changesets(where):\n return cs", "metadata": "root.MetaDb.head_changeset", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 298 }, { "content": " def changesets_by_start_time(self):\n \"\"\"Yield a list of all unmarked changesets currently recorded\n in the database, ordered by their start time.\n \"\"\"\n\twhere = '%(changeset)s.mark IS NULL'\n return self._select_changesets(where)", "metadata": "root.MetaDb.changesets_by_start_time", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 306 }, { "content": " def all_authors(self):\n \"\"\"Return a list of all author login names.\n \"\"\"\n return map(lambda row: row[0], self.dbh.execute(\"\"\"\n SELECT DISTINCT(author) FROM change ORDER BY author\n \"\"\").fetchall())", "metadata": "root.MetaDb.all_authors", "header": "['class', 'MetaDb', '(', 'object', ')', ':', '___EOS___']", "index": 313 } ]
[ { "span": "import os.path", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 14 }, { "span": "import re", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Meta", "data", " ", "for", " ", "CV", "SG", "it", " ", "abo", "ut", " ", "a", " ", "pair", " ", "of", " ", "CV", "S", " ", "and", " ", "Git", " ", "repos", "itori", "es", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlite3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cvs", "git_", "._", "changeset_", "import_", "Change_", ",_", "Change", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cvs", "git_", "._", "i18n_", "import_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Databa", "se", " ", "of", " ", "CV", "S", " ", "revis", "ion", "s", " ", "(", "change", "s", ")", " ", "and", " ", "combin", "ed", " ", "changeset", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "databa", "se", " ", "contain", "s", " ", "revis", "ion", "s", " ", "from", " ", "the", " ", "CV", "S", " ", "repos", "itor", "y", " ", "tha", "t", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "pend", "ing", " ", "or", " ", "alr", "ead", "y", " ", "groupe", "d", " ", "int", "o", " ", "changeset", "s", " ", "and", " ", "a", " ", "mark", " ", "indicati", "ng", "\\", "10", ";", " ", " ", " ", " ", "whe", "ther", " ", "a", " ", "changeset", " ", "was", " ", "alr", "ead", "y", " ", "process", "ed", ".", " ", " ", "For", " ", "Git", ",", " ", "the", " ", "mark", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "SHA", "1", " ", "commit", " ", "hash", ".", " ", " ", "Unp", "rocess", "ed", " ", "changeset", "s", " ", "have", " ", "the", " ", "mark", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dbh", "_", "=_", "property_", "(_", "get", "\\u", "dbh", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dbh", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "dbh", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "dbh", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbh", "_", "=_", "sqlite3_", "._", "connect_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "web", ".", "ut", "k", ".", "edu", "/", "~", "jp", "ly", "on", "/", "sql", "ite", "/", "SQL", "ite", "\\u", "optimization", "\\u", "FA", "Q", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "\"", "PRA", "GMA", " ", "synchron", "ous", "=", "OFF", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "\"", "PRA", "GMA", " ", "count", "\\u", "change", "s", "=", "OFF", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dbh", ".", "execute", "(\"", "PRA", "GMA", " ", "cache", "\\u", "size", "=", "4000", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "als", "o", " ", "help", ",", " ", "but", " ", "caus", "es", " ", "the", " ", "behaviour", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ROLL", "BACK", " ", "command", " ", "to", " ", "bec", "ome", " ", "undefined", "._", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "\"", "PRA", "GMA", " ", "journal", "\\u", "mode", "=", "OFF", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "helps", " ", "for", " ", "the", " ", "temporar", "y", " ", "table", " ", "whi", "ch", " ", "we", " ", "create", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterati", "ng", " ", "over", " ", "change", "s", " ", "for", " ", "changeset", " ", "generat", "ion", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "blo", "ats", " ", "the", " ", "process", " ", "image", " ", "a", " ", "lot", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "dbh", ".", "execute", "(\"", "PRA", "GMA", " ", "temp", "\\u", "store", "=", "MEM", "ORY", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "table", " ", "tha", "t", " ", "contain", "s", " ", "change", "s", " ", "pull", "ed", " ", "from", " ", "CV", "S", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "changeset", "\\u", "id", "'", " ", "is", " ", "NULL", " ", "unti", "l", " ", "a", " ", "change", " ", "is", " ", "associate", "d", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "complete", " ", "changeset", "._", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "=_", "'", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "change", " ", "('_", "'", "timestamp", " ", "DATETIME", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "author", " ", "VARCHA", "R", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "log", " ", "TEXT", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "filest", "atus", " ", "CHAR", "(", "1", ")", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "filename", " ", "VARCHA", "R", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "revis", "ion", " ", "VARCHA", "R", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "state", " ", "VARCHA", "R", "(", "8", ")", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "mode", " ", "CHAR", "(", "1", ")", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "changeset", "\\u", "id", " ", "INTEG", "ER", ",", " ", "'_", "'", "PRIMA", "RY", " ", "KEY", " ", "(", "filename", ",", " ", "revis", "ion", "))'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "'", "CREATE", " ", "INDE", "X", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "change", "\\u\\u", "changeset", "\\u", "id", " ", "'_", "'", "ON", " ", "change", " ", "(", "changeset", "\\u", "id", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "INDE", "X", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "change", "\\u\\u", "timestamp", "\\", "10", ";", " ", " ", " ", " ", "ON", " ", "change", " ", "(", "timestamp", ")\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "table", " ", "tha", "t", " ", "defin", "es", " ", "the", " ", "attribute", "s", " ", "of", " ", "complete_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "changeset", "s", ".", " ", " ", "'", "id", "'", " ", "will", " ", "be", " ", "referenced", " ", "by", " ", "one", " ", "or", " ", "more", " ", "rows_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "'", "change", "'", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "sql_", "=_", "'", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "changeset", " ", "('_", "'", "id", " ", "INTEG", "ER", " ", "PRIMA", "RY", " ", "KEY", ",", " ", "'_", "'", "start", "\\u", "time", " ", "DATETIME", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "end", "\\u", "time", " ", "DATETIME", " ", "NOT", " ", "NULL", ",", " ", "'_", "'", "mark", " ", "VARCHA", "R", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "'", "CREATE", " ", "UNI", "QUE", " ", "INDE", "X", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "'_", "'", "changeset", "\\u\\u", "id", "\\u\\u", "start", "\\u", "time", "\\u\\u", "mark", " ", "'_", "'", "ON", " ", "changeset", " ", "(", "id", ",", " ", "start", "\\u", "time", ",", " ", "mark", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "table", " ", "tha", "t", " ", "store", "s", " ", "stat", "()", " ", "informati", "on", " ", "for", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "path", "s", " ", "in", " ", "the", " ", "CV", "S", " ", "repos", "itor", "y", ".", " ", " ", "Thi", "s", " ", "allow", "s", " ", "the", " ", "CV", "S", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scanner", " ", "to", " ", "skip", " ", "unmo", "difi", "ed", " ", "RC", "S", " ", "files", " ", "and", " ", "director", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "stat", "cache", " ", "(", "\\", "10", ";", " ", " ", "path", " ", "VARCHA", "R", " ", "PRIMA", "RY", " ", "KEY", ",", "\\", "10", ";", " ", " ", "mti", "me", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ",", "\\", "10", ";", " ", " ", "size", " ", "INTEG", "ER", " ", "NOT", " ", "NULL", ")\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "With", " ", "this", " ", "index", ",", " ", "I", " ", "have", "n", "'", "t", " ", "observe", "d", " ", "any", " ", "speed", " ", "gain", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "dbh", ".", "execute", "(\"", "\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "CREATE", " ", "INDE", "X", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "stat", "cache", "\\u", "index_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ON", " ", "stat", "cache", " ", "(", "path", ",", " ", "mti", "me", ",", " ", "size", ")\"", "\"\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "dbh", "_", "=_", "dbh", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "dbh", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "load", "\\u", "stat", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", " ", "the", " ", "complete", " ", "stat", "()", " ", "cache", " ", "and", " ", "return", " ", "it", " ", "as", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "form", " ", "{", "path", ":(", "mti", "me", ",", " ", "size", ")}", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "'", "SELECT", " ", "path", ",", " ", "mti", "me", ",", " ", "size", " ", "FROM", " ", "stat", "cache", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stat", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "sql_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stat", "cache_", "[_", "row_", "[_", "0_", "]_", "]_", "=_", "row_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "stat", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "stat", "cache_", "(_", "self_", ",_", "stat", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"'", "stat", "cache", "'", " ", "is", " ", "a", " ", "dictionar", "y", " ", "of", " ", "{", "path", ":(", "mti", "me", ",", " ", "size", ")}", " ", "to", " ", "insert", "\\", "10", ";", " ", " ", " ", " ", "int", "o", " ", "or", " ", "update", " ", "in", " ", "the", " ", "meta", " ", "databa", "se", "'", "s", " ", "stat", "()", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "'", "INSERT", " ", "OR", " ", "REPLACE", " ", "INT", "O", " ", "stat", "cache", " ", "'_", "'(", "path", ",", " ", "mti", "me", ",", " ", "size", ")", " ", "VALU", "ES", " ", "(?,?", ",", "?)'", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "path_", "in_", "stat", "cache_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "(_", "path_", ",_", ")_", "+_", "stat", "cache_", "[_", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "sql_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "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", "change_", "(_", "self_", ",_", "change_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Insert", " ", "a", " ", "single", " ", "file", " ", "change", " ", "int", "o", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "record", " ", "for", " ", "the", " ", "specified", " ", "file", " ", "and", " ", "revis", "ion", " ", "exist", "s", " ", "it", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "assume", "d", " ", "to", " ", "be", " ", "identi", "cal", " ", "and", " ", "the", " ", "change", " ", "will", " ", "be", " ", "ignore", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "multiple", " ", "update", "s", " ", "to", " ", "the", " ", "databa", "se", " ", "may", " ", "be", " ", "groupe", "d", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "large", "r", " ", "transaction", " ", "for", " ", "perform", "anc", "e", ",", " ", "but", " ", "the", " ", "caller", " ", "can", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "commit", "()", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "change", "s", " ", "get", " ", "flush", "ed", " ", "to", " ", "disk", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "INSERT", " ", "OR", " ", "IGNORE", " ", "INT", "O", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "(", "timestamp", ",", " ", "author", ",", " ", "log", ",", " ", "filest", "atus", ",", " ", "filename", ",", "\\", "10", ";", " ", " ", " ", " ", "revis", "ion", ",", " ", "state", ",", " ", "mode", ")", "\\", "10", ";", " ", " ", " ", " ", "VALU", "ES", " ", "(?,?", ",?,", "?", ",?,", "?", ",?,", "?)", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "change_", "._", "timestamp_", ",_", "change_", "._", "author_", ",_", "change_", "._", "log_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "._", "filest", "atus", "_", ",_", "change_", "._", "filename_", ",_", "change_", "._", "revision_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change_", "._", "state_", ",_", "change_", "._", "mode_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "changeset_", "(_", "self_", ",_", "changeset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Record", " ", "the", " ", "attribute", "s", " ", "of", " ", "'", "changeset", "'", " ", "and", " ", "mark", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "referenced", " ", "change", "s", " ", "as", " ", "belonging", " ", "to", " ", "this", " ", "changeset", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Assoc", "iati", "ng", " ", "change", "s", " ", "with", " ", "a", " ", "changeset", " ", "can", " ", "be", " ", "consider", "ed", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "atomi", "c", " ", "operati", "on", " ", "from", " ", "the", " ", "caller", "'", "s", " ", "perspective", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "INSERT", " ", "INT", "O", " ", "changeset", " ", "(", "start", "\\u", "time", ",", " ", "end", "\\u", "time", ")", " ", "VALU", "ES", " ", "(?,?", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "(_", "changeset_", "._", "start", "\\u", "time_", ",_", "changeset_", "._", "end", "\\u", "time_", ",_", ")_", ")_", "._", "lastr", "owi", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dbh", "_", "._", "executemany", "_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "UPDATE", " ", "change", " ", "SET", " ", "changeset", "\\u", "id", "=", "%", "d", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "filename", "=?", " ", "AND", " ", "revis", "ion", "=?", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "id_", ",_", "map_", "(_", "lambda_", "c_", ":_", "(_", "c_", "._", "filename_", ",_", "c_", "._", "revision_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "changeset_", "._", "changes_", ")_", ")_", "\\u\\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_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "UPDATE", " ", "change", " ", "SET", " ", "changeset", "\\u", "id", "=", "NULL", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "changeset", "\\u", "id", "=", "%", "dfile", "name", "=?", " ", "AND", " ", "revis", "ion", "=?", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "%_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "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_", "mark", "\\u", "changeset_", "(_", "self_", ",_", "id_", ",_", "mark_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mark", " ", "'", "changeset", "'", " ", "as", " ", "hav", "ing", " ", "bee", "n", " ", "integrated", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "id_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "'", "UPDATE", " ", "changeset", " ", "SET", " ", "mark", "=?", " ", "WHE", "RE", " ", "id", "=?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "sql_", ",_", "(_", "mark_", ",_", "id_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "begin", "\\u", "transaction_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", "s", " ", "a", " ", "new", " ", "transaction", " ", "(", "disable", "s", " ", "autoc", "ommit", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "'", "BEGIN", " ", "TRANSACTION", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Commi", "ts", " ", "the", " ", "current", " ", "transaction", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "end", "\\u", "transaction_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "End", "s", " ", "a", " ", "new", " ", "transaction", " ", "(", "enable", "s", " ", "autoc", "ommit", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "'", "END", " ", "TRANSACTION", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count", "\\u", "changes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "number", " ", "of", " ", "free", " ", "change", "s", " ", "(", "not", " ", "bound", " ", "in", " ", "a", " ", "changeset", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "COUNT", "(*", ")", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "changeset", "\\u", "id", " ", "IS", " ", "NULL", "\"\"\"_", ")_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "s", "\\u", "by", "\\u", "timestamp_", "(_", "self_", ",_", "processed_", "=_", "None_", ",_", "reen", "tran", "t_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Yi", "elds", " ", "a", " ", "list", " ", "of", " ", "change", "s", " ", "recorde", "d", " ", "in", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "'", "process", "ed", "'", " ", "keyw", "ord", " ", "dete", "rmin", "es", " ", "whe", "ath", "er", " ", "change", "s", " ", "whi", "ch", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "alr", "ead", "y", " ", "include", "d", " ", "in", " ", "a", " ", "changeset", " ", "are", " ", "to", " ", "be", " ", "include", "d", " ", "or", " ", "not", ".", " ", " ", "If", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "value", " ", "is", " ", "neut", "er", " ", "Tru", "e", " ", "nor", " ", "Fal", "se", ",", " ", "all", " ", "change", "s", " ", "are", " ", "include", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "processed_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "where_", "=_", "'", "changeset", "\\u", "id", " ", "IS", " ", "NOT", " ", "NULL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "processed_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "where_", "=_", "'", "changeset", "\\u", "id", " ", "IS", " ", "NULL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "where_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mk", "change_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Change_", "(_", "timestamp_", "=_", "row_", "[_", "0_", "]_", ",_", "author_", "=_", "row_", "[_", "1_", "]_", ",_", "log_", "=_", "row_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filest", "atus", "_", "=_", "row_", "[_", "3_", "]_", ",_", "filename_", "=_", "row_", "[_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "=_", "row_", "[_", "5_", "]_", ",_", "state_", "=_", "row_", "[_", "6_", "]_", ",_", "mode_", "=_", "row_", "[_", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "reen", "tran", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "timestamp", ",", " ", "author", ",", " ", "log", ",", " ", "filest", "atus", ",", " ", "filename", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "revis", "ion", ",", " ", "state", ",", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "%", "s", "\\", "10", ";", " ", " ", " ", " ", "ORDE", "R", " ", "BY", " ", "timestamp", ",", " ", "filename", ",", " ", "revis", "ion", "\"\"\"_", "%_", "where_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "mk", "change_", "(_", "row_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "TEMP", "ORA", "RY", " ", "TAB", "LE", " ", "free", "\\u", "change", " ", "AS", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "timestamp", ",", " ", "author", ",", " ", "log", ",", " ", "filest", "atus", ",", " ", "filename", ",", "\\", "10", ";", " ", "revis", "ion", ",", " ", "state", ",", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "LIMIT", " ", "0", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "INDE", "X", " ", "free", "\\u", "change", "\\u\\u", "timestamp", "\\", "10", ";", " ", " ", " ", " ", "ON", " ", "free", "\\u", "change", " ", "(", "timestamp", ")\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "CREATE", " ", "INDE", "X", " ", "free", "\\u", "change", "\\u\\u", "filename", "\\u\\u", "revis", "ion", "\\", "10", ";", " ", " ", " ", " ", "ON", " ", "free", "\\u", "change", " ", "(", "filename", ",", " ", "revis", "ion", ")\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "INSERT", " ", "INT", "O", " ", "free", "\\u", "change", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "timestamp", ",", " ", "author", ",", " ", "log", ",", " ", "filest", "atus", ",", " ", "filename", ",", "\\", "10", ";", " ", "revis", "ion", ",", " ", "state", ",", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "%", "s", "\"\"\"_", "%_", "where_", ")_", "\\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 ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", "SELECT", " ", "timestamp", ",", " ", "author", ",", " ", "log", ",", " ", "filest", "atus", ",", " ", "filename", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "revis", "ion", ",", " ", "state", ",", " ", "mode", "\\", "10", ";", " ", " ", "FROM", " ", "free", "\\u", "change", "\\", "10", ";", " ", " ", "ORDE", "R", " ", "BY", " ", "timestamp", "\\", "10", ";", " ", " ", "LIMIT", " ", "1000", "\"\"\"_", ")_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "rows_", ")_", "==_", "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_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "change_", "=_", "mk", "change_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "change_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", "DELET", "E", " ", "FROM", " ", "free", "\\u", "change", "\\", "10", ";", " ", " ", "WHE", "RE", " ", "filename", " ", "=", " ", "?", " ", "AND", " ", "revis", "ion", " ", "=", " ", "?\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "change_", "._", "filename_", ",_", "change_", "._", "revision_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dbh", "_", "._", "execute_", "(_", "'", "DROP", " ", "TAB", "LE", " ", "IF", " ", "EXIST", "S", " ", "free", "\\u", "change", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "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_", "count", "\\u", "changeset", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "number", " ", "of", " ", "unma", "rke", "d", " ", "changeset", "s", " ", "(", "not", " ", "import", "ed", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "'", "SELECT", " ", "COUNT", "(*", ")", " ", "FROM", " ", "changeset", " ", "WHE", "RE", " ", "mark", " ", "IS", " ", "NULL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "sql_", ")_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "select", "\\u", "changeset", "s_", "(_", "self_", ",_", "where_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "where_", "=_", "where_", "%_", "{_", "'", "changeset", "'_", ":_", "'", "cs", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sql_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "cs", ".", "id", ",", " ", "cs", ".", "start", "\\u", "time", ",", " ", "cs", ".", "end", "\\u", "time", ",", " ", "c", ".", "timestamp", ",", "\\", "10", ";", " ", "c", ".", "author", ",", " ", "c", ".", "log", ",", " ", "c", ".", "filest", "atus", ",", " ", "c", ".", "filename", ",", "\\", "10", ";", " ", "c", ".", "revis", "ion", ",", " ", "c", ".", "state", ",", " ", "c", ".", "mode", "\\", "10", ";", " ", " ", " ", " ", "FROM", " ", "changeset", " ", "cs", "\\", "10", ";", " ", " ", " ", " ", "INN", "ER", " ", "JOIN", " ", "change", " ", "c", " ", "ON", " ", "c", ".", "changeset", "\\u", "id", " ", "=", " ", "cs", ".", "id", "\\", "10", ";", " ", " ", " ", " ", "WHE", "RE", " ", "%", "s", "\\", "10", ";", " ", " ", " ", " ", "ORDE", "R", " ", "BY", " ", "cs", ".", "end", "\\u", "time", ",", " ", "cs", ".", "id", "\"\"\"_", "%_", "where_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "changeset_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "sql_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change_", "=_", "Change_", "(_", "timestamp_", "=_", "row_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "row_", "[_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "row_", "[_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filest", "atus", "_", "=_", "row_", "[_", "6_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "row_", "[_", "7_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "=_", "row_", "[_", "8_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "row_", "[_", "9_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "row_", "[_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "changeset_", "is_", "None_", "or_", "changeset_", "._", "id_", "!=_", "row_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "changeset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "(_", "changeset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "changeset_", "=_", "Change", "Set_", "(_", "change_", ",_", "id_", "=_", "row_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changeset_", "._", "provider_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changeset_", "._", "start", "\\u", "time_", "=_", "row_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changeset_", "._", "end", "\\u", "time_", "=_", "row_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changeset_", "._", "changes_", "._", "append_", "(_", "change_", ")_", "\\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_", "changeset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "changeset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "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_", "head", "\\u", "changeset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "\"", "head", "\"", " ", "changeset", ",", " ", "the", " ", "one", " ", "with", " ", "the", " ", "high", "est", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "'", "id", "'", " ", "('", "mark", "'", " ", "is", " ", "ignore", "d", ")", " ", "or", " ", "Non", "e", " ", "if", " ", "there", " ", "is", " ", "no", " ", "changeset", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "where_", "=_", "'%", "(", "changeset", ")", "s", ".", "id", " ", "IS", " ", "MAX", "(%", "(", "changeset", ")", "s", ".", "id", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cs_", "in_", "self_", "._", "\\u", "select", "\\u", "changeset", "s_", "(_", "where_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "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_", "changeset", "s", "\\u", "by", "\\u", "start", "\\u", "time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Yi", "eld", " ", "a", " ", "list", " ", "of", " ", "all", " ", "unma", "rke", "d", " ", "changeset", "s", " ", "currentl", "y", " ", "recorde", "d", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "databa", "se", ",", " ", "order", "ed", " ", "by", " ", "thei", "r", " ", "start", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "where_", "=_", "'%", "(", "changeset", ")", "s", ".", "mark", " ", "IS", " ", "NULL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "select", "\\u", "changeset", "s_", "(_", "where_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Db_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all", "\\u", "authors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "list", " ", "of", " ", "all", " ", "author", " ", "login", " ", "names", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "map_", "(_", "lambda_", "row_", ":_", "row_", "[_", "0_", "]_", ",_", "self_", "._", "dbh", "_", "._", "execute_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "SELECT", " ", "DIST", "INC", "T", "(", "author", ")", " ", "FROM", " ", "change", " ", "ORDE", "R", " ", "BY", " ", "author", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "._", "fetchall_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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"\"\"\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2008-2009 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#-----------------------------------------------------------------------------\n# Code\n#-----------------------------------------------------------------------------\n\n# Curses and termios are Unix-only modules\ntry:\n import curses\n # We need termios as well, so if its import happens to raise, we bail on\n # using curses altogether.\n import termios\nexcept ImportError:\n use_curses = False\nelse:\n # Curses on Solaris may not be complete, so we can't use it there\n use_curses = hasattr(curses,'initscr')", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import termios", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "See", " ", "if", " ", "we", " ", "have", " ", "curse", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2008", "-", "200", "9", " ", " ", "The", " ", "IP", "yth", "on", " ", "Dev", "elo", "pme", "nt", " ", "Team_", "\\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_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Code_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Curs", "es", " ", "and", " ", "term", "ios", " ", "are", " ", "Uni", "x", "-", "only", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "curses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "term", "ios", " ", "as", " ", "well", ",", " ", "so", " ", "if", " ", "its", " ", "import", " ", "happ", "ens", " ", "to", " ", "raise", ",", " ", "we", " ", "bai", "l", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "curse", "s", " ", "alt", "oge", "ther", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "termios_", "\\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 ", " _", "use", "\\u", "curses_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Curs", "es", " ", "on", " ", "Sol", "aris", " ", "may", " ", "not", " ", "be", " ", "complete", ",", " ", "so", " ", "we", " ", "can", "'", "t", " ", "use", " ", "it", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "\\u", "curses_", "=_", "hasattr_", "(_", "curses_", ",_", "'", "inits", "cr", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
marcotcr/lime-experiments/load_datasets.py
[ { "content": "import random\nimport os\nimport re\nimport numpy as np\nfrom sklearn.feature_extraction.text import CountVectorizer\nfrom sklearn import linear_model\nfrom sklearn import tree\nfrom sklearn import svm\n# PUT POLARITY DATASET PATH HERE\nPOLARITY_PATH = '/Users/marcotcr/phd/datasets/multi_domain_polarity/'\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def LoadDataset(dataset_name):\n if dataset_name.endswith('ng'):\n if dataset_name == '2ng':\n cats = ['alt.atheism', 'soc.religion.christian']\n class_names = ['Atheism', 'Christianity']\n if dataset_name == 'talkng':\n cats = ['talk.politics.guns', 'talk.politics.misc']\n class_names = ['Guns', 'PoliticalMisc']\n if dataset_name == '3ng':\n cats = ['comp.os.ms-windows.misc', 'comp.sys.ibm.pc.hardware', 'comp.windows.x']\n class_names = ['windows.misc', 'ibm.hardware', 'windows.x']\n newsgroups_train = fetch_20newsgroups(subset='train',categories=cats)\n newsgroups_test = fetch_20newsgroups(subset='test',categories=cats)\n train_data = newsgroups_train.data\n train_labels = newsgroups_train.target\n test_data = newsgroups_test.data\n test_labels = newsgroups_test.target\n return train_data, train_labels, test_data, test_labels, class_names\n if dataset_name.startswith('multi_polarity_'):\n name = dataset_name.split('_')[2]\n return LoadMultiDomainDataset(POLARITY_PATH + name)", "metadata": "root.LoadDataset", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def LoadMultiDomainDataset(path_data, remove_bigrams=True):\n random.seed(1)\n pos = []\n neg = []\n def get_words(line, remove_bigrams=True):\n z = [tuple(x.split(':')) for x in re.findall('\\w*?:\\d', line)]\n if remove_bigrams:\n z = ' '.join([' '.join([x[0]] * int(x[1])) for x in z if '_' not in x[0]])\n else:\n z = ' '.join([' '.join([x[0]] * int(x[1])) for x in z])\n return z\n for line in open(os.path.join(path_data, 'negative.review')):\n neg.append(get_words(line, remove_bigrams))\n for line in open(os.path.join(path_data, 'positive.review')):\n pos.append(get_words(line, remove_bigrams))\n random.shuffle(pos)\n random.shuffle(neg)\n split_pos = int(len(pos) * .8)\n split_neg = int(len(neg) * .8)\n train_data = pos[:split_pos] + neg[:split_neg]\n test_data = pos[split_pos:] + neg[split_neg:]\n train_labels = [1] * len(pos[:split_pos]) + [0] * len(neg[:split_neg])\n test_labels = [1] * len(pos[split_pos:]) + [0] * len(neg[split_neg:])\n return train_data, np.array(train_labels), test_data, np.array(test_labels), ['neg', 'pos']", "metadata": "root.LoadMultiDomainDataset", "header": "['module', '___EOS___']", "index": 31 } ]
[ { "span": "from sklearn.feature_extraction.text import CountVectorizer", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 59 }, { "span": "from sklearn import linear_model", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 32 }, { "span": "from sklearn import tree", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 24 }, { "span": "from sklearn import svm", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "feature", "\\u", "extraction_", "._", "text_", "import_", "Count", "Vectorizer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "linear", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "svm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "PU", "T", " ", "POL", "ARI", "TY", " ", "DATASET", " ", "PATH", " ", "HER", "E_", "\\u\\u\\uNL\\u\\u\\u_", "POL", "ARI", "TY", "\\u", "PATH_", "=_", "'/", "User", "s", "/", "marc", "ot", "cr", "/", "ph", "d", "/", "dataset", "s", "/", "multi", "\\u", "domain", "\\u", "polarity", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Load", "Dataset_", "(_", "dataset", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dataset", "\\u", "name_", "._", "endswith_", "(_", "'", "ng", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dataset", "\\u", "name_", "==_", "'", "2n", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cats_", "=_", "[_", "'", "alt", ".", "ath", "eis", "m", "'_", ",_", "'", "soc", ".", "reli", "gion", ".", "chris", "tia", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "names_", "=_", "[_", "'", "Ath", "eis", "m", "'_", ",_", "'", "Christ", "ian", "it", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dataset", "\\u", "name_", "==_", "'", "talk", "ng", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cats_", "=_", "[_", "'", "talk", ".", "politic", "s", ".", "gun", "s", "'_", ",_", "'", "talk", ".", "politic", "s", ".", "misc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "names_", "=_", "[_", "'", "Gun", "s", "'_", ",_", "'", "Poli", "tica", "l", "Mis", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dataset", "\\u", "name_", "==_", "'", "3", "ng", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cats_", "=_", "[_", "'", "comp", ".", "os", ".", "ms", "-", "windows", ".", "misc", "'_", ",_", "'", "comp", ".", "sys", ".", "ib", "m", ".", "pc", ".", "hard", "ware", "'_", ",_", "'", "comp", ".", "windows", ".", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "names_", "=_", "[_", "'", "windows", ".", "misc", "'_", ",_", "'", "ib", "m", ".", "hard", "ware", "'_", ",_", "'", "windows", ".", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "news", "group", "s", "\\u", "train_", "=_", "fetch", "\\u", "20", "news", "groups_", "(_", "subset_", "=_", "'", "train", "'_", ",_", "categories_", "=_", "cats_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "news", "group", "s", "\\u", "test_", "=_", "fetch", "\\u", "20", "news", "groups_", "(_", "subset_", "=_", "'", "test", "'_", ",_", "categories_", "=_", "cats_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "data_", "=_", "news", "group", "s", "\\u", "train_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "labels_", "=_", "news", "group", "s", "\\u", "train_", "._", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "data_", "=_", "news", "group", "s", "\\u", "test_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "labels_", "=_", "news", "group", "s", "\\u", "test_", "._", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "train", "\\u", "data_", ",_", "train", "\\u", "labels_", ",_", "test\\u", "data_", ",_", "test\\u", "labels_", ",_", "class", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dataset", "\\u", "name_", "._", "startswith_", "(_", "'", "multi", "\\u", "polarity", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "dataset", "\\u", "name_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Load", "Multi", "Doma", "in", "Dataset_", "(_", "POL", "ARI", "TY", "\\u", "PATH_", "+_", "name_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Load", "Multi", "Doma", "in", "Dataset_", "(_", "path", "\\u", "data_", ",_", "remove", "\\u", "bigram", "s_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "random_", "._", "seed_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neg_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "words_", "(_", "line_", ",_", "remove", "\\u", "bigram", "s_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "[_", "tuple_", "(_", "x_", "._", "split_", "(_", "':'_", ")_", ")_", "for_", "x_", "in_", "re_", "._", "findall_", "(_", "'\\\\", "w", "*?", ":\\\\", "d", "'_", ",_", "line_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remove", "\\u", "bigram", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "'", " ", "'_", "._", "join_", "(_", "[_", "x_", "[_", "0_", "]_", "]_", "*_", "int_", "(_", "x_", "[_", "1_", "]_", ")_", ")_", "for_", "x_", "in_", "z_", "if_", "'\\u'_", "not_", "in_", "x_", "[_", "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 ", " _", "z_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "'", " ", "'_", "._", "join_", "(_", "[_", "x_", "[_", "0_", "]_", "]_", "*_", "int_", "(_", "x_", "[_", "1_", "]_", ")_", ")_", "for_", "x_", "in_", "z_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path", "\\u", "data_", ",_", "'", "negati", "ve", ".", "review", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neg_", "._", "append_", "(_", "get", "\\u", "words_", "(_", "line_", ",_", "remove", "\\u", "bigram", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path", "\\u", "data_", ",_", "'", "posit", "ive", ".", "review", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "._", "append_", "(_", "get", "\\u", "words_", "(_", "line_", ",_", "remove", "\\u", "bigram", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random_", "._", "shuffle_", "(_", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "shuffle_", "(_", "neg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "split", "\\u", "pos_", "=_", "int_", "(_", "len_", "(_", "pos_", ")_", "*_", ".8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "split", "\\u", "neg_", "=_", "int_", "(_", "len_", "(_", "neg_", ")_", "*_", ".8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "data_", "=_", "pos_", "[_", ":_", "split", "\\u", "pos_", "]_", "+_", "neg_", "[_", ":_", "split", "\\u", "neg_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "data_", "=_", "pos_", "[_", "split", "\\u", "pos_", ":_", "]_", "+_", "neg_", "[_", "split", "\\u", "neg_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "labels_", "=_", "[_", "1_", "]_", "*_", "len_", "(_", "pos_", "[_", ":_", "split", "\\u", "pos_", "]_", ")_", "+_", "[_", "0_", "]_", "*_", "len_", "(_", "neg_", "[_", ":_", "split", "\\u", "neg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "labels_", "=_", "[_", "1_", "]_", "*_", "len_", "(_", "pos_", "[_", "split", "\\u", "pos_", ":_", "]_", ")_", "+_", "[_", "0_", "]_", "*_", "len_", "(_", "neg_", "[_", "split", "\\u", "neg_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "train", "\\u", "data_", ",_", "np_", "._", "array_", "(_", "train", "\\u", "labels_", ")_", ",_", "test\\u", "data_", ",_", "np_", "._", "array_", "(_", "test\\u", "labels_", ")_", ",_", "[_", "'", "neg", "'_", ",_", "'", "pos", "'_", "]_" ]
[ 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, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Imprecise assert
opps/opps/tests/core/permissions/test_models.py
[ { "content": " def test_get_by_user_with_user_permission(self):\n user = User.objects.create(username='john_doe')\n site = Site.objects.all()[0]\n channel = Channel.objects.create(\n name='Home',\n slug='home',\n site=site,\n user=user\n )\n permission = Permission.objects.create(user=user)\n permission.channel.add(channel)\n permission.save()\n\n result = Permission.get_by_user(user)\n\n self.assertTrue(site.pk in result['all_sites_id'])\n self.assertTrue(channel.pk in result['channels_id'])", "metadata": "root.PermissionModelTest.test_get_by_user_with_user_permission", "header": "['class', 'PermissionModelTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_get_by_user_with_group_permission(self):\n group = Group.objects.create(name='programmers')\n user = User.objects.create(username='john_doe')\n user.groups.add(group)\n\n site = Site.objects.all()[0]\n channel = Channel.objects.create(\n name='Home',\n slug='home',\n site=site,\n user=user\n )\n permission = PermissionGroup.objects.create(group=group)\n permission.channel.add(channel)\n permission.save()\n\n result = Permission.get_by_user(user)\n\n self.assertTrue(site.pk in result['all_sites_id'])\n self.assertTrue(channel.pk in result['channels_id'])", "metadata": "root.PermissionModelTest.test_get_by_user_with_group_permission", "header": "['class', 'PermissionModelTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 48 } ]
[ { "span": "self.assertTrue(site.pk in result['all_sites_id'])", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 58 }, { "span": "self.assertTrue(channel.pk in result['channels_id'])", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 60 }, { "span": "self.assertTrue(site.pk in result['all_sites_id'])", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 58 }, { "span": "self.assertTrue(channel.pk in result['channels_id'])", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 60 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Permi", "ssion", "Model", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "by", "\\u", "user", "\\u", "with", "\\u", "user", "\\u", "permission_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "._", "objects_", "._", "create_", "(_", "username_", "=_", "'", "john", "\\u", "doe", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site_", "=_", "Site_", "._", "objects_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "=_", "Channel_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Home", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", "=_", "'", "home", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "=_", "Permission_", "._", "objects_", "._", "create_", "(_", "user_", "=_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "._", "channel_", "._", "add_", "(_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Permission_", "._", "get", "\\u", "by", "\\u", "user_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "site_", "._", "pk_", "in_", "result_", "[_", "'", "all", "\\u", "sites", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "channel_", "._", "pk_", "in_", "result_", "[_", "'", "channel", "s", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Permi", "ssion", "Model", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "by", "\\u", "user", "\\u", "with", "\\u", "group", "\\u", "permission_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "=_", "Group_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "programme", "rs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "User_", "._", "objects_", "._", "create_", "(_", "username_", "=_", "'", "john", "\\u", "doe", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "groups_", "._", "add_", "(_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "Site_", "._", "objects_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "=_", "Channel_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Home", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slug_", "=_", "'", "home", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "=_", "Permi", "ssion", "Group_", "._", "objects_", "._", "create_", "(_", "group_", "=_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "._", "channel_", "._", "add_", "(_", "channel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "permission_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Permission_", "._", "get", "\\u", "by", "\\u", "user_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "site_", "._", "pk_", "in_", "result_", "[_", "'", "all", "\\u", "sites", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "channel_", "._", "pk_", "in_", "result_", "[_", "'", "channel", "s", "\\u", "id", "'_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/util/compat.py
[ { "content": "# util/compat.py\n# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors\n# <see AUTHORS file>\n#\n# This module is part of SQLAlchemy and is released under\n# the MIT License: http://www.opensource.org/licenses/mit-license.php\n\n\"\"\"Handle Python version/platform incompatibilities.\"\"\"\n\nimport sys\n\ntry:\n import threading\nexcept ImportError:\n import dummy_threading as threading\n\npy33 = sys.version_info >= (3, 3)\npy32 = sys.version_info >= (3, 2)\npy3k = sys.version_info >= (3, 0)\npy2k = sys.version_info < (3, 0)\npy265 = sys.version_info >= (2, 6, 5)\njython = sys.platform.startswith('java')\npypy = hasattr(sys, 'pypy_version_info')\nwin32 = sys.platform.startswith('win')\ncpython = not pypy and not jython # TODO: something better for this ?\n\nimport collections\nnext = next\n\nif py3k:\n import pickle\nelse:\n try:\n import cPickle as pickle\n except ImportError:\n import pickle\n\n# work around http://bugs.python.org/issue2646\nif py265:\n safe_kwarg = lambda arg: arg\nelse:\n safe_kwarg = str\n\nArgSpec = collections.namedtuple(\"ArgSpec\",\n [\"args\", \"varargs\", \"keywords\", \"defaults\"])\n\nif py3k:\n import builtins\n\n from inspect import getfullargspec as inspect_getfullargspec\n from urllib.parse import (quote_plus, unquote_plus,\n parse_qsl, quote, unquote)\n import configparser\n from io import StringIO\n\n from io import BytesIO as byte_buffer\n\n\n string_types = str,\n binary_type = bytes\n text_type = str\n int_types = int,\n iterbytes = iter\n\n\n\n\n if py32:\n callable = callable\n else:\n\n\n from functools import reduce\n\n print_ = getattr(builtins, \"print\")\n\n import_ = getattr(builtins, '__import__')\n\n import itertools\n itertools_filterfalse = itertools.filterfalse\n itertools_filter = filter\n itertools_imap = map\n from itertools import zip_longest\n\n import base64\n\n\n\nelse:\n from inspect import getargspec as inspect_getfullargspec\n inspect_getargspec = inspect_getfullargspec\n from urllib import quote_plus, unquote_plus, quote, unquote\n from urlparse import parse_qsl\n import ConfigParser as configparser\n from StringIO import StringIO\n from cStringIO import StringIO as byte_buffer\n\n string_types = basestring,\n binary_type = str\n text_type = unicode\n int_types = int, long\n\n\n\n\n\n\n callable = callable\n cmp = cmp\n reduce = reduce\n\n import base64\n b64encode = base64.b64encode\n b64decode = base64.b64decode\n\n\n import itertools\n itertools_filterfalse = itertools.ifilterfalse\n itertools_filter = itertools.ifilter\n itertools_imap = itertools.imap\n from itertools import izip_longest as zip_longest\n\n\nimport time\nif win32 or jython:\n time_func = time.clock\nelse:\n time_func = time.time\n\nfrom collections import namedtuple\nfrom operator import attrgetter as dottedgetter\n\n\nif py3k:\n\nelse:\n exec(\"def reraise(tp, value, tb=None, cause=None):\\n\"\n \" raise tp, value, tb\\n\")\n\n\nif py3k:\n exec_ = getattr(builtins, 'exec')\nelse:\n\n\n\n\nfrom contextlib import contextmanager\n\ntry:\n from contextlib import nested\nexcept ImportError:\n # removed in py3k, credit to mitsuhiko for\n # workaround\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def inspect_getargspec(func):\n return ArgSpec(\n *inspect_getfullargspec(func)[0:4]\n )", "metadata": "root.inspect_getargspec", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def u(s):\n return s", "metadata": "root.u", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def ue(s):\n return s", "metadata": "root.ue", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def b(s):\n return s.encode(\"latin-1\")", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def callable(fn):\n return hasattr(fn, '__call__')", "metadata": "root.callable", "header": "['module', '___EOS___']", "index": 80 }, { "content": " def cmp(a, b):\n return (a > b) - (a < b)", "metadata": "root.cmp", "header": "['module', '___EOS___']", "index": 83 }, { "content": " def b64encode(x):\n return base64.b64encode(x).decode('ascii')", "metadata": "root.b64encode", "header": "['module', '___EOS___']", "index": 100 }, { "content": " def b64decode(x):\n return base64.b64decode(x.encode('ascii'))", "metadata": "root.b64decode", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def iterbytes(buf):\n return (ord(byte) for byte in buf)", "metadata": "root.iterbytes", "header": "['module', '___EOS___']", "index": 120 }, { "content": " def u(s):\n # this differs from what six does, which doesn't support non-ASCII\n # strings - we only use u() with\n # literal source strings, and all our source files with non-ascii\n # in them (all are tests) are utf-8 encoded.\n return unicode(s, \"utf-8\")", "metadata": "root.u", "header": "['module', '___EOS___']", "index": 123 }, { "content": " def ue(s):\n return unicode(s, \"unicode_escape\")", "metadata": "root.ue", "header": "['module', '___EOS___']", "index": 130 }, { "content": " def b(s):\n return s", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 133 }, { "content": " def import_(*args):\n if len(args) == 4:\n args = args[0:3] + ([str(arg) for arg in args[3]],)\n return __import__(*args)", "metadata": "root.import_", "header": "['module', '___EOS___']", "index": 136 }, { "content": " def print_(*args, **kwargs):\n fp = kwargs.pop(\"file\", sys.stdout)\n if fp is None:\n return\n for arg in enumerate(args):\n if not isinstance(arg, basestring):\n arg = str(arg)\n fp.write(arg)", "metadata": "root.print_", "header": "['module', '___EOS___']", "index": 149 }, { "content": " def reraise(tp, value, tb=None, cause=None):\n if cause is not None:\n value.__cause__ = cause\n if value.__traceback__ is not tb:\n raise value.with_traceback(tb)\n raise value", "metadata": "root.reraise", "header": "['module', '___EOS___']", "index": 176 }, { "content": " def raise_from_cause(exception, exc_info=None):\n if exc_info is None:\n exc_info = sys.exc_info()\n exc_type, exc_value, exc_tb = exc_info\n reraise(type(exception), exception, tb=exc_tb, cause=exc_value)", "metadata": "root.raise_from_cause", "header": "['module', '___EOS___']", "index": 183 }, { "content": " def raise_from_cause(exception, exc_info=None):\n # not as nice as that of Py3K, but at least preserves\n # the code line where the issue occurred\n if exc_info is None:\n exc_info = sys.exc_info()\n exc_type, exc_value, exc_tb = exc_info\n reraise(type(exception), exception, tb=exc_tb)", "metadata": "root.raise_from_cause", "header": "['module', '___EOS___']", "index": 192 }, { "content": " def exec_(func_text, globals_, lcl=None):\n if lcl is None:\n exec('exec func_text in globals_')\n else:\n exec('exec func_text in globals_, lcl')", "metadata": "root.exec_", "header": "['module', '___EOS___']", "index": 203 }, { "content": "def with_metaclass(meta, *bases):\n \"\"\"Create a base class with a metaclass.\n\n Drops the middle class upon creation.\n\n Source: http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/\n\n \"\"\"\n\n class metaclass(meta):\n __call__ = type.__call__\n __init__ = type.__init__\n\n def __new__(cls, name, this_bases, d):\n if this_bases is None:\n return type.__new__(cls, name, (), d)\n return meta(name, bases, d)\n return metaclass('temporary_class', None, {})", "metadata": "root.with_metaclass", "header": "['module', '___EOS___']", "index": 210 }, { "content": " @contextmanager\n def nested(*managers):\n exits = []\n vars = []\n exc = (None, None, None)\n try:\n for mgr in managers:\n exit = mgr.__exit__\n enter = mgr.__enter__\n vars.append(enter())\n exits.append(exit)\n yield vars\n except:\n exc = sys.exc_info()\n finally:\n while exits:\n exit = exits.pop()\n try:\n if exit(*exc):\n exc = (None, None, None)\n except:\n exc = sys.exc_info()\n if exc != (None, None, None):\n reraise(exc[0], exc[1], exc[2])", "metadata": "root.nested", "header": "['module', '___EOS___']", "index": 238 } ]
[ { "span": "import threading", "start_line": 12, "start_column": 4, "end_line": 12, "end_column": 20 }, { "span": "import dummy_threading as threading", "start_line": 14, "start_column": 4, "end_line": 14, "end_column": 39 }, { "span": "import pickle", "start_line": 30, "start_column": 4, "end_line": 30, "end_column": 17 }, { "span": "from urllib.parse import (quote_plus, unquote_plus,\n parse_qsl, quote, unquote)", "start_line": 50, "start_column": 4, "end_line": 51, "end_column": 56 }, { "span": "import configparser", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 23 }, { "span": "from io import StringIO", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 27 }, { "span": "from io import BytesIO as byte_buffer", "start_line": 55, "start_column": 4, "end_line": 55, "end_column": 41 }, { "span": "from itertools import zip_longest", "start_line": 96, "start_column": 4, "end_line": 96, "end_column": 37 }, { "span": "from collections import namedtuple", "start_line": 171, "start_column": 0, "end_line": 171, "end_column": 34 }, { "span": "from operator import attrgetter as dottedgetter", "start_line": 172, "start_column": 0, "end_line": 172, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "util", "/", "compa", "t", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2005", "-", "201", "5", " ", "the", " ", "SQL", "Al", "chem", "y", " ", "author", "s", " ", "and", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "see", " ", "AUTHOR", "S", " ", "file", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "module", " ", "is", " ", "part", " ", "of", " ", "SQL", "Al", "chem", "y", " ", "and", " ", "is", " ", "released", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "MIT", " ", "License", ":", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "mit", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Handle", " ", "Pyth", "on", " ", "version", "/", "platform", " ", "incomp", "ati", "bilit", "ies", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "dummy", "\\u", "threading_", "as_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "py3", "3_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py3", "2_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py3", "k_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py2", "k_", "=_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "3_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py2", "65_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "2_", ",_", "6_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jy", "tho", "n_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "java", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pypy", "_", "=_", "hasattr_", "(_", "sys_", ",_", "'", "pypy", "\\u", "version", "\\u", "info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "tho", "n_", "=_", "not_", "pypy", "_", "and_", "not_", "jy", "tho", "n_", "#", " ", "TOD", "O", ":", " ", "somet", "hing", " ", "bett", "er", " ", "for", " ", "this", " ", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next_", "=_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "py3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "work", " ", "aro", "und", " ", "http", "://", "bug", "s", ".", "python", ".", "org", "/", "issue", "264", "6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "py2", "65_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "safe", "\\u", "kwarg_", "=_", "lambda_", "arg_", ":_", "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 ", " _", "safe", "\\u", "kwarg_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Arg", "Spec_", "=_", "collections_", "._", "namedtuple_", "(_", "\"", "Arg", "Spec", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "args", "\"_", ",_", "\"", "varargs", "\"_", ",_", "\"", "keywords", "\"_", ",_", "\"", "default", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "py3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "inspect_", "import_", "getf", "ull", "argspec_", "as_", "inspect", "\\u", "getf", "ull", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "(_", "quote", "\\u", "plus_", ",_", "unqu", "ote", "\\u", "plus_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parse", "\\u", "qs", "l_", ",_", "quote_", ",_", "unquote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "configparser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "as_", "byte", "\\u", "buffer_", "\\u\\u\\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_", "string", "\\u", "types_", "=_", "str_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "types_", "=_", "int_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "bytes_", "=_", "iter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "py3", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callable_", "=_", "callable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "functools_", "import_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print\\u_", "=_", "getattr_", "(_", "builtins_", ",_", "\"", "print", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import", "\\u_", "=_", "getattr_", "(_", "builtins_", ",_", "'\\u", "\\u", "import", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter", "false_", "=_", "itertools_", "._", "filter", "false_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter_", "=_", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "imap_", "=_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "zip", "\\u", "longest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "inspect_", "import_", "getargs", "pec_", "as_", "inspect", "\\u", "getf", "ull", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inspect", "\\u", "getargs", "pec_", "=_", "inspect", "\\u", "getf", "ull", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote", "\\u", "plus_", ",_", "unqu", "ote", "\\u", "plus_", ",_", "quote_", ",_", "unquote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "parse", "\\u", "qs", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "as_", "configparser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "as_", "byte", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "string", "\\u", "types_", "=_", "basestring_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "types_", "=_", "int_", ",_", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "callable_", "=_", "callable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmp_", "=_", "cmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduce_", "=_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b64encode_", "=_", "base64_", "._", "b64encode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b64decode_", "=_", "base64_", "._", "b64decode_", "\\u\\u\\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_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter", "false_", "=_", "itertools_", "._", "ifi", "lter", "false_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter_", "=_", "itertools_", "._", "ifi", "lter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "imap_", "=_", "itertools_", "._", "imap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "izi", "p", "\\u", "longest_", "as_", "zip", "\\u", "longest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "win32", "_", "or_", "jy", "tho", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "func_", "=_", "time_", "._", "clock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "func_", "=_", "time_", "._", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "attrgetter_", "as_", "dot", "ted", "getter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "py3", "k_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "\"", "def", " ", "reraise", "(", "tp", ",", " ", "value", ",", " ", "tb", "=", "Non", "e", ",", " ", "caus", "e", "=", "Non", "e", "):", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "raise", " ", "tp", ",", " ", "value", ",", " ", "tb", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "py3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec\\u_", "=_", "getattr_", "(_", "builtins_", ",_", "'", "exec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\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_", "contextlib_", "import_", "nested_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", "d", " ", "in", " ", "py3", "k", ",", " ", "credit", " ", "to", " ", "mit", "su", "hi", "ko", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "workar", "ound_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "inspect", "\\u", "getargs", "pec_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Arg", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "inspect", "\\u", "getf", "ull", "argspec_", "(_", "func_", ")_", "[_", "0_", ":_", "4_", "]_", "\\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_", "def_", "u_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ue_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "encode_", "(_", "\"", "latin", "-1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "callable_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hasattr_", "(_", "fn_", ",_", "'\\u", "\\u", "call", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cmp_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "a_", ">_", "b_", ")_", "-_", "(_", "a_", "<_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "b64encode_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base64_", "._", "b64encode_", "(_", "x_", ")_", "._", "decode_", "(_", "'", "ascii", "'_", ")_", "\\u\\u\\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_", "b64decode_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base64_", "._", "b64decode_", "(_", "x_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "iter", "bytes_", "(_", "buf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "ord_", "(_", "byte_", ")_", "for_", "byte_", "in_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "u_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "differs", " ", "from", " ", "what", " ", "si", "x", " ", "doe", "s", ",", " ", "whi", "ch", " ", "doe", "sn", "'", "t", " ", "support", " ", "non", "-", "ASCII", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "string", "s", " ", "-", " ", "we", " ", "only", " ", "use", " ", "u", "()", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "literal", " ", "source", " ", "string", "s", ",", " ", "and", " ", "all", " ", "our", " ", "source", " ", "files", " ", "with", " ", "non", "-", "ascii_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "them", " ", "(", "all", " ", "are", " ", "tests", ")", " ", "are", " ", "utf", "-", "8", " ", "encode", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "s_", ",_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ue_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "s_", ",_", "\"", "unicode", "\\u", "escape", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "args_", "[_", "0_", ":_", "3_", "]_", "+_", "(_", "[_", "str_", "(_", "arg_", ")_", "for_", "arg_", "in_", "args_", "[_", "3_", "]_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u", "import\\u\\u_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "print\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "kwargs_", "._", "pop_", "(_", "\"", "file", "\"_", ",_", "sys_", "._", "stdout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fp_", "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_", "for_", "arg_", "in_", "enumerate_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "arg_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "str_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fp_", "._", "write_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "reraise", "_", "(_", "tp_", ",_", "value_", ",_", "tb_", "=_", "None_", ",_", "cause_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cause_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "._", "\\u\\u", "caus", "e\\u", "\\u_", "=_", "cause_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "\\u\\u", "traceback", "\\u\\u_", "is_", "not_", "tb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "value_", "._", "with", "\\u", "traceback_", "(_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "raise", "\\u", "from", "\\u", "cause_", "(_", "exception_", ",_", "exc", "\\u", "info_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc", "\\u", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "=_", "exc", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reraise", "_", "(_", "type_", "(_", "exception_", ")_", ",_", "exception_", ",_", "tb_", "=_", "exc", "\\u", "tb_", ",_", "cause_", "=_", "exc", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "raise", "\\u", "from", "\\u", "cause_", "(_", "exception_", ",_", "exc", "\\u", "info_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "as", " ", "nice", " ", "as", " ", "tha", "t", " ", "of", " ", "Py", "3", "K", ",", " ", "but", " ", "at", " ", "leas", "t", " ", "preserve", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "code", " ", "line", " ", "where", " ", "the", " ", "issue", " ", "occur", "red_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc", "\\u", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "=_", "exc", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reraise", "_", "(_", "type_", "(_", "exception_", ")_", ",_", "exception_", ",_", "tb_", "=_", "exc", "\\u", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "exec\\u_", "(_", "func", "\\u", "text_", ",_", "globals", "\\u_", ",_", "lc", "l_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lc", "l_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "'", "exec", " ", "func", "\\u", "text", " ", "in", " ", "globals", "\\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 ", " _", "exec_", "(_", "'", "exec", " ", "func", "\\u", "text", " ", "in", " ", "globals", "\\u", ",", " ", "lc", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "with", "\\u", "metaclass_", "(_", "meta_", ",_", "*_", "bases_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "base", " ", "class", " ", "with", " ", "a", " ", "metaclass", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Drop", "s", " ", "the", " ", "middle", " ", "class", " ", "upo", "n", " ", "creati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", ":", " ", "http", "://", "luc", "um", "r", ".", "poc", "oo", ".", "org", "/", "2013", "/", "5", "/", "21", "/", "porti", "ng", "-", "to", "-", "python", "-", "3", "-", "redu", "x", "/", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "metaclass_", "(_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "call\\u\\u_", "=_", "type_", "._", "\\u\\u", "call\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "init\\u\\u_", "=_", "type_", "._", "\\u\\u", "init\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "this", "\\u", "bases_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "this", "\\u", "bases_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "(_", ")_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meta_", "(_", "name_", ",_", "bases_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "metaclass_", "(_", "'", "temporar", "y", "\\u", "class", "'_", ",_", "None_", ",_", "{_", "}_", ")_", "\\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 ", " _", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "nested_", "(_", "*_", "managers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exits", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc_", "=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "mgr_", "in_", "managers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "=_", "mgr_", "._", "\\u\\u", "exit\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enter_", "=_", "mgr_", "._", "\\u\\u", "enter\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars_", "._", "append_", "(_", "enter_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exits", "_", "._", "append_", "(_", "exit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "exits", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "=_", "exits", "_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "exit_", "(_", "*_", "exc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", "\\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 ", " ", "_", "exc_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exc_", "!=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reraise", "_", "(_", "exc_", "[_", "0_", "]_", ",_", "exc_", "[_", "1_", "]_", ",_", "exc_", "[_", "2_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
zyrikby/BBoxTester/BBoxTester/main_intents_strategy.py
[ { "content": "'''\nCreated on Nov 26, 2014\n\n@author: Yury Zhauniarovich <y.zhalnerovich{at}gmail.com>\n'''\nimport os, time\n\nfrom interfaces.adb_interface import AdbInterface\nfrom bboxcoverage import BBoxCoverage\nfrom running_strategies import IntentInvocationStrategy\n\nimport smtplib\nimport email.utils\nfrom email.mime.text import MIMEText\n\nAPK_DIR_SOURCES = [\"\", \"\"]\n\nSMTP_SERVER = 'smtp.gmail.com'\nSMTP_PORT = 587\nSENDER = \"\"\nPASSWORD = \"\"\nTO_EMAIL = \"\"\n\n\n\n\n\n\n\n\n#main part\nadb = AdbInterface()\ndevice = getExecutionDevice()\nif not device:\n exit(1)\n \nadb.setTargetSerial(device)\nbboxcoverage = BBoxCoverage()\n\nfor apk_dir_source in APK_DIR_SOURCES:\n print \"\\n\\nStarting experiment for directory: [%s]\" % apk_dir_source\n result_directories = getSubdirs(apk_dir_source)\n for directory in result_directories:\n apk_file = getInstrApkInFolder(directory)\n if apk_file:\n print \"Starting experiment for apk: [%s]\" % apk_file\n try:\n bboxcoverage.initAlreadyInstrApkEnv(pathToInstrApk=apk_file, resultsDir=directory)\n except:\n print \"Exception while initialization!\"\n continue\n try:\n bboxcoverage.installApkOnDevice()\n except:\n print \"Exception while installation apk on device!\"\n bboxcoverage.uninstallPackage()\n try:\n bboxcoverage.installApkOnDevice()\n except:\n continue\n \n package_name = bboxcoverage.getPackageName()\n params = {}\n params[\"strategy\"] = \"main_intents\"\n params[\"package_name\"] = package_name\n params[\"main_activity\"] = bboxcoverage.androidManifest.getMainActivity()\n \n try: \n bboxcoverage.startTesting()\n except:\n print \"Exception while startTesting!\"\n bboxcoverage.uninstallPackage()\n continue\n \n try:\n runMainIntentsStrategy(adb=adb, androidManifest=bboxcoverage.androidManifestFile, delay=10)\n except:\n print \"Exception while running strategy!\"\n bboxcoverage.uninstallPackage()\n continue\n \n try: \n bboxcoverage.stopTesting(\"main_intents\", paramsToWrite=params)\n except:\n print \"Exception while running strategy!\"\n bboxcoverage.uninstallPackage()\n continue\n \n time.sleep(3)\n bboxcoverage.uninstallPackage()\n time.sleep(5)\n \n sendMessage(\"[BBoxTester]\", \"Experiments done for directory [%s]!\" % apk_dir_source)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 114, "start_column": 12, "end_line": 114, "end_column": 19 }, { "span": "except:", "start_line": 119, "start_column": 12, "end_line": 119, "end_column": 19 }, { "span": "except:", "start_line": 124, "start_column": 16, "end_line": 124, "end_column": 23 }, { "span": "except:", "start_line": 135, "start_column": 12, "end_line": 135, "end_column": 19 }, { "span": "except:", "start_line": 142, "start_column": 12, "end_line": 142, "end_column": 19 }, { "span": "except:", "start_line": 149, "start_column": 12, "end_line": 149, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Nov", " ", "2", "6", ",", " ", "2014", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Yu", "ry", " ", "Zha", "uni", "aro", "vic", "h", " ", "<", "y", ".", "zha", "ln", "ero", "vic", "h", "{", "at", "}", "gma", "il", ".", "com", ">", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "interfaces_", "._", "adb", "\\u", "interface_", "import_", "Ad", "b", "Interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bbox", "coverage_", "import_", "BB", "ox", "Coverage", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "runn", "ing", "\\u", "strategies_", "import_", "Inten", "t", "Invoca", "tion", "Strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "smtplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "email_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "email_", "._", "mime_", "._", "text_", "import_", "MIME", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "AP", "K", "\\u", "DIR", "\\u", "SOURCES", "_", "=_", "[_", "\"\"_", ",_", "\"\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SMT", "P", "\\u", "SERVER_", "=_", "'", "smt", "p", ".", "gma", "il", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SMT", "P", "\\u", "PORT_", "=_", "587", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEND", "ER_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PASSWORD_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TO", "\\u", "EMAIL_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", "main", " ", "part_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "adb_", "=_", "Ad", "b", "Interface_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device_", "=_", "get", "Execut", "ion", "Device_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "device_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "adb_", "._", "set", "Target", "Serial_", "(_", "device_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bbox", "coverage_", "=_", "BB", "ox", "Coverage", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "apk", "\\u", "dir\\u", "source_", "in_", "AP", "K", "\\u", "DIR", "\\u", "SOURCES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "\\\\", "n", "Start", "ing", " ", "experiment", " ", "for", " ", "director", "y", ":", " ", "[", "%", "s", "]\"_", "%_", "apk", "\\u", "dir\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "directories_", "=_", "get", "Subd", "irs_", "(_", "apk", "\\u", "dir\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "directory_", "in_", "result", "\\u", "directories_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apk", "\\u", "file_", "=_", "get", "Instr", "Ap", "k", "In", "Folder_", "(_", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "apk", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Start", "ing", " ", "experiment", " ", "for", " ", "apk", ":", " ", "[", "%", "s", "]\"_", "%_", "apk", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox", "coverage_", "._", "init", "Al", "read", "y", "Instr", "Ap", "k", "Env_", "(_", "path", "To", "Instr", "Ap", "k_", "=_", "apk", "\\u", "file_", ",_", "results", "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 ", " _", "print_", "\"", "Except", "ion", " ", "whi", "le", " ", "initialization", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox", "coverage_", "._", "install", "Ap", "k", "On", "Device_", "(_", ")_", "\\u\\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_", "\"", "Except", "ion", " ", "whi", "le", " ", "installation", " ", "apk", " ", "on", " ", "device", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bbox", "coverage_", "._", "uninstall", "Package_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bbox", "coverage_", "._", "install", "Ap", "k", "On", "Device_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "package", "\\u", "name_", "=_", "bbox", "coverage_", "._", "get", "Packa", "ge", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "\"", "strat", "eg", "y", "\"_", "]_", "=_", "\"", "main", "\\u", "intent", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "\"", "package", "\\u", "name", "\"_", "]_", "=_", "package", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "\"", "main", "\\u", "activit", "y", "\"_", "]_", "=_", "bbox", "coverage_", "._", "android", "Manifest", "_", "._", "get", "Main", "Activity_", "(_", ")_", "\\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 ", " _", "bbox", "coverage_", "._", "start", "Test", "ing_", "(_", ")_", "\\u\\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_", "\"", "Except", "ion", " ", "whi", "le", " ", "start", "Test", "ing", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bbox", "coverage_", "._", "uninstall", "Package_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run", "Main", "Inten", "ts", "Strategy_", "(_", "adb_", "=_", "adb_", ",_", "android", "Manifest", "_", "=_", "bbox", "coverage_", "._", "android", "Manifest", "File_", ",_", "delay_", "=_", "10_", ")_", "\\u\\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_", "\"", "Except", "ion", " ", "whi", "le", " ", "runn", "ing", " ", "strat", "eg", "y", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bbox", "coverage_", "._", "uninstall", "Package_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox", "coverage_", "._", "stop", "Test", "ing_", "(_", "\"", "main", "\\u", "intent", "s", "\"_", ",_", "params", "To", "Write_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Except", "ion", " ", "whi", "le", " ", "runn", "ing", " ", "strat", "eg", "y", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bbox", "coverage_", "._", "uninstall", "Package_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bbox", "coverage_", "._", "uninstall", "Package_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "send", "Message_", "(_", "\"[", "BB", "ox", "Tester", "]\"_", ",_", "\"", "Experiment", "s", " ", "don", "e", " ", "for", " ", "director", "y", " ", "[", "%", "s", "]", "!\"_", "%_", "apk", "\\u", "dir\\u", "source_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused local variable
ejeschke/ginga/ginga/misc/plugins/Thumbs.py
[ { "content": " def build_gui(self, container):\n width, height = 300, 300\n cm, im = self.fv.cm, self.fv.im\n\n tg = Viewers.ImageViewCanvas(logger=self.logger)\n tg.configure_window(200, 200)\n tg.enable_autozoom('on')\n tg.set_autocut_params('zscale')\n tg.enable_autocuts('override')\n tg.enable_auto_orient(True)\n tg.defer_redraw = False\n tg.set_bg(0.7, 0.7, 0.7)\n self.thumb_generator = tg\n\n sw = Widgets.ScrollArea()\n sw.add_callback('configure', self.thumbpane_resized_cb)\n\n # Create thumbnails pane\n vbox = Widgets.GridBox()\n vbox.set_margins(4, 4, 4, 4)\n vbox.set_column_spacing(14)\n self.w.thumbs = vbox\n\n sw.set_widget(vbox)\n self.w.thumbs_scroll = sw\n\n container.add_widget(sw, stretch=1)\n\n captions = (('Auto scroll', 'checkbutton', 'Clear', 'button'),)\n w, b = Widgets.build_info(captions)\n self.w.update(b)\n\n b.auto_scroll.set_tooltip(\n \"Scroll the thumbs window when new images arrive\")\n b.clear.set_tooltip(\"Remove all current thumbnails\")\n b.clear.add_callback('activated', lambda w: self.clear())\n auto_scroll = self.settings.get('auto_scroll', True)\n b.auto_scroll.set_state(auto_scroll)\n container.add_widget(w, stretch=0)\n\n self.gui_up = True", "metadata": "root.Thumbs.build_gui", "header": "['class', 'Thumbs', '(', 'GingaPlugin', '.', 'GlobalPlugin', ')', ':', '___EOS___']", "index": 77 }, { "content": " def add_image_cb(self, viewer, chname, image, image_info):\n if not self.gui_up:\n return False\n\n # image is flagged not to make a thumbnail?\n nothumb = image.get('nothumb', False)\n if nothumb:\n return\n\n idx = image.get('idx', None)\n # get image path\n path = image_info.path\n\n if path is not None:\n path = os.path.abspath(path)\n name = image_info.name\n\n thumbname = name\n self.logger.info(\"making thumb for %s\" % (thumbname))\n\n future = image_info.image_future\n\n # Is there a preference set to avoid making thumbnails?\n chinfo = self.fv.get_channelInfo(chname)\n prefs = chinfo.settings\n if not prefs.get('genthumb', False):\n return\n\n # Is this thumbnail already in the list?\n # NOTE: does not handle two separate images with the same path\n # in the same channel\n thumbkey = self.get_thumb_key(chname, name, path)\n with self.thmblock:\n if thumbkey in self.thumbDict:\n return\n\n # Get metadata for mouse-over tooltip\n header = image.get_header()\n metadata = {}\n for kwd in self.keywords:\n metadata[kwd] = header.get(kwd, 'N/A')\n metadata[self.settings.get('mouseover_name_key','NAME')] = name\n\n thumbpath = self.get_thumbpath(path)\n\n with self.thmblock:\n self.copy_attrs(chinfo.fitsimage)\n self.thumb_generator.set_image(image)\n imgwin = self.thumb_generator.get_image_as_widget()\n\n label_length = self.settings.get('label_length', None)\n label_cutoff = self.settings.get('label_cutoff', 'right')\n\n # Shorten thumbnail label, if requested\n if label_length is not None:\n thumbname = iohelper.shorten_name(thumbname, label_length,\n side=label_cutoff)\n\n self.insert_thumbnail(imgwin, thumbkey, thumbname, chname, name, path,\n thumbpath, metadata, future)", "metadata": "root.Thumbs.add_image_cb", "header": "['class', 'Thumbs', '(', 'GingaPlugin', '.', 'GlobalPlugin', ')', ':', '___EOS___']", "index": 129 } ]
[ { "span": "width,", "start_line": 78, "start_column": 8, "end_line": 78, "end_column": 13 }, { "span": "height ", "start_line": 78, "start_column": 15, "end_line": 78, "end_column": 21 }, { "span": "cm,", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 10 }, { "span": "im ", "start_line": 79, "start_column": 12, "end_line": 79, "end_column": 14 }, { "span": "idx ", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Thumb", "s_", "(_", "Gi", "nga", "Plugin_", "._", "Global", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "gui_", "(_", "self_", ",_", "container_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", ",_", "height_", "=_", "300_", ",_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cm_", ",_", "im_", "=_", "self_", "._", "fv_", "._", "cm_", ",_", "self_", "._", "fv_", "._", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tg_", "=_", "View", "ers_", "._", "Image", "View", "Canvas_", "(_", "logger_", "=_", "self_", "._", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg_", "._", "configur", "e\\u", "window_", "(_", "200_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg_", "._", "enable", "\\u", "auto", "zoom_", "(_", "'", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg_", "._", "set\\u", "autoc", "ut", "\\u", "params_", "(_", "'", "zsc", "ale", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg_", "._", "enable", "\\u", "autoc", "uts", "_", "(_", "'", "override", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg_", "._", "enable", "\\u", "auto", "\\u", "orient_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg_", "._", "defer", "\\u", "redraw_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tg_", "._", "set\\u", "bg_", "(_", "0.7_", ",_", "0.7_", ",_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thumb", "\\u", "generator_", "=_", "tg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sw_", "=_", "Widgets_", "._", "Scroll", "Area_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sw_", "._", "add", "\\u", "callback_", "(_", "'", "configur", "e", "'_", ",_", "self_", "._", "thumb", "pane", "\\u", "resized", "\\u", "cb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "thumbnail", "s", " ", "pane_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "Widgets_", "._", "Grid", "Box_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "set\\u", "margins", "_", "(_", "4_", ",_", "4_", ",_", "4_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "set\\u", "column", "\\u", "spacing_", "(_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "w_", "._", "thumbs", "_", "=_", "vbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sw_", "._", "set\\u", "widget_", "(_", "vbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "w_", "._", "thumbs", "\\u", "scroll_", "=_", "sw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "container_", "._", "add", "\\u", "widget_", "(_", "sw_", ",_", "stretch", "_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "captions", "_", "=_", "(_", "(_", "'", "Auto", " ", "scroll", "'_", ",_", "'", "checkbutton", "'_", ",_", "'", "Clear", "'_", ",_", "'", "button", "'_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", ",_", "b_", "=_", "Widgets_", "._", "build", "\\u", "info_", "(_", "captions", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "w_", "._", "update_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "auto", "\\u", "scroll_", "._", "set\\u", "tooltip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Scroll", " ", "the", " ", "thumbs", " ", "window", " ", "whe", "n", " ", "new", " ", "images", " ", "arrive", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clear_", "._", "set\\u", "tooltip_", "(_", "\"", "Remove", " ", "all", " ", "current", " ", "thumbnail", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clear_", "._", "add", "\\u", "callback_", "(_", "'", "activat", "ed", "'_", ",_", "lambda_", "w_", ":_", "self_", "._", "clear_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auto", "\\u", "scroll_", "=_", "self_", "._", "settings_", "._", "get_", "(_", "'", "auto", "\\u", "scroll", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "auto", "\\u", "scroll_", "._", "set\\u", "state_", "(_", "auto", "\\u", "scroll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "._", "add", "\\u", "widget_", "(_", "w_", ",_", "stretch", "_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gui", "\\u", "up_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Thumb", "s_", "(_", "Gi", "nga", "Plugin_", "._", "Global", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "image", "\\u", "cb_", "(_", "self_", ",_", "viewer_", ",_", "chn", "ame_", ",_", "image_", ",_", "image", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "gui", "\\u", "up_", ":_", "\\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_", "#", " ", "image", " ", "is", " ", "flagged", " ", "not", " ", "to", " ", "make", " ", "a", " ", "thumbnail", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "not", "hum", "b_", "=_", "image_", "._", "get_", "(_", "'", "not", "hum", "b", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not", "hum", "b_", ":_", "\\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_", "idx_", "=_", "image_", "._", "get_", "(_", "'", "idx", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "image", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "image", "\\u", "info_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "path_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "image", "\\u", "info_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thumb", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "\"", "mak", "ing", " ", "thumb", " ", "for", " ", "%", "s", "\"_", "%_", "(_", "thumb", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "future_", "=_", "image", "\\u", "info_", "._", "image", "\\u", "future_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Is", " ", "there", " ", "a", " ", "preference", " ", "set", " ", "to", " ", "avoid", " ", "mak", "ing", " ", "thumbnail", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "chin", "fo_", "=_", "self_", "._", "fv_", "._", "get", "\\u", "channel", "Info_", "(_", "chn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefs_", "=_", "chin", "fo_", "._", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "prefs_", "._", "get_", "(_", "'", "gent", "hum", "b", "'_", ",_", "False_", ")_", ":_", "\\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_", "#", " ", "Is", " ", "this", " ", "thumbnail", " ", "alr", "ead", "y", " ", "in", " ", "the", " ", "list", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "doe", "s", " ", "not", " ", "handle", " ", "two", " ", "separate", " ", "images", " ", "with", " ", "the", " ", "same", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "same", " ", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "thumb", "key_", "=_", "self_", "._", "get", "\\u", "thumb", "\\u", "key_", "(_", "chn", "ame_", ",_", "name_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "thm", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "thumb", "key_", "in_", "self_", "._", "thumb", "Dict_", ":_", "\\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_", "#", " ", "Get", " ", "metadata", " ", "for", " ", "mouse", "-", "over", " ", "tooltip_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header_", "=_", "image_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "kwd", "_", "in_", "self_", "._", "keywords_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata_", "[_", "kwd", "_", "]_", "=_", "header_", "._", "get_", "(_", "kwd", "_", ",_", "'", "N", "/", "A", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata_", "[_", "self_", "._", "settings_", "._", "get_", "(_", "'", "mouse", "over", "\\u", "name", "\\u", "key", "'_", ",_", "'", "NAME", "'_", ")_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "thumb", "path_", "=_", "self_", "._", "get", "\\u", "thumb", "path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "thm", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "copy", "\\u", "attrs_", "(_", "chin", "fo_", "._", "fits", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "thumb", "\\u", "generator_", "._", "set\\u", "image_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "win_", "=_", "self_", "._", "thumb", "\\u", "generator_", "._", "get", "\\u", "image", "\\u", "as", "\\u", "widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "label", "\\u", "length_", "=_", "self_", "._", "settings_", "._", "get_", "(_", "'", "label", "\\u", "length", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "\\u", "cutoff_", "=_", "self_", "._", "settings_", "._", "get_", "(_", "'", "label", "\\u", "cuto", "ff", "'_", ",_", "'", "right", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Short", "en", " ", "thumbnail", " ", "label", ",", " ", "if", " ", "requested_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "label", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "name_", "=_", "io", "helper_", "._", "shorten", "\\u", "name_", "(_", "thumb", "name_", ",_", "label", "\\u", "length_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "side_", "=_", "label", "\\u", "cutoff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "insert", "\\u", "thumbnail_", "(_", "img", "win_", ",_", "thumb", "key_", ",_", "thumb", "name_", ",_", "chn", "ame_", ",_", "name_", ",_", "path_", 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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 ]
Imprecise assert
PyTables/PyTables/tables/tests/test_do_undo.py
[ { "content": " def test00_simple(self):\n \"\"\"Checking simple do/undo.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00_simple...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray', [3, 4], \"Another array\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that otherarray does not exist in the object tree\n self.assertTrue(\"/otherarray\" not in self.h5file)\n self.assertEqual(self.h5file._curaction, 0)\n self.assertEqual(self.h5file._curmark, 0)\n\n # Redo the operation\n self._do_reopen()\n self.h5file.redo()\n if common.verbose:\n print(\"Object tree after redo:\", self.h5file)\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/otherarray\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray.title, \"Another array\")\n self.assertEqual(self.h5file._curaction, 1)\n self.assertEqual(self.h5file._curmark, 0)", "metadata": "root.BasicTestCase.test00_simple", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test01_twice(self):\n \"\"\"Checking do/undo (twice operations intertwined)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01_twice...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray', [3, 4], \"Another array\")\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operations\n self._do_reopen()\n self.h5file.undo()\n self.assertTrue(\"/otherarray\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertEqual(self.h5file._curaction, 0)\n self.assertEqual(self.h5file._curmark, 0)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/otherarray\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray.title, \"Another array\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")\n self.assertEqual(self.h5file._curaction, 2)\n self.assertEqual(self.h5file._curmark, 0)", "metadata": "root.BasicTestCase.test01_twice", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test02_twice2(self):\n \"\"\"Checking twice ops and two marks.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02_twice2...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray', [3, 4], \"Another array\")\n\n # Put a mark\n self._do_reopen()\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n self.assertEqual(self.h5file._curaction, 3)\n self.assertEqual(self.h5file._curmark, 1)\n\n # Unwind just one mark\n self.h5file.undo()\n self.assertTrue(\"/otherarray\" in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertEqual(self.h5file._curaction, 2)\n self.assertEqual(self.h5file._curmark, 1)\n\n # Unwind another mark\n self.h5file.undo()\n self.assertEqual(self.h5file._curaction, 0)\n self.assertEqual(self.h5file._curmark, 0)\n self.assertTrue(\"/otherarray\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n\n # Redo until the next mark\n self.h5file.redo()\n self.assertTrue(\"/otherarray\" in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self._do_reopen()\n self.assertEqual(self.h5file._curaction, 2)\n self.assertEqual(self.h5file._curmark, 1)\n\n # Redo until the end\n self.h5file.redo()\n self.assertTrue(\"/otherarray\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray.title, \"Another array\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")\n self.assertEqual(self.h5file._curaction, 3)\n self.assertEqual(self.h5file._curmark, 1)", "metadata": "root.BasicTestCase.test02_twice2", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 121 }, { "content": " def test03_6times3marks(self):\n \"\"\"Checking with six ops and three marks.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03_6times3marks...\" %\n self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Put a mark\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n\n # Put a mark\n self._do_reopen()\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray5', [7, 8], \"Another array 5\")\n self.h5file.create_array('/', 'otherarray6', [8, 9], \"Another array 6\")\n\n # Unwind just one mark\n self.h5file.undo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" in self.h5file)\n self.assertTrue(\"/otherarray5\" not in self.h5file)\n self.assertTrue(\"/otherarray6\" not in self.h5file)\n\n # Unwind another mark\n self.h5file.undo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n self.assertTrue(\"/otherarray5\" not in self.h5file)\n self.assertTrue(\"/otherarray6\" not in self.h5file)\n\n # Unwind all marks\n self.h5file.undo()\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n self.assertTrue(\"/otherarray5\" not in self.h5file)\n self.assertTrue(\"/otherarray6\" not in self.h5file)\n\n # Redo until the next mark\n self._do_reopen()\n self.h5file.redo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n self.assertTrue(\"/otherarray5\" not in self.h5file)\n self.assertTrue(\"/otherarray6\" not in self.h5file)\n\n # Redo until the next mark\n self.h5file.redo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" in self.h5file)\n self.assertTrue(\"/otherarray5\" not in self.h5file)\n self.assertTrue(\"/otherarray6\" not in self.h5file)\n\n # Redo until the end\n self.h5file.redo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" in self.h5file)\n self.assertTrue(\"/otherarray5\" in self.h5file)\n self.assertTrue(\"/otherarray6\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray3.read(), [5, 6])\n self.assertEqual(self.h5file.root.otherarray4.read(), [6, 7])\n self.assertEqual(self.h5file.root.otherarray5.read(), [7, 8])\n self.assertEqual(self.h5file.root.otherarray6.read(), [8, 9])\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")\n self.assertEqual(self.h5file.root.otherarray3.title, \"Another array 3\")\n self.assertEqual(self.h5file.root.otherarray4.title, \"Another array 4\")\n self.assertEqual(self.h5file.root.otherarray5.title, \"Another array 5\")\n self.assertEqual(self.h5file.root.otherarray6.title, \"Another array 6\")", "metadata": "root.BasicTestCase.test03_6times3marks", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 174 }, { "content": " def test04_6times3marksro(self):\n \"\"\"Checking with six operations, three marks and do/undo in random\n order.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test04_6times3marksro...\" %\n self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Put a mark\n self.h5file.mark()\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n\n # Unwind the previous mark\n self.h5file.undo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Put a mark in the middle of stack\n if common.verbose:\n print(\"All nodes:\", self.h5file.walk_nodes())\n self.h5file.mark()\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray5', [7, 8], \"Another array 5\")\n self.h5file.create_array('/', 'otherarray6', [8, 9], \"Another array 6\")\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n self.assertTrue(\"/otherarray5\" in self.h5file)\n self.assertTrue(\"/otherarray6\" in self.h5file)\n\n # Unwind previous mark\n self.h5file.undo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n self.assertTrue(\"/otherarray5\" not in self.h5file)\n self.assertTrue(\"/otherarray6\" not in self.h5file)\n\n # Redo until the last mark\n self.h5file.redo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n self.assertTrue(\"/otherarray5\" in self.h5file)\n self.assertTrue(\"/otherarray6\" in self.h5file)\n\n # Redo until the next mark (non-existent, so no action)\n self._do_reopen()\n self.h5file.redo()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n self.assertTrue(\"/otherarray5\" in self.h5file)\n self.assertTrue(\"/otherarray6\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray5.read(), [7, 8])\n self.assertEqual(self.h5file.root.otherarray6.read(), [8, 9])\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")\n self.assertEqual(self.h5file.root.otherarray5.title, \"Another array 5\")\n self.assertEqual(self.h5file.root.otherarray6.title, \"Another array 6\")", "metadata": "root.BasicTestCase.test04_6times3marksro", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 267 }, { "content": " def test05_destructive(self):\n \"\"\"Checking with a destructive action during undo.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test05_destructive...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n\n # Put a mark\n self.h5file.mark()\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Do the destructive operation\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n\n # Check objects\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray3.read(), [5, 6])\n self.assertEqual(self.h5file.root.otherarray3.title, \"Another array 3\")", "metadata": "root.BasicTestCase.test05_destructive", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 346 }, { "content": " def test05b_destructive(self):\n \"\"\"Checking with a destructive action during undo (II)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test05b_destructive...\" %\n self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n\n # Put a mark\n self._do_reopen()\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Do the destructive operation\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n\n # Put a mark\n self._do_reopen()\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n self.assertTrue(\"/otherarray4\" in self.h5file)\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check objects\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray3.read(), [5, 6])\n self.assertEqual(self.h5file.root.otherarray3.title, \"Another array 3\")\n self.assertTrue(\"/otherarray4\" not in self.h5file)", "metadata": "root.BasicTestCase.test05b_destructive", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 380 }, { "content": " def test05c_destructive(self):\n \"\"\"Checking with a destructive action during undo (III)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test05c_destructive...\" %\n self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n\n # Put a mark\n self.h5file.mark()\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Do the destructive operation\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n\n # Put a mark\n self.h5file.mark()\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n self.assertTrue(\"/otherarray4\" in self.h5file)\n\n # Now unwind twice\n self.h5file.undo()\n self._do_reopen()\n self.h5file.undo()\n\n # Check objects\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)", "metadata": "root.BasicTestCase.test05c_destructive", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 424 }, { "content": " def test05d_destructive(self):\n \"\"\"Checking with a destructive action during undo (IV)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test05d_destructive...\" %\n self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n\n # Put a mark\n self._do_reopen()\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Do the destructive operation\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n\n # Put a mark\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n self.assertTrue(\"/otherarray4\" in self.h5file)\n\n # Now, go to the first mark\n self._do_reopen()\n self.h5file.undo(0)\n\n # Check objects\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)", "metadata": "root.BasicTestCase.test05d_destructive", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 466 }, { "content": " def test05e_destructive(self):\n \"\"\"Checking with a destructive action during undo (V)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test05e_destructive...\" %\n self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n\n # Put a mark\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operation\n self.h5file.undo()\n self._do_reopen()\n\n # Do the destructive operation\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n\n # Now, unwind the actions\n self.h5file.undo(0)\n self._do_reopen()\n\n # Check objects\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)", "metadata": "root.BasicTestCase.test05e_destructive", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 506 }, { "content": " def test05f_destructive(self):\n \"\"\"Checking with a destructive creation of existing node during undo\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test05f_destructive...\" %\n self.__class__.__name__)\n\n self.h5file.enable_undo()\n self.h5file.create_array('/', 'newarray', [1])\n self.h5file.undo()\n self._do_reopen()\n self.assertTrue('/newarray' not in self.h5file)\n newarr = self.h5file.create_array('/', 'newarray', [1])\n self.h5file.undo()\n self.assertTrue('/newarray' not in self.h5file)\n self._do_reopen()\n self.h5file.redo()\n self.assertTrue('/newarray' in self.h5file)\n if not self._reopen_flag:\n self.assertTrue(self.h5file.root.newarray is newarr)", "metadata": "root.BasicTestCase.test05f_destructive", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 540 }, { "content": " def test06_totalunwind(self):\n \"\"\"Checking do/undo (total unwind)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test06_totalunwind...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray', [3, 4], \"Another array\")\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operations\n self._do_reopen()\n self.h5file.undo(0)\n self.assertTrue(\"/otherarray\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)", "metadata": "root.BasicTestCase.test06_totalunwind", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 562 }, { "content": " def test07_totalrewind(self):\n \"\"\"Checking do/undo (total rewind)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test07_totalunwind...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray', [3, 4], \"Another array\")\n self.h5file.mark()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operations\n self.h5file.undo(0)\n\n # Redo all the operations\n self._do_reopen()\n self.h5file.redo(-1)\n\n # Check that objects has come back to life in a sane state\n self.assertTrue(\"/otherarray\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray.title, \"Another array\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")", "metadata": "root.BasicTestCase.test07_totalrewind", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 583 }, { "content": " def test08_marknames(self):\n \"\"\"Checking mark names.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test08_marknames...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n self.h5file.mark(\"first\")\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n self.h5file.mark(\"second\")\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n self.h5file.mark(\"third\")\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n\n # Now go to mark \"first\"\n self.h5file.undo(\"first\")\n self._do_reopen()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Go to mark \"third\"\n self.h5file.redo(\"third\")\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Now go to mark \"second\"\n self.h5file.undo(\"second\")\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Go to the end\n self._do_reopen()\n self.h5file.redo(-1)\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" in self.h5file)\n\n # Check that objects has come back to life in a sane state\n self.assertEqual(self.h5file.root.otherarray1.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray3.read(), [5, 6])\n self.assertEqual(self.h5file.root.otherarray4.read(), [6, 7])", "metadata": "root.BasicTestCase.test08_marknames", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 613 }, { "content": " def test08_initialmark(self):\n \"\"\"Checking initial mark.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test08_initialmark...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n initmid = self.h5file.get_current_mark()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray', [3, 4], \"Another array\")\n self.h5file.mark()\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n\n # Now undo the past operations\n self.h5file.undo(initmid)\n self.assertTrue(\"/otherarray\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n\n # Redo all the operations\n self.h5file.redo(-1)\n self._do_reopen()\n\n # Check that objects has come back to life in a sane state\n self.assertTrue(\"/otherarray\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray.title, \"Another array\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")", "metadata": "root.BasicTestCase.test08_initialmark", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 668 }, { "content": " def test09_marknames(self):\n \"\"\"Checking mark names (wrong direction)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test09_marknames...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n self.h5file.mark(\"first\")\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n self.h5file.mark(\"second\")\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n self.h5file.mark(\"third\")\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n\n # Now go to mark \"first\"\n self.h5file.undo(\"first\")\n\n # Try to undo up to mark \"third\"\n with self.assertRaises(tables.UndoRedoError):\n self.h5file.undo(\"third\")\n\n # Now go to mark \"third\"\n self.h5file.redo(\"third\")\n self._do_reopen()\n\n # Try to redo up to mark \"second\"\n with self.assertRaises(tables.UndoRedoError):\n self.h5file.redo(\"second\")\n\n # Final checks\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)", "metadata": "root.BasicTestCase.test09_marknames", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 702 }, { "content": " def test10_goto(self):\n \"\"\"Checking mark names (goto)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test10_goto...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n self._do_reopen()\n self.h5file.mark(\"first\")\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n self.h5file.mark(\"second\")\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n self._do_reopen()\n self.h5file.mark(\"third\")\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n\n # Now go to mark \"first\"\n self.h5file.goto(\"first\")\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Go to mark \"third\"\n self.h5file.goto(\"third\")\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Now go to mark \"second\"\n self._do_reopen()\n self.h5file.goto(\"second\")\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Go to the end\n self.h5file.goto(-1)\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" in self.h5file)\n\n # Check that objects has come back to life in a sane state\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray3.read(), [5, 6])\n self.assertEqual(self.h5file.root.otherarray4.read(), [6, 7])", "metadata": "root.BasicTestCase.test10_goto", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 743 }, { "content": " def test10_gotoint(self):\n \"\"\"Checking mark sequential ids (goto)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test10_gotoint...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [3, 4], \"Another array 1\")\n self.h5file.mark(\"first\")\n self.h5file.create_array('/', 'otherarray2', [4, 5], \"Another array 2\")\n self.h5file.mark(\"second\")\n self._do_reopen()\n self.h5file.create_array('/', 'otherarray3', [5, 6], \"Another array 3\")\n self.h5file.mark(\"third\")\n self.h5file.create_array('/', 'otherarray4', [6, 7], \"Another array 4\")\n\n # Now go to mark \"first\"\n self.h5file.goto(1)\n self._do_reopen()\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Go to beginning\n self.h5file.goto(0)\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Go to mark \"third\"\n self._do_reopen()\n self.h5file.goto(3)\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Now go to mark \"second\"\n self.h5file.goto(2)\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n self.assertTrue(\"/otherarray4\" not in self.h5file)\n\n # Go to the end\n self._do_reopen()\n self.h5file.goto(-1)\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertTrue(\"/otherarray4\" in self.h5file)\n\n # Check that objects has come back to life in a sane state\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.read(), [3, 4])\n self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])\n self.assertEqual(self.h5file.root.otherarray3.read(), [5, 6])\n self.assertEqual(self.h5file.root.otherarray4.read(), [6, 7])", "metadata": "root.BasicTestCase.test10_gotoint", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 800 }, { "content": " def test12_keepMark(self):\n \"\"\"Ensuring the mark is kept after an UNDO operation\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test12_keepMark...\" % self.__class__.__name__)\n\n self.h5file.enable_undo()\n self.h5file.create_array('/', 'newarray1', [1])\n\n mid = self.h5file.mark()\n self.assertTrue(mid is not None)\n self._do_reopen()\n self.h5file.undo()\n\n # We should have moved to the initial mark.\n self.assertEqual(self.h5file.get_current_mark(), 0)\n\n # So /newarray1 should not be there.\n self.assertTrue('/newarray1' not in self.h5file)", "metadata": "root.BasicTestCase.test12_keepMark", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 891 }, { "content": " def test13_severalEnableDisable(self):\n \"\"\"Checking that successive enable/disable Undo works\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test13_severalEnableDisable...\" %\n self.__class__.__name__)\n\n self.h5file.enable_undo()\n self.h5file.create_array('/', 'newarray1', [1])\n self.h5file.undo()\n self._do_reopen()\n\n # We should have moved to 'mid' mark, not the initial mark.\n self.assertEqual(self.h5file.get_current_mark(), 0)\n\n # So /newarray1 should still be there.\n self.assertTrue('/newarray1' not in self.h5file)\n\n # Close this do/undo session\n self.h5file.disable_undo()\n\n # Do something\n self.h5file.create_array('/', 'newarray2', [1])\n\n # Enable again do/undo\n self.h5file.enable_undo()\n self.h5file.create_array('/', 'newarray3', [1])\n mid = self.h5file.mark()\n self.h5file.create_array('/', 'newarray4', [1])\n self.h5file.undo()\n\n # We should have moved to 'mid' mark, not the initial mark.\n self.assertEqual(self.h5file.get_current_mark(), mid)\n\n # So /newarray2 and /newarray3 should still be there.\n self.assertTrue('/newarray1' not in self.h5file)\n self.assertTrue('/newarray2' in self.h5file)\n self.assertTrue('/newarray3' in self.h5file)\n self.assertTrue('/newarray4' not in self.h5file)\n\n # Close this do/undo session\n self._do_reopen()\n self.h5file.disable_undo()\n\n # Enable again do/undo\n self.h5file.enable_undo()\n self.h5file.create_array('/', 'newarray1', [1])\n self.h5file.create_array('/', 'newarray4', [1])\n\n # So /newarray2 and /newarray3 should still be there.\n self.assertTrue('/newarray1' in self.h5file)\n self.assertTrue('/newarray2' in self.h5file)\n self.assertTrue('/newarray3' in self.h5file)\n self.assertTrue('/newarray4' in self.h5file)\n self.h5file.undo()\n self._do_reopen()\n self.assertTrue('/newarray1' not in self.h5file)\n self.assertTrue('/newarray2' in self.h5file)\n self.assertTrue('/newarray3' in self.h5file)\n self.assertTrue('/newarray4' not in self.h5file)\n\n # Close this do/undo session\n self.h5file.disable_undo()", "metadata": "root.BasicTestCase.test13_severalEnableDisable", "header": "['class', 'BasicTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 912 }, { "content": " def test00(self):\n \"\"\"Checking one action.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [1, 2], \"Another array 1\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that otherarray does not exist in the object tree\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertEqual(self.h5file.root.otherarray1.read(), [1, 2])", "metadata": "root.CreateArrayTestCase.test00", "header": "['class', 'CreateArrayTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1012 }, { "content": " def test01(self):\n \"\"\"Checking two actions.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [1, 2], \"Another array 1\")\n self.h5file.create_array('/', 'otherarray2', [2, 3], \"Another array 2\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that otherarray does not exist in the object tree\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")\n self.assertEqual(self.h5file.root.otherarray1.read(), [1, 2])\n self.assertEqual(self.h5file.root.otherarray2.read(), [2, 3])", "metadata": "root.CreateArrayTestCase.test01", "header": "['class', 'CreateArrayTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1039 }, { "content": " def test02(self):\n \"\"\"Checking three actions.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [1, 2], \"Another array 1\")\n self.h5file.create_array('/', 'otherarray2', [2, 3], \"Another array 2\")\n self.h5file.create_array('/', 'otherarray3', [3, 4], \"Another array 3\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that otherarray does not exist in the object tree\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n self.assertTrue(\"/otherarray2\" not in self.h5file)\n self.assertTrue(\"/otherarray3\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/otherarray2\" in self.h5file)\n self.assertTrue(\"/otherarray3\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertEqual(self.h5file.root.otherarray2.title, \"Another array 2\")\n self.assertEqual(self.h5file.root.otherarray3.title, \"Another array 3\")\n self.assertEqual(self.h5file.root.otherarray1.read(), [1, 2])\n self.assertEqual(self.h5file.root.otherarray2.read(), [2, 3])\n self.assertEqual(self.h5file.root.otherarray3.read(), [3, 4])", "metadata": "root.CreateArrayTestCase.test02", "header": "['class', 'CreateArrayTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1071 }, { "content": " def test03(self):\n \"\"\"Checking three actions in different depth levels.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.create_array('/', 'otherarray1', [1, 2], \"Another array 1\")\n self.h5file.create_array('/agroup', 'otherarray2',\n [2, 3], \"Another array 2\")\n self.h5file.create_array('/agroup/agroup3', 'otherarray3',\n [3, 4], \"Another array 3\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that otherarray does not exist in the object tree\n self.assertTrue(\"/otherarray1\" not in self.h5file)\n self.assertTrue(\"/agroup/otherarray2\" not in self.h5file)\n self.assertTrue(\"/agroup/agroup3/otherarray3\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/otherarray1\" in self.h5file)\n self.assertTrue(\"/agroup/otherarray2\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3/otherarray3\" in self.h5file)\n self.assertEqual(self.h5file.root.otherarray1.title, \"Another array 1\")\n self.assertEqual(self.h5file.root.agroup.otherarray2.title,\n \"Another array 2\")\n self.assertEqual(self.h5file.root.agroup.agroup3.otherarray3.title,\n \"Another array 3\")\n self.assertEqual(self.h5file.root.otherarray1.read(), [1, 2])\n self.assertEqual(self.h5file.root.agroup.otherarray2.read(), [2, 3])\n self.assertEqual(self.h5file.root.agroup.agroup3.otherarray3.read(),\n [3, 4])", "metadata": "root.CreateArrayTestCase.test03", "header": "['class', 'CreateArrayTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1108 }, { "content": " def test00(self):\n \"\"\"Checking one action.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new group\n self.h5file.create_group('/', 'othergroup1', \"Another group 1\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that othergroup1 does not exist in the object tree\n self.assertTrue(\"/othergroup1\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that othergroup1 has come back to life in a sane state\n self.assertTrue(\"/othergroup1\" in self.h5file)\n self.assertEqual(self.h5file.root.othergroup1._v_title,\n \"Another group 1\")", "metadata": "root.CreateGroupTestCase.test00", "header": "['class', 'CreateGroupTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1179 }, { "content": " def test01(self):\n \"\"\"Checking two actions.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new group\n self.h5file.create_group('/', 'othergroup1', \"Another group 1\")\n self.h5file.create_group('/', 'othergroup2', \"Another group 2\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that othergroup does not exist in the object tree\n self.assertTrue(\"/othergroup1\" not in self.h5file)\n self.assertTrue(\"/othergroup2\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that othergroup* has come back to life in a sane state\n self.assertTrue(\"/othergroup1\" in self.h5file)\n self.assertTrue(\"/othergroup2\" in self.h5file)\n self.assertEqual(self.h5file.root.othergroup1._v_title,\n \"Another group 1\")\n self.assertEqual(self.h5file.root.othergroup2._v_title,\n \"Another group 2\")", "metadata": "root.CreateGroupTestCase.test01", "header": "['class', 'CreateGroupTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1206 }, { "content": " def test02(self):\n \"\"\"Checking three actions.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new group\n self.h5file.create_group('/', 'othergroup1', \"Another group 1\")\n self.h5file.create_group('/', 'othergroup2', \"Another group 2\")\n self.h5file.create_group('/', 'othergroup3', \"Another group 3\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that othergroup* does not exist in the object tree\n self.assertTrue(\"/othergroup1\" not in self.h5file)\n self.assertTrue(\"/othergroup2\" not in self.h5file)\n self.assertTrue(\"/othergroup3\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that othergroup* has come back to life in a sane state\n self.assertTrue(\"/othergroup1\" in self.h5file)\n self.assertTrue(\"/othergroup2\" in self.h5file)\n self.assertTrue(\"/othergroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.othergroup1._v_title,\n \"Another group 1\")\n self.assertEqual(self.h5file.root.othergroup2._v_title,\n \"Another group 2\")\n self.assertEqual(self.h5file.root.othergroup3._v_title,\n \"Another group 3\")", "metadata": "root.CreateGroupTestCase.test02", "header": "['class', 'CreateGroupTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1238 }, { "content": " def test03(self):\n \"\"\"Checking three actions in different depth levels.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new group\n self.h5file.create_group('/', 'othergroup1', \"Another group 1\")\n self.h5file.create_group(\n '/othergroup1', 'othergroup2', \"Another group 2\")\n self.h5file.create_group(\n '/othergroup1/othergroup2', 'othergroup3', \"Another group 3\")\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that othergroup* does not exist in the object tree\n self.assertTrue(\"/othergroup1\" not in self.h5file)\n self.assertTrue(\"/othergroup1/othergroup2\" not in self.h5file)\n self.assertTrue(\n \"/othergroup1/othergroup2/othergroup3\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that othergroup* has come back to life in a sane state\n self.assertTrue(\"/othergroup1\" in self.h5file)\n self.assertTrue(\"/othergroup1/othergroup2\" in self.h5file)\n self.assertTrue(\"/othergroup1/othergroup2/othergroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.othergroup1._v_title,\n \"Another group 1\")\n self.assertEqual(self.h5file.root.othergroup1.othergroup2._v_title,\n \"Another group 2\")\n self.assertEqual(\n self.h5file.root.othergroup1.othergroup2.othergroup3._v_title,\n \"Another group 3\")", "metadata": "root.CreateGroupTestCase.test03", "header": "['class', 'CreateGroupTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1275 }, { "content": " def test00(self):\n \"\"\"Checking rename_node (over Groups without children)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.rename_node('/agroup2', 'agroup3')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that it does not exist in the object tree\n self.assertTrue(\"/agroup2\" in self.h5file)\n self.assertTrue(\"/agroup3\" not in self.h5file)\n self.assertEqual(self.h5file.root.agroup2._v_title, \"Group title 2\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/agroup2\" not in self.h5file)\n self.assertTrue(\"/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup3._v_title, \"Group title 2\")", "metadata": "root.RenameNodeTestCase.test00", "header": "['class', 'RenameNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1386 }, { "content": " def test01(self):\n \"\"\"Checking rename_node (over Groups with children)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.rename_node('/agroup', 'agroup3')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that it does not exist in the object tree\n self.assertTrue(\"/agroup\" in self.h5file)\n self.assertTrue(\"/agroup3\" not in self.h5file)\n\n # Check that children are reachable\n self.assertTrue(\"/agroup/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/agroup\" not in self.h5file)\n self.assertTrue(\"/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup3._v_title, \"Group title\")\n\n # Check that children are reachable\n self.assertTrue(\"/agroup3/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup3/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup3/agroup3\" in self.h5file)", "metadata": "root.RenameNodeTestCase.test01", "header": "['class', 'RenameNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1415 }, { "content": " def test01b(self):\n \"\"\"Checking rename_node (over Groups with children 2)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01b...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.rename_node('/agroup', 'agroup3')\n self.h5file.rename_node('/agroup3', 'agroup4')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that it does not exist in the object tree\n self.assertTrue(\"/agroup\" in self.h5file)\n self.assertTrue(\"/agroup4\" not in self.h5file)\n\n # Check that children are reachable\n self.assertTrue(\"/agroup/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/agroup\" not in self.h5file)\n self.assertTrue(\"/agroup4\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup4._v_title, \"Group title\")\n\n # Check that children are reachable\n self.assertTrue(\"/agroup4/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup4/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup4/agroup3\" in self.h5file)", "metadata": "root.RenameNodeTestCase.test01b", "header": "['class', 'RenameNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1454 }, { "content": " def test02(self):\n \"\"\"Checking rename_node (over Leaves)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.rename_node('/anarray', 'anarray2')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that otherarray does not exist in the object tree\n self.assertTrue(\"/anarray\" in self.h5file)\n self.assertTrue(\"/anarray2\" not in self.h5file)\n self.assertEqual(self.h5file.root.anarray.title, \"Array title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/anarray\" not in self.h5file)\n self.assertTrue(\"/anarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.anarray2.title, \"Array title\")", "metadata": "root.RenameNodeTestCase.test02", "header": "['class', 'RenameNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1494 }, { "content": " def test03(self):\n \"\"\"Checking rename_node (over Tables)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.rename_node('/table', 'table2')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that table2 does not exist in the object tree\n self.assertTrue(\"/table\" in self.h5file)\n table = self.h5file.root.table\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertTrue(table.cols.var4.index is None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertTrue(\"/table2\" not in self.h5file)\n self.assertEqual(self.h5file.root.table.title, \"Indexed\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that table2 has come back to life in a sane state\n self.assertTrue(\"/table\" not in self.h5file)\n self.assertTrue(\"/table2\" in self.h5file)\n self.assertEqual(self.h5file.root.table2.title, \"Indexed\")\n table = self.h5file.root.table2\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertTrue(table.cols.var4.index is None)", "metadata": "root.RenameNodeTestCase.test03", "header": "['class', 'RenameNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1523 }, { "content": " def test00(self):\n \"\"\"Checking move_node (over Leaf)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.move_node('/anarray', '/agroup/agroup3')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that it does not exist in the object tree\n self.assertTrue(\"/anarray\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3/anarray\" not in self.h5file)\n self.assertEqual(self.h5file.root.anarray.title, \"Array title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/anarray\" not in self.h5file)\n self.assertTrue(\"/agroup/agroup3/anarray\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup.agroup3.anarray.title,\n \"Array title\")", "metadata": "root.MoveNodeTestCase.test00", "header": "['class', 'MoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1600 }, { "content": " def test01(self):\n \"\"\"Checking move_node (over Groups with children)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.move_node('/agroup', '/agroup2', 'agroup3')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that it does not exist in the object tree\n self.assertTrue(\"/agroup\" in self.h5file)\n self.assertTrue(\"/agroup2/agroup3\" not in self.h5file)\n\n # Check that children are reachable\n self.assertTrue(\"/agroup/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/agroup\" not in self.h5file)\n self.assertTrue(\"/agroup2/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup2.agroup3._v_title,\n \"Group title\")\n\n # Check that children are reachable\n self.assertTrue(\"/agroup2/agroup3/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup2/agroup3/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup2/agroup3/agroup3\" in self.h5file)", "metadata": "root.MoveNodeTestCase.test01", "header": "['class', 'MoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1630 }, { "content": " def test01b(self):\n \"\"\"Checking move_node (over Groups with children 2)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01b...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.move_node('/agroup', '/', 'agroup3')\n self.h5file.move_node('/agroup3', '/agroup2', 'agroup4')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that it does not exist in the object tree\n self.assertTrue(\"/agroup\" in self.h5file)\n self.assertTrue(\"/agroup2/agroup4\" not in self.h5file)\n\n # Check that children are reachable\n self.assertTrue(\"/agroup/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/agroup\" not in self.h5file)\n self.assertTrue(\"/agroup2/agroup4\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup2.agroup4._v_title,\n \"Group title\")\n\n # Check that children are reachable\n self.assertTrue(\"/agroup2/agroup4/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup2/agroup4/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup2/agroup4/agroup3\" in self.h5file)", "metadata": "root.MoveNodeTestCase.test01b", "header": "['class', 'MoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1670 }, { "content": " def test02(self):\n \"\"\"Checking move_node (over Leaves)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.move_node('/anarray', '/agroup2', 'anarray2')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that otherarray does not exist in the object tree\n self.assertTrue(\"/anarray\" in self.h5file)\n self.assertTrue(\"/agroup2/anarray2\" not in self.h5file)\n self.assertEqual(self.h5file.root.anarray.title, \"Array title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that otherarray has come back to life in a sane state\n self.assertTrue(\"/anarray\" not in self.h5file)\n self.assertTrue(\"/agroup2/anarray2\" in self.h5file)\n self.assertEqual(\n self.h5file.root.agroup2.anarray2.title, \"Array title\")", "metadata": "root.MoveNodeTestCase.test02", "header": "['class', 'MoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1711 }, { "content": " def test03(self):\n \"\"\"Checking move_node (over Tables)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.move_node('/table', '/agroup2', 'table2')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that table2 does not exist in the object tree\n self.assertTrue(\"/table\" in self.h5file)\n self.assertTrue(\"/agroup2/table2\" not in self.h5file)\n table = self.h5file.root.table\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertTrue(table.cols.var4.index is None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertEqual(self.h5file.root.table.title, \"Indexed\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that table2 has come back to life in a sane state\n self.assertTrue(\"/table\" not in self.h5file)\n self.assertTrue(\"/agroup2/table2\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup2.table2.title, \"Indexed\")\n table = self.h5file.root.agroup2.table2\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertTrue(table.cols.var4.index is None)", "metadata": "root.MoveNodeTestCase.test03", "header": "['class', 'MoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1741 }, { "content": " def test00(self):\n \"\"\"Checking remove_node (over Leaf)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Delete an existing array\n self.h5file.remove_node('/anarray')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that it does exist in the object tree\n self.assertTrue(\"/anarray\" in self.h5file)\n self.assertEqual(self.h5file.root.anarray.title, \"Array title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that array has gone again\n self.assertTrue(\"/anarray\" not in self.h5file)", "metadata": "root.RemoveNodeTestCase.test00", "header": "['class', 'RemoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1818 }, { "content": " def test00b(self):\n \"\"\"Checking remove_node (over several Leaves)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00b...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Delete a couple of arrays\n self.h5file.remove_node('/anarray')\n self.h5file.remove_node('/agroup/anarray2')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that arrays has come into life\n self.assertTrue(\"/anarray\" in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" in self.h5file)\n self.assertEqual(self.h5file.root.anarray.title, \"Array title\")\n self.assertEqual(\n self.h5file.root.agroup.anarray2.title, \"Array title 2\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that arrays has disappeared again\n self.assertTrue(\"/anarray\" not in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" not in self.h5file)", "metadata": "root.RemoveNodeTestCase.test00b", "header": "['class', 'RemoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1844 }, { "content": " def test00c(self):\n \"\"\"Checking remove_node (over Tables)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00c...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Create a new array\n self.h5file.remove_node('/table')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that table2 does not exist in the object tree\n self.assertTrue(\"/table\" in self.h5file)\n table = self.h5file.root.table\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertTrue(table.cols.var4.index is None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertEqual(self.h5file.root.table.title, \"Indexed\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that table2 has come back to life in a sane state\n self.assertTrue(\"/table\" not in self.h5file)", "metadata": "root.RemoveNodeTestCase.test00c", "header": "['class', 'RemoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1875 }, { "content": " def test01(self):\n \"\"\"Checking remove_node (over Groups with children)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Delete a group recursively\n self.h5file.remove_node('/agroup', recursive=1)\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that parent and children has come into life in a sane state\n self.assertTrue(\"/agroup\" in self.h5file)\n self.assertTrue(\"/agroup/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that parent and children are not reachable\n self.assertTrue(\"/agroup\" not in self.h5file)\n self.assertTrue(\"/agroup/anarray1\" not in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" not in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" not in self.h5file)", "metadata": "root.RemoveNodeTestCase.test01", "header": "['class', 'RemoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1909 }, { "content": " def test01b(self):\n \"\"\"Checking remove_node (over Groups with children 2)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01b...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # Remove a couple of groups\n self.h5file.remove_node('/agroup', recursive=1)\n self.h5file.remove_node('/agroup2')\n\n # Now undo the past operation\n self.h5file.undo()\n\n # Check that they does exist in the object tree\n self.assertTrue(\"/agroup\" in self.h5file)\n self.assertTrue(\"/agroup2\" in self.h5file)\n\n # Check that children are reachable\n self.assertTrue(\"/agroup/anarray1\" in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title\")\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that groups does not exist again\n self.assertTrue(\"/agroup\" not in self.h5file)\n self.assertTrue(\"/agroup2\" not in self.h5file)\n\n # Check that children are not reachable\n self.assertTrue(\"/agroup/anarray1\" not in self.h5file)\n self.assertTrue(\"/agroup/anarray2\" not in self.h5file)\n self.assertTrue(\"/agroup/agroup3\" not in self.h5file)", "metadata": "root.RemoveNodeTestCase.test01b", "header": "['class', 'RemoveNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 1941 }, { "content": " def test00_copyLeaf(self):\n \"\"\"Checking copy_node (over Leaves)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00_copyLeaf...\" % self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # /anarray => /agroup/agroup3/\n new_node = self.h5file.copy_node('/anarray', '/agroup/agroup3')\n\n # Undo the copy.\n self.h5file.undo()\n\n # Check that the copied node does not exist in the object tree.\n self.assertTrue('/agroup/agroup3/anarray' not in self.h5file)\n\n # Redo the copy.\n self.h5file.redo()\n\n # Check that the copied node exists again in the object tree.\n self.assertTrue('/agroup/agroup3/anarray' in self.h5file)\n self.assertTrue(self.h5file.root.agroup.agroup3.anarray is new_node)", "metadata": "root.CopyNodeTestCase.test00_copyLeaf", "header": "['class', 'CopyNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2012 }, { "content": " def test00b_copyTable(self):\n \"\"\"Checking copy_node (over Tables)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00b_copyTable...\" % self.__class__.__name__)\n\n # open the do/undo\n self.h5file.enable_undo()\n\n # /table => /agroup/agroup3/\n warnings.filterwarnings(\"ignore\", category=UserWarning)\n table = self.h5file.copy_node(\n '/table', '/agroup/agroup3', propindexes=True)\n warnings.filterwarnings(\"default\", category=UserWarning)\n self.assertTrue(\"/agroup/agroup3/table\" in self.h5file)\n\n table = self.h5file.root.agroup.agroup3.table\n self.assertEqual(table.title, \"Indexed\")\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertTrue(table.cols.var4.index is None)\n\n # Now undo the past operation\n self.h5file.undo()\n table = self.h5file.root.table\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertTrue(table.cols.var4.index is None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n\n # Check that the copied node does not exist in the object tree.\n self.assertTrue(\"/agroup/agroup3/table\" not in self.h5file)\n\n # Redo the operation\n self.h5file.redo()\n\n # Check that table has come back to life in a sane state\n self.assertTrue(\"/table\" in self.h5file)\n self.assertTrue(\"/agroup/agroup3/table\" in self.h5file)\n table = self.h5file.root.agroup.agroup3.table\n self.assertEqual(table.title, \"Indexed\")\n self.assertTrue(table.cols.var1.index is not None)\n self.assertTrue(table.cols.var2.index is not None)\n self.assertTrue(table.cols.var3.index is not None)\n self.assertEqual(table.cols.var1.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var2.index.nelements, minRowIndex)\n self.assertEqual(table.cols.var3.index.nelements, minRowIndex)\n self.assertTrue(table.cols.var4.index is None)", "metadata": "root.CopyNodeTestCase.test00b_copyTable", "header": "['class', 'CopyNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2038 }, { "content": " def test01_copyGroup(self):\n \"\"\"Copying a group (recursively).\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01_copyGroup...\" % self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # /agroup => /acopy\n new_node = self.h5file.copy_node(\n '/agroup', newname='acopy', recursive=True)\n\n # Undo the copy.\n self.h5file.undo()\n\n # Check that the copied node does not exist in the object tree.\n self.assertTrue('/acopy' not in self.h5file)\n self.assertTrue('/acopy/anarray1' not in self.h5file)\n self.assertTrue('/acopy/anarray2' not in self.h5file)\n self.assertTrue('/acopy/agroup3' not in self.h5file)\n\n # Redo the copy.\n self.h5file.redo()\n\n # Check that the copied node exists again in the object tree.\n self.assertTrue('/acopy' in self.h5file)\n self.assertTrue('/acopy/anarray1' in self.h5file)\n self.assertTrue('/acopy/anarray2' in self.h5file)\n self.assertTrue('/acopy/agroup3' in self.h5file)\n self.assertTrue(self.h5file.root.acopy is new_node)", "metadata": "root.CopyNodeTestCase.test01_copyGroup", "header": "['class', 'CopyNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2095 }, { "content": " def test02_copyLeafOverwrite(self):\n \"\"\"Copying a leaf, overwriting destination.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02_copyLeafOverwrite...\" %\n self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # /anarray => /agroup/agroup\n oldNode = self.h5file.root.agroup\n new_node = self.h5file.copy_node(\n '/anarray', newname='agroup', overwrite=True)\n\n # Undo the copy.\n self.h5file.undo()\n\n # Check that the copied node does not exist in the object tree.\n # Check that the overwritten node exists again in the object tree.\n self.assertTrue(self.h5file.root.agroup is oldNode)\n\n # Redo the copy.\n self.h5file.redo()\n\n # Check that the copied node exists again in the object tree.\n # Check that the overwritten node does not exist in the object tree.\n self.assertTrue(self.h5file.root.agroup is new_node)", "metadata": "root.CopyNodeTestCase.test02_copyLeafOverwrite", "header": "['class', 'CopyNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2128 }, { "content": " def test03_copyChildren(self):\n \"\"\"Copying the children of a group\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03_copyChildren...\" %\n self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # /agroup/* => /agroup/\n self.h5file.copy_children('/agroup', '/agroup2', recursive=True)\n\n # Undo the copy.\n self.h5file.undo()\n\n # Check that the copied nodes do not exist in the object tree.\n self.assertTrue('/agroup2/anarray1' not in self.h5file)\n self.assertTrue('/agroup2/anarray2' not in self.h5file)\n self.assertTrue('/agroup2/agroup3' not in self.h5file)\n\n # Redo the copy.\n self.h5file.redo()\n\n # Check that the copied nodes exist again in the object tree.\n self.assertTrue('/agroup2/anarray1' in self.h5file)\n self.assertTrue('/agroup2/anarray2' in self.h5file)\n self.assertTrue('/agroup2/agroup3' in self.h5file)", "metadata": "root.CopyNodeTestCase.test03_copyChildren", "header": "['class', 'CopyNodeTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2158 }, { "content": " def test00(self):\n \"\"\"Mix of create_array, create_group, renameNone, move_node,\n remove_node, copy_node and copy_children.\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00...\" % self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # Create an array\n self.h5file.create_array(self.h5file.root, 'anarray3',\n [1], \"Array title 3\")\n # Create a group\n self.h5file.create_group(self.h5file.root, 'agroup3', \"Group title 3\")\n\n # /anarray => /agroup/agroup3/\n new_node = self.h5file.copy_node('/anarray3', '/agroup/agroup3')\n new_node = self.h5file.copy_children(\n '/agroup', '/agroup3', recursive=1)\n\n # rename anarray\n self.h5file.rename_node('/anarray', 'anarray4')\n\n # Move anarray\n new_node = self.h5file.copy_node('/anarray3', '/agroup')\n\n # Remove anarray4\n self.h5file.remove_node('/anarray4')\n\n # Undo the actions\n self.h5file.undo()\n self.assertTrue('/anarray4' not in self.h5file)\n self.assertTrue('/anarray3' not in self.h5file)\n self.assertTrue('/agroup/agroup3/anarray3' not in self.h5file)\n self.assertTrue('/agroup3' not in self.h5file)\n self.assertTrue('/anarray4' not in self.h5file)\n self.assertTrue('/anarray' in self.h5file)\n\n # Redo the actions\n self.h5file.redo()\n\n # Check that the copied node exists again in the object tree.\n self.assertTrue('/agroup/agroup3/anarray3' in self.h5file)\n self.assertTrue('/agroup/anarray3' in self.h5file)\n self.assertTrue('/agroup3/agroup3/anarray3' in self.h5file)\n self.assertTrue('/agroup3/anarray3' not in self.h5file)\n self.assertTrue(self.h5file.root.agroup.anarray3 is new_node)\n self.assertTrue('/anarray' not in self.h5file)\n self.assertTrue('/anarray4' not in self.h5file)", "metadata": "root.ComplexTestCase.test00", "header": "['class', 'ComplexTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2217 }, { "content": " def test02(self):\n \"\"\"Test with multiple generations (Group case)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02...\" % self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # remove /agroup\n self.h5file.remove_node('/agroup2')\n\n # Create a group in the same place\n self.h5file.create_group(self.h5file.root, 'agroup2', \"Group title 22\")\n\n # remove the group\n self.h5file.remove_node('/agroup2')\n\n # Create a group\n self.h5file.create_group(self.h5file.root, 'agroup2', \"Group title 3\")\n\n # remove the group\n self.h5file.remove_node('/agroup2')\n\n # Create a group\n self.h5file.create_group(self.h5file.root, 'agroup2', \"Group title 4\")\n\n # Create a child group\n self.h5file.create_group(self.h5file.root.agroup2, 'agroup5',\n \"Group title 5\")\n\n # Undo the actions\n self.h5file.undo()\n\n # Check that /agroup is in the state before enabling do/undo\n self.assertEqual(self.h5file.root.agroup2._v_title, \"Group title 2\")\n self.assertTrue('/agroup2' in self.h5file)\n\n # Redo the actions\n self.h5file.redo()\n self.assertEqual(self.h5file.root.agroup2._v_title, \"Group title 4\")\n self.assertEqual(self.h5file.root.agroup2.agroup5._v_title,\n \"Group title 5\")", "metadata": "root.ComplexTestCase.test02", "header": "['class', 'ComplexTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2309 }, { "content": " def test03(self):\n \"\"\"Test with multiple generations (Group case, recursive remove)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03...\" % self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # remove /agroup\n self.h5file.remove_node('/agroup', recursive=1)\n\n # Create a group in the same place\n self.h5file.create_group(self.h5file.root, 'agroup', \"Group title 2\")\n\n # remove the group\n self.h5file.remove_node('/agroup')\n\n # Create a group\n self.h5file.create_group(self.h5file.root, 'agroup', \"Group title 3\")\n\n # remove the group\n self.h5file.remove_node('/agroup')\n\n # Create a group\n self.h5file.create_group(self.h5file.root, 'agroup', \"Group title 4\")\n\n # Create a child group\n self.h5file.create_group(self.h5file.root.agroup, 'agroup5',\n \"Group title 5\")\n # Undo the actions\n self.h5file.undo()\n\n # Check that /agroup is in the state before enabling do/undo\n self.assertTrue('/agroup' in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title\")\n self.assertTrue('/agroup/anarray1' in self.h5file)\n self.assertTrue('/agroup/anarray2' in self.h5file)\n self.assertTrue('/agroup/agroup3' in self.h5file)\n self.assertTrue('/agroup/agroup5' not in self.h5file)\n\n # Redo the actions\n self.h5file.redo()\n self.assertTrue('/agroup' in self.h5file)\n self.assertEqual(self.h5file.root.agroup._v_title, \"Group title 4\")\n self.assertTrue('/agroup/agroup5' in self.h5file)\n self.assertEqual(\n self.h5file.root.agroup.agroup5._v_title, \"Group title 5\")", "metadata": "root.ComplexTestCase.test03", "header": "['class', 'ComplexTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2354 }, { "content": " def test03b(self):\n \"\"\"Test with multiple generations (Group case, recursive remove,\n case 2)\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03b...\" % self.__class__.__name__)\n\n # Enable undo/redo.\n self.h5file.enable_undo()\n\n # Create a new group with a child\n self.h5file.create_group(self.h5file.root, 'agroup3', \"Group title 3\")\n self.h5file.create_group(self.h5file.root.agroup3, 'agroup4',\n \"Group title 4\")\n\n # remove /agroup3\n self.h5file.remove_node('/agroup3', recursive=1)\n\n # Create a group in the same place\n self.h5file.create_group(self.h5file.root, 'agroup3', \"Group title 4\")\n\n # Undo the actions\n self.h5file.undo()\n\n # Check that /agroup is in the state before enabling do/undo\n self.assertTrue('/agroup3' not in self.h5file)\n\n # Redo the actions\n self.h5file.redo()\n self.assertEqual(self.h5file.root.agroup3._v_title, \"Group title 4\")\n self.assertTrue('/agroup3' in self.h5file)\n self.assertTrue('/agroup/agroup4' not in self.h5file)", "metadata": "root.ComplexTestCase.test03b", "header": "['class', 'ComplexTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2404 }, { "content": " def test00_setAttr(self):\n \"\"\"Setting a nonexistent attribute\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test00_setAttr...\" % self.__class__.__name__)\n\n array = self.h5file.root.array\n attrs = array.attrs\n\n self.h5file.enable_undo()\n setattr(attrs, 'attr_0', 0)\n self.assertTrue('attr_0' in attrs)\n self.assertEqual(attrs.attr_0, 0)\n self.h5file.undo()\n self.assertTrue('attr_0' not in attrs)\n self.h5file.redo()\n self.assertTrue('attr_0' in attrs)\n self.assertEqual(attrs.attr_0, 0)", "metadata": "root.AttributesTestCase.test00_setAttr", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2454 }, { "content": " def test01_setAttrExisting(self):\n \"\"\"Setting an existing attribute\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test01_setAttrExisting...\" %\n self.__class__.__name__)\n\n array = self.h5file.root.array\n attrs = array.attrs\n\n self.h5file.enable_undo()\n setattr(attrs, 'attr_1', 11)\n self.assertTrue('attr_1' in attrs)\n self.assertEqual(attrs.attr_1, 11)\n self.h5file.undo()\n self.assertTrue('attr_1' in attrs)\n self.assertEqual(attrs.attr_1, 10)\n self.h5file.redo()\n self.assertTrue('attr_1' in attrs)\n self.assertEqual(attrs.attr_1, 11)", "metadata": "root.AttributesTestCase.test01_setAttrExisting", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2474 }, { "content": " def test02_delAttr(self):\n \"\"\"Removing an attribute\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test02_delAttr...\" % self.__class__.__name__)\n\n array = self.h5file.root.array\n attrs = array.attrs\n\n self.h5file.enable_undo()\n delattr(attrs, 'attr_1')\n self.assertTrue('attr_1' not in attrs)\n self.h5file.undo()\n self.assertTrue('attr_1' in attrs)\n self.assertEqual(attrs.attr_1, 10)\n self.h5file.redo()\n self.assertTrue('attr_1' not in attrs)", "metadata": "root.AttributesTestCase.test02_delAttr", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2496 }, { "content": " def test03_copyNodeAttrs(self):\n \"\"\"Copying an attribute set\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test03_copyNodeAttrs...\" %\n self.__class__.__name__)\n\n rattrs = self.h5file.root._v_attrs\n rattrs.attr_0 = 0\n rattrs.attr_1 = 100\n\n array = self.h5file.root.array\n attrs = array.attrs\n\n self.h5file.enable_undo()\n attrs._f_copy(self.h5file.root)\n self.assertEqual(rattrs.attr_0, 0)\n self.assertEqual(rattrs.attr_1, 10)\n self.assertEqual(rattrs.attr_2, 20)\n self.assertEqual(rattrs.attr_3, 30)\n self.h5file.undo()\n self.assertEqual(rattrs.attr_0, 0)\n self.assertEqual(rattrs.attr_1, 100)\n self.assertTrue('attr_2' not in rattrs)\n self.assertTrue('attr_3' not in rattrs)\n self.h5file.redo()\n self.assertEqual(rattrs.attr_0, 0)\n self.assertEqual(rattrs.attr_1, 10)\n self.assertEqual(rattrs.attr_2, 20)\n self.assertEqual(rattrs.attr_3, 30)", "metadata": "root.AttributesTestCase.test03_copyNodeAttrs", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2515 }, { "content": " def test04_replaceNode(self):\n \"\"\"Replacing a node with a rewritten attribute\"\"\"\n\n if common.verbose:\n print('\\n', '-=' * 30)\n print(\"Running %s.test04_replaceNode...\" % self.__class__.__name__)\n\n array = self.h5file.root.array\n attrs = array.attrs\n\n self.h5file.enable_undo()\n attrs.attr_1 = 11\n self.h5file.remove_node('/array')\n arr = self.h5file.create_array('/', 'array', [1])\n arr.attrs.attr_1 = 12\n self.h5file.undo()\n self.assertTrue('attr_1' in self.h5file.root.array.attrs)\n self.assertEqual(self.h5file.root.array.attrs.attr_1, 10)\n self.h5file.redo()\n self.assertTrue('attr_1' in self.h5file.root.array.attrs)\n self.assertEqual(self.h5file.root.array.attrs.attr_1, 12)", "metadata": "root.AttributesTestCase.test04_replaceNode", "header": "['class', 'AttributesTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2547 }, { "content": " def test00_hierarchy(self):\n \"\"\"Performing hierarchy operations on a not logged node.\"\"\"\n\n self.h5file.create_group('/', 'tgroup')\n self.h5file.enable_undo()\n\n # Node creation is not undone.\n arr = self.NotLoggedArray(self.h5file.root, 'test',\n [1], self._getMethodName())\n self.h5file.undo()\n self.assertTrue('/test' in self.h5file)\n\n # Node movement is not undone.\n arr.move('/tgroup')\n self.h5file.undo()\n self.assertTrue('/tgroup/test' in self.h5file)\n\n # Node removal is not undone.\n arr.remove()\n self.h5file.undo()\n self.assertTrue('/tgroup/test' not in self.h5file)", "metadata": "root.NotLoggedTestCase.test00_hierarchy", "header": "['class', 'NotLoggedTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2576 }, { "content": " def test00_create(self):\n \"\"\"Test creating a node.\"\"\"\n\n def pre():\n pass\n\n def doit(newpath):\n self.h5file.create_array(newpath, 'array', [1], createparents=True)\n self.assertTrue(join_path(newpath, 'array') in self.h5file)\n\n def post(newpath):\n self.assertTrue(join_path(newpath, 'array') not in self.h5file)\n self.basetest(doit, pre, post)", "metadata": "root.CreateParentsTestCase.test00_create", "header": "['class', 'CreateParentsTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2649 }, { "content": " def test01_move(self):\n \"\"\"Test moving a node.\"\"\"\n\n def pre():\n self.h5file.create_array('/', 'array', [1])\n\n def doit(newpath):\n self.h5file.move_node('/array', newpath, createparents=True)\n self.assertTrue('/array' not in self.h5file)\n self.assertTrue(join_path(newpath, 'array') in self.h5file)\n\n def post(newpath):\n self.assertTrue('/array' in self.h5file)\n self.assertTrue(join_path(newpath, 'array') not in self.h5file)\n self.basetest(doit, pre, post)", "metadata": "root.CreateParentsTestCase.test01_move", "header": "['class', 'CreateParentsTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2663 }, { "content": " def test02_copy(self):\n \"\"\"Test copying a node.\"\"\"\n\n def pre():\n self.h5file.create_array('/', 'array', [1])\n\n def doit(newpath):\n self.h5file.copy_node('/array', newpath, createparents=True)\n self.assertTrue(join_path(newpath, 'array') in self.h5file)\n\n def post(newpath):\n self.assertTrue(join_path(newpath, 'array') not in self.h5file)\n self.basetest(doit, pre, post)", "metadata": "root.CreateParentsTestCase.test02_copy", "header": "['class', 'CreateParentsTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2679 }, { "content": " def test03_copyChildren(self):\n \"\"\"Test copying the children of a group.\"\"\"\n\n def pre():\n g = self.h5file.create_group('/', 'group')\n self.h5file.create_array(g, 'array1', [1])\n self.h5file.create_array(g, 'array2', [1])\n\n def doit(newpath):\n self.h5file.copy_children('/group', newpath, createparents=True)\n self.assertTrue(join_path(newpath, 'array1') in self.h5file)\n self.assertTrue(join_path(newpath, 'array2') in self.h5file)\n\n def post(newpath):\n self.assertTrue(join_path(newpath, 'array1') not in self.h5file)\n self.assertTrue(join_path(newpath, 'array2') not in self.h5file)\n self.basetest(doit, pre, post)", "metadata": "root.CreateParentsTestCase.test03_copyChildren", "header": "['class', 'CreateParentsTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 2693 } ]
[ { "span": "self.assertTrue(\"/otherarray\" not in self.h5file)", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 57 }, { "span": "self.assertTrue(\"/otherarray\" in self.h5file)", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 53 }, { "span": "self.assertTrue(\"/otherarray\" not in self.h5file)", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 57 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 104, "start_column": 8, "end_line": 104, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray\" in self.h5file)", "start_line": 112, "start_column": 8, "end_line": 112, "end_column": 53 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 113, "start_column": 8, "end_line": 113, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray\" in self.h5file)", "start_line": 143, "start_column": 8, "end_line": 143, "end_column": 53 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 144, "start_column": 8, "end_line": 144, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray\" not in self.h5file)", "start_line": 152, "start_column": 8, "end_line": 152, "end_column": 57 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 153, "start_column": 8, "end_line": 153, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray\" in self.h5file)", "start_line": 157, "start_column": 8, "end_line": 157, "end_column": 53 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 158, "start_column": 8, "end_line": 158, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray\" in self.h5file)", "start_line": 165, "start_column": 8, "end_line": 165, "end_column": 53 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 166, "start_column": 8, "end_line": 166, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 202, "start_column": 8, "end_line": 202, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 203, "start_column": 8, "end_line": 203, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 205, "start_column": 8, "end_line": 205, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray5\" not in self.h5file)", "start_line": 206, "start_column": 8, "end_line": 206, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray6\" not in self.h5file)", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 211, "start_column": 8, "end_line": 211, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 212, "start_column": 8, "end_line": 212, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 213, "start_column": 8, "end_line": 213, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 214, "start_column": 8, "end_line": 214, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray5\" not in self.h5file)", "start_line": 215, "start_column": 8, "end_line": 215, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray6\" not in self.h5file)", "start_line": 216, "start_column": 8, "end_line": 216, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 220, "start_column": 8, "end_line": 220, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 221, "start_column": 8, "end_line": 221, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 222, "start_column": 8, "end_line": 222, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray5\" not in self.h5file)", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray6\" not in self.h5file)", "start_line": 225, "start_column": 8, "end_line": 225, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 230, "start_column": 8, "end_line": 230, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 231, "start_column": 8, "end_line": 231, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 232, "start_column": 8, "end_line": 232, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 233, "start_column": 8, "end_line": 233, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray5\" not in self.h5file)", "start_line": 234, "start_column": 8, "end_line": 234, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray6\" not in self.h5file)", "start_line": 235, "start_column": 8, "end_line": 235, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 239, "start_column": 8, "end_line": 239, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 240, "start_column": 8, "end_line": 240, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 241, "start_column": 8, "end_line": 241, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 242, "start_column": 8, "end_line": 242, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray5\" not in self.h5file)", "start_line": 243, "start_column": 8, "end_line": 243, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray6\" not in self.h5file)", "start_line": 244, "start_column": 8, "end_line": 244, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 248, "start_column": 8, "end_line": 248, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 249, "start_column": 8, "end_line": 249, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 250, "start_column": 8, "end_line": 250, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 251, "start_column": 8, "end_line": 251, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray5\" in self.h5file)", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray6\" in self.h5file)", "start_line": 253, "start_column": 8, "end_line": 253, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 291, "start_column": 8, "end_line": 291, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 292, "start_column": 8, "end_line": 292, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 293, "start_column": 8, "end_line": 293, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 294, "start_column": 8, "end_line": 294, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 303, "start_column": 8, "end_line": 303, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 304, "start_column": 8, "end_line": 304, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 305, "start_column": 8, "end_line": 305, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 306, "start_column": 8, "end_line": 306, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray5\" in self.h5file)", "start_line": 307, "start_column": 8, "end_line": 307, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray6\" in self.h5file)", "start_line": 308, "start_column": 8, "end_line": 308, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 312, "start_column": 8, "end_line": 312, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 313, "start_column": 8, "end_line": 313, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 314, "start_column": 8, "end_line": 314, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 315, "start_column": 8, "end_line": 315, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray5\" not in self.h5file)", "start_line": 316, "start_column": 8, "end_line": 316, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray6\" not in self.h5file)", "start_line": 317, "start_column": 8, "end_line": 317, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 322, "start_column": 8, "end_line": 322, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 324, "start_column": 8, "end_line": 324, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray5\" in self.h5file)", "start_line": 325, "start_column": 8, "end_line": 325, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray6\" in self.h5file)", "start_line": 326, "start_column": 8, "end_line": 326, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 331, "start_column": 8, "end_line": 331, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 332, "start_column": 8, "end_line": 332, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 333, "start_column": 8, "end_line": 333, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 334, "start_column": 8, "end_line": 334, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray5\" in self.h5file)", "start_line": 335, "start_column": 8, "end_line": 335, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray6\" in self.h5file)", "start_line": 336, "start_column": 8, "end_line": 336, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 372, "start_column": 8, "end_line": 372, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 375, "start_column": 8, "end_line": 375, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 376, "start_column": 8, "end_line": 376, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 409, "start_column": 8, "end_line": 409, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 415, "start_column": 8, "end_line": 415, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 418, "start_column": 8, "end_line": 418, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 419, "start_column": 8, "end_line": 419, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 422, "start_column": 8, "end_line": 422, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 453, "start_column": 8, "end_line": 453, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 461, "start_column": 8, "end_line": 461, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 462, "start_column": 8, "end_line": 462, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 463, "start_column": 8, "end_line": 463, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 464, "start_column": 8, "end_line": 464, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 494, "start_column": 8, "end_line": 494, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 501, "start_column": 8, "end_line": 501, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 502, "start_column": 8, "end_line": 502, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 503, "start_column": 8, "end_line": 503, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 504, "start_column": 8, "end_line": 504, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 536, "start_column": 8, "end_line": 536, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 537, "start_column": 8, "end_line": 537, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 538, "start_column": 8, "end_line": 538, "end_column": 58 }, { "span": "self.assertTrue('/newarray' not in self.h5file)", "start_line": 552, "start_column": 8, "end_line": 552, "end_column": 55 }, { "span": "self.assertTrue('/newarray' not in self.h5file)", "start_line": 555, "start_column": 8, "end_line": 555, "end_column": 55 }, { "span": "self.assertTrue('/newarray' in self.h5file)", "start_line": 558, "start_column": 8, "end_line": 558, "end_column": 51 }, { "span": "self.assertTrue(self.h5file.root.newarray is newarr)", "start_line": 560, "start_column": 12, "end_line": 560, "end_column": 64 }, { "span": "self.assertTrue(\"/otherarray\" not in self.h5file)", "start_line": 580, "start_column": 8, "end_line": 580, "end_column": 57 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 581, "start_column": 8, "end_line": 581, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray\" in self.h5file)", "start_line": 606, "start_column": 8, "end_line": 606, "end_column": 53 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 607, "start_column": 8, "end_line": 607, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 635, "start_column": 8, "end_line": 635, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 636, "start_column": 8, "end_line": 636, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 637, "start_column": 8, "end_line": 637, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 638, "start_column": 8, "end_line": 638, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 642, "start_column": 8, "end_line": 642, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 643, "start_column": 8, "end_line": 643, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 644, "start_column": 8, "end_line": 644, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 645, "start_column": 8, "end_line": 645, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 649, "start_column": 8, "end_line": 649, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 650, "start_column": 8, "end_line": 650, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 651, "start_column": 8, "end_line": 651, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 652, "start_column": 8, "end_line": 652, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 657, "start_column": 8, "end_line": 657, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 658, "start_column": 8, "end_line": 658, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 659, "start_column": 8, "end_line": 659, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 660, "start_column": 8, "end_line": 660, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray\" not in self.h5file)", "start_line": 687, "start_column": 8, "end_line": 687, "end_column": 57 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 688, "start_column": 8, "end_line": 688, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray\" in self.h5file)", "start_line": 695, "start_column": 8, "end_line": 695, "end_column": 53 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 696, "start_column": 8, "end_line": 696, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 738, "start_column": 8, "end_line": 738, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 739, "start_column": 8, "end_line": 739, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 740, "start_column": 8, "end_line": 740, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 741, "start_column": 8, "end_line": 741, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 766, "start_column": 8, "end_line": 766, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 767, "start_column": 8, "end_line": 767, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 768, "start_column": 8, "end_line": 768, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 769, "start_column": 8, "end_line": 769, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 773, "start_column": 8, "end_line": 773, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 774, "start_column": 8, "end_line": 774, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 775, "start_column": 8, "end_line": 775, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 776, "start_column": 8, "end_line": 776, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 781, "start_column": 8, "end_line": 781, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 782, "start_column": 8, "end_line": 782, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 783, "start_column": 8, "end_line": 783, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 784, "start_column": 8, "end_line": 784, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 788, "start_column": 8, "end_line": 788, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 789, "start_column": 8, "end_line": 789, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 790, "start_column": 8, "end_line": 790, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 791, "start_column": 8, "end_line": 791, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 794, "start_column": 8, "end_line": 794, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 823, "start_column": 8, "end_line": 823, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 824, "start_column": 8, "end_line": 824, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 825, "start_column": 8, "end_line": 825, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 826, "start_column": 8, "end_line": 826, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 830, "start_column": 8, "end_line": 830, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 831, "start_column": 8, "end_line": 831, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 832, "start_column": 8, "end_line": 832, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 833, "start_column": 8, "end_line": 833, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 838, "start_column": 8, "end_line": 838, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 839, "start_column": 8, "end_line": 839, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 840, "start_column": 8, "end_line": 840, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 841, "start_column": 8, "end_line": 841, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 845, "start_column": 8, "end_line": 845, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 846, "start_column": 8, "end_line": 846, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 847, "start_column": 8, "end_line": 847, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray4\" not in self.h5file)", "start_line": 848, "start_column": 8, "end_line": 848, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 853, "start_column": 8, "end_line": 853, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 854, "start_column": 8, "end_line": 854, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 855, "start_column": 8, "end_line": 855, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray4\" in self.h5file)", "start_line": 856, "start_column": 8, "end_line": 856, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 859, "start_column": 8, "end_line": 859, "end_column": 54 }, { "span": "self.assertTrue(mid is not None)", "start_line": 902, "start_column": 8, "end_line": 902, "end_column": 40 }, { "span": "self.assertTrue('/newarray1' not in self.h5file)", "start_line": 910, "start_column": 8, "end_line": 910, "end_column": 56 }, { "span": "self.assertTrue('/newarray1' not in self.h5file)", "start_line": 929, "start_column": 8, "end_line": 929, "end_column": 56 }, { "span": "self.assertTrue('/newarray1' not in self.h5file)", "start_line": 948, "start_column": 8, "end_line": 948, "end_column": 56 }, { "span": "self.assertTrue('/newarray2' in self.h5file)", "start_line": 949, "start_column": 8, "end_line": 949, "end_column": 52 }, { "span": "self.assertTrue('/newarray3' in self.h5file)", "start_line": 950, "start_column": 8, "end_line": 950, "end_column": 52 }, { "span": "self.assertTrue('/newarray4' not in self.h5file)", "start_line": 951, "start_column": 8, "end_line": 951, "end_column": 56 }, { "span": "self.assertTrue('/newarray1' in self.h5file)", "start_line": 963, "start_column": 8, "end_line": 963, "end_column": 52 }, { "span": "self.assertTrue('/newarray2' in self.h5file)", "start_line": 964, "start_column": 8, "end_line": 964, "end_column": 52 }, { "span": "self.assertTrue('/newarray3' in self.h5file)", "start_line": 965, "start_column": 8, "end_line": 965, "end_column": 52 }, { "span": "self.assertTrue('/newarray4' in self.h5file)", "start_line": 966, "start_column": 8, "end_line": 966, "end_column": 52 }, { "span": "self.assertTrue('/newarray1' not in self.h5file)", "start_line": 969, "start_column": 8, "end_line": 969, "end_column": 56 }, { "span": "self.assertTrue('/newarray2' in self.h5file)", "start_line": 970, "start_column": 8, "end_line": 970, "end_column": 52 }, { "span": "self.assertTrue('/newarray3' in self.h5file)", "start_line": 971, "start_column": 8, "end_line": 971, "end_column": 52 }, { "span": "self.assertTrue('/newarray4' not in self.h5file)", "start_line": 972, "start_column": 8, "end_line": 972, "end_column": 56 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 1029, "start_column": 8, "end_line": 1029, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 1035, "start_column": 8, "end_line": 1035, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 1057, "start_column": 8, "end_line": 1057, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 1058, "start_column": 8, "end_line": 1058, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 1064, "start_column": 8, "end_line": 1064, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 1065, "start_column": 8, "end_line": 1065, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 1090, "start_column": 8, "end_line": 1090, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray2\" not in self.h5file)", "start_line": 1091, "start_column": 8, "end_line": 1091, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray3\" not in self.h5file)", "start_line": 1092, "start_column": 8, "end_line": 1092, "end_column": 58 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 1098, "start_column": 8, "end_line": 1098, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray2\" in self.h5file)", "start_line": 1099, "start_column": 8, "end_line": 1099, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray3\" in self.h5file)", "start_line": 1100, "start_column": 8, "end_line": 1100, "end_column": 54 }, { "span": "self.assertTrue(\"/otherarray1\" not in self.h5file)", "start_line": 1129, "start_column": 8, "end_line": 1129, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/otherarray2\" not in self.h5file)", "start_line": 1130, "start_column": 8, "end_line": 1130, "end_column": 65 }, { "span": "self.assertTrue(\"/agroup/agroup3/otherarray3\" not in self.h5file)", "start_line": 1131, "start_column": 8, "end_line": 1131, "end_column": 73 }, { "span": "self.assertTrue(\"/otherarray1\" in self.h5file)", "start_line": 1137, "start_column": 8, "end_line": 1137, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup/otherarray2\" in self.h5file)", "start_line": 1138, "start_column": 8, "end_line": 1138, "end_column": 61 }, { "span": "self.assertTrue(\"/agroup/agroup3/otherarray3\" in self.h5file)", "start_line": 1139, "start_column": 8, "end_line": 1139, "end_column": 69 }, { "span": "self.assertTrue(\"/othergroup1\" not in self.h5file)", "start_line": 1196, "start_column": 8, "end_line": 1196, "end_column": 58 }, { "span": "self.assertTrue(\"/othergroup1\" in self.h5file)", "start_line": 1202, "start_column": 8, "end_line": 1202, "end_column": 54 }, { "span": "self.assertTrue(\"/othergroup1\" not in self.h5file)", "start_line": 1224, "start_column": 8, "end_line": 1224, "end_column": 58 }, { "span": "self.assertTrue(\"/othergroup2\" not in self.h5file)", "start_line": 1225, "start_column": 8, "end_line": 1225, "end_column": 58 }, { "span": "self.assertTrue(\"/othergroup1\" in self.h5file)", "start_line": 1231, "start_column": 8, "end_line": 1231, "end_column": 54 }, { "span": "self.assertTrue(\"/othergroup2\" in self.h5file)", "start_line": 1232, "start_column": 8, "end_line": 1232, "end_column": 54 }, { "span": "self.assertTrue(\"/othergroup1\" not in self.h5file)", "start_line": 1257, "start_column": 8, "end_line": 1257, "end_column": 58 }, { "span": "self.assertTrue(\"/othergroup2\" not in self.h5file)", "start_line": 1258, "start_column": 8, "end_line": 1258, "end_column": 58 }, { "span": "self.assertTrue(\"/othergroup3\" not in self.h5file)", "start_line": 1259, "start_column": 8, "end_line": 1259, "end_column": 58 }, { "span": "self.assertTrue(\"/othergroup1\" in self.h5file)", "start_line": 1265, "start_column": 8, "end_line": 1265, "end_column": 54 }, { "span": "self.assertTrue(\"/othergroup2\" in self.h5file)", "start_line": 1266, "start_column": 8, "end_line": 1266, "end_column": 54 }, { "span": "self.assertTrue(\"/othergroup3\" in self.h5file)", "start_line": 1267, "start_column": 8, "end_line": 1267, "end_column": 54 }, { "span": "self.assertTrue(\"/othergroup1\" not in self.h5file)", "start_line": 1296, "start_column": 8, "end_line": 1296, "end_column": 58 }, { "span": "self.assertTrue(\"/othergroup1/othergroup2\" not in self.h5file)", "start_line": 1297, "start_column": 8, "end_line": 1297, "end_column": 70 }, { "span": "self.assertTrue(\n \"/othergroup1/othergroup2/othergroup3\" not in self.h5file)", "start_line": 1298, "start_column": 8, "end_line": 1299, "end_column": 70 }, { "span": "self.assertTrue(\"/othergroup1\" in self.h5file)", "start_line": 1305, "start_column": 8, "end_line": 1305, "end_column": 54 }, { "span": "self.assertTrue(\"/othergroup1/othergroup2\" in self.h5file)", "start_line": 1306, "start_column": 8, "end_line": 1306, "end_column": 66 }, { "span": "self.assertTrue(\"/othergroup1/othergroup2/othergroup3\" in self.h5file)", "start_line": 1307, "start_column": 8, "end_line": 1307, "end_column": 78 }, { "span": "self.assertTrue(\"/agroup2\" in self.h5file)", "start_line": 1403, "start_column": 8, "end_line": 1403, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup3\" not in self.h5file)", "start_line": 1404, "start_column": 8, "end_line": 1404, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup2\" not in self.h5file)", "start_line": 1411, "start_column": 8, "end_line": 1411, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup3\" in self.h5file)", "start_line": 1412, "start_column": 8, "end_line": 1412, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup\" in self.h5file)", "start_line": 1432, "start_column": 8, "end_line": 1432, "end_column": 49 }, { "span": "self.assertTrue(\"/agroup3\" not in self.h5file)", "start_line": 1433, "start_column": 8, "end_line": 1433, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup/anarray1\" in self.h5file)", "start_line": 1436, "start_column": 8, "end_line": 1436, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/anarray2\" in self.h5file)", "start_line": 1437, "start_column": 8, "end_line": 1437, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/agroup3\" in self.h5file)", "start_line": 1438, "start_column": 8, "end_line": 1438, "end_column": 57 }, { "span": "self.assertTrue(\"/agroup\" not in self.h5file)", "start_line": 1445, "start_column": 8, "end_line": 1445, "end_column": 53 }, { "span": "self.assertTrue(\"/agroup3\" in self.h5file)", "start_line": 1446, "start_column": 8, "end_line": 1446, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup3/anarray1\" in self.h5file)", "start_line": 1450, "start_column": 8, "end_line": 1450, "end_column": 59 }, { "span": "self.assertTrue(\"/agroup3/anarray2\" in self.h5file)", "start_line": 1451, "start_column": 8, "end_line": 1451, "end_column": 59 }, { "span": "self.assertTrue(\"/agroup3/agroup3\" in self.h5file)", "start_line": 1452, "start_column": 8, "end_line": 1452, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup\" in self.h5file)", "start_line": 1472, "start_column": 8, "end_line": 1472, "end_column": 49 }, { "span": "self.assertTrue(\"/agroup4\" not in self.h5file)", "start_line": 1473, "start_column": 8, "end_line": 1473, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup/anarray1\" in self.h5file)", "start_line": 1476, "start_column": 8, "end_line": 1476, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/anarray2\" in self.h5file)", "start_line": 1477, "start_column": 8, "end_line": 1477, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/agroup3\" in self.h5file)", "start_line": 1478, "start_column": 8, "end_line": 1478, "end_column": 57 }, { "span": "self.assertTrue(\"/agroup\" not in self.h5file)", "start_line": 1485, "start_column": 8, "end_line": 1485, "end_column": 53 }, { "span": "self.assertTrue(\"/agroup4\" in self.h5file)", "start_line": 1486, "start_column": 8, "end_line": 1486, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup4/anarray1\" in self.h5file)", "start_line": 1490, "start_column": 8, "end_line": 1490, "end_column": 59 }, { "span": "self.assertTrue(\"/agroup4/anarray2\" in self.h5file)", "start_line": 1491, "start_column": 8, "end_line": 1491, "end_column": 59 }, { "span": "self.assertTrue(\"/agroup4/agroup3\" in self.h5file)", "start_line": 1492, "start_column": 8, "end_line": 1492, "end_column": 58 }, { "span": "self.assertTrue(\"/anarray\" in self.h5file)", "start_line": 1511, "start_column": 8, "end_line": 1511, "end_column": 50 }, { "span": "self.assertTrue(\"/anarray2\" not in self.h5file)", "start_line": 1512, "start_column": 8, "end_line": 1512, "end_column": 55 }, { "span": "self.assertTrue(\"/anarray\" not in self.h5file)", "start_line": 1519, "start_column": 8, "end_line": 1519, "end_column": 54 }, { "span": "self.assertTrue(\"/anarray2\" in self.h5file)", "start_line": 1520, "start_column": 8, "end_line": 1520, "end_column": 51 }, { "span": "self.assertTrue(\"/table\" in self.h5file)", "start_line": 1540, "start_column": 8, "end_line": 1540, "end_column": 48 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 1542, "start_column": 8, "end_line": 1542, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 1543, "start_column": 8, "end_line": 1543, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 1544, "start_column": 8, "end_line": 1544, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 1545, "start_column": 8, "end_line": 1545, "end_column": 54 }, { "span": "self.assertTrue(\"/table2\" not in self.h5file)", "start_line": 1549, "start_column": 8, "end_line": 1549, "end_column": 53 }, { "span": "self.assertTrue(\"/table\" not in self.h5file)", "start_line": 1556, "start_column": 8, "end_line": 1556, "end_column": 52 }, { "span": "self.assertTrue(\"/table2\" in self.h5file)", "start_line": 1557, "start_column": 8, "end_line": 1557, "end_column": 49 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 1560, "start_column": 8, "end_line": 1560, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 1561, "start_column": 8, "end_line": 1561, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 1562, "start_column": 8, "end_line": 1562, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 1566, "start_column": 8, "end_line": 1566, "end_column": 54 }, { "span": "self.assertTrue(\"/anarray\" in self.h5file)", "start_line": 1617, "start_column": 8, "end_line": 1617, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup/agroup3/anarray\" not in self.h5file)", "start_line": 1618, "start_column": 8, "end_line": 1618, "end_column": 69 }, { "span": "self.assertTrue(\"/anarray\" not in self.h5file)", "start_line": 1625, "start_column": 8, "end_line": 1625, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup/agroup3/anarray\" in self.h5file)", "start_line": 1626, "start_column": 8, "end_line": 1626, "end_column": 65 }, { "span": "self.assertTrue(\"/agroup\" in self.h5file)", "start_line": 1647, "start_column": 8, "end_line": 1647, "end_column": 49 }, { "span": "self.assertTrue(\"/agroup2/agroup3\" not in self.h5file)", "start_line": 1648, "start_column": 8, "end_line": 1648, "end_column": 62 }, { "span": "self.assertTrue(\"/agroup/anarray1\" in self.h5file)", "start_line": 1651, "start_column": 8, "end_line": 1651, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/anarray2\" in self.h5file)", "start_line": 1652, "start_column": 8, "end_line": 1652, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/agroup3\" in self.h5file)", "start_line": 1653, "start_column": 8, "end_line": 1653, "end_column": 57 }, { "span": "self.assertTrue(\"/agroup\" not in self.h5file)", "start_line": 1660, "start_column": 8, "end_line": 1660, "end_column": 53 }, { "span": "self.assertTrue(\"/agroup2/agroup3\" in self.h5file)", "start_line": 1661, "start_column": 8, "end_line": 1661, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup2/agroup3/anarray1\" in self.h5file)", "start_line": 1666, "start_column": 8, "end_line": 1666, "end_column": 67 }, { "span": "self.assertTrue(\"/agroup2/agroup3/anarray2\" in self.h5file)", "start_line": 1667, "start_column": 8, "end_line": 1667, "end_column": 67 }, { "span": "self.assertTrue(\"/agroup2/agroup3/agroup3\" in self.h5file)", "start_line": 1668, "start_column": 8, "end_line": 1668, "end_column": 66 }, { "span": "self.assertTrue(\"/agroup\" in self.h5file)", "start_line": 1688, "start_column": 8, "end_line": 1688, "end_column": 49 }, { "span": "self.assertTrue(\"/agroup2/agroup4\" not in self.h5file)", "start_line": 1689, "start_column": 8, "end_line": 1689, "end_column": 62 }, { "span": "self.assertTrue(\"/agroup/anarray1\" in self.h5file)", "start_line": 1692, "start_column": 8, "end_line": 1692, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/anarray2\" in self.h5file)", "start_line": 1693, "start_column": 8, "end_line": 1693, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/agroup3\" in self.h5file)", "start_line": 1694, "start_column": 8, "end_line": 1694, "end_column": 57 }, { "span": "self.assertTrue(\"/agroup\" not in self.h5file)", "start_line": 1701, "start_column": 8, "end_line": 1701, "end_column": 53 }, { "span": "self.assertTrue(\"/agroup2/agroup4\" in self.h5file)", "start_line": 1702, "start_column": 8, "end_line": 1702, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup2/agroup4/anarray1\" in self.h5file)", "start_line": 1707, "start_column": 8, "end_line": 1707, "end_column": 67 }, { "span": "self.assertTrue(\"/agroup2/agroup4/anarray2\" in self.h5file)", "start_line": 1708, "start_column": 8, "end_line": 1708, "end_column": 67 }, { "span": "self.assertTrue(\"/agroup2/agroup4/agroup3\" in self.h5file)", "start_line": 1709, "start_column": 8, "end_line": 1709, "end_column": 66 }, { "span": "self.assertTrue(\"/anarray\" in self.h5file)", "start_line": 1728, "start_column": 8, "end_line": 1728, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup2/anarray2\" not in self.h5file)", "start_line": 1729, "start_column": 8, "end_line": 1729, "end_column": 63 }, { "span": "self.assertTrue(\"/anarray\" not in self.h5file)", "start_line": 1736, "start_column": 8, "end_line": 1736, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup2/anarray2\" in self.h5file)", "start_line": 1737, "start_column": 8, "end_line": 1737, "end_column": 59 }, { "span": "self.assertTrue(\"/table\" in self.h5file)", "start_line": 1758, "start_column": 8, "end_line": 1758, "end_column": 48 }, { "span": "self.assertTrue(\"/agroup2/table2\" not in self.h5file)", "start_line": 1759, "start_column": 8, "end_line": 1759, "end_column": 61 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 1761, "start_column": 8, "end_line": 1761, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 1762, "start_column": 8, "end_line": 1762, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 1763, "start_column": 8, "end_line": 1763, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 1764, "start_column": 8, "end_line": 1764, "end_column": 54 }, { "span": "self.assertTrue(\"/table\" not in self.h5file)", "start_line": 1774, "start_column": 8, "end_line": 1774, "end_column": 52 }, { "span": "self.assertTrue(\"/agroup2/table2\" in self.h5file)", "start_line": 1775, "start_column": 8, "end_line": 1775, "end_column": 57 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 1778, "start_column": 8, "end_line": 1778, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 1779, "start_column": 8, "end_line": 1779, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 1780, "start_column": 8, "end_line": 1780, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 1784, "start_column": 8, "end_line": 1784, "end_column": 54 }, { "span": "self.assertTrue(\"/anarray\" in self.h5file)", "start_line": 1835, "start_column": 8, "end_line": 1835, "end_column": 50 }, { "span": "self.assertTrue(\"/anarray\" not in self.h5file)", "start_line": 1842, "start_column": 8, "end_line": 1842, "end_column": 54 }, { "span": "self.assertTrue(\"/anarray\" in self.h5file)", "start_line": 1862, "start_column": 8, "end_line": 1862, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup/anarray2\" in self.h5file)", "start_line": 1863, "start_column": 8, "end_line": 1863, "end_column": 58 }, { "span": "self.assertTrue(\"/anarray\" not in self.h5file)", "start_line": 1872, "start_column": 8, "end_line": 1872, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup/anarray2\" not in self.h5file)", "start_line": 1873, "start_column": 8, "end_line": 1873, "end_column": 62 }, { "span": "self.assertTrue(\"/table\" in self.h5file)", "start_line": 1892, "start_column": 8, "end_line": 1892, "end_column": 48 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 1894, "start_column": 8, "end_line": 1894, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 1895, "start_column": 8, "end_line": 1895, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 1896, "start_column": 8, "end_line": 1896, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 1897, "start_column": 8, "end_line": 1897, "end_column": 54 }, { "span": "self.assertTrue(\"/table\" not in self.h5file)", "start_line": 1907, "start_column": 8, "end_line": 1907, "end_column": 52 }, { "span": "self.assertTrue(\"/agroup\" in self.h5file)", "start_line": 1926, "start_column": 8, "end_line": 1926, "end_column": 49 }, { "span": "self.assertTrue(\"/agroup/anarray1\" in self.h5file)", "start_line": 1927, "start_column": 8, "end_line": 1927, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/anarray2\" in self.h5file)", "start_line": 1928, "start_column": 8, "end_line": 1928, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/agroup3\" in self.h5file)", "start_line": 1929, "start_column": 8, "end_line": 1929, "end_column": 57 }, { "span": "self.assertTrue(\"/agroup\" not in self.h5file)", "start_line": 1936, "start_column": 8, "end_line": 1936, "end_column": 53 }, { "span": "self.assertTrue(\"/agroup/anarray1\" not in self.h5file)", "start_line": 1937, "start_column": 8, "end_line": 1937, "end_column": 62 }, { "span": "self.assertTrue(\"/agroup/anarray2\" not in self.h5file)", "start_line": 1938, "start_column": 8, "end_line": 1938, "end_column": 62 }, { "span": "self.assertTrue(\"/agroup/agroup3\" not in self.h5file)", "start_line": 1939, "start_column": 8, "end_line": 1939, "end_column": 61 }, { "span": "self.assertTrue(\"/agroup\" in self.h5file)", "start_line": 1959, "start_column": 8, "end_line": 1959, "end_column": 49 }, { "span": "self.assertTrue(\"/agroup2\" in self.h5file)", "start_line": 1960, "start_column": 8, "end_line": 1960, "end_column": 50 }, { "span": "self.assertTrue(\"/agroup/anarray1\" in self.h5file)", "start_line": 1963, "start_column": 8, "end_line": 1963, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/anarray2\" in self.h5file)", "start_line": 1964, "start_column": 8, "end_line": 1964, "end_column": 58 }, { "span": "self.assertTrue(\"/agroup/agroup3\" in self.h5file)", "start_line": 1965, "start_column": 8, "end_line": 1965, "end_column": 57 }, { "span": "self.assertTrue(\"/agroup\" not in self.h5file)", "start_line": 1972, "start_column": 8, "end_line": 1972, "end_column": 53 }, { "span": "self.assertTrue(\"/agroup2\" not in self.h5file)", "start_line": 1973, "start_column": 8, "end_line": 1973, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup/anarray1\" not in self.h5file)", "start_line": 1976, "start_column": 8, "end_line": 1976, "end_column": 62 }, { "span": "self.assertTrue(\"/agroup/anarray2\" not in self.h5file)", "start_line": 1977, "start_column": 8, "end_line": 1977, "end_column": 62 }, { "span": "self.assertTrue(\"/agroup/agroup3\" not in self.h5file)", "start_line": 1978, "start_column": 8, "end_line": 1978, "end_column": 61 }, { "span": "self.assertTrue('/agroup/agroup3/anarray' not in self.h5file)", "start_line": 2029, "start_column": 8, "end_line": 2029, "end_column": 69 }, { "span": "self.assertTrue('/agroup/agroup3/anarray' in self.h5file)", "start_line": 2035, "start_column": 8, "end_line": 2035, "end_column": 65 }, { "span": "self.assertTrue(self.h5file.root.agroup.agroup3.anarray is new_node)", "start_line": 2036, "start_column": 8, "end_line": 2036, "end_column": 76 }, { "span": "self.assertTrue(\"/agroup/agroup3/table\" in self.h5file)", "start_line": 2053, "start_column": 8, "end_line": 2053, "end_column": 63 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 2057, "start_column": 8, "end_line": 2057, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 2058, "start_column": 8, "end_line": 2058, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 2059, "start_column": 8, "end_line": 2059, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 2063, "start_column": 8, "end_line": 2063, "end_column": 54 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 2068, "start_column": 8, "end_line": 2068, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 2069, "start_column": 8, "end_line": 2069, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 2070, "start_column": 8, "end_line": 2070, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 2071, "start_column": 8, "end_line": 2071, "end_column": 54 }, { "span": "self.assertTrue(\"/agroup/agroup3/table\" not in self.h5file)", "start_line": 2077, "start_column": 8, "end_line": 2077, "end_column": 67 }, { "span": "self.assertTrue(\"/table\" in self.h5file)", "start_line": 2083, "start_column": 8, "end_line": 2083, "end_column": 48 }, { "span": "self.assertTrue(\"/agroup/agroup3/table\" in self.h5file)", "start_line": 2084, "start_column": 8, "end_line": 2084, "end_column": 63 }, { "span": "self.assertTrue(table.cols.var1.index is not None)", "start_line": 2087, "start_column": 8, "end_line": 2087, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var2.index is not None)", "start_line": 2088, "start_column": 8, "end_line": 2088, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var3.index is not None)", "start_line": 2089, "start_column": 8, "end_line": 2089, "end_column": 58 }, { "span": "self.assertTrue(table.cols.var4.index is None)", "start_line": 2093, "start_column": 8, "end_line": 2093, "end_column": 54 }, { "span": "self.assertTrue('/acopy' not in self.h5file)", "start_line": 2113, "start_column": 8, "end_line": 2113, "end_column": 52 }, { "span": "self.assertTrue('/acopy/anarray1' not in self.h5file)", "start_line": 2114, "start_column": 8, "end_line": 2114, "end_column": 61 }, { "span": "self.assertTrue('/acopy/anarray2' not in self.h5file)", "start_line": 2115, "start_column": 8, "end_line": 2115, "end_column": 61 }, { "span": "self.assertTrue('/acopy/agroup3' not in self.h5file)", "start_line": 2116, "start_column": 8, "end_line": 2116, "end_column": 60 }, { "span": "self.assertTrue('/acopy' in self.h5file)", "start_line": 2122, "start_column": 8, "end_line": 2122, "end_column": 48 }, { "span": "self.assertTrue('/acopy/anarray1' in self.h5file)", "start_line": 2123, "start_column": 8, "end_line": 2123, "end_column": 57 }, { "span": "self.assertTrue('/acopy/anarray2' in self.h5file)", "start_line": 2124, "start_column": 8, "end_line": 2124, "end_column": 57 }, { "span": "self.assertTrue('/acopy/agroup3' in self.h5file)", "start_line": 2125, "start_column": 8, "end_line": 2125, "end_column": 56 }, { "span": "self.assertTrue(self.h5file.root.acopy is new_node)", "start_line": 2126, "start_column": 8, "end_line": 2126, "end_column": 59 }, { "span": "self.assertTrue(self.h5file.root.agroup is oldNode)", "start_line": 2149, "start_column": 8, "end_line": 2149, "end_column": 59 }, { "span": "self.assertTrue(self.h5file.root.agroup is new_node)", "start_line": 2156, "start_column": 8, "end_line": 2156, "end_column": 60 }, { "span": "self.assertTrue('/agroup2/anarray1' not in self.h5file)", "start_line": 2176, "start_column": 8, "end_line": 2176, "end_column": 63 }, { "span": "self.assertTrue('/agroup2/anarray2' not in self.h5file)", "start_line": 2177, "start_column": 8, "end_line": 2177, "end_column": 63 }, { "span": "self.assertTrue('/agroup2/agroup3' not in self.h5file)", "start_line": 2178, "start_column": 8, "end_line": 2178, "end_column": 62 }, { "span": "self.assertTrue('/agroup2/anarray1' in self.h5file)", "start_line": 2184, "start_column": 8, "end_line": 2184, "end_column": 59 }, { "span": "self.assertTrue('/agroup2/anarray2' in self.h5file)", "start_line": 2185, "start_column": 8, "end_line": 2185, "end_column": 59 }, { "span": "self.assertTrue('/agroup2/agroup3' in self.h5file)", "start_line": 2186, "start_column": 8, "end_line": 2186, "end_column": 58 }, { "span": "self.assertTrue('/anarray4' not in self.h5file)", "start_line": 2250, "start_column": 8, "end_line": 2250, "end_column": 55 }, { "span": "self.assertTrue('/anarray3' not in self.h5file)", "start_line": 2251, "start_column": 8, "end_line": 2251, "end_column": 55 }, { "span": "self.assertTrue('/agroup/agroup3/anarray3' not in self.h5file)", "start_line": 2252, "start_column": 8, "end_line": 2252, "end_column": 70 }, { "span": "self.assertTrue('/agroup3' not in self.h5file)", "start_line": 2253, "start_column": 8, "end_line": 2253, "end_column": 54 }, { "span": "self.assertTrue('/anarray4' not in self.h5file)", "start_line": 2254, "start_column": 8, "end_line": 2254, "end_column": 55 }, { "span": "self.assertTrue('/anarray' in self.h5file)", "start_line": 2255, "start_column": 8, "end_line": 2255, "end_column": 50 }, { "span": "self.assertTrue('/agroup/agroup3/anarray3' in self.h5file)", "start_line": 2261, "start_column": 8, "end_line": 2261, "end_column": 66 }, { "span": "self.assertTrue('/agroup/anarray3' in self.h5file)", "start_line": 2262, "start_column": 8, "end_line": 2262, "end_column": 58 }, { "span": "self.assertTrue('/agroup3/agroup3/anarray3' in self.h5file)", "start_line": 2263, "start_column": 8, "end_line": 2263, "end_column": 67 }, { "span": "self.assertTrue('/agroup3/anarray3' not in self.h5file)", "start_line": 2264, "start_column": 8, "end_line": 2264, "end_column": 63 }, { "span": "self.assertTrue(self.h5file.root.agroup.anarray3 is new_node)", "start_line": 2265, "start_column": 8, "end_line": 2265, "end_column": 69 }, { "span": "self.assertTrue('/anarray' not in self.h5file)", "start_line": 2266, "start_column": 8, "end_line": 2266, "end_column": 54 }, { "span": "self.assertTrue('/anarray4' not in self.h5file)", "start_line": 2267, "start_column": 8, "end_line": 2267, "end_column": 55 }, { "span": "self.assertTrue('/agroup2' in self.h5file)", "start_line": 2346, "start_column": 8, "end_line": 2346, "end_column": 50 }, { "span": "self.assertTrue('/agroup' in self.h5file)", "start_line": 2389, "start_column": 8, "end_line": 2389, "end_column": 49 }, { "span": "self.assertTrue('/agroup/anarray1' in self.h5file)", "start_line": 2391, "start_column": 8, "end_line": 2391, "end_column": 58 }, { "span": "self.assertTrue('/agroup/anarray2' in self.h5file)", "start_line": 2392, "start_column": 8, "end_line": 2392, "end_column": 58 }, { "span": "self.assertTrue('/agroup/agroup3' in self.h5file)", "start_line": 2393, "start_column": 8, "end_line": 2393, "end_column": 57 }, { "span": "self.assertTrue('/agroup/agroup5' not in self.h5file)", "start_line": 2394, "start_column": 8, "end_line": 2394, "end_column": 61 }, { "span": "self.assertTrue('/agroup' in self.h5file)", "start_line": 2398, "start_column": 8, "end_line": 2398, "end_column": 49 }, { "span": "self.assertTrue('/agroup/agroup5' in self.h5file)", "start_line": 2400, "start_column": 8, "end_line": 2400, "end_column": 57 }, { "span": "self.assertTrue('/agroup3' not in self.h5file)", "start_line": 2430, "start_column": 8, "end_line": 2430, "end_column": 54 }, { "span": "self.assertTrue('/agroup3' in self.h5file)", "start_line": 2435, "start_column": 8, "end_line": 2435, "end_column": 50 }, { "span": "self.assertTrue('/agroup/agroup4' not in self.h5file)", "start_line": 2436, "start_column": 8, "end_line": 2436, "end_column": 61 }, { "span": "self.assertTrue('attr_0' in attrs)", "start_line": 2466, "start_column": 8, "end_line": 2466, "end_column": 42 }, { "span": "self.assertTrue('attr_0' not in attrs)", "start_line": 2469, "start_column": 8, "end_line": 2469, "end_column": 46 }, { "span": "self.assertTrue('attr_0' in attrs)", "start_line": 2471, "start_column": 8, "end_line": 2471, "end_column": 42 }, { "span": "self.assertTrue('attr_1' in attrs)", "start_line": 2487, "start_column": 8, "end_line": 2487, "end_column": 42 }, { "span": "self.assertTrue('attr_1' in attrs)", "start_line": 2490, "start_column": 8, "end_line": 2490, "end_column": 42 }, { "span": "self.assertTrue('attr_1' in attrs)", "start_line": 2493, "start_column": 8, "end_line": 2493, "end_column": 42 }, { "span": "self.assertTrue('attr_1' not in attrs)", "start_line": 2508, "start_column": 8, "end_line": 2508, "end_column": 46 }, { "span": "self.assertTrue('attr_1' in attrs)", "start_line": 2510, "start_column": 8, "end_line": 2510, "end_column": 42 }, { "span": "self.assertTrue('attr_1' not in attrs)", "start_line": 2513, "start_column": 8, "end_line": 2513, "end_column": 46 }, { "span": "self.assertTrue('attr_2' not in rattrs)", "start_line": 2539, "start_column": 8, "end_line": 2539, "end_column": 47 }, { "span": "self.assertTrue('attr_3' not in rattrs)", "start_line": 2540, "start_column": 8, "end_line": 2540, "end_column": 47 }, { "span": "self.assertTrue('attr_1' in self.h5file.root.array.attrs)", "start_line": 2563, "start_column": 8, "end_line": 2563, "end_column": 65 }, { "span": "self.assertTrue('attr_1' in self.h5file.root.array.attrs)", "start_line": 2566, "start_column": 8, "end_line": 2566, "end_column": 65 }, { "span": "self.assertTrue('/test' in self.h5file)", "start_line": 2586, "start_column": 8, "end_line": 2586, "end_column": 47 }, { "span": "self.assertTrue('/tgroup/test' in self.h5file)", "start_line": 2591, "start_column": 8, "end_line": 2591, "end_column": 54 }, { "span": "self.assertTrue('/tgroup/test' not in self.h5file)", "start_line": 2596, "start_column": 8, "end_line": 2596, "end_column": 58 }, { "span": "self.assertTrue(join_path(newpath, 'array') in self.h5file)", "start_line": 2657, "start_column": 12, "end_line": 2657, "end_column": 71 }, { "span": "self.assertTrue(join_path(newpath, 'array') not in self.h5file)", "start_line": 2660, "start_column": 12, "end_line": 2660, "end_column": 75 }, { "span": "self.assertTrue('/array' not in self.h5file)", "start_line": 2671, "start_column": 12, "end_line": 2671, "end_column": 56 }, { "span": "self.assertTrue(join_path(newpath, 'array') in self.h5file)", "start_line": 2672, "start_column": 12, "end_line": 2672, "end_column": 71 }, { "span": "self.assertTrue('/array' in self.h5file)", "start_line": 2675, "start_column": 12, "end_line": 2675, "end_column": 52 }, { "span": "self.assertTrue(join_path(newpath, 'array') not in self.h5file)", "start_line": 2676, "start_column": 12, "end_line": 2676, "end_column": 75 }, { "span": "self.assertTrue(join_path(newpath, 'array') in self.h5file)", "start_line": 2687, "start_column": 12, "end_line": 2687, "end_column": 71 }, { "span": "self.assertTrue(join_path(newpath, 'array') not in self.h5file)", "start_line": 2690, "start_column": 12, "end_line": 2690, "end_column": 75 }, { "span": "self.assertTrue(join_path(newpath, 'array1') in self.h5file)", "start_line": 2703, "start_column": 12, "end_line": 2703, "end_column": 72 }, { "span": "self.assertTrue(join_path(newpath, 'array2') in self.h5file)", "start_line": 2704, "start_column": 12, "end_line": 2704, "end_column": 72 }, { "span": "self.assertTrue(join_path(newpath, 'array1') not in self.h5file)", "start_line": 2707, "start_column": 12, "end_line": 2707, "end_column": 76 }, { "span": "self.assertTrue(join_path(newpath, 'array2') not in self.h5file)", "start_line": 2708, "start_column": 12, "end_line": 2708, "end_column": 76 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0", "\\u", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "simple", " ", "do", "/", "undo", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0", "\\u", "simple", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Object", " ", "tree", " ", "after", " ", "redo", ":\"_", ",_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "twi", "ce_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "do", "/", "undo", " ", "(", "twi", "ce", " ", "operati", "ons", " ", "inter", "twin", "ed", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "\\u", "twi", "ce", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "twi", "ce", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "twi", "ce", " ", "ops", " ", "and", " ", "two", " ", "mark", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "\\u", "twi", "ce", "2", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "wind", " ", "just", " ", "one", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "wind", " ", "anot", "her", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "unti", "l", " ", "the", " ", "next", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "unti", "l", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "action_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "\\u", "cur", "mark_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3", "\\u", "6", "times", "3", "marks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "si", "x", " ", "ops", " ", "and", " ", "three", " ", "mark", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "\\u", "6", "times", "3", "mark", "s", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "5", "'_", ",_", "[_", "7_", ",_", "8_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "6", "'_", ",_", "[_", "8_", ",_", "9_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "wind", " ", "just", " ", "one", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "wind", " ", "anot", "her", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "wind", " ", "all", " ", "marks_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "unti", "l", " ", "the", " ", "next", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "unti", "l", " ", "the", " ", "next", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "unti", "l", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "[_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "4_", "._", "read_", "(_", ")_", ",_", "[_", "6_", ",_", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "5_", "._", "read_", "(_", ")_", ",_", "[_", "7_", ",_", "8_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "6_", "._", "read_", "(_", ")_", ",_", "[_", "8_", ",_", "9_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "4_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "5_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "6_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "4", "\\u", "6", "times", "3", "mark", "sr", "o_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "si", "x", " ", "operati", "ons", ",", " ", "three", " ", "mark", "s", " ", "and", " ", "do", "/", "undo", " ", "in", " ", "random", "\\", "10", ";", " ", " ", " ", " ", "order", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "4", "\\u", "6", "times", "3", "mark", "sr", "o", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "wind", " ", "the", " ", "previ", "ous", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark", " ", "in", " ", "the", " ", "middle", " ", "of", " ", "stack_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "All", " ", "nodes", ":\"_", ",_", "self_", "._", "h5file", "_", "._", "walk", "\\u", "nodes_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "5", "'_", ",_", "[_", "7_", ",_", "8_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "6", "'_", ",_", "[_", "8_", ",_", "9_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "wind", " ", "previ", "ous", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "unti", "l", " ", "the", " ", "last", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "unti", "l", " ", "the", " ", "next", " ", "mark", " ", "(", "non", "-", "existen", "t", ",", " ", "so", " ", "no", " ", "action", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "5", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "6", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "5_", "._", "read_", "(_", ")_", ",_", "[_", "7_", ",_", "8_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "6_", "._", "read_", "(_", ")_", ",_", "[_", "8_", ",_", "9_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "5_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "6_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "6", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "5", "\\u", "destruct", "ive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "a", " ", "destruct", "ive", " ", "action", " ", "dur", "ing", " ", "undo", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "5", "\\u", "destruct", "ive", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "destruct", "ive", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "[_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "5b", "\\u", "destruct", "ive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "a", " ", "destruct", "ive", " ", "action", " ", "dur", "ing", " ", "undo", " ", "(", "II", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "5b", "\\u", "destruct", "ive", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "destruct", "ive", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "[_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "5c", "\\u", "destruct", "ive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "a", " ", "destruct", "ive", " ", "action", " ", "dur", "ing", " ", "undo", " ", "(", "III", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "5c", "\\u", "destruct", "ive", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "destruct", "ive", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "unw", "ind", " ", "twi", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "5d", "\\u", "destruct", "ive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "a", " ", "destruct", "ive", " ", "action", " ", "dur", "ing", " ", "undo", " ", "(", "IV", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "5d", "\\u", "destruct", "ive", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "destruct", "ive", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "go", " ", "to", " ", "the", " ", "first", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "5e", "\\u", "destruct", "ive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "a", " ", "destruct", "ive", " ", "action", " ", "dur", "ing", " ", "undo", " ", "(", "V", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "5e", "\\u", "destruct", "ive", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "a", " ", "mark_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "destruct", "ive", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "unw", "ind", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "5f", "\\u", "destruct", "ive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "with", " ", "a", " ", "destruct", "ive", " ", "creati", "on", " ", "of", " ", "exist", "ing", " ", "node", " ", "dur", "ing", " ", "undo", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "5f", "\\u", "destruct", "ive", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newa", "rr_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "reo", "pen", "\\u", "flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "newa", "rray_", "is_", "newa", "rr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "6", "\\u", "total", "unw", "ind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "do", "/", "undo", " ", "(", "total", " ", "unw", "ind", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "6", "\\u", "total", "unw", "ind", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "7", "\\u", "total", "rewi", "nd_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "do", "/", "undo", " ", "(", "total", " ", "rewi", "nd", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "7", "\\u", "total", "unw", "ind", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "all", " ", "the", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "object", "s", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "8", "\\u", "mark", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "mark", " ", "names", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "8", "\\u", "mark", "names", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "first", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "second", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "first", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "\"", "first", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "mark", " ", "\"", "third", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "second", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "\"", "second", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "object", "s", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "[_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "4_", "._", "read_", "(_", ")_", ",_", "[_", "6_", ",_", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "8", "\\u", "initial", "mark_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "initial", " ", "mark", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "8", "\\u", "initial", "mark", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "mid_", "=_", "self_", "._", "h5file", "_", "._", "get", "\\u", "current", "\\u", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "init", "mid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "all", " ", "the", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "object", "s", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "9", "\\u", "mark", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "mark", " ", "names", " ", "(", "wrong", " ", "direction", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "9", "\\u", "mark", "names", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "first", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "second", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "first", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", "\"", "first", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "undo", " ", "up", " ", "to", " ", "mark", " ", "\"", "third", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tables_", "._", "Und", "o", "Red", "o", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "undo_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "third", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "redo", " ", "up", " ", "to", " ", "mark", " ", "\"", "second", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tables_", "._", "Und", "o", "Red", "o", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", "\"", "second", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", " ", "checks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "10", "\\u", "goto_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "mark", " ", "names", " ", "(", "got", "o", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test", "10", "\\u", "got", "o", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "first", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "second", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "first", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "\"", "first", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "mark", " ", "\"", "third", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "second", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "\"", "second", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "object", "s", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "[_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "4_", "._", "read_", "(_", ")_", ",_", "[_", "6_", ",_", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "10", "\\u", "got", "oint_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "mark", " ", "sequential", " ", "ids", " ", "(", "got", "o", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test", "10", "\\u", "got", "oint", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "first", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "4_", ",_", "5_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "second", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "5_", ",_", "6_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "mark_", "(_", "\"", "third", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "4", "'_", ",_", "[_", "6_", ",_", "7_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "first", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "beginn", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "mark", " ", "\"", "third", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "go", " ", "to", " ", "mark", " ", "\"", "second", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "goto_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "object", "s", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "[_", "5_", ",_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "4_", "._", "read_", "(_", ")_", ",_", "[_", "6_", ",_", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "1", "2", "\\u", "keep", "Mark_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "ing", " ", "the", " ", "mark", " ", "is", " ", "kep", "t", " ", "after", " ", "an", " ", "UND", "O", " ", "operati", "on", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test", "1", "2", "\\u", "keep", "Mark", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "1", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mid_", "=_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mid_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "have", " ", "moved", " ", "to", " ", "the", " ", "initial", " ", "mark", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "get", "\\u", "current", "\\u", "mark_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "/", "newa", "rray", "1", " ", "shou", "ld", " ", "not", " ", "be", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "1", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "13", "\\u", "sever", "al", "Enable", "Disable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "tha", "t", " ", "success", "ive", " ", "enable", "/", "disable", " ", "Und", "o", " ", "works", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test", "13", "\\u", "sever", "al", "Enable", "Disa", "ble", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "1", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "have", " ", "moved", " ", "to", " ", "'", "mid", "'", " ", "mark", ",", " ", "not", " ", "the", " ", "initial", " ", "mark", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "get", "\\u", "current", "\\u", "mark_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "/", "newa", "rray", "1", " ", "shou", "ld", " ", "still", " ", "be", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "1", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clos", "e", " ", "this", " ", "do", "/", "undo", " ", "session_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "disable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "something_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "2", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "again", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "3", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mid_", "=_", "self_", "._", "h5file", "_", "._", "mark_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "4", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "have", " ", "moved", " ", "to", " ", "'", "mid", "'", " ", "mark", ",", " ", "not", " ", "the", " ", "initial", " ", "mark", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "get", "\\u", "current", "\\u", "mark_", "(_", ")_", ",_", "mid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "/", "newa", "rray", "2", " ", "and", " ", "/", "newa", "rray", "3", " ", "shou", "ld", " ", "still", " ", "be", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "1", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "2", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clos", "e", " ", "this", " ", "do", "/", "undo", " ", "session_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "disable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "again", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "1", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "newa", "rray", "4", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "/", "newa", "rray", "2", " ", "and", " ", "/", "newa", "rray", "3", " ", "shou", "ld", " ", "still", " ", "be", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "1", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "2", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "4", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "do", "\\u", "reo", "pen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "1", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "2", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "newa", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clos", "e", " ", "this", " ", "do", "/", "undo", " ", "session_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "disable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Array", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "one", " ", "action", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0.", "..\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "1_", ",_", "2_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Array", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "two", " ", "action", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "1_", ",_", "2_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "2_", ",_", "3_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Array", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "three", " ", "action", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "1_", ",_", "2_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "2", "'_", ",_", "[_", "2_", ",_", "3_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "3", "'_", ",_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Array", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "three", " ", "action", "s", " ", "in", " ", "different", " ", "depth", " ", "level", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "other", "array", "1", "'_", ",_", "[_", "1_", ",_", "2_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/", "agr", "oup", "'_", ",_", "'", "other", "array", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "2_", ",_", "3_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", ",_", "'", "other", "array", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", ",_", "4_", "]_", ",_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "other", "array", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "other", "array", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "array", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "other", "array", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "other", "array", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "title_", ",_", "\"", "Ano", "ther", " ", "array", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "other", "array", "2_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "array", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "other", "array", "3_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "array", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "array", "1_", "._", "read_", "(_", ")_", ",_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "other", "array", "2_", "._", "read_", "(_", ")_", ",_", "[_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "other", "array", "3_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Group", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "one", " ", "action", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0.", "..\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "other", "group", "1", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", "1", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", "1", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group1_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Group", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "two", " ", "action", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "other", "group", "1", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "other", "group", "2", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", "*", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group1_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group2_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Group", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "three", " ", "action", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "other", "group", "1", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "other", "group", "2", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "other", "group", "3", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", "*", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", "*", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group1_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group2_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group", "3_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Group", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "three", " ", "action", "s", " ", "in", " ", "different", " ", "depth", " ", "level", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "other", "group", "1", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "other", "group", "1", "'_", ",_", "'", "other", "group", "2", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "other", "group", "1", "/", "other", "group", "2", "'_", ",_", "'", "other", "group", "3", "'_", ",_", "\"", "Ano", "ther", " ", "group", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", "*", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "/", "other", "group", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "other", "group", "1", "/", "other", "group", "2", "/", "other", "group", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "group", "*", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "/", "other", "group", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "other", "group", "1", "/", "other", "group", "2", "/", "other", "group", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group1_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group1_", "._", "other", "group2_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "root_", "._", "other", "group1_", "._", "other", "group2_", "._", "other", "group", "3_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ano", "ther", " ", "group", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rename", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "rename", "\\u", "node", " ", "(", "over", " ", "Group", "s", " ", "with", "out", " ", "child", "ren", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0.", "..\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "agr", "oup", "2", "'_", ",_", "'", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "3_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rename", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "rename", "\\u", "node", " ", "(", "over", " ", "Group", "s", " ", "with", " ", "child", "ren", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ",_", "'", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "3_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "3", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "3", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "3", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rename", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1b", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "rename", "\\u", "node", " ", "(", "over", " ", "Group", "s", " ", "with", " ", "child", "ren", " ", "2", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1b", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ",_", "'", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "agr", "oup", "3", "'_", ",_", "'", "agr", "oup", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "4_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "4", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "4", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "4", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rename", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "rename", "\\u", "node", " ", "(", "over", " ", "Leav", "es", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ",_", "'", "ana", "rray", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "ana", "rray_", "._", "title_", ",_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "ana", "rray", "2_", "._", "title_", ",_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rename", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "rename", "\\u", "node", " ", "(", "over", " ", "Table", "s", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "table", "'_", ",_", "'", "table", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", "2", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", "2", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "table2_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Move", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "move", "\\u", "node", " ", "(", "over", " ", "Lea", "f", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0.", "..\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "move", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ",_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "ana", "rray_", "._", "title_", ",_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "ana", "rray_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Move", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "move", "\\u", "node", " ", "(", "over", " ", "Group", "s", " ", "with", " ", "child", "ren", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "move", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ",_", "'/", "agr", "oup", "2", "'_", ",_", "'", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "agr", "oup", "3_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "3", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "3", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "3", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Move", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1b", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "move", "\\u", "node", " ", "(", "over", " ", "Group", "s", " ", "with", " ", "child", "ren", " ", "2", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1b", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "move", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ",_", "'/'_", ",_", "'", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "move", "\\u", "node_", "(_", "'/", "agr", "oup", "3", "'_", ",_", "'/", "agr", "oup", "2", "'_", ",_", "'", "agr", "oup", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "4", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "4", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "agr", "oup", "4_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "4", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "4", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "agr", "oup", "4", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Move", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "move", "\\u", "node", " ", "(", "over", " ", "Leav", "es", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "move", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ",_", "'/", "agr", "oup", "2", "'_", ",_", "'", "ana", "rray", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "ana", "rray", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "ana", "rray_", "._", "title_", ",_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "other", "array", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "ana", "rray", "2_", "._", "title_", ",_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Move", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "move", "\\u", "node", " ", "(", "over", " ", "Table", "s", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "move", "\\u", "node_", "(_", "'/", "table", "'_", ",_", "'/", "agr", "oup", "2", "'_", ",_", "'", "table", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", "2", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "table", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", "2", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "/", "table", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "table2_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "table2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remove", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "remove", "\\u", "node", " ", "(", "over", " ", "Lea", "f", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0.", "..\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "an", " ", "exist", "ing", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "it", " ", "doe", "s", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "ana", "rray_", "._", "title_", ",_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "array", " ", "has", " ", "gone", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remove", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0b", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "remove", "\\u", "node", " ", "(", "over", " ", "sever", "al", " ", "Leav", "es", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0b", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "a", " ", "couple", " ", "of", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "/", "ana", "rray", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "arrays", " ", "has", " ", "come", " ", "int", "o", " ", "life_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "ana", "rray_", "._", "title_", ",_", "\"", "Array", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "ana", "rray", "2_", "._", "title_", ",_", "\"", "Array", " ", "title", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "arrays", " ", "has", " ", "disapp", "ear", "ed", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "ana", "rray", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remove", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0c", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "remove", "\\u", "node", " ", "(", "over", " ", "Table", "s", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0c", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "table", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", "2", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", "2", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remove", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "remove", "\\u", "node", " ", "(", "over", " ", "Group", "s", " ", "with", " ", "child", "ren", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "a", " ", "group", " ", "recurs", "ively", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ",_", "recursive_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "parent", " ", "and", " ", "child", "ren", " ", "has", " ", "come", " ", "int", "o", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "parent", " ", "and", " ", "child", "ren", " ", "are", " ", "not", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remove", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1b", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "remove", "\\u", "node", " ", "(", "over", " ", "Group", "s", " ", "with", " ", "child", "ren", " ", "2", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1b", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "a", " ", "couple", " ", "of", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ",_", "recursive_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", "y", " ", "doe", "s", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "group", "s", " ", "doe", "s", " ", "not", " ", "exist", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "child", "ren", " ", "are", " ", "not", " ", "reachable", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "1", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "ana", "rray", "2", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Copy", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0", "\\u", "copy", "Leaf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "copy", "\\u", "node", " ", "(", "over", " ", "Leav", "es", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0", "\\u", "copy", "Lea", "f", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "ana", "rray", " ", "=>", " ", "/", "agr", "oup", "/", "agr", "oup", "3", "/_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ",_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "exist", "s", " ", "again", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "ana", "rray_", "is_", "new", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Copy", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0b", "\\u", "copy", "Table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "ing", " ", "copy", "\\u", "node", " ", "(", "over", " ", "Table", "s", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0b", "\\u", "copy", "Table", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "the", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "table", " ", "=>", " ", "/", "agr", "oup", "/", "agr", "oup", "3", "/_", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "filterw", "arnings", "_", "(_", "\"", "ignore", "\"_", ",_", "category_", "=_", "User", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "table", "'_", ",_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", ",_", "prop", "indexes_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "filterw", "arnings", "_", "(_", "\"", "default", "\"_", ",_", "category_", "=_", "User", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "undo", " ", "the", " ", "past", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "table", "\"_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "table", " ", "has", " ", "come", " ", "back", " ", "to", " ", "life", " ", "in", " ", "a", " ", "sane", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"/", "agr", "oup", "/", "agr", "oup", "3", "/", "table", "\"_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "3_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "title_", ",_", "\"", "Indexe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var1_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var2_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "table_", "._", "cols_", "._", "var", "3_", "._", "index_", "._", "nele", "ments_", ",_", "min", "Row", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "table_", "._", "cols_", "._", "var", "4_", "._", "index_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Copy", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "copy", "Group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", "ing", " ", "a", " ", "group", " ", "(", "recurs", "ively", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "\\u", "copy", "Group", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "agr", "oup", " ", "=>", " ", "/", "aco", "py_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "agr", "oup", "'_", ",_", "newname_", "=_", "'", "aco", "py", "'_", ",_", "recursive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "/", "ana", "rray", "1", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "/", "ana", "rray", "2", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "/", "agr", "oup", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "exist", "s", " ", "again", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "/", "ana", "rray", "1", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "/", "ana", "rray", "2", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "aco", "py", "/", "agr", "oup", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "aco", "py_", "is_", "new", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Copy", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "copy", "Lea", "f", "Over", "write_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", "ing", " ", "a", " ", "leaf", ",", " ", "overwrit", "ing", " ", "destinat", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "\\u", "copy", "Lea", "f", "Over", "write", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "ana", "rray", " ", "=>", " ", "/", "agr", "oup", "/", "agr", "oup_", "\\u\\u\\uNL\\u\\u\\u_", "old", "Node_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "ana", "rray", "'_", ",_", "newname_", "=_", "'", "agr", "oup", "'_", ",_", "overwrite_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "overwrit", "ten", " ", "node", " ", "exist", "s", " ", "again", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "is_", "old", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "exist", "s", " ", "again", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "overwrit", "ten", " ", "node", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "is_", "new", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Copy", "Node", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3", "\\u", "copy", "Children_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", "ing", " ", "the", " ", "child", "ren", " ", "of", " ", "a", " ", "group", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "\\u", "copy", "Chil", "dre", "n", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "agr", "oup", "/*", " ", "=>", " ", "/", "agr", "oup", "/_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "children_", "(_", "'/", "agr", "oup", "'_", ",_", "'/", "agr", "oup", "2", "'_", ",_", "recursive_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "nodes", " ", "do", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "2", "/", "ana", "rray", "1", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "2", "/", "ana", "rray", "2", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "2", "/", "agr", "oup", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "nodes", " ", "exist", " ", "again", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "2", "/", "ana", "rray", "1", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "2", "/", "ana", "rray", "2", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "2", "/", "agr", "oup", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comple", "x", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mix", " ", "of", " ", "create", "\\u", "array", ",", " ", "create", "\\u", "group", ",", " ", "rename", "Non", "e", ",", " ", "move", "\\u", "node", ",", "\\", "10", ";", " ", " ", " ", " ", "remove", "\\u", "node", ",", " ", "copy", "\\u", "node", " ", "and", " ", "copy", "\\u", "child", "ren", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0.", "..\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "ana", "rray", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", "]_", ",_", "\"", "Array", " ", "title", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "3", "'_", ",_", "\"", "Group", " ", "title", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "ana", "rray", " ", "=>", " ", "/", "agr", "oup", "/", "agr", "oup", "3", "/_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "'/", "ana", "rray", "3", "'_", ",_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "children_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "agr", "oup", "'_", ",_", "'/", "agr", "oup", "3", "'_", ",_", "recursive_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rename", " ", "ana", "rray_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "rename", "\\u", "node_", "(_", "'/", "ana", "rray", "'_", ",_", "'", "ana", "rray", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Move", " ", "ana", "rray_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "node_", "=_", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "'/", "ana", "rray", "3", "'_", ",_", "'/", "agr", "oup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "ana", "rray", "4_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "ana", "rray", "4", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "copie", "d", " ", "node", " ", "exist", "s", " ", "again", " ", "in", " ", "the", " ", "object", " ", "tree", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "ana", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "/", "ana", "rray", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "ana", "rray", "3_", "is_", "new", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "ana", "rray", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comple", "x", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "with", " ", "multiple", " ", "generations", " ", "(", "Group", " ", "case", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "/", "agr", "oup_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group", " ", "in", " ", "the", " ", "same", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "2", "'_", ",_", "\"", "Group", " ", "title", " ", "2", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "2", "'_", ",_", "\"", "Group", " ", "title", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "2", "'_", ",_", "\"", "Group", " ", "title", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "child", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", ",_", "'", "agr", "oup", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", " ", "title", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "/", "agr", "oup", " ", "is", " ", "in", " ", "the", " ", "state", " ", "bef", "ore", " ", "ena", "blin", "g", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "2", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "2_", "._", "agr", "oup", "5_", "._", "\\u", "v", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", " ", "title", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comple", "x", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "with", " ", "multiple", " ", "generations", " ", "(", "Group", " ", "case", ",", " ", "recurs", "ive", " ", "remove", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "/", "agr", "oup_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ",_", "recursive_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group", " ", "in", " ", "the", " ", "same", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "'_", ",_", "\"", "Group", " ", "title", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "'_", ",_", "\"", "Group", " ", "title", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "'_", ",_", "\"", "Group", " ", "title", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "child", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", ",_", "'", "agr", "oup", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", " ", "title", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "/", "agr", "oup", " ", "is", " ", "in", " ", "the", " ", "state", " ", "bef", "ore", " ", "ena", "blin", "g", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "ana", "rray", "1", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "ana", "rray", "2", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "5", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "5", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup_", "._", "agr", "oup", "5_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comple", "x", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3b", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "with", " ", "multiple", " ", "generations", " ", "(", "Group", " ", "case", ",", " ", "recurs", "ive", " ", "remove", ",", "\\", "10", ";", " ", " ", " ", " ", "case", " ", "2", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3b", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "undo", "/", "redo", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "group", " ", "with", " ", "a", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "3", "'_", ",_", "\"", "Group", " ", "title", " ", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "3_", ",_", "'", "agr", "oup", "4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", " ", "title", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "/", "agr", "oup", "3_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "agr", "oup", "3", "'_", ",_", "recursive_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "group", " ", "in", " ", "the", " ", "same", " ", "place_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "agr", "oup", "3", "'_", ",_", "\"", "Group", " ", "title", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Und", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "/", "agr", "oup", " ", "is", " ", "in", " ", "the", " ", "state", " ", "bef", "ore", " ", "ena", "blin", "g", " ", "do", "/", "undo_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "o", " ", "the", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "agr", "oup", "3_", "._", "\\u", "v", "\\u", "title_", ",_", "\"", "Group", " ", "title", " ", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "3", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "agr", "oup", "/", "agr", "oup", "4", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0", "\\u", "set", "Attr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sett", "ing", " ", "a", " ", "nonexist", "ent", " ", "attribute", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "0", "\\u", "set", "Attr", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "array_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "array_", "._", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "attrs_", ",_", "'", "attr", "\\u", "0", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "0", "'_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "attrs_", "._", "attr", "\\u", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "0", "'_", "not_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "0", "'_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "attrs_", "._", "attr", "\\u", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "set", "Attr", "Exist", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sett", "ing", " ", "an", " ", "exist", "ing", " ", "attribute", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "1", "\\u", "set", "Attr", "Exist", "ing", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "array_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "array_", "._", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "attrs_", ",_", "'", "attr", "\\u", "1", "'_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "attrs_", "._", "attr", "\\u", "1_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "attrs_", "._", "attr", "\\u", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "attrs_", "._", "attr", "\\u", "1_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "del", "Attr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remo", "ving", " ", "an", " ", "attribute", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "2", "\\u", "del", "Attr", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "array_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "array_", "._", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delattr", "_", "(_", "attrs_", ",_", "'", "attr", "\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "not_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "attrs_", "._", "attr", "\\u", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "not_", "in_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3", "\\u", "copy", "Node", "Attrs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", "ing", " ", "an", " ", "attribute", " ", "set", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "3", "\\u", "copy", "Node", "Attr", "s", "...\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rat", "trs_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "\\u", "v", "\\u", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rat", "trs_", "._", "attr", "\\u", "0_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rat", "trs_", "._", "attr", "\\u", "1_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "array_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "array_", "._", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "._", "\\u", "f", "\\u", "copy_", "(_", "self_", "._", "h5file", "_", "._", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "2_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "3_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "1_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "2", "'_", "not_", "in_", "rat", "trs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "3", "'_", "not_", "in_", "rat", "trs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "2_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "rat", "trs_", "._", "attr", "\\u", "3_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "4", "\\u", "replace", "Node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Repl", "acing", " ", "a", " ", "node", " ", "with", " ", "a", " ", "rew", "rit", "ten", " ", "attribute", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "common_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ",_", "'-", "='_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Run", "ning", " ", "%", "s", ".", "test0", "4", "\\u", "replace", "Node", "...\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "array_", "=_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "array_", "._", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "._", "attr", "\\u", "1_", "=_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "remove", "\\u", "node_", "(_", "'/", "array", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arr_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "array", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arr_", "._", "attrs_", "._", "attr", "\\u", "1_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "in_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "._", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "._", "attrs_", "._", "attr", "\\u", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "redo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "attr", "\\u", "1", "'_", "in_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "._", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "h5file", "_", "._", "root_", "._", "array_", "._", "attrs_", "._", "attr", "\\u", "1_", ",_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Not", "Log", "ged", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0", "\\u", "hierarchy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", "ing", " ", "hier", "arch", "y", " ", "operati", "ons", " ", "on", " ", "a", " ", "not", " ", "logged", " ", "node", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "tg", "roup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "enable", "\\u", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Node", " ", "creati", "on", " ", "is", " ", "not", " ", "undo", "ne", "._", "\\u\\u\\uNL\\u\\u\\u_", "arr_", "=_", "self_", "._", "Not", "Log", "ged", "Array_", "(_", "self_", "._", "h5file", "_", "._", "root_", ",_", "'", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1_", "]_", ",_", "self_", "._", "\\u", "get", "Meth", "od", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "test", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Node", " ", "movement", " ", "is", " ", "not", " ", "undo", "ne", "._", "\\u\\u\\uNL\\u\\u\\u_", "arr_", "._", "move_", "(_", "'/", "tg", "roup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "tg", "roup", "/", "test", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Node", " ", "removal", " ", "is", " ", "not", " ", "undo", "ne", "._", "\\u\\u\\uNL\\u\\u\\u_", "arr_", "._", "remove_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "undo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "tg", "roup", "/", "test", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Parent", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "0", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "creati", "ng", " ", "a", " ", "node", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pre_", "(_", ")_", ":_", "\\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_", "def_", "doit", "_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "newpath_", ",_", "'", "array", "'_", ",_", "[_", "1_", "]_", ",_", "create", "parents_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "'_", ")_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "'_", ")_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "base", "test_", "(_", "doit", "_", ",_", "pre_", ",_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Parent", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "1", "\\u", "move_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "movin", "g", " ", "a", " ", "node", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pre_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "array", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "doit", "_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "move", "\\u", "node_", "(_", "'/", "array", "'_", ",_", "newpath_", ",_", "create", "parents_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "array", "'_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "'_", ")_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "'/", "array", "'_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "'_", ")_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "base", "test_", "(_", "doit", "_", ",_", "pre_", ",_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Parent", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "2", "\\u", "copy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "copy", "ing", " ", "a", " ", "node", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pre_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "'/'_", ",_", "'", "array", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "doit", "_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "copy", "\\u", "node_", "(_", "'/", "array", "'_", ",_", "newpath_", ",_", "create", "parents_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "'_", ")_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "'_", ")_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "base", "test_", "(_", "doit", "_", ",_", "pre_", ",_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Parent", "s", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test0", "3", "\\u", "copy", "Children_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "copy", "ing", " ", "the", " ", "child", "ren", " ", "of", " ", "a", " ", "group", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pre_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "group_", "(_", "'/'_", ",_", "'", "group", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "g_", ",_", "'", "array", "1", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "g_", ",_", "'", "array", "2", "'_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "doit", "_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "h5file", "_", "._", "copy", "\\u", "children_", "(_", "'/", "group", "'_", ",_", "newpath_", ",_", "create", "parents_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "1", "'_", ")_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "2", "'_", ")_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "newpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "1", "'_", ")_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "join", "\\u", "path_", "(_", "newpath_", ",_", "'", "array", "2", "'_", ")_", "not_", "in_", "self_", "._", "h5file", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "base", "test_", "(_", "doit", "_", ",_", "pre_", ",_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
SheffieldML/GPy/GPy/plotting/__init__.py
[ { "content": "def change_plotting_library(lib):\n try:\n #===========================================================================\n # Load in your plotting library here and\n # save it under the name plotting_library!\n # This is hooking the library in\n # for the usage in GPy:\n if lib not in supported_libraries:\n raise ValueError(\"Warning: Plotting library {} not recognized, currently supported libraries are: \\n {}\".format(lib, \", \".join(supported_libraries)))\n if lib == 'matplotlib':\n import matplotlib\n from .matplot_dep.plot_definitions import MatplotlibPlots\n from .matplot_dep import visualize, mapping_plots, priors_plots, ssgplvm, svig_plots, variational_plots, img_plots\n current_lib[0] = MatplotlibPlots()\n if lib == 'plotly':\n import plotly\n from .plotly_dep.plot_definitions import PlotlyPlots\n current_lib[0] = PlotlyPlots()\n if lib == 'none':\n current_lib[0] = None\n inject_plotting()\n #===========================================================================\n except (ImportError, NameError):\n config.set('plotting', 'library', 'none')\n raise\n import warnings\n warnings.warn(ImportWarning(\"You spevified {} in your configuration, but is not available. Install newest version of {} for plotting\".format(lib, lib)))", "metadata": "root.change_plotting_library", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "import warnings", "start_line": 32, "start_column": 8, "end_line": 32, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "change", "\\u", "plott", "ing", "\\u", "library_", "(_", "lib_", ")_", ":_", "\\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_", "#", " ", "Load", " ", "in", " ", "your", " ", "plott", "ing", " ", "librar", "y", " ", "here", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "it", " ", "under", " ", "the", " ", "name", " ", "plott", "ing", "\\u", "librar", "y", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "hook", "ing", " ", "the", " ", "librar", "y", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "usage", " ", "in", " ", "GP", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lib_", "not_", "in_", "support", "ed", "\\u", "libraries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Warn", "ing", ":", " ", "Plott", "ing", " ", "librar", "y", " ", "{}", " ", "not", " ", "recognize", "d", ",", " ", "currentl", "y", " ", "support", "ed", " ", "librar", "ies", " ", "are", ":", " ", "\\\\", "n", " ", "{}\"_", "._", "format_", "(_", "lib_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "support", "ed", "\\u", "libraries_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lib_", "==_", "'", "mat", "plotlib", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "mat", "plot", "\\u", "dep_", "._", "plot", "\\u", "definitions_", "import_", "Mat", "plotlib", "Plot", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "mat", "plot", "\\u", "dep_", "import_", "visualize", "_", ",_", "mapping", "\\u", "plots_", ",_", "prior", "s", "\\u", "plots_", ",_", "ss", "gpl", "vm_", ",_", "sv", "ig", "\\u", "plots_", ",_", "variatio", "nal", "\\u", "plots_", ",_", "img", "\\u", "plots_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "lib_", "[_", "0_", "]_", "=_", "Mat", "plotlib", "Plot", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lib_", "==_", "'", "plotly", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "plotly", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "plotly", "\\u", "dep_", "._", "plot", "\\u", "definitions_", "import_", "Plot", "ly", "Plot", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "lib_", "[_", "0_", "]_", "=_", "Plot", "ly", "Plot", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lib_", "==_", "'", "none", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "lib_", "[_", "0_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inject", "\\u", "plotting_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=====", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Import", "Error_", ",_", "Name", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "set_", "(_", "'", "plott", "ing", "'_", ",_", "'", "librar", "y", "'_", ",_", "'", "none", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "Import", "Warning_", "(_", "\"", "You", " ", "spe", "vi", "fied", " ", "{}", " ", "in", " ", "your", " ", "configura", "tion", ",", " ", "but", " ", "is", " ", "not", " ", "avail", "able", ".", " ", "Install", " ", "newest", " ", "version", " ", "of", " ", "{}", " ", "for", " ", "plott", "ing", "\"_", "._", "format_", "(_", "lib_", ",_", "lib_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
VisTrails/VisTrails/contrib/titan/__init__.py
[ { "content": "def package_dependencies():\n import core.packagemanager\n manager = core.packagemanager.get_package_manager()\n\n ret = []\n #if manager.has_package('edu.utah.sci.vistrails.vtk'):\n ret.append('edu.utah.sci.vistrails.vtk')\n #if manager.has_package('edu.utah.sci.vistrails.spreadsheet'):\n ret.append('edu.utah.sci.vistrails.spreadsheet')\n return ret", "metadata": "root.package_dependencies", "header": "['module', '___EOS___']", "index": 40 } ]
[ { "span": "manager ", "start_line": 42, "start_column": 4, "end_line": 42, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "package", "\\u", "dependencies_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "core_", "._", "package", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "core_", "._", "package", "manager_", "._", "get", "\\u", "package", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "manage", "r", ".", "has", "\\u", "package", "('", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "vtk", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "._", "append_", "(_", "'", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "vtk", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "manage", "r", ".", "has", "\\u", "package", "('", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "spreadsheet", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "._", "append_", "(_", "'", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "spreadsheet", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
VisTrails/VisTrails/contrib/cdat/cdat_cell.py
[ { "content": "from PyQt4 import QtCore, QtGui\nfrom core.modules.vistrails_module import Module, ModuleError, NotCacheable\nfrom core.modules.basic_modules import Constant\nfrom packages.spreadsheet.spreadsheet_controller import spreadsheetController\nfrom packages.spreadsheet.spreadsheet_cell import QCellWidget, QCellToolBar\nfrom packages.spreadsheet.basic_widgets import SpreadsheetCell, CellLocation\nfrom packages.spreadsheet.spreadsheet_event import DisplayCellEvent\n#from cdatwrap.coreappwrap import VCSQtManager\nimport vcs\nimport genutil\nimport cdutil\nimport time\nimport api\nimport re\nimport MV2\n\n\"\"\" This file contains all of the classes related to the Vistrails Modules (the\nboxes). Eventually Variable and GraphicsMethod should be replaced by generating\nthe proper graphics method, cdms2, MV2, etc... modules \"\"\"\n\n# Index into the VCSQtManager window array so we can communicate with the\n# C++ Qt windows which the plots show up in. If this number is no longer\n# consistent with the number of C++ Qt windows due to adding or removing\n# vcs.init() calls, then when you plot, it will plot into a\n# separate window instead of in the cell and may crash.\nwindowIndex = 1 \n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Variable(Module):\n \"\"\" Get the updated transient variable \"\"\"\n \n\n\n\n", "metadata": "root.Variable", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def compute(self):\n # *** IMPORTANT ***\n # Once someone figures out how to pass the tvariable object, to this\n # module none of the computation in this method is necessary \n \n # Check ports\n if not self.has_input('cdmsfile'):\n raise ModuleError(self, \"'cdmsfile' is mandatory.\")\n if not self.has_input('id'):\n raise ModuleError(self, \"'id' is mandatory.\")\n\n # Get input from ports\n cdmsfile = self.get_input('cdmsfile')\n id = self.get_input('id')\n axes = self.force_get_input('axes') # None if no input\n axesOperations = self.force_get_input('axesOperations') # None if no input\n\n # Get the variable\n varType = self.getVarType(id, cdmsfile)\n if (varType == 'variable'):\n var = cdmsfile.__call__(id)\n elif (varType == 'axis'):\n varID = self.getAxisID(id) \n axis = getattr(cdmsfile, 'axes')[varID]\n var = MV2.array(axis)\n var.setAxis(0, axis)\n elif (varType == 'weighted-axis'):\n varID, axisID = self.getVarAndAxisID(id)\n var = cdmsfile.__call__(varID) \n var = genutil.getAxisWeightByName(var, axisID)\n var.id = varID +'_' + axisID + '_weight'\n else:\n var = None\n\n # Eval the variable with the axes\n if axes is not None and var is not None:\n try:\n kwargs = eval(axes)\n var = var(**kwargs)\n except:\n raise ModuleError(self, \"Invalid 'axes' specification\", axes)\n\n # Apply axes ops to the variable\n if axesOperations is not None:\n var = self.applyAxesOperations(var, axesOperations)\n\n self.set_output('variable', var)", "metadata": "root.Variable.compute", "header": "['class', 'Variable', '(', 'Module', ')', ':', '___EOS___']", "index": 30 }, { "content": " def applyAxesOperations(self, var, axesOperations):\n \"\"\" Apply axes operations to update the slab \"\"\"\n try:\n axesOperations = eval(axesOperations)\n except:\n raise TypeError(\"Invalid string 'axesOperations'\")\n\n for axis in list(axesOperations):\n if axesOperations[axis] == 'sum':\n var = cdutil.averager(var, axis=\"(%s)\" % axis, weight='equal',\n action='sum')\n elif axesOperations[axis] == 'avg':\n var = cdutil.averager(var, axis=\"(%s)\" % axis, weight='equal')\n elif axesOperations[axis] == 'wgt':\n var = cdutil.averager(var, axis=\"(%s)\" % axis)\n elif axesOperations[axis] == 'gtm':\n var = genutil.statistics.geometricmean(var, axis=\"(%s)\" % axis)\n elif axesOperations[axis] == 'std':\n var = genutil.statistics.std(var, axis=\"(%s)\" % axis) \n \n return var", "metadata": "root.Variable.applyAxesOperations", "header": "['class', 'Variable', '(', 'Module', ')', ':', '___EOS___']", "index": 78 }, { "content": " def getVarType(self, varID, file):\n if varID in list(getattr(file, 'variables')):\n return 'variable'\n elif varID in list(getattr(file, 'axes')):\n return 'axis'\n elif re.compile('(.+)(_)(.+)(_)axis').match(varID):\n return 'axis'\n elif re.compile('(.+)(_)(.+)(_)weight').match(varID):\n return 'weighted-axis' ", "metadata": "root.Variable.getVarType", "header": "['class', 'Variable', '(', 'Module', ')', ':', '___EOS___']", "index": 100 }, { "content": " def getVarAndAxisID(self, varID):\n \"\"\" Get the varID and axisID from a string with format:\n varID_axisID_weight \"\"\"\n \n match = re.compile('(.+)(_)(.+)(_)(weight)').match(varID)\n if match:\n return (match.group(1), match.group(3))\n\n return None", "metadata": "root.Variable.getVarAndAxisID", "header": "['class', 'Variable', '(', 'Module', ')', ':', '___EOS___']", "index": 110 }, { "content": " def getAxisID(self, varID):\n \"\"\" Get the axisID from a string with format: varID_axisID_axis \"\"\"\n\n match = re.compile('(.+)(_)(.+)(_)(axis)').match(varID)\n if match:\n return match.group(3)\n\n return varID", "metadata": "root.Variable.getAxisID", "header": "['class', 'Variable', '(', 'Module', ')', ':', '___EOS___']", "index": 120 }, { "content": "class Quickplot(Variable):\n \"\"\" Quickplot is identical to Variable except we will only have a single\n quickplot module in a pipeline. \"\"\"\n", "metadata": "root.Quickplot", "header": "['module', '___EOS___']", "index": 129 }, { "content": " def foo(self):\n return", "metadata": "root.Quickplot.foo", "header": "['class', 'Quickplot', '(', 'Variable', ')', ':', '___EOS___']", "index": 133 }, { "content": "class GraphicsMethod(Module, NotCacheable):\n \"\"\" GraphicsMethod initializes the vcs canvas and gets the graphics method\n and modify it's attributes \"\"\"\n ", "metadata": "root.GraphicsMethod", "header": "['module', '___EOS___']", "index": 136 }, { "content": " def compute(self):\n # Check required input ports\n if not self.has_input('gmName'):\n return\n if not self.has_input('plotType'):\n return\n if not self.has_input('slab1'):\n return\n \n # Get required input\n gmName = self.get_input('gmName')\n plotType = self.get_input('plotType')\n\n # GraphicsMethod doesn't need slab1/slab2 as input. It can be passed\n # directly to CDATCell but I pass it to graphics method so it looks\n # nicer in the pipeline.\n slab1 = self.get_input('slab1')\n if self.has_input('slab2'):\n self.set_output('slab2', self.get_input('slab2'))\n \n # Initialize the canvas and get the graphics method\n canvas = vcs.init()\n gm = canvas.get_gm(plotType.lower(), gmName)\n\n # Modify the graphics method's attributes\n if self.has_input('color_1'):\n gm.color_1 = self.get_input('color_1')\n if self.has_input('color_2'):\n gm.color_2 = self.get_input('color_2')\n if self.has_input('level_1'):\n gm.level_1 = self.get_input('level_1')\n if self.has_input('level_2'):\n gm.level_2 = self.get_input('level_2')\n # TODO: more gm attributes ...\n\n # Add canvas / slab to output Ports\n self.set_output('slab1', slab1)\n self.set_output('canvas', canvas)", "metadata": "root.GraphicsMethod.compute", "header": "['class', 'GraphicsMethod', '(', 'Module', ',', 'NotCacheable', ')', ':', '___EOS___']", "index": 140 }, { "content": "class CDATCell(SpreadsheetCell, NotCacheable):\n ", "metadata": "root.CDATCell", "header": "['module', '___EOS___']", "index": 179 }, { "content": " def __init__(self):\n SpreadsheetCell.__init__(self)\n self.cellWidget = None", "metadata": "root.CDATCell.__init__", "header": "['class', 'CDATCell', '(', 'SpreadsheetCell', ',', 'NotCacheable', ')', ':', '___EOS___']", "index": 180 }, { "content": " def compute(self):\n \"\"\" compute() -> None\n Dispatch the vtkRenderer to the actual rendering widget\n \"\"\"\n # Check required input ports\n if self.has_input('canvas'):\n canvas = self.get_input('canvas')\n else:\n self.cellWidget = self.displayAndWait(QCDATWidget, (None,))\n self.set_output('canvas', self.cellWidget.canvas)\n return\n self.set_output('canvas', canvas)\n if not self.has_input('gmName'):\n return\n if not self.has_input('plotType'):\n return\n if not self.has_input('slab1'):\n return\n if not self.has_input('template'):\n return\n\n # Build up the argument list\n args = []\n slab1 = self.get_input('slab1')\n args.append(self.get_input('slab1'))\n if self.has_input('slab2'):\n args.append(self.get_input('slab2'))\n args.append(self.get_input('template'))\n args.append(self.get_input('plotType'))\n args.append(self.get_input('gmName'))\n\n # Build up plot keyword args ...\n kwargs = {}\n if self.has_input('continents'):\n kwargs['continents'] = self.get_input('continents')\n \n # Set the cell row / col\n self.location = CellLocation()\n if self.has_input('row'):\n self.location.row = self.get_input('row')\n if self.has_input('col'):\n self.location.col = self.get_input('col')\n\n # Plot into the cell\n inputPorts = (canvas, args, kwargs)\n self.displayAndWait(QCDATWidget, inputPorts) ", "metadata": "root.CDATCell.compute", "header": "['class', 'CDATCell', '(', 'SpreadsheetCell', ',', 'NotCacheable', ')', ':', '___EOS___']", "index": 184 }, { "content": "class QCDATWidget(QCellWidget):\n \"\"\" QCDATWidget is the spreadsheet cell widget where the plots are displayed.\n The widget interacts with the underlying C++, VCSQtManager through SIP.\n This enables QCDATWidget to get a reference to the Qt MainWindow that the\n plot will be displayed in and send signals (events) to that window widget.\n \"\"\"\n \n\n\n", "metadata": "root.QCDATWidget", "header": "['module', '___EOS___']", "index": 231 }, { "content": " def __init__(self, parent=None):\n QCellWidget.__init__(self, parent)\n self.window = None \n self.canvas = None\n self.windowIndex = self.getWindowIndex() #index to get QT Window from VCSQtManager", "metadata": "root.QCDATWidget.__init__", "header": "['class', 'QCDATWidget', '(', 'QCellWidget', ')', ':', '___EOS___']", "index": 238 }, { "content": " def getWindowIndex(self):\n \"\"\" Return the index into the VCSQtManager's array of Qt Windows which\n plots will be displayed in.\n \"\"\"\n global windowIndex\n\n windowIndex += 1\n maxWindows = 8\n if windowIndex > maxWindows:\n windowIndex = 1\n return windowIndex", "metadata": "root.QCDATWidget.getWindowIndex", "header": "['class', 'QCDATWidget', '(', 'QCellWidget', ')', ':', '___EOS___']", "index": 244 }, { "content": " def updateContents(self, inputPorts):\n \"\"\" Get the vcs canvas, setup the cell's layout, and plot \"\"\" \n spreadsheetWindow = spreadsheetController.findSpreadsheetWindow()\n spreadsheetWindow.setUpdatesEnabled(False)\n\n # Set the canvas\n self.canvas = inputPorts[0]\n if self.canvas is None:\n self.canvas = vcs.init()\n self.canvas.clear()\n\n # Place the mainwindow that the plot will be displayed in, into this\n # cell widget's layout\n self.window = VCSQtManager.window(self.windowIndex)\n layout = QtGui.QVBoxLayout()\n layout.addWidget(self.window)\n self.setLayout(layout) \n\n # Plot\n if len(inputPorts) > 2:\n args = inputPorts[1]\n kwargs = inputPorts[2]\n self.canvas.plot(*args, **kwargs)\n\n spreadsheetWindow.setUpdatesEnabled(True)", "metadata": "root.QCDATWidget.updateContents", "header": "['class', 'QCDATWidget', '(', 'QCellWidget', ')', ':', '___EOS___']", "index": 256 }, { "content": " def deleteLater(self):\n \"\"\" deleteLater() -> None \n Make sure to free render window resource when\n deallocating. Overriding PyQt deleteLater to free up\n resources\n \"\"\"\n self.canvas = None\n QCellWidget.deleteLater(self) ", "metadata": "root.QCDATWidget.deleteLater", "header": "['class', 'QCDATWidget', '(', 'QCellWidget', ')', ':', '___EOS___']", "index": 282 } ]
[ { "span": "from PyQt4 import QtCore, QtGui", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 31 }, { "span": "from core.modules.basic_modules import Constant", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 47 }, { "span": "from packages.spreadsheet.spreadsheet_cell import QCellWidget, QCellToolBar", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 75 }, { "span": "from packages.spreadsheet.spreadsheet_event import DisplayCellEvent", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 67 }, { "span": "import time", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 11 }, { "span": "import api", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "Py", "Qt4_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", ",_", "Not", "Cache", "able_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "basic", "\\u", "modules_", "import_", "Constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "packages_", "._", "spreadsheet", "_", "._", "spreadsheet", "\\u", "controller_", "import_", "spreadsheet", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "packages_", "._", "spreadsheet", "_", "._", "spreadsheet", "\\u", "cell_", "import_", "QC", "ell", "Widget_", ",_", "QC", "ell", "Tool", "Bar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "packages_", "._", "spreadsheet", "_", "._", "basic", "\\u", "widgets_", "import_", "Spread", "sheet", "Cell_", ",_", "Cel", "l", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "packages_", "._", "spreadsheet", "_", "._", "spreadsheet", "\\u", "event_", "import_", "Display", "Cel", "l", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "cda", "tw", "rap", ".", "core", "app", "wrap", " ", "import", " ", "VCS", "Qt", "Manager_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "vcs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "genu", "til_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cd", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "MV", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Thi", "s", " ", "file", " ", "contain", "s", " ", "all", " ", "of", " ", "the", " ", "classe", "s", " ", "relate", "d", " ", "to", " ", "the", " ", "Vis", "trail", "s", " ", "Modul", "es", " ", "(", "the", "\\", "10", ";", "box", "es", ").", " ", " ", "Event", "ual", "ly", " ", "Varia", "ble", " ", "and", " ", "Graphic", "s", "Meth", "od", " ", "shou", "ld", " ", "be", " ", "replaced", " ", "by", " ", "generat", "ing", "\\", "10", ";", "the", " ", "proper", " ", "graphic", "s", " ", "method", ",", " ", "cd", "ms", "2", ",", " ", "MV", "2", ",", " ", "etc", "...", " ", "module", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Index", " ", "int", "o", " ", "the", " ", "VCS", "Qt", "Manager", " ", "window", " ", "array", " ", "so", " ", "we", " ", "can", " ", "communi", "cate", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "C", "++", " ", "Qt", " ", "windows", " ", "whi", "ch", " ", "the", " ", "plots", " ", "show", " ", "up", " ", "in", ".", " ", " ", "If", " ", "this", " ", "number", " ", "is", " ", "no", " ", "long", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consistent", " ", "with", " ", "the", " ", "number", " ", "of", " ", "C", "++", " ", "Qt", " ", "windows", " ", "due", " ", "to", " ", "addin", "g", " ", "or", " ", "remo", "ving", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vcs", ".", "init", "()", " ", "calls", ",", " ", "then", " ", "whe", "n", " ", "you", " ", "plot", ",", " ", "it", " ", "will", " ", "plot", " ", "int", "o", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "separate", " ", "window", " ", "inst", "ead", " ", "of", " ", "in", " ", "the", " ", "cell", " ", "and", " ", "may", " ", "crash", "._", "\\u\\u\\uNL\\u\\u\\u_", "window", "Index_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Variable_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "update", "d", " ", "transient", " ", "variab", "le", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Variable_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "***", " ", "IMPORT", "ANT", " ", "***", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ce", " ", "some", "one", " ", "figure", "s", " ", "out", " ", "how", " ", "to", " ", "pass", " ", "the", " ", "tva", "ria", "ble", " ", "object", ",", " ", "to", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "module", " ", "none", " ", "of", " ", "the", " ", "computation", " ", "in", " ", "this", " ", "method", " ", "is", " ", "necessar", "y", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "cd", "ms", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"'", "cd", "ms", "file", "'", " ", "is", " ", "mandat", "ory", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "id", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"'", "id", "'", " ", "is", " ", "mandat", "ory", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "input", " ", "from", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cd", "ms", "file_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "cd", "ms", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "axes", "'_", ")_", "#", " ", "Non", "e", " ", "if", " ", "no", " ", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes", "Operations_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "axes", "Opera", "tion", "s", "'_", ")_", "#", " ", "Non", "e", " ", "if", " ", "no", " ", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "var", "Type_", "=_", "self_", "._", "get", "Var", "Type_", "(_", "id_", ",_", "cd", "ms", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "var", "Type_", "==_", "'", "variab", "le", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "cd", "ms", "file_", "._", "\\u\\u", "call\\u\\u_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "var", "Type_", "==_", "'", "axis", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "ID_", "=_", "self_", "._", "get", "Axi", "s", "ID_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axis_", "=_", "getattr_", "(_", "cd", "ms", "file_", ",_", "'", "axes", "'_", ")_", "[_", "var", "ID_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "MV", "2_", "._", "array_", "(_", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "._", "set", "Axis_", "(_", "0_", ",_", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "var", "Type_", "==_", "'", "weight", "ed", "-", "axis", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "ID_", ",_", "axis", "ID_", "=_", "self_", "._", "get", "Var", "And", "Axi", "s", "ID_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "cd", "ms", "file_", "._", "\\u\\u", "call\\u\\u_", "(_", "var", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "genu", "til_", "._", "get", "Axi", "s", "Weig", "ht", "By", "Name_", "(_", "var_", ",_", "axis", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "._", "id_", "=_", "var", "ID_", "+_", "'\\u'_", "+_", "axis", "ID_", "+_", "'\\u", "weight", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Eval", " ", "the", " ", "variab", "le", " ", "with", " ", "the", " ", "axes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "axes_", "is_", "not_", "None_", "and_", "var_", "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 ", " _", "kwargs_", "=_", "eval_", "(_", "axes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "var_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Inva", "lid", " ", "'", "axes", "'", " ", "specifica", "tion", "\"_", ",_", "axes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "axes", " ", "ops", " ", "to", " ", "the", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "axes", "Operations_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "self_", "._", "appl", "y", "Axe", "s", "Operations_", "(_", "var_", ",_", "axes", "Operations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "variab", "le", "'_", ",_", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Variable_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "Axe", "s", "Operations_", "(_", "self_", ",_", "var_", ",_", "axes", "Operations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Apply", " ", "axes", " ", "operati", "ons", " ", "to", " ", "update", " ", "the", " ", "slab", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axes", "Operations_", "=_", "eval_", "(_", "axes", "Operations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Inva", "lid", " ", "string", " ", "'", "axes", "Opera", "tion", "s", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "axis_", "in_", "list_", "(_", "axes", "Operations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "axes", "Operations_", "[_", "axis_", "]_", "==_", "'", "sum", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "cd", "util_", "._", "averag", "er_", "(_", "var_", ",_", "axis_", "=_", "\"(", "%", "s", ")\"_", "%_", "axis_", ",_", "weight_", "=_", "'", "equal", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "sum", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "axes", "Operations_", "[_", "axis_", "]_", "==_", "'", "avg", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "cd", "util_", "._", "averag", "er_", "(_", "var_", ",_", "axis_", "=_", "\"(", "%", "s", ")\"_", "%_", "axis_", ",_", "weight_", "=_", "'", "equal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "axes", "Operations_", "[_", "axis_", "]_", "==_", "'", "wgt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "cd", "util_", "._", "averag", "er_", "(_", "var_", ",_", "axis_", "=_", "\"(", "%", "s", ")\"_", "%_", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "axes", "Operations_", "[_", "axis_", "]_", "==_", "'", "gt", "m", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "genu", "til_", "._", "statistics_", "._", "geometric", "mean_", "(_", "var_", ",_", "axis_", "=_", "\"(", "%", "s", ")\"_", "%_", "axis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "axes", "Operations_", "[_", "axis_", "]_", "==_", "'", "std", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "genu", "til_", "._", "statistics_", "._", "std_", "(_", "var_", ",_", "axis_", "=_", "\"(", "%", "s", ")\"_", "%_", "axis_", ")_", "\\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_", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Variable_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Var", "Type_", "(_", "self_", ",_", "var", "ID_", ",_", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "ID_", "in_", "list_", "(_", "getattr_", "(_", "file_", ",_", "'", "variab", "les", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "variab", "le", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "var", "ID_", "in_", "list_", "(_", "getattr_", "(_", "file_", ",_", "'", "axes", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "axis", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "compile_", "(_", "'(", ".+)", "(\\u", ")(", ".+)", "(\\u", ")", "axis", "'_", ")_", "._", "match_", "(_", "var", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "axis", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "compile_", "(_", "'(", ".+)", "(\\u", ")(", ".+)", "(\\u", ")", "weight", "'_", ")_", "._", "match_", "(_", "var", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "weight", "ed", "-", "axis", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Variable_", "(_", "Module_", ")_", ":_", "\\u\\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", "Var", "And", "Axi", "s", "ID_", "(_", "self_", ",_", "var", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "var", "ID", " ", "and", " ", "axis", "ID", " ", "from", " ", "a", " ", "string", " ", "with", " ", "format", ":", "\\", "10", ";", " ", " ", " ", " ", "var", "ID", "\\u", "axis", "ID", "\\u", "weight", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "re_", "._", "compile_", "(_", "'(", ".+)", "(\\u", ")(", ".+)", "(\\u", ")(", "weight", ")'_", ")_", "._", "match_", "(_", "var", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ",_", "match_", "._", "group_", "(_", "3_", ")_", ")_", "\\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_", "Variable_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Axi", "s", "ID_", "(_", "self_", ",_", "var", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "axis", "ID", " ", "from", " ", "a", " ", "string", " ", "with", " ", "format", ":", " ", "var", "ID", "\\u", "axis", "ID", "\\u", "axis", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "re_", "._", "compile_", "(_", "'(", ".+)", "(\\u", ")(", ".+)", "(\\u", ")(", "axis", ")'_", ")_", "._", "match_", "(_", "var", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "match_", "._", "group_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "var", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Qui", "ck", "plot_", "(_", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Qui", "ck", "plot", " ", "is", " ", "identi", "cal", " ", "to", " ", "Varia", "ble", " ", "except", " ", "we", " ", "will", " ", "only", " ", "have", " ", "a", " ", "single", "\\", "10", ";", " ", " ", " ", " ", "quick", "plot", " ", "module", " ", "in", " ", "a", " ", "pipeline", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Qui", "ck", "plot_", "(_", "Variable_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "foo_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Graphic", "s", "Method_", "(_", "Module_", ",_", "Not", "Cache", "able_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Graphic", "s", "Meth", "od", " ", "initialize", "s", " ", "the", " ", "vcs", " ", "canv", "as", " ", "and", " ", "gets", " ", "the", " ", "graphic", "s", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "modif", "y", " ", "it", "'", "s", " ", "attribute", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Graphic", "s", "Method_", "(_", "Module_", ",_", "Not", "Cache", "able_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "require", "d", " ", "input", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "gm", "Name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "plot", "Type", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "require", "d", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gm", "Name_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "gm", "Name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "plot", "Type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Graphic", "s", "Meth", "od", " ", "doe", "sn", "'", "t", " ", "need", " ", "slab", "1", "/", "slab", "2", " ", "as", " ", "input", ".", " ", " ", "It", " ", "can", " ", "be", " ", "passed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "to", " ", "CD", "ATC", "ell", " ", "but", " ", "I", " ", "pass", " ", "it", " ", "to", " ", "graphic", "s", " ", "method", " ", "so", " ", "it", " ", "look", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nice", "r", " ", "in", " ", "the", " ", "pipeline", "._", "\\u\\u\\uNL\\u\\u\\u_", "slab", "1_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "slab", "2", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "output_", "(_", "'", "slab", "2", "'_", ",_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "2", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "the", " ", "canv", "as", " ", "and", " ", "get", " ", "the", " ", "graphic", "s", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "canvas_", "=_", "vcs_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "=_", "canvas_", "._", "get", "\\u", "gm_", "(_", "plot", "Type_", "._", "lower_", "(_", ")_", ",_", "gm", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modif", "y", " ", "the", " ", "graphic", "s", " ", "method", "'", "s", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "color", "\\u", "1", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm_", "._", "color", "\\u", "1_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "color", "\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "color", "\\u", "2", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm_", "._", "color", "\\u", "2_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "color", "\\u", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "level", "\\u", "1", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm_", "._", "level", "\\u", "1_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "level", "\\u", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "level", "\\u", "2", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gm_", "._", "level", "\\u", "2_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "level", "\\u", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "more", " ", "gm", " ", "attribute", "s", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "canv", "as", " ", "/", " ", "slab", " ", "to", " ", "output", " ", "Ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "slab", "1", "'_", ",_", "slab", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "canv", "as", "'_", ",_", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "CD", "ATC", "ell_", "(_", "Spread", "sheet", "Cell_", ",_", "Not", "Cache", "able_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "CD", "ATC", "ell_", "(_", "Spread", "sheet", "Cell_", ",_", "Not", "Cache", "able_", ")_", ":_", "\\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 ", " _", "Spread", "sheet", "Cell_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cell", "Widget_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CD", "ATC", "ell_", "(_", "Spread", "sheet", "Cell_", ",_", "Not", "Cache", "able_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "compute", "()", " ", "->", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Dispa", "tch", " ", "the", " ", "vtk", "Render", "er", " ", "to", " ", "the", " ", "actual", " ", "render", "ing", " ", "widget", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "require", "d", " ", "input", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "canv", "as", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "canvas_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "canv", "as", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cell", "Widget_", "=_", "self_", "._", "display", "And", "Wait_", "(_", "QC", "DAT", "Widget_", ",_", "(_", "None_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "canv", "as", "'_", ",_", "self_", "._", "cell", "Widget_", "._", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "canv", "as", "'_", ",_", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "gm", "Name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "plot", "Type", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "template", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "up", " ", "the", " ", "argu", "ment", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slab", "1_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "slab", "2", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "2", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "template", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "plot", "Type", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "gm", "Name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "up", " ", "plot", " ", "keyw", "ord", " ", "args", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "continent", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "continent", "s", "'_", "]_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "continent", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "cell", " ", "row", " ", "/", " ", "col_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "location_", "=_", "Cel", "l", "Location_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "row", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "location_", "._", "row_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "row", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "col", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "location_", "._", "col_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "col", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plot", " ", "int", "o", " ", "the", " ", "cell_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "Ports_", "=_", "(_", "canvas_", ",_", "args_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "display", "And", "Wait_", "(_", "QC", "DAT", "Widget_", ",_", "input", "Ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "QC", "DAT", "Widget_", "(_", "QC", "ell", "Widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "QC", "DAT", "Wid", "get", " ", "is", " ", "the", " ", "spreadsheet", " ", "cell", " ", "widget", " ", "where", " ", "the", " ", "plots", " ", "are", " ", "displaye", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "widget", " ", "interact", "s", " ", "with", " ", "the", " ", "underl", "ying", " ", "C", "++", ",", " ", "VCS", "Qt", "Manager", " ", "through", " ", "SI", "P", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "enable", "s", " ", "QC", "DAT", "Wid", "get", " ", "to", " ", "get", " ", "a", " ", "reference", " ", "to", " ", "the", " ", "Qt", " ", "Main", "Window", " ", "tha", "t", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "plot", " ", "will", " ", "be", " ", "displaye", "d", " ", "in", " ", "and", " ", "send", " ", "signal", "s", " ", "(", "events", ")", " ", "to", " ", "tha", "t", " ", "window", " ", "widget", ".", "\\", "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_", "QC", "DAT", "Widget_", "(_", "QC", "ell", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "QC", "ell", "Widget_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "canvas_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window", "Index_", "=_", "self_", "._", "get", "Window", "Index_", "(_", ")_", "#", "index", " ", "to", " ", "get", " ", "QT", " ", "Window", " ", "from", " ", "VCS", "Qt", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QC", "DAT", "Widget_", "(_", "QC", "ell", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Window", "Index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "index", " ", "int", "o", " ", "the", " ", "VCS", "Qt", "Manager", "'", "s", " ", "array", " ", "of", " ", "Qt", " ", "Window", "s", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "plots", " ", "will", " ", "be", " ", "displaye", "d", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "window", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "window", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Windows_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "window", "Index_", ">_", "max", "Windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window", "Index_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "window", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QC", "DAT", "Widget_", "(_", "QC", "ell", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Contents_", "(_", "self_", ",_", "input", "Ports_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "the", " ", "vcs", " ", "canv", "as", ",", " ", "setup", " ", "the", " ", "cell", "'", "s", " ", "layout", ",", " ", "and", " ", "plot", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spreadsheet", "Window_", "=_", "spreadsheet", "Controller_", "._", "find", "Spread", "sheet", "Window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spreadsheet", "Window_", "._", "set", "Update", "s", "Enabled_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "canvas_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "canvas_", "=_", "input", "Ports_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "canvas_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "canvas_", "=_", "vcs_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "canvas_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Place", " ", "the", " ", "mainwindow", " ", "tha", "t", " ", "the", " ", "plot", " ", "will", " ", "be", " ", "displaye", "d", " ", "in", ",", " ", "int", "o", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cell", " ", "widget", "'", "s", " ", "layout_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "window_", "=_", "VCS", "Qt", "Manager_", "._", "window_", "(_", "self_", "._", "window", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "Qt", "Gui_", "._", "QV", "Box", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "add", "Widget_", "(_", "self_", "._", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Layout_", "(_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plot_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "input", "Ports_", ")_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "input", "Ports_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "input", "Ports_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "canvas_", "._", "plot_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spreadsheet", "Window_", "._", "set", "Update", "s", "Enabled_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QC", "DAT", "Widget_", "(_", "QC", "ell", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "Later_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "delete", "Late", "r", "()", " ", "->", " ", "Non", "e", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "sure", " ", "to", " ", "free", " ", "render", " ", "window", " ", "resource", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "deal", "locat", "ing", ".", " ", "Over", "rid", "ing", " ", "Py", "Qt", " ", "delete", "Late", "r", " ", "to", " ", "free", " ", "up", "\\", "10", ";", " ", " ", " ", " ", "resource", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "canvas_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "QC", "ell", "Widget_", "._", "delete", "Later_", "(_", "self_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Except block handles 'BaseException'
CountZer0/PipelineConstructionSet/python/common/diagnostic/pydevDebug/coverage.py
[ { "content": "#!/usr/bin/python\n#\n# Perforce Defect Tracking Integration Project\n# <http://www.ravenbrook.com/project/p4dti/>\n#\n# COVERAGE.PY -- COVERAGE TESTING\n#\n# Gareth Rees, Ravenbrook Limited, 2001-12-04\n# Ned Batchelder, 2004-12-12\n# http://nedbatchelder.com/code/modules/coverage.html\n#\n#\n# 1. INTRODUCTION\n#\n# This module provides coverage testing for Python code.\n#\n# The intended readership is all Python developers.\n#\n# This document is not confidential.\n#\n# See [GDR 2001-12-04a] for the command-line interface, programmatic\n# interface and limitations. See [GDR 2001-12-04b] for requirements and\n# design.\n\nr\"\"\"Usage:\n\ncoverage.py -x [-p] MODULE.py [ARG1 ARG2 ...]\n Execute module, passing the given command-line arguments, collecting\n coverage data. With the -p option, write to a temporary file containing\n the machine name and process ID.\n\ncoverage.py -e\n Erase collected coverage data.\n\ncoverage.py -waitfor\n it's the same as -r -m, but...\n goes to a raw_input() and waits for the files that should be executed...\n\ncoverage.py -c\n Collect data from multiple coverage files (as created by -p option above)\n and store it into a single file representing the union of the coverage.\n\ncoverage.py -r [-m] [-o dir1,dir2,...] FILE1 FILE2 ...\n Report on the statement coverage for the given files. With the -m\n option, show line numbers of the statements that weren't executed.\n\ncoverage.py -a [-d dir] [-o dir1,dir2,...] FILE1 FILE2 ...\n Make annotated copies of the given files, marking statements that\n are executed with > and statements that are missed with !. With\n the -d option, make the copies in that directory. Without the -d\n option, make each copy in the same directory as the original.\n\n-o dir,dir2,...\n Omit reporting or annotating files when their filename path starts with\n a directory listed in the omit list.\n e.g. python coverage.py -i -r -o c:\\python23,lib\\enthought\\traits\n\nCoverage data is saved in the file .coverage by default. Set the\nCOVERAGE_FILE environment variable to save it somewhere else.\"\"\"\n\n__version__ = \"2.78.20070930\" # see detailed history at the end of this file.\n\nimport compiler\nimport compiler.visitor\nimport glob\nimport os\nimport re\nimport string\nimport symbol\nimport sys\nimport threading\nimport token\nimport types\nimport email\nfrom socket import gethostname\n\n# Python version compatibility\ntry:\n strclass = basestring # new to 2.3\nexcept:\n strclass = str\n\n# 2. IMPLEMENTATION\n#\n# This uses the \"singleton\" pattern.\n#\n# The word \"morf\" means a module object (from which the source file can\n# be deduced by suitable manipulation of the __file__ attribute) or a\n# filename.\n#\n# When we generate a coverage report we have to canonicalize every\n# filename in the coverage dictionary just in case it refers to the\n# module we are reporting on. It seems a shame to throw away this\n# information so the data in the coverage dictionary is transferred to\n# the 'cexecuted' dictionary under the canonical filenames.\n#\n# The coverage dictionary is called \"c\" and the trace function \"t\". The\n# reason for these short names is that Python looks up variables by name\n# at runtime and so execution time depends on the length of variables!\n# In the bottleneck of this application it's appropriate to abbreviate\n# names to increase speed.\n\n\n\n\n\n\n\n\n# Module functions call methods in the singleton object.\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Command-line interface.\nif __name__ == '__main__':\n# it's the same as -r -m, but...\n# goes to a raw_input() and waits for the files that should be executed...\n\n global cache_location #let's set the cache location now...\n cache_location = sys.argv[1] #first parameter is the cache location.\n sys.argv.remove(cache_location)\n print cache_location\n \n global the_coverage\n # Singleton object.\n the_coverage = coverage()\n\n if len(sys.argv) == 2:\n \n if '-waitfor' == sys.argv[1]:\n sys.argv.remove('-waitfor')\n sys.argv.append('-r')\n sys.argv.append('-m')\n \n #second gets the files to be executed\n s = raw_input()\n s = s.replace('\\r', '')\n s = s.replace('\\n', '')\n files = s.split('|')\n files = [v for v in files if len(v) > 0]\n sys.argv += files\n \n if '-x' in sys.argv:\n # Save coverage data when Python exits. (The atexit module wasn't\n # introduced until Python 2.0, so use sys.exitfunc when it's not\n # available.)\n try:\n import atexit\n atexit.register(the_coverage.save)\n except ImportError:\n sys.exitfunc = the_coverage.save\n \n the_coverage.command_line(sys.argv[1:])\n\n\n# A. REFERENCES\n#\n# [GDR 2001-12-04a] \"Statement coverage for Python\"; Gareth Rees;\n# Ravenbrook Limited; 2001-12-04;\n# <http://www.nedbatchelder.com/code/modules/rees-coverage.html>.\n#\n# [GDR 2001-12-04b] \"Statement coverage for Python: design and\n# analysis\"; Gareth Rees; Ravenbrook Limited; 2001-12-04;\n# <http://www.nedbatchelder.com/code/modules/rees-design.html>.\n#\n# [van Rossum 2001-07-20a] \"Python Reference Manual (releae 2.1.1)\";\n# Guide van Rossum; 2001-07-20;\n# <http://www.python.org/doc/2.1.1/ref/ref.html>.\n#\n# [van Rossum 2001-07-20b] \"Python Library Reference\"; Guido van Rossum;\n# 2001-07-20; <http://www.python.org/doc/2.1.1/lib/lib.html>.\n#\n#\n# B. DOCUMENT HISTORY\n#\n# 2001-12-04 GDR Created.\n#\n# 2001-12-06 GDR Added command-line interface and source code\n# annotation.\n#\n# 2001-12-09 GDR Moved design and interface to separate documents.\n#\n# 2001-12-10 GDR Open cache file as binary on Windows. Allow\n# simultaneous -e and -x, or -a and -r.\n#\n# 2001-12-12 GDR Added command-line help. Cache analysis so that it\n# only needs to be done once when you specify -a and -r.\n#\n# 2001-12-13 GDR Improved speed while recording. Portable between\n# Python 1.5.2 and 2.1.1.\n#\n# 2002-01-03 GDR Module-level functions work correctly.\n#\n# 2002-01-07 GDR Update sys.path when running a file with the -x option,\n# so that it matches the value the program would get if it were run on\n# its own.\n#\n# 2004-12-12 NMB Significant code changes.\n# - Finding executable statements has been rewritten so that docstrings and\n# other quirks of Python execution aren't mistakenly identified as missing\n# lines.\n# - Lines can be excluded from consideration, even entire suites of lines.\n# - The filesystem cache of covered lines can be disabled programmatically.\n# - Modernized the code.\n#\n# 2004-12-14 NMB Minor tweaks. Return 'analysis' to its original behavior\n# and add 'analysis2'. Add a global for 'annotate', and factor it, adding\n# 'annotate_file'.\n#\n# 2004-12-31 NMB Allow for keyword arguments in the module global functions.\n# Thanks, Allen.\n#\n# 2005-12-02 NMB Call threading.settrace so that all threads are measured.\n# Thanks Martin Fuzzey. Add a file argument to report so that reports can be \n# captured to a different destination.\n#\n# 2005-12-03 NMB coverage.py can now measure itself.\n#\n# 2005-12-04 NMB Adapted Greg Rogers' patch for using relative filenames,\n# and sorting and omitting files to report on.\n#\n# 2006-07-23 NMB Applied Joseph Tate's patch for function decorators.\n#\n# 2006-08-21 NMB Applied Sigve Tjora and Mark van der Wal's fixes for argument\n# handling.\n#\n# 2006-08-22 NMB Applied Geoff Bache's parallel mode patch.\n#\n# 2006-08-23 NMB Refactorings to improve testability. Fixes to command-line\n# logic for parallel mode and collect.\n#\n# 2006-08-25 NMB \"#pragma: nocover\" is excluded by default.\n#\n# 2006-09-10 NMB Properly ignore docstrings and other constant expressions that\n# appear in the middle of a function, a problem reported by Tim Leslie.\n# Minor changes to avoid lint warnings.\n#\n# 2006-09-17 NMB coverage.erase() shouldn't clobber the exclude regex.\n# Change how parallel mode is invoked, and fix erase() so that it erases the\n# cache when called programmatically.\n#\n# 2007-07-21 NMB In reports, ignore code executed from strings, since we can't\n# do anything useful with it anyway.\n# Better file handling on Linux, thanks Guillaume Chazarain.\n# Better shell support on Windows, thanks Noel O'Boyle.\n# Python 2.2 support maintained, thanks Catherine Proulx.\n#\n# 2007-07-22 NMB Python 2.5 now fully supported. The method of dealing with\n# multi-line statements is now less sensitive to the exact line that Python\n# reports during execution. Pass statements are handled specially so that their\n# disappearance during execution won't throw off the measurement.\n#\n# 2007-07-23 NMB Now Python 2.5 is *really* fully supported: the body of the\n# new with statement is counted as executable.\n#\n# 2007-07-29 NMB Better packaging.\n#\n# 2007-09-30 NMB Don't try to predict whether a file is Python source based on\n# the extension. Extensionless files are often Pythons scripts. Instead, simply\n# parse the file and catch the syntax errors. Hat tip to Ben Finney.\n\n# C. COPYRIGHT AND LICENCE\n#\n# Copyright 2001 Gareth Rees. All rights reserved.\n# Copyright 2004-2007 Ned Batchelder. 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\n# notice, 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\n# distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\n# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\n# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\n# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n# DAMAGE.\n#\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def restore_file(self, file_name):\n try:\n cache = open(file_name, 'rb')\n import marshal\n cexecuted = marshal.load(cache)\n cache.close()\n if isinstance(cexecuted, types.DictType):\n return cexecuted\n else:\n return {}\n except:\n return {}", "metadata": "root.coverage.restore_file", "header": "['class', 'coverage', ':', '___NEWLINE___', '# Name of the cache file (unless environment variable is set).', '___NL___', '___EOS___']", "index": 493 }, { "content": " def is_string_constant(self, tree):\n try:\n return tree[0] == symbol.stmt and tree[1][1][1][0] == symbol.expr_stmt\n except:\n return False", "metadata": "root.coverage.is_string_constant", "header": "['class', 'coverage', ':', '___NEWLINE___', '# Name of the cache file (unless environment variable is set).', '___NL___', '___EOS___']", "index": 627 }, { "content": " def is_pass_stmt(self, tree):\n try:\n return tree[0] == symbol.stmt and tree[1][1][1][0] == symbol.pass_stmt\n except:\n return False", "metadata": "root.coverage.is_pass_stmt", "header": "['class', 'coverage', ':', '___NEWLINE___', '# Name of the cache file (unless environment variable is set).', '___NL___', '___EOS___']", "index": 633 }, { "content": " def report(self, morfs, show_missing=1, ignore_errors=0, file=None, omit_prefixes=[]):\n '''\n @param morfs: list of files that we want to get information from\n \n The report is created in the following format:\n Name Stmts Exec Cover Missing\n ---------------------------------------------\n file_to_test @ 7 @ 6 @ 85% @ 8\n file_to_test2 @ 13 @ 9 @ 69% @ 12-14, 17\n ---------------------------------------------\n TOTAL 20 15 75% \n \n @returns a list of tuples in the format ('file_to_test2', 13, 9, 69.230769230769226, '12-14, 17')\n @note: 'file' param was 'out'\n '''\n \n \n if not isinstance(morfs, types.ListType):\n morfs = [morfs]\n # On windows, the shell doesn't expand wildcards. Do it here.\n globbed = []\n for morf in morfs:\n if isinstance(morf, strclass):\n globbed.extend(glob.glob(morf))\n else:\n globbed.append(morf)\n morfs = globbed\n \n morfs = self.filter_by_prefix(morfs, omit_prefixes)\n morfs.sort(self.morf_name_compare)\n\n max_name = max([5, ] + map(len, map(self.morf_name, morfs)))\n fmt_name = \"%%- %ds \" % max_name\n fmt_err = fmt_name + \"%s: %s\"\n header = fmt_name % \"Name\" + \" Stmts Exec Cover\"\n fmt_coverage = fmt_name + \"@% 6d @% 6d @% 5d%%\"\n if show_missing:\n header = header + \" Missing\"\n fmt_coverage = fmt_coverage + \"@ %s\"\n if not file:\n file = sys.stdout\n print >> file, header\n print >> file, \"-\" * len(header)\n total_statements = 0\n total_executed = 0\n for morf in morfs:\n name = self.morf_name(morf)\n try:\n _, statements, _, missing, readable = self.analysis2(morf)\n n = len(statements)\n m = n - len(missing)\n if n > 0:\n pc = 100.0 * m / n\n else:\n pc = 100.0\n args = (morf, n, m, pc)\n if show_missing:\n args = args + (readable,)\n print >> file, fmt_coverage % args\n total_statements = total_statements + n\n total_executed = total_executed + m\n except KeyboardInterrupt: #pragma: no cover\n raise\n except:\n if not ignore_errors:\n typ, msg = sys.exc_info()[:2]\n print >> file, fmt_err % (morf, typ, msg)\n if len(morfs) > 1:\n print >> file, \"-\" * len(header)\n if total_statements > 0:\n pc = 100.0 * total_executed / total_statements\n else:\n pc = 100.0\n args = (\"TOTAL\", total_statements, total_executed, pc)\n if show_missing:\n args = args + (\"\",)\n print >> file, fmt_coverage % args", "metadata": "root.coverage.report", "header": "['class', 'coverage', ':', '___NEWLINE___', '# Name of the cache file (unless environment variable is set).', '___NL___', '___EOS___']", "index": 808 }, { "content": " def annotate(self, morfs, directory=None, ignore_errors=0, omit_prefixes=[]):\n morfs = self.filter_by_prefix(morfs, omit_prefixes)\n for morf in morfs:\n try:\n filename, statements, excluded, missing, _ = self.analysis2(morf)\n self.annotate_file(filename, statements, excluded, missing, directory)\n except KeyboardInterrupt:\n raise\n except:\n if not ignore_errors:\n raise", "metadata": "root.coverage.annotate", "header": "['class', 'coverage', ':', '___NEWLINE___', '# Name of the cache file (unless environment variable is set).', '___NL___', '___EOS___']", "index": 891 } ]
[ { "span": "except:", "start_line": 79, "start_column": 0, "end_line": 79, "end_column": 7 }, { "span": "except:", "start_line": 503, "start_column": 8, "end_line": 503, "end_column": 15 }, { "span": "except:", "start_line": 630, "start_column": 8, "end_line": 630, "end_column": 15 }, { "span": "except:", "start_line": 636, "start_column": 8, "end_line": 636, "end_column": 15 }, { "span": "except:", "start_line": 871, "start_column": 12, "end_line": 871, "end_column": 19 }, { "span": "except:", "start_line": 899, "start_column": 12, "end_line": 899, "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_", "#", " ", " ", " ", " ", " ", "Perf", "orce", " ", "Defe", "ct", " ", "Track", "ing", " ", "Integrati", "on", " ", "Project_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "<", "http", "://", "www", ".", "rave", "nbr", "ook", ".", "com", "/", "project", "/", "p4", "dt", "i", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "COVER", "AGE", ".", "PY", " ", "--", " ", "COVER", "AGE", " ", "TESTING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "Gar", "eth", " ", "Re", "es", ",", " ", "Ra", "ven", "bro", "ok", " ", "Limit", "ed", ",", " ", "200", "1", "-1", "2", "-0", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Ne", "d", " ", "Bat", "che", "lder", ",", " ", "2004", "-1", "2", "-1", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "ned", "batche", "lder", ".", "com", "/", "code", "/", "module", "s", "/", "covera", "ge", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "INT", "RO", "DU", "CTION", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "module", " ", "provide", "s", " ", "covera", "ge", " ", "testi", "ng", " ", "for", " ", "Pyth", "on", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "inten", "ded", " ", "reader", "ship", " ", "is", " ", "all", " ", "Pyth", "on", " ", "developer", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "document", " ", "is", " ", "not", " ", "confi", "denti", "al", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "[", "GD", "R", " ", "200", "1", "-1", "2", "-0", "4a", "]", " ", "for", " ", "the", " ", "command", "-", "line", " ", "interface", ",", " ", "program", "mati", "c_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "interface", " ", "and", " ", "limit", "ation", "s", ".", " ", " ", "See", " ", "[", "GD", "R", " ", "200", "1", "-1", "2", "-0", "4b", "]", " ", "for", " ", "require", "ment", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "design", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\"\"", "Us", "age", ":", "\\", "10", ";", "\\", "10", ";", "covera", "ge", ".", "py", " ", "-", "x", " ", "[-", "p", "]", " ", "MODUL", "E", ".", "py", " ", "[", "ARG", "1", " ", "ARG", "2", " ", "...]", "\\", "10", ";", " ", " ", " ", " ", "Execut", "e", " ", "module", ",", " ", "passi", "ng", " ", "the", " ", "give", "n", " ", "command", "-", "line", " ", "argu", "ment", "s", ",", " ", "collecti", "ng", "\\", "10", ";", " ", " ", " ", " ", "covera", "ge", " ", "data", ".", " ", "With", " ", "the", " ", "-", "p", " ", "option", ",", " ", "write", " ", "to", " ", "a", " ", "temporar", "y", " ", "file", " ", "contain", "ing", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "machine", " ", "name", " ", "and", " ", "process", " ", "ID", ".", "\\", "10", ";", "\\", "10", ";", "covera", "ge", ".", "py", " ", "-", "e", "\\", "10", ";", " ", " ", " ", " ", "Erase", " ", "collected", " ", "covera", "ge", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", "covera", "ge", ".", "py", " ", "-", "wait", "for", "\\", "10", ";", " ", " ", " ", " ", "it", "'", "s", " ", "the", " ", "same", " ", "as", " ", "-", "r", " ", "-", "m", ",", " ", "but", "...", "\\", "10", ";", " ", " ", " ", " ", "go", "es", " ", "to", " ", "a", " ", "raw", "\\u", "input", "()", " ", "and", " ", "waits", " ", "for", " ", "the", " ", "files", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "executed", "...", "\\", "10", ";", "\\", "10", ";", "covera", "ge", ".", "py", " ", "-", "c", "\\", "10", ";", " ", " ", " ", " ", "Collect", " ", "data", " ", "from", " ", "multiple", " ", "covera", "ge", " ", "files", " ", "(", "as", " ", "created", " ", "by", " ", "-", "p", " ", "option", " ", "above", ")", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "store", " ", "it", " ", "int", "o", " ", "a", " ", "single", " ", "file", " ", "represent", "ing", " ", "the", " ", "uni", "on", " ", "of", " ", "the", " ", "covera", "ge", ".", "\\", "10", ";", "\\", "10", ";", "covera", "ge", ".", "py", " ", "-", "r", " ", "[-", "m", "]", " ", "[-", "o", " ", "dir", "1", ",", "dir", "2", ",...", "]", " ", "FILE", "1", " ", "FILE", "2", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Report", " ", "on", " ", "the", " ", "statem", "ent", " ", "covera", "ge", " ", "for", " ", "the", " ", "give", "n", " ", "files", ".", " ", " ", "With", " ", "the", " ", "-", "m", "\\", "10", ";", " ", " ", " ", " ", "option", ",", " ", "show", " ", "line", " ", "numbers", " ", "of", " ", "the", " ", "statem", "ents", " ", "tha", "t", " ", "wer", "en", "'", "t", " ", "executed", ".", "\\", "10", ";", "\\", "10", ";", "covera", "ge", ".", "py", " ", "-", "a", " ", "[-", "d", " ", "dir", "]", " ", "[-", "o", " ", "dir", "1", ",", "dir", "2", ",...", "]", " ", "FILE", "1", " ", "FILE", "2", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "annotated", " ", "copie", "s", " ", "of", " ", "the", " ", "give", "n", " ", "files", ",", " ", "marking", " ", "statem", "ents", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "executed", " ", "with", " ", ">", " ", "and", " ", "statem", "ents", " ", "tha", "t", " ", "are", " ", "missed", " ", "with", " ", "!.", " ", " ", "With", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "-", "d", " ", "option", ",", " ", "make", " ", "the", " ", "copie", "s", " ", "in", " ", "tha", "t", " ", "director", "y", ".", " ", " ", "With", "out", " ", "the", " ", "-", "d", "\\", "10", ";", " ", " ", " ", " ", "option", ",", " ", "make", " ", "each", " ", "copy", " ", "in", " ", "the", " ", "same", " ", "director", "y", " ", "as", " ", "the", " ", "original", ".", "\\", "10", ";", "\\", "10", ";", "-", "o", " ", "dir", ",", "dir", "2", ",...", "\\", "10", ";", " ", " ", "Om", "it", " ", "reporting", " ", "or", " ", "annot", "ati", "ng", " ", "files", " ", "whe", "n", " ", "thei", "r", " ", "filename", " ", "path", " ", "starts", " ", "with", "\\", "10", ";", " ", " ", "a", " ", "director", "y", " ", "liste", "d", " ", "in", " ", "the", " ", "omit", " ", "list", ".", "\\", "10", ";", " ", " ", "e", ".", "g", ".", " ", "python", " ", "covera", "ge", ".", "py", " ", "-", "i", " ", "-", "r", " ", "-", "o", " ", "c", ":\\\\", "python", "23", ",", "lib", "\\\\", "enth", "ou", "ght", "\\\\", "traits", "\\", "10", ";", "\\", "10", ";", "Coverage", " ", "data", " ", "is", " ", "saved", " ", "in", " ", "the", " ", "file", " ", ".", "covera", "ge", " ", "by", " ", "default", ".", " ", " ", "Set", " ", "the", "\\", "10", ";", "COVER", "AGE", "\\u", "FILE", " ", "environ", "ment", " ", "variab", "le", " ", "to", " ", "save", " ", "it", " ", "some", "where", " ", "else", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "2.7", "8.2", "007", "093", "0", "\"_", "#", " ", "see", " ", "detailed", " ", "histo", "ry", " ", "at", " ", "the", " ", "end", " ", "of", " ", "this", " ", "file", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "compiler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "compiler_", "._", "visitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "gethostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "version", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strc", "lass_", "=_", "basestring_", "#", " ", "new", " ", "to", " ", "2.3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strc", "lass_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "IMPL", "EME", "NTA", "TION_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "use", "s", " ", "the", " ", "\"", "singleton", "\"", " ", "pattern", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "word", " ", "\"", "mor", "f", "\"", " ", "means", " ", "a", " ", "module", " ", "object", " ", "(", "from", " ", "whi", "ch", " ", "the", " ", "source", " ", "file", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "deduc", "ed", " ", "by", " ", "suit", "able", " ", "manipulati", "on", " ", "of", " ", "the", " ", "\\u\\u", "file", "\\u\\u", " ", "attribute", ")", " ", "or", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filename", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "we", " ", "generat", "e", " ", "a", " ", "covera", "ge", " ", "report", " ", "we", " ", "have", " ", "to", " ", "canonicaliz", "e", " ", "every_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filename", " ", "in", " ", "the", " ", "covera", "ge", " ", "dictionar", "y", " ", "just", " ", "in", " ", "case", " ", "it", " ", "refer", "s", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "module", " ", "we", " ", "are", " ", "reporting", " ", "on", ".", " ", " ", "It", " ", "see", "ms", " ", "a", " ", "sha", "me", " ", "to", " ", "throw", " ", "awa", "y", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "informati", "on", " ", "so", " ", "the", " ", "data", " ", "in", " ", "the", " ", "covera", "ge", " ", "dictionar", "y", " ", "is", " ", "transferred", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "'", "ce", "xec", "ute", "d", "'", " ", "dictionar", "y", " ", "under", " ", "the", " ", "canonical", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "covera", "ge", " ", "dictionar", "y", " ", "is", " ", "call", "ed", " ", "\"", "c", "\"", " ", "and", " ", "the", " ", "trace", " ", "function", " ", "\"", "t", "\".", " ", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reason", " ", "for", " ", "these", " ", "short", " ", "names", " ", "is", " ", "tha", "t", " ", "Pyth", "on", " ", "look", "s", " ", "up", " ", "variab", "les", " ", "by", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "runt", "ime", " ", "and", " ", "so", " ", "executi", "on", " ", "time", " ", "depend", "s", " ", "on", " ", "the", " ", "length", " ", "of", " ", "variab", "les", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "the", " ", "bottleneck", " ", "of", " ", "this", " ", "applica", "tion", " ", "it", "'", "s", " ", "appropr", "iate", " ", "to", " ", "abbrev", "iate", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "names", " ", "to", " ", "increase", " ", "speed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Modul", "e", " ", "function", "s", " ", "call", " ", "method", "s", " ", "in", " ", "the", " ", "singleton", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Command", "-", "line", " ", "interface", "._", "\\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_", "#", " ", " ", " ", " ", "it", "'", "s", " ", "the", " ", "same", " ", "as", " ", "-", "r", " ", "-", "m", ",", " ", "but", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "go", "es", " ", "to", " ", "a", " ", "raw", "\\u", "input", "()", " ", "and", " ", "waits", " ", "for", " ", "the", " ", "files", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "executed", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "cache", "\\u", "location_", "#", "let", "'", "s", " ", "set", " ", "the", " ", "cache", " ", "location", " ", "now", "..._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "\\u", "location_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "#", "first", " ", "parameter", " ", "is", " ", "the", " ", "cache", " ", "location", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "argv_", "._", "remove_", "(_", "cache", "\\u", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "cache", "\\u", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "the", "\\u", "coverage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Singleton", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "the", "\\u", "coverage_", "=_", "coverage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'-", "wait", "for", "'_", "==_", "sys_", "._", "argv_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "argv_", "._", "remove_", "(_", "'-", "wait", "for", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "argv_", "._", "append_", "(_", "'-", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "argv_", "._", "append_", "(_", "'-", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "second", " ", "gets", " ", "the", " ", "files", " ", "to", " ", "be", " ", "executed", "_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "raw", "\\u", "input_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "._", "replace_", "(_", "'\\\\", "r", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "s_", "._", "split_", "(_", "'|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "[_", "v_", "for_", "v_", "in_", "files_", "if_", "len_", "(_", "v_", ")_", ">_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "argv_", "+=_", "files_", "\\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", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "covera", "ge", " ", "data", " ", "whe", "n", " ", "Pyth", "on", " ", "exits", ".", " ", " ", "(", "The", " ", "ate", "xit", " ", "module", " ", "was", "n", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "introduce", "d", " ", "unti", "l", " ", "Pyth", "on", " ", "2.0", ",", " ", "so", " ", "use", " ", "sys", ".", "exit", "func", " ", "whe", "n", " ", "it", "'", "s", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avail", "able", ".)", "_", "\\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 ", " _", "import_", "atexit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atexit_", "._", "register_", "(_", "the", "\\u", "coverage_", "._", "save_", ")_", "\\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 ", " _", "sys_", "._", "exit", "func_", "=_", "the", "\\u", "coverage_", "._", "save_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "the", "\\u", "coverage_", "._", "command", "\\u", "line_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", ".", " ", "REFERENCE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "GD", "R", " ", "200", "1", "-1", "2", "-0", "4a", "]", " ", "\"", "State", "ment", " ", "covera", "ge", " ", "for", " ", "Pyth", "on", "\";", " ", "Gar", "eth", " ", "Re", "es", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ra", "ven", "bro", "ok", " ", "Limit", "ed", ";", " ", "200", "1", "-1", "2", "-0", "4", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "http", "://", "www", ".", "ned", "batche", "lder", ".", "com", "/", "code", "/", "module", "s", "/", "ree", "s", "-", "covera", "ge", ".", "html", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "GD", "R", " ", "200", "1", "-1", "2", "-0", "4b", "]", " ", "\"", "State", "ment", " ", "covera", "ge", " ", "for", " ", "Pyth", "on", ":", " ", "design", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "analys", "is", "\";", " ", "Gar", "eth", " ", "Re", "es", ";", " ", "Ra", "ven", "bro", "ok", " ", "Limit", "ed", ";", " ", "200", "1", "-1", "2", "-0", "4", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "http", "://", "www", ".", "ned", "batche", "lder", ".", "com", "/", "code", "/", "module", "s", "/", "ree", "s", "-", "design", ".", "html", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "van", " ", "Ros", "sum", " ", "200", "1", "-0", "7", "-", "20", "a", "]", " ", "\"", "Pyth", "on", " ", "Reference", " ", "Manu", "al", " ", "(", "rele", "ae", " ", "2.1", ".1", ")\"", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Guide", " ", "van", " ", "Ros", "sum", ";", " ", "200", "1", "-0", "7", "-", "20", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "http", "://", "www", ".", "python", ".", "org", "/", "doc", "/", "2.1", ".1", "/", "ref", "/", "ref", ".", "html", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "van", " ", "Ros", "sum", " ", "200", "1", "-0", "7", "-", "20", "b", "]", " ", "\"", "Pyth", "on", " ", "Libr", "ary", " ", "Reference", "\";", " ", "Guid", "o", " ", "van", " ", "Ros", "sum", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-0", "7", "-", "20", ";", " ", "<", "http", "://", "www", ".", "python", ".", "org", "/", "doc", "/", "2.1", ".1", "/", "lib", "/", "lib", ".", "html", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "B", ".", " ", "DOCUMENT", " ", "HISTORY", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "4", " ", "GD", "R", " ", "Creat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "6", " ", "GD", "R", " ", "Added", " ", "command", "-", "line", " ", "interface", " ", "and", " ", "source", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "annot", "ation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-0", "9", " ", "GD", "R", " ", "Move", "d", " ", "design", " ", "and", " ", "interface", " ", "to", " ", "separate", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-1", "0", " ", "GD", "R", " ", "Open", " ", "cache", " ", "file", " ", "as", " ", "binar", "y", " ", "on", " ", "Window", "s", ".", " ", " ", "All", "ow_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simultaneous", " ", "-", "e", " ", "and", " ", "-", "x", ",", " ", "or", " ", "-", "a", " ", "and", " ", "-", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-1", "2", " ", "GD", "R", " ", "Added", " ", "command", "-", "line", " ", "help", ".", " ", " ", "Cache", " ", "analys", "is", " ", "so", " ", "tha", "t", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "need", "s", " ", "to", " ", "be", " ", "don", "e", " ", "onc", "e", " ", "whe", "n", " ", "you", " ", "speci", "fy", " ", "-", "a", " ", "and", " ", "-", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", "1", "-1", "2", "-1", "3", " ", "GD", "R", " ", "Impro", "ved", " ", "speed", " ", "whi", "le", " ", "record", "ing", ".", " ", " ", "Porta", "ble", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "1.5", ".2", " ", "and", " ", "2.1", ".1", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2002", "-0", "1", "-0", "3", " ", "GD", "R", " ", "Modul", "e-", "level", " ", "function", "s", " ", "work", " ", "correct", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2002", "-0", "1", "-0", "7", " ", "GD", "R", " ", "Update", " ", "sys", ".", "path", " ", "whe", "n", " ", "runn", "ing", " ", "a", " ", "file", " ", "with", " ", "the", " ", "-", "x", " ", "option", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "tha", "t", " ", "it", " ", "matche", "s", " ", "the", " ", "value", " ", "the", " ", "program", " ", "wou", "ld", " ", "get", " ", "if", " ", "it", " ", "wer", "e", " ", "run", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "its", " ", "own", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2004", "-1", "2", "-1", "2", " ", "NM", "B", " ", "Sign", "ifica", "nt", " ", "code", " ", "change", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "Finding", " ", "executable", " ", "statem", "ents", " ", "has", " ", "bee", "n", " ", "rew", "rit", "ten", " ", "so", " ", "tha", "t", " ", "docstrings", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "other", " ", "quir", "ks", " ", "of", " ", "Pyth", "on", " ", "executi", "on", " ", "are", "n", "'", "t", " ", "mist", "ake", "nl", "y", " ", "identifi", "ed", " ", "as", " ", "missing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "lines", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "Line", "s", " ", "can", " ", "be", " ", "exclu", "ded", " ", "from", " ", "consider", "ation", ",", " ", "even", " ", "entire", " ", "suites", " ", "of", " ", "lines", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "The", " ", "filesystem", " ", "cache", " ", "of", " ", "covered", " ", "lines", " ", "can", " ", "be", " ", "disable", "d", " ", "program", "matical", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "Mode", "rn", "ize", "d", " ", "the", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2004", "-1", "2", "-1", "4", " ", "NM", "B", " ", "Min", "or", " ", "tweak", "s", ".", " ", " ", "Return", " ", "'", "analys", "is", "'", " ", "to", " ", "its", " ", "original", " ", "behavior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "add", " ", "'", "analys", "is", "2", "'.", " ", " ", "Add", " ", "a", " ", "global", " ", "for", " ", "'", "annot", "ate", "',", " ", "and", " ", "factor", " ", "it", ",", " ", "addin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "annot", "ate", "\\u", "file", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2004", "-1", "2", "-", "3", "1", " ", "NM", "B", " ", "All", "ow", " ", "for", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "in", " ", "the", " ", "module", " ", "global", " ", "function", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thanks", ",", " ", "Alle", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2005", "-1", "2", "-0", "2", " ", "NM", "B", " ", "Call", " ", "thread", "ing", ".", "sett", "race", " ", "so", " ", "tha", "t", " ", "all", " ", "thread", "s", " ", "are", " ", "measure", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thanks", " ", "Mart", "in", " ", "Fuzz", "ey", ".", " ", "Add", " ", "a", " ", "file", " ", "argu", "ment", " ", "to", " ", "report", " ", "so", " ", "tha", "t", " ", "report", "s", " ", "can", " ", "be", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "captured", " ", "to", " ", "a", " ", "different", " ", "destinat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2005", "-1", "2", "-0", "3", " ", "NM", "B", " ", "covera", "ge", ".", "py", " ", "can", " ", "now", " ", "measure", " ", "its", "elf", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2005", "-1", "2", "-0", "4", " ", "NM", "B", " ", "Adapt", "ed", " ", "Gre", "g", " ", "Ro", "gers", "'", " ", "patch", " ", "for", " ", "usi", "ng", " ", "relative", " ", "filename", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "sorting", " ", "and", " ", "omit", "ting", " ", "files", " ", "to", " ", "report", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2006", "-0", "7", "-", "23", " ", "NM", "B", " ", "Appl", "ied", " ", "Jos", "eph", " ", "Ta", "te", "'", "s", " ", "patch", " ", "for", " ", "function", " ", "decorat", "ors", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2006", "-0", "8", "-", "21", " ", "NM", "B", " ", "Appl", "ied", " ", "Sig", "ve", " ", "Tj", "ora", " ", "and", " ", "Mark", " ", "van", " ", "der", " ", "Wal", "'", "s", " ", "fixes", " ", "for", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handling", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2006", "-0", "8", "-", "2", "2", " ", "NM", "B", " ", "Appl", "ied", " ", "Geo", "ff", " ", "Bac", "he", "'", "s", " ", "parall", "el", " ", "mode", " ", "patch", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2006", "-0", "8", "-", "23", " ", "NM", "B", " ", "Ref", "actor", "ings", " ", "to", " ", "improve", " ", "testa", "bilit", "y", ".", " ", " ", "Fix", "es", " ", "to", " ", "command", "-", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logic", " ", "for", " ", "parall", "el", " ", "mode", " ", "and", " ", "collect", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2006", "-0", "8", "-", "25", " ", "NM", "B", " ", "\"#", "pragma", ":", " ", "noco", "ver", "\"", " ", "is", " ", "exclu", "ded", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2006", "-0", "9", "-1", "0", " ", "NM", "B", " ", "Proper", "ly", " ", "ignore", " ", "docstrings", " ", "and", " ", "other", " ", "constant", " ", "express", "ion", "s", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appear", " ", "in", " ", "the", " ", "middle", " ", "of", " ", "a", " ", "function", ",", " ", "a", " ", "problem", " ", "reporte", "d", " ", "by", " ", "Tim", " ", "Les", "lie", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Min", "or", " ", "change", "s", " ", "to", " ", "avoid", " ", "lint", " ", "warn", "ings", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2006", "-0", "9", "-1", "7", " ", "NM", "B", " ", "covera", "ge", ".", "erase", "()", " ", "shou", "ld", "n", "'", "t", " ", "clobber", " ", "the", " ", "exclu", "de", " ", "regex", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", " ", "how", " ", "parall", "el", " ", "mode", " ", "is", " ", "invoke", "d", ",", " ", "and", " ", "fix", " ", "erase", "()", " ", "so", " ", "tha", "t", " ", "it", " ", "erase", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cache", " ", "whe", "n", " ", "call", "ed", " ", "program", "matical", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2007", "-0", "7", "-", "21", " ", "NM", "B", " ", "In", " ", "report", "s", ",", " ", "ignore", " ", "code", " ", "executed", " ", "from", " ", "string", "s", ",", " ", "sinc", "e", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "anyt", "hing", " ", "usef", "ul", " ", "with", " ", "it", " ", "anyway", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bet", "ter", " ", "file", " ", "handling", " ", "on", " ", "Lin", "ux", ",", " ", "thanks", " ", "Guil", "lau", "me", " ", "Cha", "zar", "ain", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bet", "ter", " ", "shell", " ", "support", " ", "on", " ", "Window", "s", ",", " ", "thanks", " ", "No", "el", " ", "O", "'", "Bo", "yle", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.2", " ", "support", " ", "maintain", "ed", ",", " ", "thanks", " ", "Cat", "heri", "ne", " ", "Pro", "ul", "x", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2007", "-0", "7", "-", "2", "2", " ", "NM", "B", " ", "Pyth", "on", " ", "2.5", " ", "now", " ", "full", "y", " ", "support", "ed", ".", " ", "The", " ", "method", " ", "of", " ", "deal", "ing", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multi", "-", "line", " ", "statem", "ents", " ", "is", " ", "now", " ", "less", " ", "sensi", "tiv", "e", " ", "to", " ", "the", " ", "exact", " ", "line", " ", "tha", "t", " ", "Python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "report", "s", " ", "dur", "ing", " ", "executi", "on", ".", " ", "Pass", " ", "statem", "ents", " ", "are", " ", "handle", "d", " ", "special", "ly", " ", "so", " ", "tha", "t", " ", "thei", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disapp", "ear", "anc", "e", " ", "dur", "ing", " ", "executi", "on", " ", "won", "'", "t", " ", "throw", " ", "off", " ", "the", " ", "measure", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2007", "-0", "7", "-", "23", " ", "NM", "B", " ", "No", "w", " ", "Pyth", "on", " ", "2.5", " ", "is", " ", "*", "reall", "y", "*", " ", "full", "y", " ", "support", "ed", ":", " ", "the", " ", "body", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", " ", "with", " ", "statem", "ent", " ", "is", " ", "counted", " ", "as", " ", "executable", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2007", "-0", "7", "-", "2", "9", " ", "NM", "B", " ", "Bet", "ter", " ", "packaging", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2007", "-0", "9", "-", "30", " ", "NM", "B", " ", "Don", "'", "t", " ", "try", " ", "to", " ", "predi", "ct", " ", "whe", "ther", " ", "a", " ", "file", " ", "is", " ", "Pyth", "on", " ", "source", " ", "based", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "extensi", "on", ".", " ", "Ext", "ensi", "onl", "ess", " ", "files", " ", "are", " ", "oft", "en", " ", "Pyth", "ons", " ", "scripts", ".", " ", "Ins", "tea", "d", ",", " ", "simp", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "the", " ", "file", " ", "and", " ", "catch", " ", "the", " ", "synta", "x", " ", "error", "s", ".", " ", " ", "Hat", " ", "tip", " ", "to", " ", "Ben", " ", "Fin", "ne", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "C", ".", " ", "COPY", "RIG", "HT", " ", "AND", " ", "LIC", "ENCE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "1", " ", "Gar", "eth", " ", "Re", "es", ".", " ", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2004", "-", "2007", " ", "Ne", "d", " ", "Bat", "che", "lder", ".", " ", " ", "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", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIGHT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "coverage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Name", " ", "of", " ", "the", " ", "cache", " ", "file", " ", "(", "unl", "ess", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "set", ").", "_", "\\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_", "restore", "\\u", "file_", "(_", "self_", ",_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "open_", "(_", "file", "\\u", "name_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "marshal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ce", "xec", "ute", "d_", "=_", "marshal_", "._", "load_", "(_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "ce", "xec", "ute", "d_", ",_", "types_", "._", "Dict", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ce", "xec", "ute", "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 ", " _", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "coverage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Name", " ", "of", " ", "the", " ", "cache", " ", "file", " ", "(", "unl", "ess", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "set", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "string", "\\u", "constant_", "(_", "self_", ",_", "tree_", ")_", ":_", "\\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_", "tree_", "[_", "0_", "]_", "==_", "symbol_", "._", "stmt_", "and_", "tree_", "[_", "1_", "]_", "[_", "1_", "]_", "[_", "1_", "]_", "[_", "0_", "]_", "==_", "symbol_", "._", "expr", "\\u", "stmt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "coverage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Name", " ", "of", " ", "the", " ", "cache", " ", "file", " ", "(", "unl", "ess", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "set", ").", "_", "\\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_", "is", "\\u", "pass", "\\u", "stmt_", "(_", "self_", ",_", "tree_", ")_", ":_", "\\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_", "tree_", "[_", "0_", "]_", "==_", "symbol_", "._", "stmt_", "and_", "tree_", "[_", "1_", "]_", "[_", "1_", "]_", "[_", "1_", "]_", "[_", "0_", "]_", "==_", "symbol_", "._", "pass", "\\u", "stmt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "coverage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Name", " ", "of", " ", "the", " ", "cache", " ", "file", " ", "(", "unl", "ess", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "set", ").", "_", "\\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_", "report_", "(_", "self_", ",_", "mor", "fs_", ",_", "show", "\\u", "missing_", "=_", "1_", ",_", "ignore", "\\u", "errors_", "=_", "0_", ",_", "file_", "=_", "None_", ",_", "omit", "\\u", "prefixes_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "mor", "fs", ":", " ", "list", " ", "of", " ", "files", " ", "tha", "t", " ", "we", " ", "want", " ", "to", " ", "get", " ", "informati", "on", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "report", " ", "is", " ", "created", " ", "in", " ", "the", " ", "follow", "ing", " ", "format", ":", "\\", "10", ";", " ", " ", " ", " ", "Name", " ", " ", " ", " ", "Stmt", "s", " ", " ", " ", "Exe", "c", " ", " ", "Cover", " ", " ", " ", "Missing", "\\", "10", ";", " ", " ", " ", " ", "--------------", "--------------", "--------------", "---", "\\", "10", ";", " ", " ", " ", " ", "file", "\\u", "to", "\\u", "test", " ", " ", " ", " ", "@", " ", " ", " ", " ", "7", " ", " ", " ", "@", " ", " ", " ", "6", " ", " ", "@", " ", " ", "85", "%", " ", " ", "@", " ", "8", "\\", "10", ";", " ", " ", " ", " ", "file", "\\u", "to", "\\u", "test", "2", " ", " ", " ", "@", " ", " ", " ", "13", " ", " ", " ", "@", " ", " ", " ", "9", " ", " ", "@", " ", " ", "6", "9", "%", " ", " ", "@", " ", "1", "2", "-1", "4", ",", " ", "1", "7", "\\", "10", ";", " ", " ", " ", " ", "--------------", "--------------", "--------------", "---", "\\", "10", ";", " ", " ", " ", " ", "TOTAL", " ", " ", " ", " ", " ", " ", "20", " ", "15", " ", " ", " ", " ", "7", "5", "%", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "in", " ", "the", " ", "format", " ", "('", "file", "\\u", "to", "\\u", "test", "2", "',", " ", "13", ",", " ", "9", ",", " ", "69.", "230", "769", "230", "769", "226", ",", " ", "'", "1", "2", "-1", "4", ",", " ", "1", "7", "')", "\\", "10", ";", " ", " ", " ", " ", "@", "note", ":", " ", "'", "file", "'", " ", "param", " ", "was", " ", "'", "out", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "mor", "fs_", ",_", "types_", "._", "List", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mor", "fs_", "=_", "[_", "mor", "fs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", " ", "windows", ",", " ", "the", " ", "shell", " ", "doe", "sn", "'", "t", " ", "expand", " ", "wildcards", ".", " ", " ", "Do", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glob", "bed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mor", "f_", "in_", "mor", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "mor", "f_", ",_", "strc", "lass_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glob", "bed_", "._", "extend_", "(_", "glob_", "._", "glob_", "(_", "mor", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "glob", "bed_", "._", "append_", "(_", "mor", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mor", "fs_", "=_", "glob", "bed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mor", "fs_", "=_", "self_", "._", "filter", "\\u", "by", "\\u", "prefix_", "(_", "mor", "fs_", ",_", "omit", "\\u", "prefixes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mor", "fs_", "._", "sort_", "(_", "self_", "._", "mor", "f", "\\u", "name", "\\u", "compare_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "name_", "=_", "max_", "(_", "[_", "5_", ",_", "]_", "+_", "map_", "(_", "len_", ",_", "map_", "(_", "self_", "._", "mor", "f", "\\u", "name_", ",_", "mor", "fs_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt", "\\u", "name_", "=_", "\"%%", "-", " ", "%", "ds", " ", " ", "\"_", "%_", "max", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt", "\\u", "err_", "=_", "fmt", "\\u", "name_", "+_", "\"%", "s", ":", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "fmt", "\\u", "name_", "%_", "\"", "Name", "\"_", "+_", "\"", " ", "Stmt", "s", " ", " ", " ", "Exe", "c", " ", " ", "Cover", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt", "\\u", "coverage_", "=_", "fmt", "\\u", "name_", "+_", "\"@", "%", " ", "6d", " ", "@", "%", " ", "6d", " ", "@", "%", " ", "5d", "%%\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "show", "\\u", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "=_", "header_", "+_", "\"", " ", " ", " ", "Missing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt", "\\u", "coverage_", "=_", "fmt", "\\u", "coverage_", "+_", "\"@", " ", " ", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "file_", ",_", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "file_", ",_", "\"-\"_", "*_", "len_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "statements_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "executed", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mor", "f_", "in_", "mor", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "self_", "._", "mor", "f", "\\u", "name_", "(_", "mor", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "statements_", ",_", "\\u_", ",_", "missing_", ",_", "readable_", "=_", "self_", "._", "analys", "is", "2_", "(_", "mor", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "statements_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "n_", "-_", "len_", "(_", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pc_", "=_", "100.0_", "*_", "m_", "/_", "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 ", " ", "_", "pc_", "=_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "(_", "mor", "f_", ",_", "n_", ",_", "m_", ",_", "pc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "show", "\\u", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "args_", "=_", "args_", "+_", "(_", "readable_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "file_", ",_", "fmt", "\\u", "coverage_", "%_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "statements_", "=_", "total", "\\u", "statements_", "+_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "executed", "_", "=_", "total", "\\u", "executed", "_", "+_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "#", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "ignore", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "typ_", ",_", "msg_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "file_", ",_", "fmt", "\\u", "err_", "%_", "(_", "mor", "f_", ",_", "typ_", ",_", "msg_", ")_", "\\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_", "len_", "(_", "mor", "fs_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "file_", ",_", "\"-\"_", "*_", "len_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total", "\\u", "statements_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pc_", "=_", "100.0_", "*_", "total", "\\u", "executed", "_", "/_", "total", "\\u", "statements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pc_", "=_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "(_", "\"", "TOTAL", "\"_", ",_", "total", "\\u", "statements_", ",_", "total", "\\u", "executed", "_", ",_", "pc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "show", "\\u", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "args_", "+_", "(_", "\"\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "file_", ",_", "fmt", "\\u", "coverage_", "%_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "coverage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Name", " ", "of", " ", "the", " ", "cache", " ", "file", " ", "(", "unl", "ess", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "set", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "annotate_", "(_", "self_", ",_", "mor", "fs_", ",_", "directory_", "=_", "None_", ",_", "ignore", "\\u", "errors_", "=_", "0_", ",_", "omit", "\\u", "prefixes_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mor", "fs_", "=_", "self_", "._", "filter", "\\u", "by", "\\u", "prefix_", "(_", "mor", "fs_", ",_", "omit", "\\u", "prefixes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mor", "f_", "in_", "mor", "fs_", ":_", "\\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 ", " _", "filename_", ",_", "statements_", ",_", "excluded_", ",_", "missing_", ",_", "\\u_", "=_", "self_", "._", "analys", "is", "2_", "(_", "mor", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "annot", "ate", "\\u", "file_", "(_", "filename_", ",_", "statements_", ",_", "excluded_", ",_", "missing_", ",_", "directory_", ")_", "\\u\\u\\uNEWLINE\\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_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "ignore", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
mozilla/inventory/core/service/tests/test_api.py
[ { "content": " def test_import_remove_system(self):\n # export, add one system, assert the sytem was added, remove it, assert\n # it was removed\n sblob = self.get_service(self.s1.iql_stmt())\n\n # create\n s = create_fake_host(hostname='hihihi.mozilla.com')\n\n # add\n sblob['services'][0]['systems'].append(s.hostname)\n\n # new host shouldn't exist in the service\n self.assertFalse(self.s1.systems.filter(hostname=s.hostname).exists())\n\n # import\n _, resp = self.import_services(sblob)\n self.assertEqual(resp.status_code, 200, resp.content)\n\n # new host should now exist in the service\n self.assertTrue(self.s1.systems.filter(hostname=s.hostname).exists())\n\n # refresh the blob for good measure\n sblob = self.get_service(self.s1.iql_stmt())\n\n # make sure the system's hostname is in the blob (this may be\n # redundant)\n self.assertTrue(s.hostname in sblob['services'][0]['systems'])\n # remove the host form the export blob\n sblob['services'][0]['systems'].remove(s.hostname)\n\n # import the blob\n _, resp = self.import_services(sblob)\n self.assertEqual(resp.status_code, 200, resp.content)\n\n # make sure it was removed\n self.assertFalse(self.s1.systems.filter(hostname=s.hostname).exists())", "metadata": "root.ServiceAPITests.test_import_remove_system", "header": "['class', 'ServiceAPITests', '(', 'BaseServiceTests', ',', 'TestCase', ')', ':', '___EOS___']", "index": 223 }, { "content": " def test_add_deps(self):\n s4 = Service.objects.create(name='foo', site=self.site)\n sblob = self.get_service(s4.iql_stmt())\n sblob['services'][0]['depends_on'] = [\n self.s1.iql_stmt(),\n self.s2.iql_stmt(),\n self.s3.iql_stmt()\n ]\n\n # import the blob\n _, resp = self.import_services(sblob)\n self.assertEqual(resp.status_code, 200, resp.content)\n\n pk_list = map(lambda d: d.provider.pk, s4.providers.all())\n self.assertTrue(self.s1.pk in pk_list)\n self.assertTrue(self.s2.pk in pk_list)\n self.assertTrue(self.s3.pk in pk_list)", "metadata": "root.ServiceAPITests.test_add_deps", "header": "['class', 'ServiceAPITests', '(', 'BaseServiceTests', ',', 'TestCase', ')', ':', '___EOS___']", "index": 260 }, { "content": " def test_import_remove_add_dependant_service(self):\n # This test does: export all state, remove a dep from s1, import,\n # ensure the remove worked, add a dep to s1, import, make sure the\n # add worked\n\n # get an export so we can play with it\n sblob = self.get_service(self.s1.iql_stmt())\n\n # remember how many deps we started with\n old_dep_count = Dependency.objects.count()\n\n self.assertEqual(\n 2, len(sblob['services'][0]['depends_on'])\n )\n # remove a dep\n sblob['services'][0]['depends_on'].remove(self.s2.iql_stmt())\n # Make sure the s3 service is still there\n self.assertTrue(\n self.s3.iql_stmt() in sblob['services'][0]['depends_on']\n )\n\n # import the new state\n _, resp = self.import_services(sblob)\n self.assertEqual(resp.status_code, 200, resp.content)\n\n # refresh state\n sblob = self.get_service(self.s1.iql_stmt())\n\n # we should only see one dep now\n self.assertEqual(\n 1, len(sblob['services'][0]['depends_on'])\n )\n\n # make sure we deleted the right one. the old dep should still be there\n self.assertTrue(\n self.s3.iql_stmt() in sblob['services'][0]['depends_on']\n )\n\n # Make sure we only deleted one dep\n new_dep_count = Dependency.objects.count()\n self.assertEqual(\n old_dep_count - 1, new_dep_count,\n \"It doesn't look like a dependency was deleted\"\n )\n\n # add back the dep\n sblob['services'][0]['depends_on'].append(self.s2.iql_stmt())\n\n # import the new state\n _, resp = self.import_services(sblob)\n self.assertEqual(resp.status_code, 200, resp.content)\n\n # refresh state\n sblob = self.get_service(self.s1.iql_stmt())\n\n # ensure the new dep is there\n self.assertTrue(\n self.s2.iql_stmt() in sblob['services'][0]['depends_on']\n )", "metadata": "root.ServiceAPITests.test_import_remove_add_dependant_service", "header": "['class', 'ServiceAPITests', '(', 'BaseServiceTests', ',', 'TestCase', ')', ':', '___EOS___']", "index": 278 } ]
[ { "span": "self.assertTrue(s.hostname in sblob['services'][0]['systems'])", "start_line": 249, "start_column": 8, "end_line": 249, "end_column": 70 }, { "span": "self.assertTrue(self.s1.pk in pk_list)", "start_line": 274, "start_column": 8, "end_line": 274, "end_column": 46 }, { "span": "self.assertTrue(self.s2.pk in pk_list)", "start_line": 275, "start_column": 8, "end_line": 275, "end_column": 46 }, { "span": "self.assertTrue(self.s3.pk in pk_list)", "start_line": 276, "start_column": 8, "end_line": 276, "end_column": 46 }, { "span": "self.assertTrue(\n self.s3.iql_stmt() in sblob['services'][0]['depends_on']\n )", "start_line": 295, "start_column": 8, "end_line": 297, "end_column": 9 }, { "span": "self.assertTrue(\n self.s3.iql_stmt() in sblob['services'][0]['depends_on']\n )", "start_line": 312, "start_column": 8, "end_line": 314, "end_column": 9 }, { "span": "self.assertTrue(\n self.s2.iql_stmt() in sblob['services'][0]['depends_on']\n )", "start_line": 334, "start_column": 8, "end_line": 336, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Service", "API", "Tests_", "(_", "Base", "Service", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "import", "\\u", "remove", "\\u", "system_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "export", ",", " ", "add", " ", "one", " ", "system", ",", " ", "assert", " ", "the", " ", "sy", "tem", " ", "was", " ", "adde", "d", ",", " ", "remove", " ", "it", ",", " ", "assert_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "was", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sb", "lob", "_", "=_", "self_", "._", "get", "\\u", "service_", "(_", "self_", "._", "s1_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "create", "\\u", "fake", "\\u", "host_", "(_", "hostname_", "=_", "'", "hi", "hi", "hi", ".", "moz", "illa", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add_", "\\u\\u\\uNL\\u\\u\\u_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "system", "s", "'_", "]_", "._", "append_", "(_", "s_", "._", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", " ", "host", " ", "shou", "ld", "n", "'", "t", " ", "exist", " ", "in", " ", "the", " ", "service_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "s1_", "._", "systems_", "._", "filter_", "(_", "hostname_", "=_", "s_", "._", "hostname_", ")_", "._", "exists_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "resp_", "=_", "self_", "._", "import", "\\u", "services_", "(_", "sb", "lob", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", " ", "host", " ", "shou", "ld", " ", "now", " ", "exist", " ", "in", " ", "the", " ", "service_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "s1_", "._", "systems_", "._", "filter_", "(_", "hostname_", "=_", "s_", "._", "hostname_", ")_", "._", "exists_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "refre", "sh", " ", "the", " ", "blob", " ", "for", " ", "good", " ", "measure_", "\\u\\u\\uNL\\u\\u\\u_", "sb", "lob", "_", "=_", "self_", "._", "get", "\\u", "service_", "(_", "self_", "._", "s1_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "the", " ", "system", "'", "s", " ", "host", "name", " ", "is", " ", "in", " ", "the", " ", "blob", " ", "(", "this", " ", "may", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "redundant", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "s_", "._", "hostname_", "in_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "system", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "host", " ", "form", " ", "the", " ", "export", " ", "blob_", "\\u\\u\\uNL\\u\\u\\u_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "system", "s", "'_", "]_", "._", "remove_", "(_", "s_", "._", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "the", " ", "blob_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "resp_", "=_", "self_", "._", "import", "\\u", "services_", "(_", "sb", "lob", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "it", " ", "was", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "s1_", "._", "systems_", "._", "filter_", "(_", "hostname_", "=_", "s_", "._", "hostname_", ")_", "._", "exists_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "API", "Tests_", "(_", "Base", "Service", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "deps_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s4_", "=_", "Service_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "foo", "'_", ",_", "site_", "=_", "self_", "._", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sb", "lob", "_", "=_", "self_", "._", "get", "\\u", "service_", "(_", "s4_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "depend", "s", "\\u", "on", "'_", "]_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "s1_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "s2_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "s3_", "._", "iq", "l\\u", "stmt_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "the", " ", "blob_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "resp_", "=_", "self_", "._", "import", "\\u", "services_", "(_", "sb", "lob", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pk", "\\u", "list_", "=_", "map_", "(_", "lambda_", "d_", ":_", "d_", "._", "provider_", "._", "pk_", ",_", "s4_", "._", "providers_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "s1_", "._", "pk_", "in_", "pk", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "s2_", "._", "pk_", "in_", "pk", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "s3_", "._", "pk_", "in_", "pk", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "API", "Tests_", "(_", "Base", "Service", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "import", "\\u", "remove", "\\u", "add", "\\u", "depend", "ant", "\\u", "service_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "doe", "s", ":", " ", "export", " ", "all", " ", "state", ",", " ", "remove", " ", "a", " ", "dep", " ", "from", " ", "s1", ",", " ", "import", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "the", " ", "remove", " ", "worked", ",", " ", "add", " ", "a", " ", "dep", " ", "to", " ", "s1", ",", " ", "import", ",", " ", "make", " ", "sure", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "worked", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "an", " ", "export", " ", "so", " ", "we", " ", "can", " ", "play", " ", "with", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sb", "lob", "_", "=_", "self_", "._", "get", "\\u", "service_", "(_", "self_", "._", "s1_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remember", " ", "how", " ", "many", " ", "dep", "s", " ", "we", " ", "start", "ed", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "dep", "\\u", "count_", "=_", "Dependency_", "._", "objects_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ",_", "len_", "(_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "depend", "s", "\\u", "on", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "a", " ", "dep_", "\\u\\u\\uNL\\u\\u\\u_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "depend", "s", "\\u", "on", "'_", "]_", "._", "remove_", "(_", "self_", "._", "s2_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "s3", " ", "service", " ", "is", " ", "still", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "s3_", "._", "iq", "l\\u", "stmt_", "(_", ")_", "in_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "depend", "s", "\\u", "on", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "the", " ", "new", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "resp_", "=_", "self_", "._", "import", "\\u", "services_", "(_", "sb", "lob", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "refre", "sh", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "sb", "lob", "_", "=_", "self_", "._", "get", "\\u", "service_", "(_", "self_", "._", "s1_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "shou", "ld", " ", "only", " ", "see", " ", "one", " ", "dep", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ",_", "len_", "(_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "depend", "s", "\\u", "on", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", " ", "delete", "d", " ", "the", " ", "right", " ", "one", ".", " ", "the", " ", "old", " ", "dep", " ", "shou", "ld", " ", "still", " ", "be", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "s3_", "._", "iq", "l\\u", "stmt_", "(_", ")_", "in_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "depend", "s", "\\u", "on", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "only", " ", "delete", "d", " ", "one", " ", "dep_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "dep", "\\u", "count_", "=_", "Dependency_", "._", "objects_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "dep", "\\u", "count_", "-_", "1_", ",_", "new", "\\u", "dep", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "It", " ", "doe", "sn", "'", "t", " ", "look", " ", "like", " ", "a", " ", "dependen", "cy", " ", "was", " ", "delete", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "back", " ", "the", " ", "dep_", "\\u\\u\\uNL\\u\\u\\u_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "depend", "s", "\\u", "on", "'_", "]_", "._", "append_", "(_", "self_", "._", "s2_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "the", " ", "new", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "resp_", "=_", "self_", "._", "import", "\\u", "services_", "(_", "sb", "lob", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ",_", "resp_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "refre", "sh", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "sb", "lob", "_", "=_", "self_", "._", "get", "\\u", "service_", "(_", "self_", "._", "s1_", "._", "iq", "l\\u", "stmt_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "the", " ", "new", " ", "dep", " ", "is", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "s2_", "._", "iq", "l\\u", "stmt_", "(_", ")_", "in_", "sb", "lob", "_", "[_", "'", "service", "s", "'_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
SpriteLink/NIPAP/whoisd/nipap_whoisd.py
[ { "content": "def createDaemon():\n \"\"\"Detach a process from the controlling terminal and run it in the\n background as a daemon.\n \"\"\"\n\n try:\n # Fork a child process so the parent can exit. This returns control to\n # the command-line or shell. It also guarantees that the child will not\n # be a process group leader, since the child receives a new process ID\n # and inherits the parent's process group ID. This step is required\n # to insure that the next call to os.setsid is successful.\n pid = os.fork()\n except OSError, e:\n raise Exception, \"%s [%d]\" % (e.strerror, e.errno)\n\n if (pid == 0): # The first child.\n # To become the session leader of this new session and the process group\n # leader of the new process group, we call os.setsid(). The process is\n # also guaranteed not to have a controlling terminal.\n os.setsid()\n\n # Is ignoring SIGHUP necessary?\n #\n # It's often suggested that the SIGHUP signal should be ignored before\n # the second fork to avoid premature termination of the process. The\n # reason is that when the first child terminates, all processes, e.g.\n # the second child, in the orphaned group will be sent a SIGHUP.\n #\n # \"However, as part of the session management system, there are exactly\n # two cases where SIGHUP is sent on the death of a process:\n #\n # 1) When the process that dies is the session leader of a session that\n # is attached to a terminal device, SIGHUP is sent to all processes\n # in the foreground process group of that terminal device.\n # 2) When the death of a process causes a process group to become\n # orphaned, and one or more processes in the orphaned group are\n # stopped, then SIGHUP and SIGCONT are sent to all members of the\n # orphaned group.\" [2]\n #\n # The first case can be ignored since the child is guaranteed not to have\n # a controlling terminal. The second case isn't so easy to dismiss.\n # The process group is orphaned when the first child terminates and\n # POSIX.1 requires that every STOPPED process in an orphaned process\n # group be sent a SIGHUP signal followed by a SIGCONT signal. Since the\n # second child is not STOPPED though, we can safely forego ignoring the\n # SIGHUP signal. In any case, there are no ill-effects if it is ignored.\n #\n # import signal # Set handlers for asynchronous events.\n # signal.signal(signal.SIGHUP, signal.SIG_IGN)\n\n try:\n # Fork a second child and exit immediately to prevent zombies. This\n # causes the second child process to be orphaned, making the init\n # process responsible for its cleanup. And, since the first child is\n # a session leader without a controlling terminal, it's possible for\n # it to acquire one by opening a terminal in the future (System V-\n # based systems). This second fork guarantees that the child is no\n # longer a session leader, preventing the daemon from ever acquiring\n # a controlling terminal.\n pid = os.fork() # Fork a second child.\n except OSError, e:\n raise Exception, \"%s [%d]\" % (e.strerror, e.errno)\n\n if (pid == 0): # The second child.\n # Since the current working directory may be a mounted filesystem, we\n # avoid the issue of not being able to unmount the filesystem at\n # shutdown time by changing it to the root directory.\n os.chdir(WORKDIR)\n # We probably don't want the file mode creation mask inherited from\n # the parent, so we give the child complete control over permissions.\n os.umask(UMASK)\n else:\n # exit() or _exit()? See below.\n os._exit(0) # Exit parent (the first child) of the second child.\n else:\n # exit() or _exit()?\n # _exit is like exit(), but it doesn't call any functions registered\n # with atexit (and on_exit) or any registered signal handlers. It also\n # closes any open file descriptors. Using exit() may cause all stdio\n # streams to be flushed twice and any temporary files may be unexpectedly\n # removed. It's therefore recommended that child branches of a fork()\n # and the parent branch(es) of a daemon use _exit().\n os._exit(0) # Exit parent of the first child.\n\n # Close all open file descriptors. This prevents the child from keeping\n # open any file descriptors inherited from the parent. There is a variety\n # of methods to accomplish this task. Three are listed below.\n #\n # Try the system configuration variable, SC_OPEN_MAX, to obtain the maximum\n # number of open file descriptors to close. If it doesn't exists, use\n # the default value (configurable).\n #\n # try:\n # maxfd = os.sysconf(\"SC_OPEN_MAX\")\n # except (AttributeError, ValueError):\n # maxfd = MAXFD\n #\n # OR\n #\n # if (os.sysconf_names.has_key(\"SC_OPEN_MAX\")):\n # maxfd = os.sysconf(\"SC_OPEN_MAX\")\n # else:\n # maxfd = MAXFD\n #\n # OR\n #\n # Use the getrlimit method to retrieve the maximum file descriptor number\n # that can be opened by this process. If there is not limit on the\n # resource, use the default value.\n #\n import resource # Resource usage information.\n maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n if (maxfd == resource.RLIM_INFINITY):\n maxfd = MAXFD\n \n # FIXME: this breaks our tpxmld, so it's commented for now //kll\n # Iterate through and close all file descriptors.\n# for fd in range(0, maxfd):\n# try:\n# os.close(fd)\n# except OSError: # ERROR, fd wasn't open to begin with (ignored)\n# pass\n\n # Redirect the standard I/O file descriptors to the specified file. Since\n # the daemon has no controlling terminal, most daemons redirect stdin,\n # stdout, and stderr to /dev/null. This is done to prevent side-effects\n # from reads and writes to the standard I/O file descriptors.\n\n # This call to open is guaranteed to return the lowest file descriptor,\n # which will be 0 (stdin), since it was closed above.\n os.open(REDIRECT_TO, os.O_RDWR) # standard input (0)\n\n # Duplicate standard input to standard output and standard error.\n os.dup2(0, 1) # standard output (1)\n os.dup2(0, 2) # standard error (2)\n\n return(0)", "metadata": "root.createDaemon", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def drop_privileges(uid_name='nobody', gid_name='nogroup'):\n if os.getuid() != 0:\n raise Exception(\"non-root user cannot drop privileges\")\n\n import pwd, grp\n # Get the uid/gid from the name\n uid = pwd.getpwnam(uid_name).pw_uid\n gid = grp.getgrnam(gid_name).gr_gid\n\n # Remove group privileges\n os.setgroups([])\n\n # Try setting the new uid/gid\n os.setgid(gid)\n os.setuid(uid)\n\n # Ensure a very conservative umask\n old_umask = os.umask(077)", "metadata": "root.drop_privileges", "header": "['module', '___EOS___']", "index": 167 } ]
[ { "span": "maxfd ", "start_line": 140, "start_column": 6, "end_line": 140, "end_column": 11 }, { "span": "old_umask ", "start_line": 184, "start_column": 4, "end_line": 184, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Daemon_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Detach", " ", "a", " ", "process", " ", "from", " ", "the", " ", "controll", "ing", " ", "termina", "l", " ", "and", " ", "run", " ", "it", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", "background", " ", "as", " ", "a", " ", "daemon", ".", "\\", "10", ";", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", "k", " ", "a", " ", "child", " ", "process", " ", "so", " ", "the", " ", "parent", " ", "can", " ", "exit", ".", " ", " ", "Thi", "s", " ", "return", "s", " ", "control", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "command", "-", "line", " ", "or", " ", "shell", ".", " ", " ", "It", " ", "als", "o", " ", "guaran", "tee", "s", " ", "tha", "t", " ", "the", " ", "child", " ", "will", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "a", " ", "process", " ", "group", " ", "leader", ",", " ", "sinc", "e", " ", "the", " ", "child", " ", "receive", "s", " ", "a", " ", "new", " ", "process", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "inherits", " ", "the", " ", "parent", "'", "s", " ", "process", " ", "group", " ", "ID", ".", " ", " ", "Thi", "s", " ", "step", " ", "is", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "insu", "re", " ", "tha", "t", " ", "the", " ", "next", " ", "call", " ", "to", " ", "os", ".", "sets", "id", " ", "is", " ", "success", "ful", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", ",_", "\"%", "s", " ", "[", "%", "d", "]\"_", "%_", "(_", "e_", "._", "strerror_", ",_", "e_", "._", "errno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "pid_", "==_", "0_", ")_", ":_", "#", " ", "The", " ", "first", " ", "child", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "To", " ", "bec", "ome", " ", "the", " ", "session", " ", "leader", " ", "of", " ", "this", " ", "new", " ", "session", " ", "and", " ", "the", " ", "process", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "leader", " ", "of", " ", "the", " ", "new", " ", "process", " ", "group", ",", " ", "we", " ", "call", " ", "os", ".", "sets", "id", "()", ".", " ", " ", "The", " ", "process", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "als", "o", " ", "guaran", "tee", "d", " ", "not", " ", "to", " ", "have", " ", "a", " ", "controll", "ing", " ", "termina", "l", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "sets", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Is", " ", "ign", "orin", "g", " ", "SIG", "HU", "P", " ", "necessar", "y", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "oft", "en", " ", "suggested", " ", "tha", "t", " ", "the", " ", "SIG", "HU", "P", " ", "signal", " ", "shou", "ld", " ", "be", " ", "ignore", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "second", " ", "fork", " ", "to", " ", "avoid", " ", "prem", "ature", " ", "termination", " ", "of", " ", "the", " ", "process", ".", " ", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reason", " ", "is", " ", "tha", "t", " ", "whe", "n", " ", "the", " ", "first", " ", "child", " ", "terminate", "s", ",", " ", "all", " ", "process", "es", ",", " ", "e", ".", "g", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "second", " ", "child", ",", " ", "in", " ", "the", " ", "orphan", "ed", " ", "group", " ", "will", " ", "be", " ", "sent", " ", "a", " ", "SIG", "HU", "P", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Ho", "we", "ver", ",", " ", "as", " ", "part", " ", "of", " ", "the", " ", "session", " ", "manage", "ment", " ", "system", ",", " ", "there", " ", "are", " ", "exact", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "two", " ", "case", "s", " ", "where", " ", "SIG", "HU", "P", " ", "is", " ", "sent", " ", "on", " ", "the", " ", "death", " ", "of", " ", "a", " ", "process", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "1", ")", " ", "Whe", "n", " ", "the", " ", "process", " ", "tha", "t", " ", "die", "s", " ", "is", " ", "the", " ", "session", " ", "leader", " ", "of", " ", "a", " ", "session", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "is", " ", "attache", "d", " ", "to", " ", "a", " ", "termina", "l", " ", "device", ",", " ", "SIG", "HU", "P", " ", "is", " ", "sent", " ", "to", " ", "all", " ", "processes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "in", " ", "the", " ", "fore", "ground", " ", "process", " ", "group", " ", "of", " ", "tha", "t", " ", "termina", "l", " ", "device", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "2", ")", " ", "Whe", "n", " ", "the", " ", "death", " ", "of", " ", "a", " ", "process", " ", "caus", "es", " ", "a", " ", "process", " ", "group", " ", "to", " ", "bec", "ome_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "orphan", "ed", ",", " ", "and", " ", "one", " ", "or", " ", "more", " ", "process", "es", " ", "in", " ", "the", " ", "orphan", "ed", " ", "group", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "stopp", "ed", ",", " ", "then", " ", "SIG", "HU", "P", " ", "and", " ", "SIG", "CONT", " ", "are", " ", "sent", " ", "to", " ", "all", " ", "member", "s", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "orphan", "ed", " ", "group", ".\"", " ", "[", "2", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "case", " ", "can", " ", "be", " ", "ignore", "d", " ", "sinc", "e", " ", "the", " ", "child", " ", "is", " ", "guaran", "tee", "d", " ", "not", " ", "to", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "controll", "ing", " ", "termina", "l", ".", " ", " ", "The", " ", "second", " ", "case", " ", "isn", "'", "t", " ", "so", " ", "easy", " ", "to", " ", "dismiss", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "process", " ", "group", " ", "is", " ", "orphan", "ed", " ", "whe", "n", " ", "the", " ", "first", " ", "child", " ", "terminate", "s", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POSI", "X", ".1", " ", "require", "s", " ", "tha", "t", " ", "every", " ", "STOPPED", " ", "process", " ", "in", " ", "an", " ", "orphan", "ed", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "group", " ", "be", " ", "sent", " ", "a", " ", "SIG", "HU", "P", " ", "signal", " ", "followe", "d", " ", "by", " ", "a", " ", "SIG", "CONT", " ", "signal", ".", " ", " ", "Sin", "ce", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "second", " ", "child", " ", "is", " ", "not", " ", "STOPPED", " ", "tho", "ugh", ",", " ", "we", " ", "can", " ", "safe", "ly", " ", "fore", "go", " ", "ign", "orin", "g", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SIG", "HU", "P", " ", "signal", ".", " ", " ", "In", " ", "any", " ", "case", ",", " ", "there", " ", "are", " ", "no", " ", "ill", "-", "effect", "s", " ", "if", " ", "it", " ", "is", " ", "ignore", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "signal", " ", " ", " ", "#", " ", "Set", " ", "handler", "s", " ", "for", " ", "async", "hronous", " ", "events", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "signal", ".", "signal", "(", "signal", ".", "SIG", "HU", "P", ",", " ", "signal", ".", "SIG", "\\u", "IGN", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", "k", " ", "a", " ", "second", " ", "child", " ", "and", " ", "exit", " ", "immediate", "ly", " ", "to", " ", "prevent", " ", "zombie", "s", ".", " ", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "caus", "es", " ", "the", " ", "second", " ", "child", " ", "process", " ", "to", " ", "be", " ", "orphan", "ed", ",", " ", "mak", "ing", " ", "the", " ", "init_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", " ", "responsib", "le", " ", "for", " ", "its", " ", "clean", "up", ".", " ", " ", "And", ",", " ", "sinc", "e", " ", "the", " ", "first", " ", "child", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "session", " ", "leader", " ", "with", "out", " ", "a", " ", "controll", "ing", " ", "termina", "l", ",", " ", "it", "'", "s", " ", "possib", "le", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "to", " ", "acquir", "e", " ", "one", " ", "by", " ", "opening", " ", "a", " ", "termina", "l", " ", "in", " ", "the", " ", "future", " ", "(", "System", " ", "V", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "based", " ", "system", "s", ").", " ", " ", "Thi", "s", " ", "second", " ", "fork", " ", "guaran", "tee", "s", " ", "tha", "t", " ", "the", " ", "child", " ", "is", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "long", "er", " ", "a", " ", "session", " ", "leader", ",", " ", "prevent", "ing", " ", "the", " ", "daemon", " ", "from", " ", "ever", " ", "acquir", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "controll", "ing", " ", "termina", "l", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid_", "=_", "os_", "._", "fork_", "(_", ")_", "#", " ", "For", "k", " ", "a", " ", "second", " ", "child", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", ",_", "\"%", "s", " ", "[", "%", "d", "]\"_", "%_", "(_", "e_", "._", "strerror_", ",_", "e_", "._", "errno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "pid_", "==_", "0_", ")_", ":_", "#", " ", "The", " ", "second", " ", "child", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "the", " ", "current", " ", "working", " ", "director", "y", " ", "may", " ", "be", " ", "a", " ", "mounte", "d", " ", "filesystem", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avoid", " ", "the", " ", "issue", " ", "of", " ", "not", " ", "bei", "ng", " ", "able", " ", "to", " ", "unmo", "unt", " ", "the", " ", "filesystem", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shut", "down", " ", "time", " ", "by", " ", "chang", "ing", " ", "it", " ", "to", " ", "the", " ", "root", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "WORK", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "probab", "ly", " ", "don", "'", "t", " ", "want", " ", "the", " ", "file", " ", "mode", " ", "creati", "on", " ", "mask", " ", "inherited", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "parent", ",", " ", "so", " ", "we", " ", "give", " ", "the", " ", "child", " ", "complete", " ", "control", " ", "over", " ", "permissi", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "umask", "_", "(_", "UM", "ASK", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exit", "()", " ", "or", " ", "\\u", "exit", "()", "?", " ", " ", "See", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "#", " ", "Exi", "t", " ", "parent", " ", "(", "the", " ", "first", " ", "child", ")", " ", "of", " ", "the", " ", "second", " ", "child", "._", "\\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_", "#", " ", "exit", "()", " ", "or", " ", "\\u", "exit", "()", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "exit", " ", "is", " ", "like", " ", "exit", "()", ",", " ", "but", " ", "it", " ", "doe", "sn", "'", "t", " ", "call", " ", "any", " ", "function", "s", " ", "registered_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "ate", "xit", " ", "(", "and", " ", "on", "\\u", "exit", ")", " ", "or", " ", "any", " ", "register", "ed", " ", "signal", " ", "handler", "s", ".", " ", " ", "It", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "closes", " ", "any", " ", "open", " ", "file", " ", "descrip", "tors", ".", " ", " ", "Us", "ing", " ", "exit", "()", " ", "may", " ", "caus", "e", " ", "all", " ", "std", "io_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stream", "s", " ", "to", " ", "be", " ", "flush", "ed", " ", "twi", "ce", " ", "and", " ", "any", " ", "temporar", "y", " ", "files", " ", "may", " ", "be", " ", "unexpected", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", "d", ".", " ", " ", "It", "'", "s", " ", "there", "fore", " ", "recommende", "d", " ", "tha", "t", " ", "child", " ", "branch", "es", " ", "of", " ", "a", " ", "fork", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "parent", " ", "branch", "(", "es", ")", " ", "of", " ", "a", " ", "daemon", " ", "use", " ", "\\u", "exit", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "\\u", "exit_", "(_", "0_", ")_", "#", " ", "Exi", "t", " ", "parent", " ", "of", " ", "the", " ", "first", " ", "child", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clos", "e", " ", "all", " ", "open", " ", "file", " ", "descrip", "tors", ".", " ", " ", "Thi", "s", " ", "prevent", "s", " ", "the", " ", "child", " ", "from", " ", "keep", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "open", " ", "any", " ", "file", " ", "descrip", "tors", " ", "inherited", " ", "from", " ", "the", " ", "parent", ".", " ", " ", "There", " ", "is", " ", "a", " ", "variet", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "method", "s", " ", "to", " ", "accom", "pli", "sh", " ", "this", " ", "task", ".", " ", " ", "Thre", "e", " ", "are", " ", "liste", "d", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "the", " ", "system", " ", "configura", "tion", " ", "variab", "le", ",", " ", "SC", "\\u", "OPEN", "\\u", "MAX", ",", " ", "to", " ", "obtain", " ", "the", " ", "maximum_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "number", " ", "of", " ", "open", " ", "file", " ", "descrip", "tors", " ", "to", " ", "close", ".", " ", " ", "If", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", "s", ",", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "default", " ", "value", " ", "(", "configurable", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "maxf", "d", " ", "=", " ", "os", ".", "sysc", "onf", "(\"", "SC", "\\u", "OPEN", "\\u", "MAX", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", " ", "(", "Attribute", "Error", ",", " ", "Value", "Error", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "maxf", "d", " ", "=", " ", "MAX", "FD_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "(", "os", ".", "sysc", "onf", "\\u", "names", ".", "has", "\\u", "key", "(\"", "SC", "\\u", "OPEN", "\\u", "MAX", "\"))", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "maxf", "d", " ", "=", " ", "os", ".", "sysc", "onf", "(\"", "SC", "\\u", "OPEN", "\\u", "MAX", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "maxf", "d", " ", "=", " ", "MAX", "FD_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "getr", "limit", " ", "method", " ", "to", " ", "retrieve", " ", "the", " ", "maxim", "um", " ", "file", " ", "descrip", "tor", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "can", " ", "be", " ", "opene", "d", " ", "by", " ", "this", " ", "process", ".", " ", " ", "If", " ", "there", " ", "is", " ", "not", " ", "limit", " ", "on", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resource", ",", " ", "use", " ", "the", " ", "default", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "resource_", "#", " ", "Reso", "urc", "e", " ", "usage", " ", "informati", "on", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxf", "d_", "=_", "resource_", "._", "getr", "limit_", "(_", "resource_", "._", "RL", "IM", "IT", "\\u", "NO", "FILE_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "maxf", "d_", "==_", "resource_", "._", "RL", "IM", "\\u", "INFINIT", "Y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxf", "d_", "=_", "MAX", "FD_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "this", " ", "breaks", " ", "our", " ", "tp", "xmld", ",", " ", "so", " ", "it", "'", "s", " ", "commente", "d", " ", "for", " ", "now", " ", "//", "kl", "l_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Iterat", "e", " ", "through", " ", "and", " ", "close", " ", "all", " ", "file", " ", "descrip", "tors", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "for", " ", "fd", " ", "in", " ", "range", "(", "0", ",", " ", "maxf", "d", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "os", ".", "close", "(", "fd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "except", " ", "OSE", "rror", ":", " ", " ", " ", "#", " ", "ERROR", ",", " ", "fd", " ", "was", "n", "'", "t", " ", "open", " ", "to", " ", "begin", " ", "with", " ", "(", "ignore", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redirect", " ", "the", " ", "standard", " ", "I", "/", "O", " ", "file", " ", "descrip", "tors", " ", "to", " ", "the", " ", "specified", " ", "file", ".", " ", " ", "Sin", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "daemon", " ", "has", " ", "no", " ", "controll", "ing", " ", "termina", "l", ",", " ", "most", " ", "daemon", "s", " ", "redirec", "t", " ", "std", "in", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stdout", ",", " ", "and", " ", "std", "err", " ", "to", " ", "/", "dev", "/", "null", ".", " ", " ", "Thi", "s", " ", "is", " ", "don", "e", " ", "to", " ", "prevent", " ", "side", "-", "effects_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "reads", " ", "and", " ", "writes", " ", "to", " ", "the", " ", "standard", " ", "I", "/", "O", " ", "file", " ", "descrip", "tors", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "call", " ", "to", " ", "open", " ", "is", " ", "guaran", "tee", "d", " ", "to", " ", "return", " ", "the", " ", "lowe", "st", " ", "file", " ", "descrip", "tor", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "will", " ", "be", " ", "0", " ", "(", "std", "in", "),", " ", "sinc", "e", " ", "it", " ", "was", " ", "close", "d", " ", "above", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "open_", "(_", "REDIRECT", "\\u", "TO_", ",_", "os_", "._", "O", "\\u", "RD", "WR", "_", ")_", "#", " ", "standard", " ", "input", " ", "(", "0", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Duplicate", " ", "standard", " ", "input", " ", "to", " ", "standard", " ", "output", " ", "and", " ", "standard", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "dup", "2_", "(_", "0_", ",_", "1_", ")_", "#", " ", "standard", " ", "output", " ", "(", "1", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "dup", "2_", "(_", "0_", ",_", "2_", ")_", "#", " ", "standard", " ", "error", " ", "(", "2", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "drop", "\\u", "privilege", "s_", "(_", "uid", "\\u", "name_", "=_", "'", "nob", "ody", "'_", ",_", "gid", "\\u", "name_", "=_", "'", "nog", "roup", "'_", ")_", ":_", "\\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 ", " _", "raise_", "Exception_", "(_", "\"", "non", "-", "root", " ", "user", " ", "cann", "ot", " ", "drop", " ", "privilege", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "pwd_", ",_", "grp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "uid", "/", "gid", " ", "from", " ", "the", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "uid_", "=_", "pwd_", "._", "getpw", "nam_", "(_", "uid", "\\u", "name_", ")_", "._", "pw", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gid_", "=_", "grp_", "._", "getg", "rnam", "_", "(_", "gid", "\\u", "name_", ")_", "._", "gr", "\\u", "gid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "group", " ", "privilege", "s_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "set", "groups_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "setti", "ng", " ", "the", " ", "new", " ", "uid", "/", "gid_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "set", "gid_", "(_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "set", "uid_", "(_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "a", " ", "very", " ", "conserv", "ative", " ", "umask", "_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "umask", "_", "=_", "os_", "._", "umask", "_", "(_", "0_", "77_", ")_" ]
[ 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Esri/ops-server-config/Publish/Portal/PortalContentPost.py
[ { "content": "#------------------------------------------------------------------------------\n# Copyright 2014 Esri\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#Name: PortalContentPost.py\n# \n#Purpose: Publishes portal content that was extracted with the\n# PortalContentExtract.py script.\n#\n#==============================================================================\nimport os, sys\n\n# Add \"Root folder\"\\SupportFiles to sys path inorder to import\n# modules in subfolder\nsupportFilesPath = os.path.join(\n os.path.dirname(\n os.path.dirname(os.path.dirname(sys.argv[0]))), \"SupportFiles\")\nsys.path.append(supportFilesPath)\n\nimport portalpy\nimport json\nimport urlparse\nimport types\nimport shutil\nfrom datetime import datetime, timedelta\nfrom portalpy import Portal, parse_hostname, portal_time, WebMap, normalize_url, unpack, TEXT_BASED_ITEM_TYPES\nfrom portalpy.provision import load_items, load_item\nfrom Utilities import findInFile, editFiles\nimport logging\nimport copy\nfrom Utilities import findFilePath\n\nlogging.basicConfig()\n\n# For now hard-code the server name of the source ArcGIS Server machine\nsource_hostname = \"my_source_portal.domain\"\nnew_hostname = \"\"\nnew_port = None #Use 6080 or None\n\nhostname_map = {}\n\nDEBUG = False\n\ntitleBreak = \"=====================================================================================\"\nsectionBreak = \"------------------------------------------------------------------------------------\"\nsectionBreak2 = \"--------------------\"\nportal_processing = \"POST\"\nportalLogFolder = \"PortalPostLogs\"\nusers = {}\n\n#track stored IDs to new IDs when posting groups\noriginGroupToDestGroups = {}\n\n#EL track new group id and the group name\ndestGroupID_GroupName = {}\n\n# Store original item id and new item id\norigIDToNewID = {}\n\n \n \n\n\n \n#POST\n \n\n \n \n\n\n\n\n\n\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 main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n\n scriptName = sys.argv[0]\n\n specified_users = None\n #specified_ops_types = None\n specified_groups = None\n id_mapping_file = None\n \n # ---------------------------------------------------------------------\n # Check arguments\n # --------------------------------------------------------------------- \n if len(sys.argv) < 5:\n print '\\n' + scriptName + ' <PortalURL> <AdminUser> <AdminPassword> ' + \\\n '<ContentFolderPath> {UsersToPost} {GroupsToPost} {IdMappingFile}'\n print '\\nWhere:'\n print '\\n\\t<PortalURL> (required): URL of Portal to post content (i.e. https://fully_qualified_domain_name/arcgis)'\n \n print '\\n\\t<AdminUser> (required): Portal user that has administrator role.'\n \n print '\\n\\t<AdminPassword> (required): Password for AdminUser.'\n \n print '\\n\\t<ContentFolderPath> (required): Folder path containing portal content to post.'\n \n print '\\n\\t{UsersToPost} (optional):'\n print '\\t\\t-By default, content for all users is posted'\n print '\\t\\t-Specify # placeholder character if you want to post content for all users and you are'\n print '\\t\\t specifying {GroupsToPost} values'\n print '\\t\\t-To post content for only specific users specify comma delimited list of users, i.e. user1,user2,...'\n print '\\t\\t-To post content for ALL users except specific users, specify comma delimited '\n print '\\t\\t list of users to exclude with \"-\" prefix, i.e. -user1,user2,...'\n print '\\t\\t-NOTE: Users names must match the \"SourceUserName\" values in the <ContentFolderPath>\\userfile.txt file.'\n \n print '\\n\\t{GroupsToPost} (optional):'\n print '\\t\\t-To post content shared with specific portal groups specify a pipe \"|\" delimited list of groups using the syntax \"GroupOwner:GroupTitle|GroupOwner:GroupTitle|...\".'\n print '\\t\\t-Specify # placeholder character if you do not want to use this parameter and need to specify the {IdMappingFile} parameter value.'\n print '\\t\\t-NOTE: GroupOwner and GroupTitle values are case sensitive.'\n print '\\t\\t-NOTE: Parameter value MUST be surrounded by double-quotes.'\n \n print '\\n\\t{IdMappingFile} (optional): JSON file containing mapping between source and target portal item ids.'\n print '\\t\\t-Provides \"overwrite\" capability. If IdMappingFile is specified, the script will'\n print '\\t\\t update any item that already exists; items that do not exist will be added.'\n \n print '\\n\\tNOTES:'\n print '\\t\\t(1) To include spaces in any of the parameter lists, surround the list with double-quotes,'\n print '\\t\\t i.e., \"value1, value2, ...\"'\n \n print '\\n\\t\\t(2) Replacement of portal item URLs:'\n print '\\t\\t\\t-This script will replace the host names in URLs in service, webmap and operation view items; '\n print '\\t\\t\\t the script is hardcoded to replace the source hostname \"' + source_hostname + '\" with the '\n print '\\t\\t\\t hostname of the target portal server <PortalURL>; i.e., this script assumes that the target'\n print '\\t\\t\\t ArcGIS Server is installed on the target portal machine.'\n sys.exit(1)\n \n \n # Set variables from script parameters\n target_portal_address = sys.argv[1]\n adminuser = sys.argv[2]\n adminpassword = sys.argv[3]\n contentpath = sys.argv[4]\n if len(sys.argv) > 5:\n specified_users = sys.argv[5]\n if len(sys.argv) > 6:\n specified_groups = sys.argv[6]\n specified_groups = [group.strip() for group in specified_groups.split('|')]\n if len(sys.argv) > 7:\n id_mapping_file = sys.argv[7]\n if len(sys.argv) > 8:\n print \"You entered too many script parameters.\"\n sys.exit(1)\n \n if DEBUG:\n print \"target_portal_address: \" + str(target_portal_address)\n print \"adminuser: \" + str(adminuser)\n print \"adminpassword: \" + str(adminpassword)\n print \"contentpath: \" + str(contentpath)\n if specified_users:\n print \"specifiedUsers: \" + str(specified_users)\n if specified_groups:\n print \"specifiedOpsTypes: \" + str(specified_groups)\n if id_mapping_file:\n print \"id_mapping_file: \" + str(id_mapping_file)\n \n \n # Check if specified content folder exists.\n if not val_arg_content_path(contentpath):\n print \"Parameter <ContentFolderPath>: folder '\" + contentpath + \"' does not exist.\"\n sys.exit(1)\n \n # Check if specified users are valid\n users = val_arg_users(specified_users, contentpath)\n \n if DEBUG:\n print \"Users to publish: \" + str(users.keys())\n \n # Check if specified id mapping file exists\n if id_mapping_file:\n if not os.path.exists(id_mapping_file):\n print \"Parameter {IdMappingFile}: folder '\" + id_mapping_file + \"' does not exist.\"\n \n # Extract target ArcGIS Server hostname from target portal URL;\n # NOTE: this script assumes that the ArcGIS Server is installed\n # on the same machine as Portal for ArcGIS\n new_hostname = parse_hostname(target_portal_address)\n hostname_map = {source_hostname: new_hostname}\n \n # Publish content to target portal\n publish_portal(target_portal_address, contentpath, adminuser, adminpassword, users, hostname_map, specified_groups, id_mapping_file)\n \n os.chdir(contentpath)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def print_script_header(portal, portal_processing, users, specified_groups):\n print titleBreak\n print \" Portal Content \" + portal_processing\n print titleBreak\n print \"Processing type: \\t\\t\\t\" + portal_processing\n print \"Portal URL: \\t\\t\\t\\t\" + portal.url\n print \"Signed in as: \\t\\t\\t\\t\" + portal.logged_in_user()['username'] + \" (Role: \" + portal.logged_in_user()['role'] + \")\"\n print \"Posting content for users: \\t\\t\" + str(users.keys())\n print \"Posting items shared with the following groups:\"\n print str(specified_groups)", "metadata": "root.print_script_header", "header": "['module', '___EOS___']", "index": 182 }, { "content": "def publish_portal(portaladdress,contentpath,adminuser,adminpassword, users, hostname_map, specified_groups, id_mapping_file):\n os.chdir(contentpath)\n \n portal_properties = json.load(open(\"portal_properties.json\"))\n portaladmin = Portal(portaladdress, adminuser, adminpassword)\n \n print_script_header(portaladmin, portal_processing, users, specified_groups)\n\n # Create Portal log folder for this portal\n portalLogPath = os.path.join(contentpath, portalLogFolder, get_servername_from_url(portaladmin.url))\n makeFolder(portalLogPath)\n \n # ------------------------------------------------------------------------\n # Get info about the groups on disk to filter items based on group membership\n # ------------------------------------------------------------------------\n # Get the groups on disk\n grps_on_disk = get_groups_on_disk(contentpath)\n \n # Validate that each specified group is valid\n if specified_groups:\n invalid_specified_groups = []\n for specified_group in specified_groups:\n found = False\n for grp in grps_on_disk.itervalues():\n if specified_group == grp:\n found = True\n if not found:\n invalid_specified_groups.append(specified_group)\n \n if len(invalid_specified_groups) > 0:\n print '\\n***ERROR: the following specified groups do not exist; NOTE: group owner and group title must match exactly including case:\\n'\n print invalid_specified_groups\n return\n \n # ------------------------------------------------------------------------\n # Create users\n # ------------------------------------------------------------------------\n print titleBreak\n print 'Create users...\\n'\n \n # Only create users if this is not an online organization\n if portaladmin.properties()['id'] == '0123456789ABCDEF': # All portals have this id.\n for username, userinfo in users.iteritems():\n create_user(portaladmin, contentpath, userinfo)\n else:\n print '\\tThis is an online organization. Users must already have been created.'\n\n # ------------------------------------------------------------------------\n # Create user folders\n # ------------------------------------------------------------------------\n print '\\n'+ titleBreak\n print 'Create user folders...\\n'\n \n for username, userinfo in users.iteritems():\n print '\\nUser: ' + userinfo['target_username']\n create_user_folders(portaladmin, contentpath, userinfo)\n\n # ------------------------------------------------------------------------\n # Create groups and add users to groups\n # ------------------------------------------------------------------------\n print \"\\n\" + titleBreak\n print \"Creating groups ...\\n\"\n \n oldGrpID_newGrpID = {}\n for username, userinfo in users.iteritems():\n newGroups = publish_user_groups(portaladmin, contentpath, userinfo, users)\n \n for key,val in newGroups.iteritems():\n oldGrpID_newGrpID[key] = {'id': val}\n \n # ------------------------------------------------------------------------\n # Publish Items and Update their sharing info\n # ------------------------------------------------------------------------\n print \"\\n\" + titleBreak\n print \"Publishing items and setting sharing ...\"\n print titleBreak\n \n for username, userinfo in users.iteritems():\n \n username = userinfo['target_username']\n password = userinfo['target_password']\n userfoldername = userinfo['username']\n \n # ---------------------------------------\n # Publish all the users' items\n # ---------------------------------------\n usercontentpath = os.path.join(contentpath, userfoldername)\n \n newItems, origItemSourceIDs = publish_user_items(portaladmin, username, usercontentpath, source_hostname,\n new_hostname, new_port, specified_groups, id_mapping_file, grps_on_disk)\n \n # Dump info about new items to JSON to use for resetting IDs of related items\n dump_newItem_info(newItems, origItemSourceIDs, os.path.join(portalLogPath, username))\n \n # ---------------------------------------\n # Share the users' items with the\n # appropriate groups\n # ---------------------------------------\n userItemsPath = os.path.join(contentpath, userfoldername, \"items\")\n share_items(portaladmin, userItemsPath, newItems, origItemSourceIDs, originGroupToDestGroups)\n \n \n # Dump info about all items (old, new ids) into json\n os.chdir(portalLogPath)\n json.dump(origIDToNewID, open('oldID_newID.json','w'))\n json.dump(oldGrpID_newGrpID, open('oldGrpID_newGrpID.json', 'w'))\n\n # ------------------------------------------------------------------------\n # Post publishing processing: Update URLs and item ids\n # ------------------------------------------------------------------------\n print \"\\n\" + titleBreak\n print \"Update URLs and Item IDs...\"\n print titleBreak + \"\\n\"\n \n # Add the group ids to the dictionary of old/new ids\n origIDToNewID.update(oldGrpID_newGrpID)\n \n update_post_publish(portaladmin, hostname_map, origIDToNewID)\n\n # Comment out: this functionality is now available out of the box\n # # ------------------------------------------------------------------------\n # # Share items in default web apps template and default gallery\n # # ------------------------------------------------------------------------ \n # # Share the items in the default web apps template and\n # # default gallery template built-in group with the\n # # 'OpsServer' user 'AFMI Web Application Templates' and\n # # 'AFMI Gallery Templates'\n # print \"\\n\" + sectionBreak\n # print \"Share the items in the default web apps and gallery template groups...\"\n # group_owner = 'OpsServer'\n # if users.get(group_owner):\n # share_templates(portaladdress, users[group_owner]['target_username'], users[group_owner]['target_password'])\n # else:\n # print \"-Skipping...user {} was not created. Can perform same operation through portal 'Edit Settings'.\".format(group_owner)\n\n print \"\\nDONE: Finished posting content to portal.\"", "metadata": "root.publish_portal", "header": "['module', '___EOS___']", "index": 195 }, { "content": "def get_groups_on_disk(contentpath):\n groups_on_disk_info = {}\n group_json_files = findFilePath(contentpath, 'group.json', returnFirst=False)\n for group_json_file in group_json_files:\n os.chdir(os.path.dirname(group_json_file))\n group_json = json.load(open('group.json'))\n groups_on_disk_info[group_json['id']] = '{}:{}'.format(group_json['owner'], group_json['title'])\n \n return groups_on_disk_info", "metadata": "root.get_groups_on_disk", "header": "['module', '___EOS___']", "index": 332 }, { "content": "def dump_newItem_info(newItems, origItemSourceIDs, userLogPath):\n # Used for resetting the various ids in 'related' items in target portal\n \n oldID_newItem_JsonFile = \"oldID_newItem.json\"\n oldID_newItem_JsonFilePath = os.path.join(userLogPath, oldID_newItem_JsonFile)\n \n oldID_newID_JsonFile = \"oldID_newID.json\"\n oldID_newID_JsonFilePath = os.path.join(userLogPath, oldID_newID_JsonFile)\n \n # Create user log folder\n makeFolder(userLogPath)\n os.chdir(userLogPath)\n \n # Create dictionary where key is old item id, value is dictionary containing info\n # about new item\n # {\"oldID\": {\"newID\": \"new id value\", \"type\": \"type value, \"owner\": \"owner value\"}}\n oldID_newItem = []\n oldID_newID = {}\n for x in range(0, len(origItemSourceIDs)):\n d = {}\n d_new_info = {}\n \n newID = newItems[x][\"id\"]\n oldID = origItemSourceIDs[x]\n itemType = newItems[x][\"type\"]\n itemOwner = newItems[x][\"owner\"]\n \n d[\"oldID\"] = oldID\n d[\"newItem\"] = newItems[x]\n \n oldID_newItem.append(d)\n \n d_new_info = {\"id\": newID, \"type\": itemType, \"owner\": itemOwner}\n oldID_newID[oldID] = dict(d_new_info)\n \n #Also add to module level dictionary\n origIDToNewID[oldID] = dict(d_new_info)\n \n # Dump info out to JSON files\n json.dump(oldID_newItem, open(oldID_newItem_JsonFile,'w'))\n json.dump(oldID_newID, open(oldID_newID_JsonFile,'w'))\n\n return oldID_newID_JsonFilePath, oldID_newItem_JsonFilePath", "metadata": "root.dump_newItem_info", "header": "['module', '___EOS___']", "index": 344 }, { "content": "def share_items(portal, userItemsPath, newItems, origItemSourceIDs, originGroupToDestGroups):\n #newItems - info on the items that were added to portal\n #origItemSourceIDs - the original source ids of the newItems, order of ids must match\n # order of newItems\n\n print \"Sharing items...\"\n \n for x in range(0, len(origItemSourceIDs)):\n newItem = newItems[x]\n newID = newItem[\"id\"]\n origID = origItemSourceIDs[x]\n\n itemIdfolder = os.path.join(userItemsPath,str(origID))\n \n if not os.path.exists(itemIdfolder):\n continue\n \n # Load sharing json file\n os.chdir(itemIdfolder)\n sharing = json.load(open('sharing.json'))\n \n new_group_ids = []\n new_group_names = []\n everyone = False\n org = False\n \n if sharing:\n #TODO: check if owner belongs to the groups being shared to??\n # swap stored group ids with portal group ids??\n old_group_ids = sharing['groups']\n for g in old_group_ids:\n if g in originGroupToDestGroups.keys():\n new_group_id = originGroupToDestGroups[g]\n new_group_ids.append(new_group_id)\n new_group_names = destGroupID_GroupName[new_group_id] #EL used for display\n \n if len(new_group_ids) == 0:\n new_group_ids = None\n \n print \"\\tSharing item \" + str(newItem.get(\"title\")) + \\\n \"[\" + str(newItem.get(\"type\")) + \"] with: \" + \\\n sharing['access'] + \", \" + str(new_group_names) + \"...\"\n \n if sharing['access'].lower() == \"public\":\n everyone = True\n org = True\n elif sharing['access'].lower() == \"org\":\n everyone = False\n org = True\n \n #TODO: should this function be located outside the if sharing statement...\n resp = portal.share_item(newID, new_group_ids, org, everyone)\n\n else:\n pass # nothing to share??\n del sharing", "metadata": "root.share_items", "header": "['module', '___EOS___']", "index": 388 }, { "content": "def has_user(portaladmin, username):\n ''' Determines if portal already has username '''\n exists = False\n portal_usernames = []\n portal_users = portaladmin.org_users()\n for portal_user in portal_users:\n portal_usernames.append(portal_user['username'])\n \n if username in portal_usernames:\n exists = True\n \n return exists", "metadata": "root.has_user", "header": "['module', '___EOS___']", "index": 445 }, { "content": "def create_user(portaladmin,contentpath,userinfo):\n \n username = userinfo['target_username']\n password = userinfo['target_password']\n userfoldername = userinfo['username']\n\n user_exists = has_user(portaladmin, username)\n \n if not user_exists:\n print ' - Creating user {}...'.format(username)\n # Get user properties from file\n userfolder = os.path.join(contentpath, userfoldername)\n os.chdir(userfolder)\n userproperties = json.load(open(\"userinfo.json\"))\n fullname = userproperties[\"fullName\"]\n role = userproperties[\"role\"]\n email = userproperties[\"email\"]\n \n # Check for null email\n if not email:\n email = username + '@no_email_in_user_profile.org'\n\n # Create user\n portaladmin.signup(username,password,fullname,email)\n \n # Modify user role\n portaladmin.update_user_role(username, role)\n else:\n print ' - User {} already exists.'.format(username)", "metadata": "root.create_user", "header": "['module', '___EOS___']", "index": 458 }, { "content": "def has_folder(portaladmin, username, foldername):\n ''' Determines if folder already exists '''\n exists = False\n portal_folders = []\n for portal_folder in portaladmin.folders(username):\n portal_folders.append(portal_folder['title'])\n \n if foldername in portal_folders:\n exists = True\n \n return exists", "metadata": "root.has_folder", "header": "['module', '___EOS___']", "index": 488 }, { "content": "def create_user_folders(portaladmin, contentpath, userinfo):\n ''' Create user folders '''\n \n if not os.path.exists(os.path.join(contentpath, userinfo['username'], 'folders.json')):\n print ' - No folders to create.'\n else:\n os.chdir(os.path.join(contentpath, userinfo['username']))\n folderinfo = json.load(open('folders.json'))\n for folder in folderinfo:\n foldername = folder[1]\n if not has_folder(portaladmin, userinfo['target_username'], foldername):\n print ' - Creating folder \"{}\"...'.format(foldername)\n portaladmin.create_folder(userinfo['target_username'], foldername)\n else:\n print ' - Folder \"{}\" already exists.'.format(foldername)", "metadata": "root.create_user_folders", "header": "['module', '___EOS___']", "index": 500 }, { "content": "def publish_user_items(portal, username, usercontentpath, old_hostname, new_hostname, new_port, specified_groups, id_mapping_file, grps_on_disk):\n ''' Publish all items for current user '''\n # Returns list of dictionaries of new items as well as a list of the\n # original item ids\n newitems, old_source_ids = [], []\n existing_portal_ids = []\n \n print \"\\n\" + sectionBreak\n print \"Publishing items for user '\" + username + \"'...\\n\"\n \n # Load 'id mapping' file if specified. Since this supports overwrite\n # capability, let's also create a list of all current item ids to verify that item\n # actually exists.\n id_mapping = None\n if id_mapping_file:\n filefolder = os.path.dirname(id_mapping_file)\n filename = os.path.basename(id_mapping_file)\n os.chdir(filefolder)\n id_mapping = json.load(open(filename))\n \n # Create list of existing portal items\n existing_portal_items = portal.search()\n for existing_portal_item in existing_portal_items:\n existing_portal_ids.append(existing_portal_item['id'])\n \n\n item_dirs = os.listdir(os.path.join(usercontentpath,\"items\"))\n \n n = 1\n for item_dir in item_dirs:\n overwrite_id = None\n do_load_item = False\n foldername = None\n \n print \"\\n\\tPublishing item {} ({}/{})...\".format(item_dir, n, len(item_dirs))\n \n if id_mapping:\n overwrite_id = id_mapping.get(item_dir)['id']\n if overwrite_id:\n print \"\\t -Item referenced in id mapping file. Checking if item exists in portal...\"\n if overwrite_id in existing_portal_ids:\n print \"\\t -Item exists in portal. Will update item.\"\n else:\n overwrite_id = None\n print \"*** WARNING: item referenced in id mapping file does NOT exist in portal. Will add new item instead of updating.\"\n \n \n # Determine if item should be loaded base on specified group parameters\n if not specified_groups:\n do_load_item = True\n else:\n os.chdir(os.path.join(usercontentpath,\"items\", item_dir))\n sharing_info = json.load(open('sharing.json'))\n item_groups = sharing_info.get('groups')\n for item_group in item_groups:\n grp_on_disk = grps_on_disk.get(item_group)\n if grp_on_disk:\n for specified_group in specified_groups:\n if specified_group == grp_on_disk:\n do_load_item = True\n\n if not do_load_item:\n print \"\\t -Skipping item. Item groups do not match user specified group criteria.\" \n \n \n # Add/Update item\n if do_load_item:\n \n try:\n item, old_source_id = load_item(portal, os.path.join(usercontentpath,\"items\", item_dir), overwrite_id)\n newitems.append(item)\n old_source_ids.append(old_source_id) \n \n # Reassign item to target owner and folder\n if os.path.exists(os.path.join(usercontentpath, \"folders.json\")):\n os.chdir(usercontentpath)\n foldersinfo = json.load(open('folders.json'))\n foldername = publish_get_folder_name_for_item(item, foldersinfo)\n \n portal.reassign_item(item['id'], username, foldername)\n \n except Exception as err:\n print 'ERROR: Exception on adding/updating item: {}'.format(item_dir)\n \n n = n + 1\n\n return newitems, old_source_ids", "metadata": "root.publish_user_items", "header": "['module', '___EOS___']", "index": 516 }, { "content": "def publish_user_groups(portal,contentpath, userinfo, users):\n \n username = userinfo['target_username']\n password = userinfo['target_password']\n userfoldername = userinfo['username']\n \n groupfolder = os.path.join(contentpath, userfoldername, 'groups')\n groupfolders = os.listdir(groupfolder)\n \n numTotalGroupFolders = len(groupfolders)\n if numTotalGroupFolders == 0:\n print \"\\nUser '{}' does not own any groups.\".format(username)\n else:\n print \"\\nCreating '{}' group(s) for user '{}'...\".format(str(numTotalGroupFolders), username)\n \n groupcount = 0\n groupsprocessed = 0\n groupsFailed = [\"None\"] #TODO: later we append to this list, but why do we initialize\n # list with one element with \"None\" string? Was this supposed to be\n # groupsFailed = []\n for folder in groupfolders:\n groupcount = groupcount + 1\n oldGroupID = folder #was groupID = folder\n groupidfolder = os.path.join(groupfolder, folder)\n os.chdir(groupidfolder)\n group = json.load(open(\"group.json\"))\n group_users = json.load(open(\"group_users.json\"))\n \n # Check if group to add already exists\n groupId = getGroupID(portal, username, str(group['title']))\n \n # Create group if it doesn't exist\n if not groupId:\n print \"... group '\" + str(group['title']) + \"'\"\n groupId = portal.create_group(group,group['thumbfile'])\n # Reassign group\n portal.reassign_group(groupId, username)\n else:\n print \"... group '\" + str(group['title']) + \"' already exists.\"\n \n destGroupID_GroupName[groupId] = str(group['title']) #Track new group id and group name for later use\n \n print \"...... adding users to group\"\n if groupId:\n originGroupToDestGroups[oldGroupID] = groupId\n groups = []\n groups.append(groupId)\n \n # Check if users are in the list we added to the portal\n users_to_invite = []\n portal_users = get_target_users(users)\n for u in map_group_users(group_users[\"users\"], users):\n u = str(u) #dict keys are unicode, make them ascii\n if u in portal_users:\n users_to_invite.append(u)\n \n if len(users_to_invite) != 0:\n print \"......... adding the following users: \" + str(users_to_invite)\n results = portal.add_group_users(users_to_invite, groups)\n else:\n print \"......... no users to add.\"\n groupsprocessed = groupsprocessed + 1\n else:\n groupsFailed.append(groupID) #TODO: we append to this list, but don't use it anywhere.\n os.chdir(groupfolder)\n \n return originGroupToDestGroups", "metadata": "root.publish_user_groups", "header": "['module', '___EOS___']", "index": 604 }, { "content": "def get_target_users(users):\n target_users = []\n for user, userinfo in users.iteritems():\n target_users.append(userinfo['target_username'])\n \n return target_users", "metadata": "root.get_target_users", "header": "['module', '___EOS___']", "index": 672 }, { "content": "def map_group_users(group_users, users):\n target_group_users = []\n for group_user in group_users:\n if group_user in users.keys():\n target_group_users.append(users[group_user]['target_username'])\n return target_group_users", "metadata": "root.map_group_users", "header": "['module', '___EOS___']", "index": 679 }, { "content": "def publish_portal_resources(portaladmin,portal_properties):\n #publish resources from disk\n portalID = portal_properties['id']\n resourcesJSON = json.load(open(os.path.join(contentpath,'resources.json')))\n resourcesList = resourcesJSON['resources']\n \n print \"Posting resources\"\n for rsc in resourcesList:\n key = rsc['key']\n if key != 'accountSettings':\n datafile = os.path.join(contentpath,key)\n resp = portaladmin.add_resource(portalID,key,datafile,None)", "metadata": "root.publish_portal_resources", "header": "['module', '___EOS___']", "index": 686 }, { "content": "def publish_portal_properties(portaladmin,portal_properties,oldHostname,newHostname):\n #update portal properties from old host to new\n \n portalID = portal_properties['id']\n resp = portaladmin.publish_portal_properties(portalID,portal_properties,oldHostname,newHostname)\n if resp['success'] == True:\n print \"Portal properties updated.\"\n else:\n print \"Error updating portal properties\"", "metadata": "root.publish_portal_properties", "header": "['module', '___EOS___']", "index": 699 }, { "content": "def get_servername_from_url(url):\n '''Get servername from url'''\n p = urlparse.urlparse(url)\n return p.hostname", "metadata": "root.get_servername_from_url", "header": "['module', '___EOS___']", "index": 709 }, { "content": "def publish_get_folder_name_for_item(item, folders):\n '''Return the folder name the specific item is in'''\n folderName = None\n \n ownerFolderID = item.get('ownerFolder') #Make sure to use .get, which will\n #return None if key does not exist.\n \n if ownerFolderID is not None and ownerFolderID <> 'null':\n # We now have the ID of the folder so examine the folder json\n # and determine the folder name for this folder ID\n \n # Example [[\"e1363455dd044ab384995218fe3386bb\", \"folder_1\", [{\"avgRating\": 0.0,...\n # element 0 is folderID, element 1 is folder name\n for folder in folders:\n folderID = folder[0]\n if folderID == ownerFolderID:\n folderName = folder[1]\n \n return folderName", "metadata": "root.publish_get_folder_name_for_item", "header": "['module', '___EOS___']", "index": 714 }, { "content": "def update_post_publish(portal, hostname_map, id_map):\n '''Replace server name and update item IDs referenced in items'''\n\n # Return all portal items\n items = portal.search()\n \n for item in items:\n \n print_item_info(item)\n \n # Replace host name/item ids in item json properties\n update_item_properties(portal, item, hostname_map, id_map)\n \n # Replace host name/item ids in item \"data\"\n update_item_data(portal, item, hostname_map, id_map)", "metadata": "root.update_post_publish", "header": "['module', '___EOS___']", "index": 734 }, { "content": "def update_item_properties(portal, item, hostname_map, id_map):\n '''Replace host name/item ids in item json properties'''\n \n jsonPropsToUpdate = ['description', 'snippet', 'accessInformation', 'licenseInfo', 'url']\n for jsonProp in jsonPropsToUpdate:\n is_updated = False\n propertyValue = item.get(jsonProp)\n if propertyValue:\n for host in hostname_map:\n search_str_list = [host, host.lower(), host.upper()]\n for search_str in search_str_list:\n if propertyValue.find(search_str) > -1:\n propertyValue = propertyValue.replace(search_str, hostname_map[host])\n is_updated = True\n \n for item_id in id_map:\n search_str_list = [item_id, item_id.lower(), item_id.upper()]\n for search_str in search_str_list:\n if propertyValue.find(search_str) > -1:\n propertyValue = propertyValue.replace(search_str, id_map[item_id][\"id\"])\n is_updated = True\n \n if is_updated:\n portal.update_item(item['id'], {jsonProp: propertyValue}) ", "metadata": "root.update_item_properties", "header": "['module', '___EOS___']", "index": 750 }, { "content": "def update_item_data(portal, item, hostname_map, id_map):\n '''Replace host name/item ids in item data'''\n\n if item['type'] in TEXT_BASED_ITEM_TYPES:\n \n try:\n itemdata = portal.item_data(item['id'])\n except Exception as err:\n print('ERROR: Exception: update_item_data function could not get item data for item: \"{}\"'.format(str(item.get('title'))))\n itemdata = None\n \n if itemdata:\n \n is_updated = False\n \n for host in hostname_map:\n search_str_list = [host, host.lower(), host.upper()]\n for search_str in search_str_list:\n if itemdata.find(search_str) > -1:\n itemdata = itemdata.replace(search_str, hostname_map[host])\n is_updated = True\n\n for item_id in id_map:\n search_str_list = [item_id, item_id.lower(), item_id.upper()]\n for search_str in search_str_list:\n if itemdata.find(search_str) > -1:\n itemdata = itemdata.replace(search_str, id_map[item_id][\"id\"])\n is_updated = True\n \n if is_updated:\n portal.update_item(item['id'], {'text': itemdata}) \n\n if item['type'] == 'CSV':\n update_csv_item(portal, item, hostname_map)", "metadata": "root.update_item_data", "header": "['module', '___EOS___']", "index": 775 }, { "content": "def update_csv_item(portal, item, hostname_map):\n ''' Update URLs in CSV item '''\n \n # Download file from portal\n filePath = portal.item_datad(item['id'])\n \n # Determine if file has the search string and perform replace\n is_updated = False\n for host in hostname_map:\n search_str_list = [host, host.lower(), host.upper()]\n for search_str in search_str_list:\n if findInFile(filePath, search_str):\n editFiles([filePath], search_str, hostname_map[host])\n is_updated = True\n \n # Upload the updated file back to the portal item\n if is_updated:\n portal.update_item(item['id'], None, filePath)\n \n # Delete the downloaded file\n if os.path.exists(filePath):\n os.remove(filePath)", "metadata": "root.update_csv_item", "header": "['module', '___EOS___']", "index": 810 }, { "content": "def print_item_info(item):\n itemID = item.get('id')\n itemTitle = item.get('title')\n itemOwner = item.get('owner')\n itemType = item.get('type')\n print \"\\tId: \" + str(itemID) + \"\\tTitle: '\" + str(itemTitle) + \"' (\" + str(itemType) + \"), Owner: '\" + str(itemOwner) + \"'\\n\"", "metadata": "root.print_item_info", "header": "['module', '___EOS___']", "index": 833 }, { "content": "def makeFolder(folderPath):\n '''Create folder'''\n if not os.path.exists(folderPath):\n os.makedirs(folderPath)", "metadata": "root.makeFolder", "header": "['module', '___EOS___']", "index": 840 }, { "content": "def val_arg_content_path(contentpath):\n '''Validate the content path script argument parameter'''\n is_valid = False\n if os.path.exists(contentpath):\n if os.path.isdir(contentpath):\n is_valid = True\n return is_valid", "metadata": "root.val_arg_content_path", "header": "['module', '___EOS___']", "index": 845 }, { "content": "def read_userfile(contentpath):\n # Create dictionary of users based on contents of userfile.txt file.\n # The \"userfile.txt\" file contains user name from source portal,\n # user name for target portal and the password for the target user name\n all_users = {}\n userfile = open(os.path.join(contentpath,'userfile.txt'),'r')\n lineOne = True\n for line in userfile:\n # Skip the header info line\n if lineOne:\n lineOne = False\n continue\n username,target_username,target_password = line.rstrip().split(',')\n \n all_users[username] = {'username': username,\n 'target_username': target_username,\n 'target_password': target_password}\n userfile.close()\n \n return all_users", "metadata": "root.read_userfile", "header": "['module', '___EOS___']", "index": 853 }, { "content": "def val_arg_users(specified_users, contentpath):\n values_to_use = {} # Contains users that that will be published\n exclude_users_list = [] # Contains users that should be excluded from publishing\n include_users_list = []\n \n if not specified_users:\n specified_users = \"\"\n else:\n specified_users = specified_users.strip()\n \n all_users = read_userfile(contentpath)\n \n # if there are no specified users then we should post content for\n # all users so return dictionary of all users\n if len(specified_users) == 0:\n return all_users\n \n elif specified_users == \"#\":\n return all_users\n \n elif specified_users.find(\"-\") == 0:\n values_to_use = all_users.copy()\n exclude_users = specified_users.replace(\"-\",\"\",1)\n exclude_users_list = [element.lower().strip() for element in exclude_users.split(\",\")]\n for exclude_user in exclude_users_list:\n for user in all_users:\n if exclude_user == user.lower():\n # Remove the user from the dictionary\n del values_to_use[user]\n return values_to_use \n \n else:\n # keep the users that were specified\n include_users_list = [element.lower().strip() for element in specified_users.split(\",\")]\n for include_user in include_users_list:\n for user in all_users:\n if include_user == user.lower():\n #add to dictionary\n values_to_use[user] = all_users[user] \n return values_to_use", "metadata": "root.val_arg_users", "header": "['module', '___EOS___']", "index": 874 }, { "content": "def share_templates(portaladdress, username, password):\n \n # Create portal connection\n portal = Portal(portaladdress, username, password)\n \n print '\\nShare web app templates with \"AFMI Web Application Templates\" group...'\n results = share_default_webapp_templates(portal, portal.logged_in_user()['username'], 'AFMI Web Application Templates')\n if results['success']:\n print '\\tDone.'\n else:\n print 'ERROR: {}'.format(results['message'])\n \n print '\\nShare web app templates with \"AFMI Gallery Templates\" group...'\n results = share_default_gallery_templates(portal, portal.logged_in_user()['username'], 'AFMI Gallery Templates')\n if results['success']:\n print '\\tDone.'\n else:\n print 'ERROR: {}'.format(results['message']) ", "metadata": "root.share_templates", "header": "['module', '___EOS___']", "index": 915 }, { "content": "def share_default_gallery_templates(portal, groupOwner, groupTitle):\n func_results = {'success': True}\n \n templateType = 'GALLERY'\n results = share_default_templates(portal, templateType, groupOwner, groupTitle)\n if not results['success']:\n func_results['success'] = results['success']\n func_results['message'] = results['message']\n \n return func_results", "metadata": "root.share_default_gallery_templates", "header": "['module', '___EOS___']", "index": 934 }, { "content": "def share_default_webapp_templates(portal, groupOwner, groupTitle):\n func_results = {'success': True}\n \n templateType = 'WEBAPPS'\n results = share_default_templates(portal, templateType, groupOwner, groupTitle)\n if not results['success']:\n func_results['success'] = results['success']\n func_results['message'] = results['message']\n \n return func_results", "metadata": "root.share_default_webapp_templates", "header": "['module', '___EOS___']", "index": 945 }, { "content": "def share_default_templates(portal, templateType, groupOwner, groupTitle):\n func_results = {'success': True}\n \n # Get a list of template ids for items shared with the \"default\" template group\n printStatement = '\\t-Retrieving list of items in default {} group...'\n \n if templateType == 'WEBAPPS':\n \n templateTypeStr = 'web app templates'\n print printStatement.format(templateTypeStr)\n templateIDs = unpack(portal.webmap_templates(['id']))\n \n elif templateType == 'GALLERY':\n \n templateTypeStr = 'gallery templates'\n print printStatement.format(templateTypeStr)\n templateIDs = unpack(portal.gallery_templates(['id']))\n \n else:\n # Template type value is invalid\n func_results['success'] = False\n func_results['message'] = 'Invalid templateType value \"{}\"; must be WEBAPPS or GALLERY.'.format(templateType)\n return func_results\n \n if not templateIDs:\n func_results['success'] = False\n func_results['message'] = '{} portal property not set to use \"Default\" group.'.format(templateTypeStr.capitalize())\n return func_results\n \n # Get the group id for the group to share the template items\n groupID = getGroupID(portal, groupOwner, groupTitle)\n \n if not groupID:\n func_results['success'] = False\n func_results['message'] = 'Could not find group where owner = \"{}\" and title = \"{}\"'.format(groupOwner, groupTitle)\n return func_results\n \n # Share templates with group\n print '\\t-Sharing web templates with group {} ({})...'.format(groupTitle, groupOwner)\n results = share_template_items(portal, templateIDs, [groupID])\n if not results['success']:\n func_results['success'] = False\n print results['message']\n \n return func_results", "metadata": "root.share_default_templates", "header": "['module', '___EOS___']", "index": 956 }, { "content": "def getGroupID(portal, owner, title):\n # Return id for group owned by 'owner' with title = specified title\n groupID = None\n groups = portal.user(owner)['groups']\n if groups:\n for group in groups:\n if group['title'] == title:\n groupID = group['id']\n \n return groupID", "metadata": "root.getGroupID", "header": "['module', '___EOS___']", "index": 1002 }, { "content": "def share_template_items(portal, item_ids, group_ids):\n func_results = {'success': True}\n errList = []\n for item_id in item_ids:\n results = portal.share_item(item_id, group_ids)\n if len(results['notSharedWith']) > 0:\n errList.append(results)\n \n if len(errList) > 0:\n func_results['success'] = False\n func_results['message'] = errList\n \n return func_results", "metadata": "root.share_template_items", "header": "['module', '___EOS___']", "index": 1013 }, { "content": "def tags_exist(find_tags, tags_to_search):\n '''Determines if specific \"OpsServer\" values exist in list of tags'''\n found = False\n \n DEBUG = False\n \n # Create list of possible \"OpsServer\" type tag prefixes; i.e. in case someone didn't\n # specify the correct prefix.\n ops_type_flags = [\"opsserver\", \"opsservers\", \"opserver\", \"opservers\", \"opssrver\", \"opssrvr\"]\n \n # Convert find_tags to lower case and remove and leading/trailing spaces\n find_tags_mod = [element.lower().strip().encode(\"ascii\") for element in list(find_tags)]\n \n # Convert tags_to_search to lower case and remove and leading/trailing spaces\n tags_to_search_mod = [element.lower().strip().encode(\"ascii\") for element in list(tags_to_search)]\n \n if DEBUG:\n print \"In tags_exist function: \"\n print \"\\tfind_tags_mod: \" + str(find_tags_mod)\n print \"\\ttags_to_search_mod: \" + str(tags_to_search_mod)\n print \"\\tops_type_flags: \" + str(ops_type_flags)\n \n # Loop through tags to search and look for the find tags\n for search in tags_to_search_mod:\n search = search.replace(\" \",\"\")\n \n if DEBUG:\n print \"\\tsearch: \" + search\n \n if search.find(\":\") > -1:\n \n if DEBUG:\n print \"\\tI'm in the find : if statement\"\n \n element1 = search.split(\":\")[0]\n element2 = search.split(\":\")[1]\n \n if DEBUG:\n print \"\\t\\telement1: \" + element1\n print \"\\t\\telement2: \" + element2\n \n if element1 in ops_type_flags:\n if element2 in find_tags_mod:\n found = True\n \n if DEBUG:\n print \"\\tfound: \" + str(found)\n \n return found", "metadata": "root.tags_exist", "header": "['module', '___EOS___']", "index": 1027 } ]
[ { "span": "import portalpy", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 15 }, { "span": "import types", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 12 }, { "span": "import shutil", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 13 }, { "span": "from portalpy import Portal, parse_hostname, portal_time, WebMap, normalize_url, unpack, TEXT_BASED_ITEM_TYPES", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 110 }, { "span": "from portalpy.provision import load_items, load_item", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 52 }, { "span": "import copy", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Es", "ri_", "\\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_", "#", "Name", ":", " ", " ", "Porta", "l", "Conten", "t", "Post", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pur", "pose", ":", " ", " ", " ", "Publish", "es", " ", "portal", " ", "content", " ", "tha", "t", " ", "was", " ", "extracted", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Porta", "l", "Conten", "t", "Extract", ".", "py", " ", "script", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "\"", "Roo", "t", " ", "folder", "\"\\\\", "Supp", "ort", "Files", " ", "to", " ", "sys", " ", "path", " ", "inor", "der", " ", "to", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "module", "s", " ", "in", " ", "subfolder", "_", "\\u\\u\\uNL\\u\\u\\u_", "support", "Files", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", ")_", ")_", ",_", "\"", "Supp", "ort", "Files", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "support", "Files", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "portal", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "portal", "py_", "import_", "Porta", "l_", ",_", "parse", "\\u", "hostname_", ",_", "portal", "\\u", "time_", ",_", "Web", "Map_", ",_", "normali", "ze", "\\u", "url_", ",_", "unpack_", ",_", "TEXT", "\\u", "BASED", "\\u", "ITEM", "\\u", "TYPES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "portal", "py_", "._", "provision", "_", "import_", "load", "\\u", "items_", ",_", "load", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Utilities_", "import_", "find", "In", "File_", ",_", "edit", "Files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Utilities_", "import_", "find", "File", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "now", " ", "hard", "-", "code", " ", "the", " ", "server", " ", "name", " ", "of", " ", "the", " ", "source", " ", "Arc", "GI", "S", " ", "Server", " ", "machine_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "hostname_", "=_", "\"", "my", "\\u", "source", "\\u", "portal", ".", "domain", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "hostname_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "port_", "=_", "None_", "#", "Us", "e", " ", "608", "0", " ", "or", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host", "name", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title", "Break", "_", "=_", "\"====", "==============", "==============", "==============", "==============", "==============", "=========", "==\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section", "Break", "_", "=_", "\"-------", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section", "Break", "2_", "=_", "\"-------", "-------------", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "processing_", "=_", "\"", "POST", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "Log", "Folder_", "=_", "\"", "Porta", "l", "Post", "Log", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "track", " ", "store", "d", " ", "ID", "s", " ", "to", " ", "new", " ", "ID", "s", " ", "whe", "n", " ", "posting", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "in", "Group", "To", "Dest", "Groups_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "EL", " ", "track", " ", "new", " ", "group", " ", "id", " ", "and", " ", "the", " ", "group", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "Group", "ID", "\\u", "Group", "Name_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "e", " ", "original", " ", "item", " ", "id", " ", "and", " ", "new", " ", "item", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "ID", "To", "New", "ID_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "POST_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script", "Name_", "=_", "sys_", "._", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "specified", "\\u", "users_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "specified", "\\u", "ops", "\\u", "types", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "specified", "\\u", "groups_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "mapping", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "<_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "'_", "+_", "script", "Name_", "+_", "'", " ", "<", "Porta", "l", "URL", ">", " ", "<", "Admi", "n", "User", ">", " ", "<", "Admi", "n", "Passw", "ord", ">", " ", "'_", "+_", "'<", "Conten", "t", "Fold", "er", "Path", ">", " ", "{", "User", "s", "To", "Post", "}", " ", "{", "Group", "s", "To", "Post", "}", " ", "{", "Id", "Map", "ping", "File", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "Whe", "re", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Porta", "l", "URL", ">", " ", "(", "require", "d", "):", " ", "URL", " ", "of", " ", "Porta", "l", " ", "to", " ", "post", " ", "content", " ", "(", "i", ".", "e", ".", " ", "https", "://", "full", "y", "\\u", "qualified", "\\u", "domain", "\\u", "name", "/", "arc", "gi", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Admi", "n", "User", ">", " ", "(", "require", "d", "):", " ", "Porta", "l", " ", "user", " ", "tha", "t", " ", "has", " ", "administrat", "or", " ", "role", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Admi", "n", "Passw", "ord", ">", " ", "(", "require", "d", "):", " ", "Passw", "ord", " ", "for", " ", "Admi", "n", "User", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "<", "Conten", "t", "Fold", "er", "Path", ">", " ", "(", "require", "d", "):", " ", "Fold", "er", " ", "path", " ", "contain", "ing", " ", "portal", " ", "content", " ", "to", " ", "post", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "{", "User", "s", "To", "Post", "}", " ", "(", "option", "al", "):'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "By", " ", "default", ",", " ", "content", " ", "for", " ", "all", " ", "users", " ", "is", " ", "poste", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "Speci", "fy", " ", "#", " ", "placehold", "er", " ", "character", " ", "if", " ", "you", " ", "want", " ", "to", " ", "post", " ", "content", " ", "for", " ", "all", " ", "users", " ", "and", " ", "you", " ", "are", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", " ", " ", " ", "speci", "fy", "ing", " ", "{", "Group", "s", "To", "Post", "}", " ", "values", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "To", " ", "post", " ", "content", " ", "for", " ", "only", " ", "specific", " ", "users", " ", "speci", "fy", " ", "comma", " ", "delim", "ited", " ", "list", " ", "of", " ", "users", ",", " ", "i", ".", "e", ".", " ", "user", "1", ",", "user", "2", ",...", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "To", " ", "post", " ", "content", " ", "for", " ", "ALL", " ", "users", " ", "except", " ", "specific", " ", "users", ",", " ", "speci", "fy", " ", "comma", " ", "delim", "ited", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", " ", " ", " ", "list", " ", "of", " ", "users", " ", "to", " ", "exclu", "de", " ", "with", " ", "\"-", "\"", " ", "prefix", ",", " ", "i", ".", "e", ".", " ", "-", "user", "1", ",", "user", "2", ",...", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "NOTE", ":", " ", "User", "s", " ", "names", " ", "must", " ", "match", " ", "the", " ", "\"", "Sou", "rce", "User", "Name", "\"", " ", "values", " ", "in", " ", "the", " ", "<", "Conten", "t", "Fold", "er", "Path", ">\\\\", "user", "file", ".", "txt", " ", "file", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "{", "Group", "s", "To", "Post", "}", " ", "(", "option", "al", "):'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "To", " ", "post", " ", "content", " ", "shared", " ", "with", " ", "specific", " ", "portal", " ", "group", "s", " ", "speci", "fy", " ", "a", " ", "pipe", " ", "\"|", "\"", " ", "delim", "ited", " ", "list", " ", "of", " ", "group", "s", " ", "usi", "ng", " ", "the", " ", "synta", "x", " ", "\"", "Group", "Owne", "r", ":", "Group", "Tit", "le", "|", "Group", "Owne", "r", ":", "Group", "Tit", "le", "|.", "..", "\".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "Speci", "fy", " ", "#", " ", "placehold", "er", " ", "character", " ", "if", " ", "you", " ", "do", " ", "not", " ", "want", " ", "to", " ", "use", " ", "this", " ", "parameter", " ", "and", " ", "need", " ", "to", " ", "speci", "fy", " ", "the", " ", "{", "Id", "Map", "ping", "File", "}", " ", "parameter", " ", "value", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "NOTE", ":", " ", "Group", "Owne", "r", " ", "and", " ", "Group", "Tit", "le", " ", "values", " ", "are", " ", "case", " ", "sensi", "tiv", "e", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "NOTE", ":", " ", "Parameter", " ", "value", " ", "MUS", "T", " ", "be", " ", "surround", "ed", " ", "by", " ", "double", "-", "quote", "s", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "{", "Id", "Map", "ping", "File", "}", " ", "(", "option", "al", "):", " ", "JSO", "N", " ", "file", " ", "contain", "ing", " ", "mapping", " ", "bet", "ween", " ", "source", " ", "and", " ", "target", " ", "portal", " ", "item", " ", "ids", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "-", "Prov", "ides", " ", "\"", "overwrit", "e", "\"", " ", "capab", "ilit", "y", ".", " ", "If", " ", "Id", "Map", "ping", "File", " ", "is", " ", "specified", ",", " ", "the", " ", "script", " ", "will", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", " ", " ", " ", "update", " ", "any", " ", "item", " ", "tha", "t", " ", "alr", "ead", "y", " ", "exist", "s", ";", " ", "items", " ", "tha", "t", " ", "do", " ", "not", " ", "exist", " ", "will", " ", "be", " ", "adde", "d", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "NOTE", "S", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "(", "1", ")", " ", "To", " ", "include", " ", "space", "s", " ", "in", " ", "any", " ", "of", " ", "the", " ", "parameter", " ", "lists", ",", " ", "surround", " ", "the", " ", "list", " ", "with", " ", "double", "-", "quote", "s", ",'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", " ", "i", ".", "e", ".,", " ", "\"", "value", "1", ",", " ", "value", "2", ",", " ", "...\"", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "\\\\", "t", "\\\\", "t", "(", "2", ")", " ", "Replace", "ment", " ", "of", " ", "portal", " ", "item", " ", "URL", "s", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", "-", "Thi", "s", " ", "script", " ", "will", " ", "replace", " ", "the", " ", "host", " ", "names", " ", "in", " ", "URL", "s", " ", "in", " ", "service", ",", " ", "webm", "ap", " ", "and", " ", "operati", "on", " ", "view", " ", "items", ";", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", " ", "the", " ", "script", " ", "is", " ", "hard", "code", "d", " ", "to", " ", "replace", " ", "the", " ", "source", " ", "host", "name", " ", "\"'_", "+_", "source", "\\u", "hostname_", "+_", "'\"", " ", "with", " ", "the", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", " ", "host", "name", " ", "of", " ", "the", " ", "target", " ", "portal", " ", "server", " ", "<", "Porta", "l", "URL", ">", ";", " ", "i", ".", "e", ".,", " ", "this", " ", "script", " ", "assume", "s", " ", "tha", "t", " ", "the", " ", "target", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'\\\\", "t", "\\\\", "t", "\\\\", "t", " ", "Arc", "GI", "S", " ", "Server", " ", "is", " ", "install", "ed", " ", "on", " ", "the", " ", "target", " ", "portal", " ", "machine", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "variab", "les", " ", "from", " ", "script", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "\\u", "portal", "\\u", "address_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "user_", "=_", "sys_", "._", "argv_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "password_", "=_", "sys_", "._", "argv_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "path_", "=_", "sys_", "._", "argv_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "specified", "\\u", "users_", "=_", "sys_", "._", "argv_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "specified", "\\u", "groups_", "=_", "sys_", "._", "argv_", "[_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "specified", "\\u", "groups_", "=_", "[_", "group_", "._", "strip_", "(_", ")_", "for_", "group_", "in_", "specified", "\\u", "groups_", "._", "split_", "(_", "'|'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id", "\\u", "mapping", "\\u", "file_", "=_", "sys_", "._", "argv_", "[_", "7_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "You", " ", "enter", "ed", " ", "too", " ", "many", " ", "script", " ", "parameter", "s", ".\"_", "\\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_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "target", "\\u", "portal", "\\u", "address", ":", " ", "\"_", "+_", "str_", "(_", "target", "\\u", "portal", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "admin", "user", ":", " ", "\"_", "+_", "str_", "(_", "admin", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "admin", "password", ":", " ", "\"_", "+_", "str_", "(_", "admin", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "content", "path", ":", " ", "\"_", "+_", "str_", "(_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "specified", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "specified", "User", "s", ":", " ", "\"_", "+_", "str_", "(_", "specified", "\\u", "users_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "specified", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "specified", "Op", "s", "Type", "s", ":", " ", "\"_", "+_", "str_", "(_", "specified", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "id", "\\u", "mapping", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "id", "\\u", "mapping", "\\u", "file", ":", " ", "\"_", "+_", "str_", "(_", "id", "\\u", "mapping", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "specified", " ", "content", " ", "folder", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "val", "\\u", "arg", "\\u", "content", "\\u", "path_", "(_", "content", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Parameter", " ", "<", "Conten", "t", "Fold", "er", "Path", ">:", " ", "folder", " ", "'\"_", "+_", "content", "path_", "+_", "\"'", " ", "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_", "#", " ", "Check", " ", "if", " ", "specified", " ", "users", " ", "are", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "users_", "=_", "val", "\\u", "arg", "\\u", "users_", "(_", "specified", "\\u", "users_", ",_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "User", "s", " ", "to", " ", "publi", "sh", ":", " ", "\"_", "+_", "str_", "(_", "users_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "specified", " ", "id", " ", "mapping", " ", "file", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "id", "\\u", "mapping", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "id", "\\u", "mapping", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Parameter", " ", "{", "Id", "Map", "ping", "File", "}:", " ", "folder", " ", "'\"_", "+_", "id", "\\u", "mapping", "\\u", "file_", "+_", "\"'", " ", "doe", "s", " ", "not", " ", "exist", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extract", " ", "target", " ", "Arc", "GI", "S", " ", "Server", " ", "host", "name", " ", "from", " ", "target", " ", "portal", " ", "URL", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "this", " ", "script", " ", "assume", "s", " ", "tha", "t", " ", "the", " ", "Arc", "GI", "S", " ", "Server", " ", "is", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "the", " ", "same", " ", "machine", " ", "as", " ", "Porta", "l", " ", "for", " ", "Arc", "GI", "S_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "hostname_", "=_", "parse", "\\u", "hostname_", "(_", "target", "\\u", "portal", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "name", "\\u", "map_", "=_", "{_", "source", "\\u", "hostname_", ":_", "new", "\\u", "hostname_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Publish", " ", "content", " ", "to", " ", "target", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "publi", "sh", "\\u", "portal_", "(_", "target", "\\u", "portal", "\\u", "address_", ",_", "content", "path_", ",_", "admin", "user_", ",_", "admin", "password_", ",_", "users_", ",_", "host", "name", "\\u", "map_", ",_", "specified", "\\u", "groups_", ",_", "id", "\\u", "mapping", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "script", "\\u", "header_", "(_", "portal_", ",_", "portal", "\\u", "processing_", ",_", "users_", ",_", "specified", "\\u", "groups_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", " ", "Porta", "l", " ", "Conten", "t", " ", "\"_", "+_", "portal", "\\u", "processing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Process", "ing", " ", "type", ":", " ", "\\\\", "t", "\\\\", "t", "\\\\", "t", "\"_", "+_", "portal", "\\u", "processing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Porta", "l", " ", "URL", ":", " ", "\\\\", "t", "\\\\", "t", "\\\\", "t", "\\\\", "t", "\"_", "+_", "portal_", "._", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Signe", "d", " ", "in", " ", "as", ":", " ", "\\\\", "t", "\\\\", "t", "\\\\", "t", "\\\\", "t", "\"_", "+_", "portal_", "._", "logged", "\\u", "in", "\\u", "user_", "(_", ")_", "[_", "'", "user", "name", "'_", "]_", "+_", "\"", " ", "(", "Ro", "le", ":", " ", "\"_", "+_", "portal_", "._", "logged", "\\u", "in", "\\u", "user_", "(_", ")_", "[_", "'", "role", "'_", "]_", "+_", "\")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Post", "ing", " ", "content", " ", "for", " ", "users", ":", " ", "\\\\", "t", "\\\\", "t", "\"_", "+_", "str_", "(_", "users_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Post", "ing", " ", "items", " ", "shared", " ", "with", " ", "the", " ", "follow", "ing", " ", "group", "s", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "str_", "(_", "specified", "\\u", "groups_", ")_", "\\u\\u\\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_", "publi", "sh", "\\u", "portal_", "(_", "portal", "address_", ",_", "content", "path_", ",_", "admin", "user_", ",_", "admin", "password_", ",_", "users_", ",_", "host", "name", "\\u", "map_", ",_", "specified", "\\u", "groups_", ",_", "id", "\\u", "mapping", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "portal", "\\u", "properties_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "\"", "portal", "\\u", "proper", "ties", ".", "json", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "admin_", "=_", "Porta", "l_", "(_", "portal", "address_", ",_", "admin", "user_", ",_", "admin", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print", "\\u", "script", "\\u", "header_", "(_", "portal", "admin_", ",_", "portal", "\\u", "processing_", ",_", "users_", ",_", "specified", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "Porta", "l", " ", "log", " ", "folder", " ", "for", " ", "this", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "portal", "Log", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "portal", "Log", "Folder_", ",_", "get", "\\u", "server", "name", "\\u", "from", "\\u", "url_", "(_", "portal", "admin_", "._", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "Folder_", "(_", "portal", "Log", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "info", " ", "abo", "ut", " ", "the", " ", "group", "s", " ", "on", " ", "disk", " ", "to", " ", "filter", " ", "items", " ", "based", " ", "on", " ", "group", " ", "membership_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "group", "s", " ", "on", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "grp", "s", "\\u", "on", "\\u", "disk_", "=_", "get", "\\u", "group", "s", "\\u", "on", "\\u", "disk_", "(_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "tha", "t", " ", "each", " ", "specified", " ", "group", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "specified", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invalid", "\\u", "specified", "\\u", "groups_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "specified", "\\u", "group_", "in_", "specified", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "grp_", "in_", "grp", "s", "\\u", "on", "\\u", "disk_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "specified", "\\u", "group_", "==_", "grp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invalid", "\\u", "specified", "\\u", "groups_", "._", "append_", "(_", "specified", "\\u", "group_", ")_", "\\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_", "(_", "invalid", "\\u", "specified", "\\u", "groups_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "***", "ERROR", ":", " ", "the", " ", "follow", "ing", " ", "specified", " ", "group", "s", " ", "do", " ", "not", " ", "exist", ";", " ", "NOTE", ":", " ", "group", " ", "owner", " ", "and", " ", "group", " ", "title", " ", "must", " ", "match", " ", "exact", "ly", " ", "inclu", "ding", " ", "case", ":\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "invalid", "\\u", "specified", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "users_", "\\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_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Creat", "e", " ", "users", "...", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "create", " ", "users", " ", "if", " ", "this", " ", "is", " ", "not", " ", "an", " ", "onli", "ne", " ", "organization_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "portal", "admin_", "._", "properties_", "(_", ")_", "[_", "'", "id", "'_", "]_", "==_", "'", "0123456", "789", "ABCDE", "F", "'_", ":_", "#", " ", "All", " ", "portal", "s", " ", "have", " ", "this", " ", "id", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "user_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ")_", "\\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_", "'\\\\", "t", "Thi", "s", " ", "is", " ", "an", " ", "onli", "ne", " ", "organization", ".", " ", "User", "s", " ", "must", " ", "alr", "ead", "y", " ", "have", " ", "bee", "n", " ", "created", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "user", " ", "folders_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "'_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Creat", "e", " ", "user", " ", "folder", "s", "...", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "User", ":", " ", "'_", "+_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "user", "\\u", "folders_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "group", "s", " ", "and", " ", "add", " ", "users", " ", "to", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Creat", "ing", " ", "group", "s", " ", "...", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Groups_", "=_", "publi", "sh", "\\u", "user", "\\u", "groups_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ",_", "users_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "new", "Groups_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", "[_", "key_", "]_", "=_", "{_", "'", "id", "'_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Publish", " ", "Item", "s", " ", "and", " ", "Update", " ", "thei", "r", " ", "shar", "ing", " ", "info_", "\\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_", "\"\\\\", "n", "\"_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Publish", "ing", " ", "items", " ", "and", " ", "setti", "ng", " ", "shar", "ing", " ", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "username_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "userinfo_", "[_", "'", "target", "\\u", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "folder", "name_", "=_", "userinfo_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Publish", " ", "all", " ", "the", " ", "users", "'", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "userco", "ntent", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "user", "folder", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", "=_", "publi", "sh", "\\u", "user", "\\u", "items_", "(_", "portal", "admin_", ",_", "username_", ",_", "userco", "ntent", "path_", ",_", "source", "\\u", "hostname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "hostname_", ",_", "new", "\\u", "port_", ",_", "specified", "\\u", "groups_", ",_", "id", "\\u", "mapping", "\\u", "file_", ",_", "grp", "s", "\\u", "on", "\\u", "disk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dump", " ", "info", " ", "abo", "ut", " ", "new", " ", "items", " ", "to", " ", "JSO", "N", " ", "to", " ", "use", " ", "for", " ", "reset", "ting", " ", "ID", "s", " ", "of", " ", "relate", "d", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "dump", "\\u", "new", "Item", "\\u", "info_", "(_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", ",_", "os_", "._", "path_", "._", "join_", "(_", "portal", "Log", "Path_", ",_", "username_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Share", " ", "the", " ", "users", "'", " ", "items", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appropr", "iate", " ", "groups_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Item", "s", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "user", "folder", "name_", ",_", "\"", "items", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "share", "\\u", "items_", "(_", "portal", "admin_", ",_", "user", "Item", "s", "Path_", ",_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", ",_", "orig", "in", "Group", "To", "Dest", "Groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dump", " ", "info", " ", "abo", "ut", " ", "all", " ", "items", " ", "(", "old", ",", " ", "new", " ", "ids", ")", " ", "int", "o", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "portal", "Log", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "orig", "ID", "To", "New", "ID_", ",_", "open_", "(_", "'", "old", "ID", "\\u", "new", "ID", ".", "json", "'_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", ",_", "open_", "(_", "'", "old", "Grp", "ID", "\\u", "new", "Grp", "ID", ".", "json", "'_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Post", " ", "publishing", " ", "process", "ing", ":", " ", "Update", " ", "URL", "s", " ", "and", " ", "item", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "+_", "title", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Update", " ", "URL", "s", " ", "and", " ", "Item", " ", "ID", "s", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "title", "Break", "_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "group", " ", "ids", " ", "to", " ", "the", " ", "dictionar", "y", " ", "of", " ", "old", "/", "new", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "ID", "To", "New", "ID_", "._", "update_", "(_", "old", "Grp", "ID", "\\u", "new", "Grp", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "post", "\\u", "publish_", "(_", "portal", "admin_", ",_", "host", "name", "\\u", "map_", ",_", "orig", "ID", "To", "New", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Comme", "nt", " ", "out", ":", " ", "this", " ", "functional", "it", "y", " ", "is", " ", "now", " ", "avail", "able", " ", "out", " ", "of", " ", "the", " ", "box_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Share", " ", "items", " ", "in", " ", "default", " ", "web", " ", "apps", " ", "template", " ", "and", " ", "default", " ", "gallery", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Share", " ", "the", " ", "items", " ", "in", " ", "the", " ", "default", " ", "web", " ", "apps", " ", "template", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "default", " ", "gallery", " ", "template", " ", "bui", "lt", "-", "in", " ", "group", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "'", "Op", "s", "Server", "'", " ", "user", " ", "'", "AF", "MI", " ", "Web", " ", "Applica", "tion", " ", "Templa", "tes", "'", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "'", "AF", "MI", " ", "Gallery", " ", "Templa", "tes", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"\\\\", "n", "\"", " ", "+", " ", "section", "Break", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", "Share", " ", "the", " ", "items", " ", "in", " ", "the", " ", "default", " ", "web", " ", "apps", " ", "and", " ", "gallery", " ", "template", " ", "group", "s", "...\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "group", "\\u", "owner", " ", "=", " ", "'", "Op", "s", "Server", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "users", ".", "get", "(", "group", "\\u", "owner", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "share", "\\u", "template", "s", "(", "portal", "address", ",", " ", "users", "[", "group", "\\u", "owner", "]['", "target", "\\u", "user", "name", "']", ",", " ", "users", "[", "group", "\\u", "owner", "]['", "target", "\\u", "password", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"-", "Ski", "ppi", "ng", "...", "user", " ", "{}", " ", "was", " ", "not", " ", "created", ".", " ", "Can", " ", "perform", " ", "same", " ", "operati", "on", " ", "through", " ", "portal", " ", "'", "Edit", " ", "Sett", "ings", "'.", "\".", "format", "(", "group", "\\u", "owner", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "DON", "E", ":", " ", "Finish", "ed", " ", "posting", " ", "content", " ", "to", " ", "portal", ".\"_", "\\u\\u\\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", "group", "s", "\\u", "on", "\\u", "disk_", "(_", "content", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "s", "\\u", "on", "\\u", "disk", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "json", "\\u", "files_", "=_", "find", "File", "Path_", "(_", "content", "path_", ",_", "'", "group", ".", "json", "'_", ",_", "return", "First_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group", "\\u", "json", "\\u", "file_", "in_", "group", "\\u", "json", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "group", "\\u", "json", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "json_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "'", "group", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "s", "\\u", "on", "\\u", "disk", "\\u", "info_", "[_", "group", "\\u", "json_", "[_", "'", "id", "'_", "]_", "]_", "=_", "'{}", ":{}'_", "._", "format_", "(_", "group", "\\u", "json_", "[_", "'", "owner", "'_", "]_", ",_", "group", "\\u", "json_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "group", "s", "\\u", "on", "\\u", "disk", "\\u", "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_", "def_", "dump", "\\u", "new", "Item", "\\u", "info_", "(_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", ",_", "user", "Log", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "ed", " ", "for", " ", "reset", "ting", " ", "the", " ", "vari", "ous", " ", "ids", " ", "in", " ", "'", "relate", "d", "'", " ", "items", " ", "in", " ", "target", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "ID", "\\u", "new", "Item", "\\u", "Js", "on", "File_", "=_", "\"", "old", "ID", "\\u", "new", "Item", ".", "json", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "ID", "\\u", "new", "Item", "\\u", "Js", "on", "File", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "user", "Log", "Path_", ",_", "old", "ID", "\\u", "new", "Item", "\\u", "Js", "on", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "ID", "\\u", "new", "ID", "\\u", "Js", "on", "File_", "=_", "\"", "old", "ID", "\\u", "new", "ID", ".", "json", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "ID", "\\u", "new", "ID", "\\u", "Js", "on", "File", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "user", "Log", "Path_", ",_", "old", "ID", "\\u", "new", "ID", "\\u", "Js", "on", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "user", " ", "log", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Folder_", "(_", "user", "Log", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "user", "Log", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "dictionar", "y", " ", "where", " ", "key", " ", "is", " ", "old", " ", "item", " ", "id", ",", " ", "value", " ", "is", " ", "dictionar", "y", " ", "contain", "ing", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abo", "ut", " ", "new", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "{", "\"", "old", "ID", "\":", " ", "{", "\"", "new", "ID", "\":", " ", "\"", "new", " ", "id", " ", "value", "\",", " ", "\"", "type", "\":", " ", "\"", "type", " ", "value", ",", " ", "\"", "owner", "\":", " ", "\"", "owner", " ", "value", "\"}}", "_", "\\u\\u\\uNL\\u\\u\\u_", "old", "ID", "\\u", "new", "Item_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "ID", "\\u", "new", "ID_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "orig", "Item", "Sou", "rce", "ID", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d\\u", "new", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "ID_", "=_", "new", "Items_", "[_", "x_", "]_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "ID_", "=_", "orig", "Item", "Sou", "rce", "ID", "s_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Type_", "=_", "new", "Items_", "[_", "x_", "]_", "[_", "\"", "type", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Owner_", "=_", "new", "Items_", "[_", "x_", "]_", "[_", "\"", "owner", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "[_", "\"", "old", "ID", "\"_", "]_", "=_", "old", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "\"", "new", "Item", "\"_", "]_", "=_", "new", "Items_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "ID", "\\u", "new", "Item_", "._", "append_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d\\u", "new", "\\u", "info_", "=_", "{_", "\"", "id", "\"_", ":_", "new", "ID_", ",_", "\"", "type", "\"_", ":_", "item", "Type_", ",_", "\"", "owner", "\"_", ":_", "item", "Owner_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "ID", "\\u", "new", "ID_", "[_", "old", "ID_", "]_", "=_", "dict_", "(_", "d\\u", "new", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Al", "so", " ", "add", " ", "to", " ", "module", " ", "level", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "ID", "To", "New", "ID_", "[_", "old", "ID_", "]_", "=_", "dict_", "(_", "d\\u", "new", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dump", " ", "info", " ", "out", " ", "to", " ", "JSO", "N", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "._", "dump_", "(_", "old", "ID", "\\u", "new", "Item_", ",_", "open_", "(_", "old", "ID", "\\u", "new", "Item", "\\u", "Js", "on", "File_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "old", "ID", "\\u", "new", "ID_", ",_", "open_", "(_", "old", "ID", "\\u", "new", "ID", "\\u", "Js", "on", "File_", ",_", "'", "w", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "old", "ID", "\\u", "new", "ID", "\\u", "Js", "on", "File", "Path_", ",_", "old", "ID", "\\u", "new", "Item", "\\u", "Js", "on", "File", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "share", "\\u", "items_", "(_", "portal_", ",_", "user", "Item", "s", "Path_", ",_", "new", "Items_", ",_", "orig", "Item", "Sou", "rce", "ID", "s_", ",_", "orig", "in", "Group", "To", "Dest", "Groups_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "new", "Item", "s", " ", "-", " ", "info", " ", "on", " ", "the", " ", "items", " ", "tha", "t", " ", "wer", "e", " ", "adde", "d", " ", "to", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "#", "orig", "Item", "Sou", "rce", "ID", "s", " ", "-", " ", "the", " ", "original", " ", "source", " ", "ids", " ", "of", " ", "the", " ", "new", "Item", "s", ",", " ", "order", " ", "of", " ", "ids", " ", "must", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "order", " ", "of", " ", "new", "Items_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Shar", "ing", " ", "items", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "orig", "Item", "Sou", "rce", "ID", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Item_", "=_", "new", "Items_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "ID_", "=_", "new", "Item_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "ID_", "=_", "orig", "Item", "Sou", "rce", "ID", "s_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "item", "Id", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "user", "Item", "s", "Path_", ",_", "str_", "(_", "orig", "ID_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "item", "Id", "folder_", ")_", ":_", "\\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_", "#", " ", "Load", " ", "shar", "ing", " ", "json", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "item", "Id", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shar", "ing_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "'", "shar", "ing", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "group", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "group", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "everyone", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shar", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "check", " ", "if", " ", "owner", " ", "belo", "ngs", " ", "to", " ", "the", " ", "group", "s", " ", "bei", "ng", " ", "shared", " ", "to", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "swap", " ", "store", "d", " ", "group", " ", "ids", " ", "with", " ", "portal", " ", "group", " ", "ids", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "group", "\\u", "ids_", "=_", "shar", "ing_", "[_", "'", "group", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g_", "in_", "old", "\\u", "group", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "g_", "in_", "orig", "in", "Group", "To", "Dest", "Groups_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "group", "\\u", "id_", "=_", "orig", "in", "Group", "To", "Dest", "Groups_", "[_", "g_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "group", "\\u", "ids_", "._", "append_", "(_", "new", "\\u", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "group", "\\u", "names_", "=_", "dest", "Group", "ID", "\\u", "Group", "Name_", "[_", "new", "\\u", "group", "\\u", "id_", "]_", "#", "EL", " ", "used", " ", "for", " ", "display_", "\\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_", "(_", "new", "\\u", "group", "\\u", "ids_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "group", "\\u", "ids_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "t", "Shar", "ing", " ", "item", " ", "\"_", "+_", "str_", "(_", "new", "Item_", "._", "get_", "(_", "\"", "title", "\"_", ")_", ")_", "+_", "\"[\"_", "+_", "str_", "(_", "new", "Item_", "._", "get_", "(_", "\"", "type", "\"_", ")_", ")_", "+_", "\"]", " ", "with", ":", " ", "\"_", "+_", "shar", "ing_", "[_", "'", "access", "'_", "]_", "+_", "\",", " ", "\"_", "+_", "str_", "(_", "new", "\\u", "group", "\\u", "names_", ")_", "+_", "\"...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shar", "ing_", "[_", "'", "access", "'_", "]_", "._", "lower_", "(_", ")_", "==_", "\"", "public", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "everyone", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "shar", "ing_", "[_", "'", "access", "'_", "]_", "._", "lower_", "(_", ")_", "==_", "\"", "org", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "everyone", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "org_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "shou", "ld", " ", "this", " ", "function", " ", "be", " ", "located", " ", "outsi", "de", " ", "the", " ", "if", " ", "shar", "ing", " ", "statem", "ent", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "portal_", "._", "share", "\\u", "item_", "(_", "new", "ID_", ",_", "new", "\\u", "group", "\\u", "ids_", ",_", "org_", ",_", "everyone", "_", ")_", "\\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 ", " _", "pass_", "#", " ", "not", "hing", " ", "to", " ", "share", "??", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "shar", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "user_", "(_", "portal", "admin_", ",_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Det", "erm", "ine", "s", " ", "if", " ", "portal", " ", "alr", "ead", "y", " ", "has", " ", "user", "name", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exists_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "usernames", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "users_", "=_", "portal", "admin_", "._", "org", "\\u", "users_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "portal", "\\u", "user_", "in_", "portal", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "\\u", "usernames", "_", "._", "append_", "(_", "portal", "\\u", "user_", "[_", "'", "user", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "username_", "in_", "portal", "\\u", "usernames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exists_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "user_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "userinfo_", "[_", "'", "target", "\\u", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "folder", "name_", "=_", "userinfo_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "exists_", "=_", "has", "\\u", "user_", "(_", "portal", "admin_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "user", "\\u", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", "-", " ", "Creat", "ing", " ", "user", " ", "{}.", "..'_", "._", "format_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "user", " ", "proper", "ties", " ", "from", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "user", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "user", "folder", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "user", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "userp", "rope", "rti", "es_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "\"", "userin", "fo", ".", "json", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fullname_", "=_", "userp", "rope", "rti", "es_", "[_", "\"", "full", "Name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role_", "=_", "userp", "rope", "rti", "es_", "[_", "\"", "role", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "userp", "rope", "rti", "es_", "[_", "\"", "email", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "null", " ", "email_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "email_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email_", "=_", "username_", "+_", "'@", "no", "\\u", "email", "\\u", "in", "\\u", "user", "\\u", "profile", ".", "org", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "portal", "admin_", "._", "signup", "_", "(_", "username_", ",_", "password_", ",_", "fullname_", ",_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modif", "y", " ", "user", " ", "role_", "\\u\\u\\uNL\\u\\u\\u_", "portal", "admin_", "._", "update", "\\u", "user", "\\u", "role_", "(_", "username_", ",_", "role_", ")_", "\\u\\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_", "'", " ", " ", " ", "-", " ", "User", " ", "{}", " ", "alr", "ead", "y", " ", "exist", "s", ".'_", "._", "format_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "folder_", "(_", "portal", "admin_", ",_", "username_", ",_", "folder", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Det", "erm", "ine", "s", " ", "if", " ", "folder", " ", "alr", "ead", "y", " ", "exist", "s", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exists_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "folders_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "portal", "\\u", "folder_", "in_", "portal", "admin_", "._", "folders_", "(_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "\\u", "folders_", "._", "append_", "(_", "portal", "\\u", "folder_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "folder", "name_", "in_", "portal", "\\u", "folders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exists_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "user", "\\u", "folders_", "(_", "portal", "admin_", ",_", "content", "path_", ",_", "userinfo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Creat", "e", " ", "user", " ", "folder", "s", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "userinfo_", "[_", "'", "user", "name", "'_", "]_", ",_", "'", "folder", "s", ".", "json", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", "-", " ", "No", " ", "folder", "s", " ", "to", " ", "create", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "userinfo_", "[_", "'", "user", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "info_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "'", "folder", "s", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "folder_", "in_", "folder", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "name_", "=_", "folder_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "has", "\\u", "folder_", "(_", "portal", "admin_", ",_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", ",_", "folder", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", "-", " ", "Creat", "ing", " ", "folder", " ", "\"{}\"", "...'_", "._", "format_", "(_", "folder", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "admin_", "._", "create", "\\u", "folder_", "(_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", ",_", "folder", "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 ", " _", "print_", "'", " ", " ", " ", "-", " ", "Fold", "er", " ", "\"{}\"", " ", "alr", "ead", "y", " ", "exist", "s", ".'_", "._", "format_", "(_", "folder", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publi", "sh", "\\u", "user", "\\u", "items_", "(_", "portal_", ",_", "username_", ",_", "userco", "ntent", "path_", ",_", "old", "\\u", "hostname_", ",_", "new", "\\u", "hostname_", ",_", "new", "\\u", "port_", ",_", "specified", "\\u", "groups_", ",_", "id", "\\u", "mapping", "\\u", "file_", ",_", "grp", "s", "\\u", "on", "\\u", "disk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Publish", " ", "all", " ", "items", " ", "for", " ", "current", " ", "user", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", "s", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "of", " ", "new", " ", "items", " ", "as", " ", "well", " ", "as", " ", "a", " ", "list", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "original", " ", "item", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "newi", "tems_", ",_", "old", "\\u", "source", "\\u", "ids_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "portal", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "+_", "section", "Break", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Publish", "ing", " ", "items", " ", "for", " ", "user", " ", "'\"_", "+_", "username_", "+_", "\"'", "...", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "'", "id", " ", "mapping", "'", " ", "file", " ", "if", " ", "specified", ".", " ", "Sin", "ce", " ", "this", " ", "support", "s", " ", "overwrite_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "capab", "ilit", "y", ",", " ", "let", "'", "s", " ", "als", "o", " ", "create", " ", "a", " ", "list", " ", "of", " ", "all", " ", "current", " ", "item", " ", "ids", " ", "to", " ", "verify", " ", "tha", "t", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "actual", "ly", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u", "mapping_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id", "\\u", "mapping", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filef", "older_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "id", "\\u", "mapping", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "id", "\\u", "mapping", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "filef", "older_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "mapping_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "list", " ", "of", " ", "exist", "ing", " ", "portal", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "portal", "\\u", "items_", "=_", "portal_", "._", "search_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "exist", "ing", "\\u", "portal", "\\u", "item_", "in_", "exist", "ing", "\\u", "portal", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exist", "ing", "\\u", "portal", "\\u", "ids_", "._", "append_", "(_", "exist", "ing", "\\u", "portal", "\\u", "item_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "item", "\\u", "dirs_", "=_", "os_", "._", "listdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "userco", "ntent", "path_", ",_", "\"", "items", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item", "\\u", "dir_", "in_", "item", "\\u", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overwrit", "e\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "load", "\\u", "item_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\\\\", "n", "\\\\", "t", "Publish", "ing", " ", "item", " ", "{}", " ", "({}", "/{}", ").", "..\"_", "._", "format_", "(_", "item", "\\u", "dir_", ",_", "n_", ",_", "len_", "(_", "item", "\\u", "dirs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "id", "\\u", "mapping_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overwrit", "e\\u", "id_", "=_", "id", "\\u", "mapping_", "._", "get_", "(_", "item", "\\u", "dir_", ")_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "overwrit", "e\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", " ", " ", " ", "-", "Item", " ", "referenced", " ", "in", " ", "id", " ", "mapping", " ", "file", ".", " ", "Check", "ing", " ", "if", " ", "item", " ", "exist", "s", " ", "in", " ", "portal", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "overwrit", "e\\u", "id_", "in_", "exist", "ing", "\\u", "portal", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"\\\\", "t", " ", " ", " ", "-", "Item", " ", "exist", "s", " ", "in", " ", "portal", ".", " ", "Wil", "l", " ", "update", " ", "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 ", " ", "_", "overwrit", "e\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"**", "*", " ", "WARN", "ING", ":", " ", "item", " ", "referenced", " ", "in", " ", "id", " ", "mapping", " ", "file", " ", "doe", "s", " ", "NOT", " ", "exist", " ", "in", " ", "portal", ".", " ", "Wil", "l", " ", "add", " ", "new", " ", "item", " ", "inst", "ead", " ", "of", " ", "updat", "ing", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "item", " ", "shou", "ld", " ", "be", " ", "load", "ed", " ", "base", " ", "on", " ", "specified", " ", "group", " ", "parameters_", "\\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_", "specified", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "\\u", "load", "\\u", "item_", "=_", "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 ", " _", "os_", "._", "chdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "userco", "ntent", "path_", ",_", "\"", "items", "\"_", ",_", "item", "\\u", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shar", "ing", "\\u", "info_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "'", "shar", "ing", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "groups_", "=_", "shar", "ing", "\\u", "info_", "._", "get_", "(_", "'", "group", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item", "\\u", "group_", "in_", "item", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grp", "\\u", "on", "\\u", "disk_", "=_", "grp", "s", "\\u", "on", "\\u", "disk_", "._", "get_", "(_", "item", "\\u", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "grp", "\\u", "on", "\\u", "disk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "specified", "\\u", "group_", "in_", "specified", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "specified", "\\u", "group_", "==_", "grp", "\\u", "on", "\\u", "disk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "do", "\\u", "load", "\\u", "item_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "do", "\\u", "load", "\\u", "item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", " ", " ", " ", "-", "Ski", "ppi", "ng", " ", "item", ".", " ", "Item", " ", "group", "s", " ", "do", " ", "not", " ", "match", " ", "user", " ", "specified", " ", "group", " ", "crite", "ria", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "/", "Update", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "do", "\\u", "load", "\\u", "item_", ":_", "\\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 ", " _", "item_", ",_", "old", "\\u", "source", "\\u", "id_", "=_", "load", "\\u", "item_", "(_", "portal_", ",_", "os_", "._", "path_", "._", "join_", "(_", "userco", "ntent", "path_", ",_", "\"", "items", "\"_", ",_", "item", "\\u", "dir_", ")_", ",_", "overwrit", "e\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newi", "tems_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "source", "\\u", "ids_", "._", "append_", "(_", "old", "\\u", "source", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rea", "ssi", "gn", " ", "item", " ", "to", " ", "target", " ", "owner", " ", "and", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "userco", "ntent", "path_", ",_", "\"", "folder", "s", ".", "json", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "chdir_", "(_", "userco", "ntent", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "sin", "fo_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "'", "folder", "s", ".", "json", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "name_", "=_", "publi", "sh", "\\u", "get", "\\u", "folder", "\\u", "name", "\\u", "for", "\\u", "item_", "(_", "item_", ",_", "folder", "sin", "fo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "portal_", "._", "reass", "ign", "\\u", "item_", "(_", "item_", "[_", "'", "id", "'_", "]_", ",_", "username_", ",_", "folder", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "ERROR", ":", " ", "Except", "ion", " ", "on", " ", "addin", "g", "/", "updat", "ing", " ", "item", ":", " ", "{}'_", "._", "format_", "(_", "item", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "newi", "tems_", ",_", "old", "\\u", "source", "\\u", "ids_", "\\u\\u\\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_", "publi", "sh", "\\u", "user", "\\u", "groups_", "(_", "portal_", ",_", "content", "path_", ",_", "userinfo_", ",_", "users_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "userinfo_", "[_", "'", "target", "\\u", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "folder", "name_", "=_", "userinfo_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "user", "folder", "name_", ",_", "'", "group", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "folders_", "=_", "os_", "._", "listdir_", "(_", "group", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Total", "Group", "Folders", "_", "=_", "len_", "(_", "group", "folders_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "Total", "Group", "Folders", "_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "User", " ", "'{}'", " ", "doe", "s", " ", "not", " ", "own", " ", "any", " ", "group", "s", ".\"_", "._", "format_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "Creat", "ing", " ", "'{}'", " ", "group", "(", "s", ")", " ", "for", " ", "user", " ", "'{}'", "...\"_", "._", "format_", "(_", "str_", "(_", "num", "Total", "Group", "Folders", "_", ")_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "spro", "cess", "ed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "s", "Failed_", "=_", "[_", "\"", "Non", "e", "\"_", "]_", "#", "TOD", "O", ":", " ", "late", "r", " ", "we", " ", "append", " ", "to", " ", "this", " ", "list", ",", " ", "but", " ", "wh", "y", " ", "do", " ", "we", " ", "initialize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "list", " ", "with", " ", "one", " ", "element", " ", "with", " ", "\"", "Non", "e", "\"", " ", "string", "?", " ", "Wa", "s", " ", "this", " ", "supposed", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "group", "s", "Fail", "ed", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "folder_", "in_", "group", "folders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "count_", "=_", "group", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Group", "ID_", "=_", "folder_", "#", "was", " ", "group", "ID", " ", "=", " ", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groupid", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "group", "folder_", ",_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "groupid", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "\"", "group", ".", "json", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "\\u", "users_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "\"", "group", "\\u", "users", ".", "json", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "group", " ", "to", " ", "add", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "group", "Id_", "=_", "get", "Group", "ID_", "(_", "portal_", ",_", "username_", ",_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "group", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "group", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", " ", "group", " ", "'\"_", "+_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", "+_", "\"'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group", "Id_", "=_", "portal_", "._", "create", "\\u", "group_", "(_", "group_", ",_", "group_", "[_", "'", "thumb", "file", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rea", "ssi", "gn", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "portal_", "._", "reass", "ign", "\\u", "group_", "(_", "group", "Id_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", " ", "group", " ", "'\"_", "+_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", "+_", "\"'", " ", "alr", "ead", "y", " ", "exist", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "Group", "ID", "\\u", "Group", "Name_", "[_", "group", "Id_", "]_", "=_", "str_", "(_", "group_", "[_", "'", "title", "'_", "]_", ")_", "#", "Track", " ", "new", " ", "group", " ", "id", " ", "and", " ", "group", " ", "name", " ", "for", " ", "late", "r", " ", "use_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"...", "...", " ", "addin", "g", " ", "users", " ", "to", " ", "group", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "group", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orig", "in", "Group", "To", "Dest", "Groups_", "[_", "old", "Group", "ID_", "]_", "=_", "group", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "._", "append_", "(_", "group", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "users", " ", "are", " ", "in", " ", "the", " ", "list", " ", "we", " ", "adde", "d", " ", "to", " ", "the", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "users", "\\u", "to", "\\u", "invite_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "portal", "\\u", "users_", "=_", "get", "\\u", "target", "\\u", "users_", "(_", "users_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "u_", "in_", "map", "\\u", "group", "\\u", "users_", "(_", "group", "\\u", "users_", "[_", "\"", "users", "\"_", "]_", ",_", "users_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u_", "=_", "str_", "(_", "u_", ")_", "#", "dict", " ", "keys", " ", "are", " ", "unicode", ",", " ", "make", " ", "them", " ", "ascii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "u_", "in_", "portal", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "users", "\\u", "to", "\\u", "invite_", "._", "append_", "(_", "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_", "len_", "(_", "users", "\\u", "to", "\\u", "invite_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"...", "......", " ", "addin", "g", " ", "the", " ", "follow", "ing", " ", "users", ":", " ", "\"_", "+_", "str_", "(_", "users", "\\u", "to", "\\u", "invite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "portal_", "._", "add", "\\u", "group", "\\u", "users_", "(_", "users", "\\u", "to", "\\u", "invite_", ",_", "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 ", " _", "print_", "\"...", "......", " ", "no", " ", "users", " ", "to", " ", "add", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group", "spro", "cess", "ed_", "=_", "group", "spro", "cess", "ed_", "+_", "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 ", " _", "group", "s", "Failed_", "._", "append_", "(_", "group", "ID_", ")_", "#", "TOD", "O", ":", " ", "we", " ", "append", " ", "to", " ", "this", " ", "list", ",", " ", "but", " ", "don", "'", "t", " ", "use", " ", "it", " ", "any", "where", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "group", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "orig", "in", "Group", "To", "Dest", "Groups_", "\\u\\u\\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", "target", "\\u", "users_", "(_", "users_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", ",_", "userinfo_", "in_", "users_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "users_", "._", "append_", "(_", "userinfo_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "target", "\\u", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "map", "\\u", "group", "\\u", "users_", "(_", "group", "\\u", "users_", ",_", "users_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "group", "\\u", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "group", "\\u", "user_", "in_", "group", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group", "\\u", "user_", "in_", "users_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "group", "\\u", "users_", "._", "append_", "(_", "users_", "[_", "group", "\\u", "user_", "]_", "[_", "'", "target", "\\u", "user", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "target", "\\u", "group", "\\u", "users_", "\\u\\u\\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_", "publi", "sh", "\\u", "portal", "\\u", "resources_", "(_", "portal", "admin_", ",_", "portal", "\\u", "properties_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "publi", "sh", " ", "resource", "s", " ", "from", " ", "disk_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "ID_", "=_", "portal", "\\u", "properties_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "s", "JSON_", "=_", "json_", "._", "load_", "(_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "'", "resource", "s", ".", "json", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "s", "List_", "=_", "resource", "s", "JSON_", "[_", "'", "resource", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Post", "ing", " ", "resource", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rsc", "_", "in_", "resource", "s", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "rsc", "_", "[_", "'", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "!=_", "'", "account", "Sett", "ings", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datafile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "portal", "admin_", "._", "add", "\\u", "resource_", "(_", "portal", "ID_", ",_", "key_", ",_", "datafile_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publi", "sh", "\\u", "portal", "\\u", "properties_", "(_", "portal", "admin_", ",_", "portal", "\\u", "properties_", ",_", "old", "Host", "name_", ",_", "new", "Host", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "update", " ", "portal", " ", "proper", "ties", " ", "from", " ", "old", " ", "host", " ", "to", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal", "ID_", "=_", "portal", "\\u", "properties_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "portal", "admin_", "._", "publi", "sh", "\\u", "portal", "\\u", "properties_", "(_", "portal", "ID_", ",_", "portal", "\\u", "properties_", ",_", "old", "Host", "name_", ",_", "new", "Host", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resp_", "[_", "'", "success", "'_", "]_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Porta", "l", " ", "proper", "ties", " ", "update", "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 ", " _", "print_", "\"", "Error", " ", "updat", "ing", " ", "portal", " ", "proper", "ties", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "server", "name", "\\u", "from", "\\u", "url_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Get", " ", "server", "name", " ", "from", " ", "url", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "p_", "._", "hostname_", "\\u\\u\\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_", "publi", "sh", "\\u", "get", "\\u", "folder", "\\u", "name", "\\u", "for", "\\u", "item_", "(_", "item_", ",_", "folders_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "the", " ", "folder", " ", "name", " ", "the", " ", "specific", " ", "item", " ", "is", " ", "in", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "Name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "owner", "Fold", "er", "ID_", "=_", "item_", "._", "get_", "(_", "'", "owner", "Fold", "er", "'_", ")_", "#", "Make", " ", "sure", " ", "to", " ", "use", " ", ".", "get", ",", " ", "whi", "ch", " ", "will", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", " ", "Non", "e", " ", "if", " ", "key", " ", "doe", "s", " ", "not", " ", "exist", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "owner", "Fold", "er", "ID_", "is_", "not_", "None_", "and_", "owner", "Fold", "er", "ID_", "<_", ">_", "'", "null", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "now", " ", "have", " ", "the", " ", "ID", " ", "of", " ", "the", " ", "folder", " ", "so", " ", "examine", " ", "the", " ", "folder", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "dete", "rmin", "e", " ", "the", " ", "folder", " ", "name", " ", "for", " ", "this", " ", "folder", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", " ", "[[", "\"", "e1", "363", "455", "dd", "044", "ab", "384", "995", "218", "fe", "338", "6b", "b", "\",", " ", "\"", "folder", "\\u", "1", "\",", " ", "[{", "\"", "avg", "Rati", "ng", "\":", " ", "0.", "0", ",...", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "element", " ", "0", " ", "is", " ", "folder", "ID", ",", " ", "element", " ", "1", " ", "is", " ", "folder", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "folder_", "in_", "folders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "ID_", "=_", "folder_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "folder", "ID_", "==_", "owner", "Fold", "er", "ID_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "Name_", "=_", "folder_", "[_", "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_", "return_", "folder", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "post", "\\u", "publish_", "(_", "portal_", ",_", "host", "name", "\\u", "map_", ",_", "id", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "server", " ", "name", " ", "and", " ", "update", " ", "item", " ", "ID", "s", " ", "referenced", " ", "in", " ", "items", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "all", " ", "portal", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "items_", "=_", "portal_", "._", "search_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "item", "\\u", "info_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "host", " ", "name", "/", "item", " ", "ids", " ", "in", " ", "item", " ", "json", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "item", "\\u", "properties_", "(_", "portal_", ",_", "item_", ",_", "host", "name", "\\u", "map_", ",_", "id", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "host", " ", "name", "/", "item", " ", "ids", " ", "in", " ", "item", " ", "\"", "data", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "item", "\\u", "data_", "(_", "portal_", ",_", "item_", ",_", "host", "name", "\\u", "map_", ",_", "id", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "item", "\\u", "properties_", "(_", "portal_", ",_", "item_", ",_", "host", "name", "\\u", "map_", ",_", "id", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "host", " ", "name", "/", "item", " ", "ids", " ", "in", " ", "item", " ", "json", " ", "proper", "ties", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json", "Props", "To", "Update_", "=_", "[_", "'", "description", "'_", ",_", "'", "snippet", "'_", ",_", "'", "access", "Information", "'_", ",_", "'", "license", "Info", "'_", ",_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "json", "Prop_", "in_", "json", "Props", "To", "Update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "updated_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property", "Value_", "=_", "item_", "._", "get_", "(_", "json", "Prop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "property", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "host_", "in_", "host", "name", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "str", "\\u", "list_", "=_", "[_", "host_", ",_", "host_", "._", "lower_", "(_", ")_", ",_", "host_", "._", "upper_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "search", "\\u", "str_", "in_", "search", "\\u", "str", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "property", "Value_", "._", "find_", "(_", "search", "\\u", "str_", ")_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "property", "Value_", "=_", "property", "Value_", "._", "replace_", "(_", "search", "\\u", "str_", ",_", "host", "name", "\\u", "map_", "[_", "host_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "updated_", "=_", "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_", "for_", "item", "\\u", "id_", "in_", "id", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "str", "\\u", "list_", "=_", "[_", "item", "\\u", "id_", ",_", "item", "\\u", "id_", "._", "lower_", "(_", ")_", ",_", "item", "\\u", "id_", "._", "upper_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "search", "\\u", "str_", "in_", "search", "\\u", "str", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "property", "Value_", "._", "find_", "(_", "search", "\\u", "str_", ")_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "property", "Value_", "=_", "property", "Value_", "._", "replace_", "(_", "search", "\\u", "str_", ",_", "id", "\\u", "map_", "[_", "item", "\\u", "id_", "]_", "[_", "\"", "id", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "updated_", "=_", "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_", "is", "\\u", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal_", "._", "update", "\\u", "item_", "(_", "item_", "[_", "'", "id", "'_", "]_", ",_", "{_", "json", "Prop_", ":_", "property", "Value_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "item", "\\u", "data_", "(_", "portal_", ",_", "item_", ",_", "host", "name", "\\u", "map_", ",_", "id", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "host", " ", "name", "/", "item", " ", "ids", " ", "in", " ", "item", " ", "data", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "item_", "[_", "'", "type", "'_", "]_", "in_", "TEXT", "\\u", "BASED", "\\u", "ITEM", "\\u", "TYPES_", ":_", "\\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 ", " _", "item", "data_", "=_", "portal_", "._", "item", "\\u", "data_", "(_", "item_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "ERROR", ":", " ", "Except", "ion", ":", " ", "update", "\\u", "item", "\\u", "data", " ", "function", " ", "coul", "d", " ", "not", " ", "get", " ", "item", " ", "data", " ", "for", " ", "item", ":", " ", "\"{}\"'_", "._", "format_", "(_", "str_", "(_", "item_", "._", "get_", "(_", "'", "title", "'_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "item", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "updated_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "host_", "in_", "host", "name", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "str", "\\u", "list_", "=_", "[_", "host_", ",_", "host_", "._", "lower_", "(_", ")_", ",_", "host_", "._", "upper_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "search", "\\u", "str_", "in_", "search", "\\u", "str", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "item", "data_", "._", "find_", "(_", "search", "\\u", "str_", ")_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "item", "data_", "=_", "item", "data_", "._", "replace_", "(_", "search", "\\u", "str_", ",_", "host", "name", "\\u", "map_", "[_", "host_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "updated_", "=_", "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_", "for_", "item", "\\u", "id_", "in_", "id", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "str", "\\u", "list_", "=_", "[_", "item", "\\u", "id_", ",_", "item", "\\u", "id_", "._", "lower_", "(_", ")_", ",_", "item", "\\u", "id_", "._", "upper_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "search", "\\u", "str_", "in_", "search", "\\u", "str", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "item", "data_", "._", "find_", "(_", "search", "\\u", "str_", ")_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "item", "data_", "=_", "item", "data_", "._", "replace_", "(_", "search", "\\u", "str_", ",_", "id", "\\u", "map_", "[_", "item", "\\u", "id_", "]_", "[_", "\"", "id", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "updated_", "=_", "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_", "is", "\\u", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal_", "._", "update", "\\u", "item_", "(_", "item_", "[_", "'", "id", "'_", "]_", ",_", "{_", "'", "text", "'_", ":_", "item", "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_", "if_", "item_", "[_", "'", "type", "'_", "]_", "==_", "'", "CSV", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "csv", "\\u", "item_", "(_", "portal_", ",_", "item_", ",_", "host", "name", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "csv", "\\u", "item_", "(_", "portal_", ",_", "item_", ",_", "host", "name", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Update", " ", "URL", "s", " ", "in", " ", "CSV", " ", "item", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Down", "load", " ", "file", " ", "from", " ", "portal_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Path_", "=_", "portal_", "._", "item", "\\u", "datad", "_", "(_", "item_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "file", " ", "has", " ", "the", " ", "search", " ", "string", " ", "and", " ", "perform", " ", "replace_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "updated_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host_", "in_", "host", "name", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search", "\\u", "str", "\\u", "list_", "=_", "[_", "host_", ",_", "host_", "._", "lower_", "(_", ")_", ",_", "host_", "._", "upper_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "search", "\\u", "str_", "in_", "search", "\\u", "str", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "find", "In", "File_", "(_", "file", "Path_", ",_", "search", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edit", "Files_", "(_", "[_", "file", "Path_", "]_", ",_", "search", "\\u", "str_", ",_", "host", "name", "\\u", "map_", "[_", "host_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "updated_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Upload", " ", "the", " ", "update", "d", " ", "file", " ", "back", " ", "to", " ", "the", " ", "portal", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal_", "._", "update", "\\u", "item_", "(_", "item_", "[_", "'", "id", "'_", "]_", ",_", "None_", ",_", "file", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "the", " ", "download", "ed", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "file", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "file", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "item", "\\u", "info_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item", "ID_", "=_", "item_", "._", "get_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Title_", "=_", "item_", "._", "get_", "(_", "'", "title", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Owner_", "=_", "item_", "._", "get_", "(_", "'", "owner", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "Type_", "=_", "item_", "._", "get_", "(_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "Id", ":", " ", "\"_", "+_", "str_", "(_", "item", "ID_", ")_", "+_", "\"\\\\", "t", "Tit", "le", ":", " ", "'\"_", "+_", "str_", "(_", "item", "Title_", ")_", "+_", "\"'", " ", "(\"_", "+_", "str_", "(_", "item", "Type_", ")_", "+_", "\")", ",", " ", "Owne", "r", ":", " ", "'\"_", "+_", "str_", "(_", "item", "Owner_", ")_", "+_", "\"'\\", "\\", "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_", "make", "Folder_", "(_", "folder", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Creat", "e", " ", "folder", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "folder", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "folder", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "val", "\\u", "arg", "\\u", "content", "\\u", "path_", "(_", "content", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Validate", " ", "the", " ", "content", " ", "path", " ", "script", " ", "argu", "ment", " ", "parameter", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "content", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "content", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "is", "\\u", "valid_", "\\u\\u\\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_", "read", "\\u", "user", "file_", "(_", "content", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "dictionar", "y", " ", "of", " ", "users", " ", "based", " ", "on", " ", "content", "s", " ", "of", " ", "user", "file", ".", "txt", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "\"", "user", "file", ".", "txt", "\"", " ", "file", " ", "contain", "s", " ", "user", " ", "name", " ", "from", " ", "source", " ", "portal", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "name", " ", "for", " ", "target", " ", "portal", " ", "and", " ", "the", " ", "password", " ", "for", " ", "the", " ", "target", " ", "user", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "users_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "file_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "content", "path_", ",_", "'", "user", "file", ".", "txt", "'_", ")_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "One_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "user", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "the", " ", "header", " ", "info", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line", "One_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "One_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "username_", ",_", "target", "\\u", "username_", ",_", "target", "\\u", "password_", "=_", "line_", "._", "rstrip_", "(_", ")_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "users_", "[_", "username_", "]_", "=_", "{_", "'", "user", "name", "'_", ":_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "\\u", "user", "name", "'_", ":_", "target", "\\u", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "\\u", "password", "'_", ":_", "target", "\\u", "password_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "all", "\\u", "users_", "\\u\\u\\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_", "val", "\\u", "arg", "\\u", "users_", "(_", "specified", "\\u", "users_", ",_", "content", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values", "\\u", "to", "\\u", "use_", "=_", "{_", "}_", "#", " ", "Contain", "s", " ", "users", " ", "tha", "t", " ", "tha", "t", " ", "will", " ", "be", " ", "published_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "users", "\\u", "list_", "=_", "[_", "]_", "#", " ", "Contain", "s", " ", "users", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "exclu", "ded", " ", "from", " ", "publishing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "include", "\\u", "users", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "specified", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "specified", "\\u", "users_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "specified", "\\u", "users_", "=_", "specified", "\\u", "users_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "users_", "=_", "read", "\\u", "user", "file_", "(_", "content", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "are", " ", "no", " ", "specified", " ", "users", " ", "then", " ", "we", " ", "shou", "ld", " ", "post", " ", "content", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "users", " ", "so", " ", "return", " ", "dictionar", "y", " ", "of", " ", "all", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "specified", "\\u", "users_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "all", "\\u", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "specified", "\\u", "users_", "==_", "\"#\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "all", "\\u", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "specified", "\\u", "users_", "._", "find_", "(_", "\"-\"_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values", "\\u", "to", "\\u", "use_", "=_", "all", "\\u", "users_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "users_", "=_", "specified", "\\u", "users_", "._", "replace_", "(_", "\"-\"_", ",_", "\"\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclu", "de", "\\u", "users", "\\u", "list_", "=_", "[_", "element_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", "for_", "element_", "in_", "exclu", "de", "\\u", "users_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "exclu", "de", "\\u", "user_", "in_", "exclu", "de", "\\u", "users", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "user_", "in_", "all", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exclu", "de", "\\u", "user_", "==_", "user_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "the", " ", "user", " ", "from", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "values", "\\u", "to", "\\u", "use_", "[_", "user_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "values", "\\u", "to", "\\u", "use_", "\\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_", "#", " ", "keep", " ", "the", " ", "users", " ", "tha", "t", " ", "wer", "e", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "include", "\\u", "users", "\\u", "list_", "=_", "[_", "element_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", "for_", "element_", "in_", "specified", "\\u", "users_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "include", "\\u", "user_", "in_", "include", "\\u", "users", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "user_", "in_", "all", "\\u", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "include", "\\u", "user_", "==_", "user_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "add", " ", "to", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "values", "\\u", "to", "\\u", "use_", "[_", "user_", "]_", "=_", "all", "\\u", "users_", "[_", "user_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "values", "\\u", "to", "\\u", "use_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "share", "\\u", "templates_", "(_", "portal", "address_", ",_", "username_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "portal", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "portal_", "=_", "Porta", "l_", "(_", "portal", "address_", ",_", "username_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Share", " ", "web", " ", "app", " ", "template", "s", " ", "with", " ", "\"", "AF", "MI", " ", "Web", " ", "Applica", "tion", " ", "Templa", "tes", "\"", " ", "group", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "share", "\\u", "default", "\\u", "weba", "pp", "\\u", "templates_", "(_", "portal_", ",_", "portal_", "._", "logged", "\\u", "in", "\\u", "user_", "(_", ")_", "[_", "'", "user", "name", "'_", "]_", ",_", "'", "AF", "MI", " ", "Web", " ", "Applica", "tion", " ", "Templa", "tes", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "results_", "[_", "'", "success", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "t", "Don", "e", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "ERROR", ":", " ", "{}'_", "._", "format_", "(_", "results_", "[_", "'", "message", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "Share", " ", "web", " ", "app", " ", "template", "s", " ", "with", " ", "\"", "AF", "MI", " ", "Gallery", " ", "Templa", "tes", "\"", " ", "group", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "share", "\\u", "default", "\\u", "gallery", "\\u", "templates_", "(_", "portal_", ",_", "portal_", "._", "logged", "\\u", "in", "\\u", "user_", "(_", ")_", "[_", "'", "user", "name", "'_", "]_", ",_", "'", "AF", "MI", " ", "Gallery", " ", "Templa", "tes", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "results_", "[_", "'", "success", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "t", "Don", "e", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "ERROR", ":", " ", "{}'_", "._", "format_", "(_", "results_", "[_", "'", "message", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "share", "\\u", "default", "\\u", "gallery", "\\u", "templates_", "(_", "portal_", ",_", "group", "Owner_", ",_", "group", "Title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "=_", "{_", "'", "success", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "Type_", "=_", "'", "GAL", "LER", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "share", "\\u", "default", "\\u", "templates_", "(_", "portal_", ",_", "template", "Type_", ",_", "group", "Owner_", ",_", "group", "Title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "results_", "[_", "'", "success", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "[_", "'", "success", "'_", "]_", "=_", "results_", "[_", "'", "success", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "results_", "[_", "'", "message", "'_", "]_", "=_", "results_", "[_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func", "\\u", "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_", "share", "\\u", "default", "\\u", "weba", "pp", "\\u", "templates_", "(_", "portal_", ",_", "group", "Owner_", ",_", "group", "Title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "=_", "{_", "'", "success", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "Type_", "=_", "'", "WEB", "APP", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "share", "\\u", "default", "\\u", "templates_", "(_", "portal_", ",_", "template", "Type_", ",_", "group", "Owner_", ",_", "group", "Title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "results_", "[_", "'", "success", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "[_", "'", "success", "'_", "]_", "=_", "results_", "[_", "'", "success", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "results_", "[_", "'", "message", "'_", "]_", "=_", "results_", "[_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func", "\\u", "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_", "share", "\\u", "default", "\\u", "templates_", "(_", "portal_", ",_", "template", "Type_", ",_", "group", "Owner_", ",_", "group", "Title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "=_", "{_", "'", "success", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "list", " ", "of", " ", "template", " ", "ids", " ", "for", " ", "items", " ", "shared", " ", "with", " ", "the", " ", "\"", "default", "\"", " ", "template", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "print", "Statement_", "=_", "'\\\\", "t", "-", "Retriev", "ing", " ", "list", " ", "of", " ", "items", " ", "in", " ", "default", " ", "{}", " ", "group", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "template", "Type_", "==_", "'", "WEB", "APP", "S", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "Type", "Str_", "=_", "'", "web", " ", "app", " ", "template", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "print", "Statement_", "._", "format_", "(_", "template", "Type", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "ID", "s_", "=_", "unpack_", "(_", "portal_", "._", "webm", "ap", "\\u", "templates_", "(_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "template", "Type_", "==_", "'", "GAL", "LER", "Y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "Type", "Str_", "=_", "'", "gallery", " ", "template", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "print", "Statement_", "._", "format_", "(_", "template", "Type", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "ID", "s_", "=_", "unpack_", "(_", "portal_", "._", "gallery", "\\u", "templates_", "(_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Templa", "te", " ", "type", " ", "value", " ", "is", " ", "invalid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "[_", "'", "success", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "results_", "[_", "'", "message", "'_", "]_", "=_", "'", "Inva", "lid", " ", "template", "Type", " ", "value", " ", "\"{}\"", ";", " ", "must", " ", "be", " ", "WEB", "APP", "S", " ", "or", " ", "GAL", "LER", "Y", ".'_", "._", "format_", "(_", "template", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "template", "ID", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "[_", "'", "success", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "results_", "[_", "'", "message", "'_", "]_", "=_", "'{}", " ", "portal", " ", "property", " ", "not", " ", "set", " ", "to", " ", "use", " ", "\"", "Default", "\"", " ", "group", ".'_", "._", "format_", "(_", "template", "Type", "Str_", "._", "capitalize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "group", " ", "id", " ", "for", " ", "the", " ", "group", " ", "to", " ", "share", " ", "the", " ", "template", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "group", "ID_", "=_", "get", "Group", "ID_", "(_", "portal_", ",_", "group", "Owner_", ",_", "group", "Title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "group", "ID_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "[_", "'", "success", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "results_", "[_", "'", "message", "'_", "]_", "=_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "group", " ", "where", " ", "owner", " ", "=", " ", "\"{}\"", " ", "and", " ", "title", " ", "=", " ", "\"{}\"'_", "._", "format_", "(_", "group", "Owner_", ",_", "group", "Title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Share", " ", "template", "s", " ", "with", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "t", "-", "Shar", "ing", " ", "web", " ", "template", "s", " ", "with", " ", "group", " ", "{}", " ", "({})", "...'_", "._", "format_", "(_", "group", "Title_", ",_", "group", "Owner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "share", "\\u", "template", "\\u", "items_", "(_", "portal_", ",_", "template", "ID", "s_", ",_", "[_", "group", "ID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "results_", "[_", "'", "success", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "[_", "'", "success", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "results_", "[_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func", "\\u", "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_", "get", "Group", "ID_", "(_", "portal_", ",_", "owner_", ",_", "title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "id", " ", "for", " ", "group", " ", "owned", " ", "by", " ", "'", "owner", "'", " ", "with", " ", "title", " ", "=", " ", "specified", " ", "title_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "ID_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "=_", "portal_", "._", "user_", "(_", "owner_", ")_", "[_", "'", "group", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "group_", "in_", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group_", "[_", "'", "title", "'_", "]_", "==_", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "ID_", "=_", "group_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "group", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "share", "\\u", "template", "\\u", "items_", "(_", "portal_", ",_", "item", "\\u", "ids_", ",_", "group", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "=_", "{_", "'", "success", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item", "\\u", "id_", "in_", "item", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "portal_", "._", "share", "\\u", "item_", "(_", "item", "\\u", "id_", ",_", "group", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "results_", "[_", "'", "not", "Share", "d", "With", "'_", "]_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "List_", "._", "append_", "(_", "results_", ")_", "\\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_", "(_", "err", "List_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "results_", "[_", "'", "success", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "results_", "[_", "'", "message", "'_", "]_", "=_", "err", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "func", "\\u", "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_", "tags", "\\u", "exist_", "(_", "find", "\\u", "tags_", ",_", "tags", "\\u", "to", "\\u", "search_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Det", "erm", "ine", "s", " ", "if", " ", "specific", " ", "\"", "Op", "s", "Server", "\"", " ", "values", " ", "exist", " ", "in", " ", "list", " ", "of", " ", "tags", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "list", " ", "of", " ", "possib", "le", " ", "\"", "Op", "s", "Server", "\"", " ", "type", " ", "tag", " ", "prefix", "es", ";", " ", "i", ".", "e", ".", " ", "in", " ", "case", " ", "some", "one", " ", "did", "n", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "speci", "fy", " ", "the", " ", "correct", " ", "prefix", "._", "\\u\\u\\uNL\\u\\u\\u_", "ops", "\\u", "type", "\\u", "flags_", "=_", "[_", "\"", "ops", "server", "\"_", ",_", "\"", "ops", "server", "s", "\"_", ",_", "\"", "ops", "erver", "\"_", ",_", "\"", "ops", "erver", "s", "\"_", ",_", "\"", "ops", "srv", "er", "\"_", ",_", "\"", "ops", "srv", "r", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "find", "\\u", "tags", " ", "to", " ", "lower", " ", "case", " ", "and", " ", "remove", " ", "and", " ", "lead", "ing", "/", "trail", "ing", " ", "spaces_", "\\u\\u\\uNL\\u\\u\\u_", "find", "\\u", "tags", "\\u", "mod_", "=_", "[_", "element_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "encode_", "(_", "\"", "ascii", "\"_", ")_", "for_", "element_", "in_", "list_", "(_", "find", "\\u", "tags_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "tags", "\\u", "to", "\\u", "search", " ", "to", " ", "lower", " ", "case", " ", "and", " ", "remove", " ", "and", " ", "lead", "ing", "/", "trail", "ing", " ", "spaces_", "\\u\\u\\uNL\\u\\u\\u_", "tags", "\\u", "to", "\\u", "search", "\\u", "mod_", "=_", "[_", "element_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "encode_", "(_", "\"", "ascii", "\"_", ")_", "for_", "element_", "in_", "list_", "(_", "tags", "\\u", "to", "\\u", "search_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "In", " ", "tags", "\\u", "exist", " ", "function", ":", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "tfi", "nd", "\\u", "tags", "\\u", "mod", ":", " ", "\"_", "+_", "str_", "(_", "find", "\\u", "tags", "\\u", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "tta", "gs", "\\u", "to", "\\u", "search", "\\u", "mod", ":", " ", "\"_", "+_", "str_", "(_", "tags", "\\u", "to", "\\u", "search", "\\u", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "tops", "\\u", "type", "\\u", "flags", ":", " ", "\"_", "+_", "str_", "(_", "ops", "\\u", "type", "\\u", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "through", " ", "tags", " ", "to", " ", "search", " ", "and", " ", "look", " ", "for", " ", "the", " ", "find", " ", "tags_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "search_", "in_", "tags", "\\u", "to", "\\u", "search", "\\u", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "search_", "=_", "search_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "tse", "arch", ":", " ", "\"_", "+_", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "search_", "._", "find_", "(_", "\":\"_", ")_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "I", "'", "m", " ", "in", " ", "the", " ", "find", " ", ":", " ", "if", " ", "statem", "ent", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "element", "1_", "=_", "search_", "._", "split_", "(_", "\":\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element", "2_", "=_", "search_", "._", "split_", "(_", "\":\"_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "\\\\", "tele", "ment", "1", ":", " ", "\"_", "+_", "element", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "\\\\", "tele", "ment", "2", ":", " ", "\"_", "+_", "element", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "element", "1_", "in_", "ops", "\\u", "type", "\\u", "flags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element", "2_", "in_", "find", "\\u", "tags", "\\u", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "tfo", "und", ":", " ", "\"_", "+_", "str_", "(_", "found_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "found_", "\\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,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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 ]
Variable defined multiple times
VisTrails/VisTrails/contrib/NumSciPy/ArrayPlot.py
[ { "content": " def compute(self):\n data = self.get_input(\"Data Array\")\n da_ar = data.get_array().squeeze()\n if da_ar.ndim != 2:\n raise ModuleError(\"Input Data Array must have dimension = 2\")\n\n aspect_ratio = self.force_get_input(\"Aspect Ratio\")\n colormap = self.force_get_input(\"Colormap\")\n colorbar = self.force_get_input(\"Colorbar\")\n extents = self.force_get_input(\"Extents\")\n\n # Quickly check the assigned colormap to make sure it's valid\n if colormap == None:\n colormap = \"jet\"\n if not hasattr(pylab, colormap):\n colormap = \"jet\"\n \n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n \n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n s += 'imshow(da_ar, interpolation=\\'bicubic\\''\n if aspect_ratio != None:\n s += ', aspect=' + str(aspect_ratio)\n\n if extents != None:\n s += ', extent=['+str(extents[0])+','+str(extents[1])+','+str(extents[2])+','+str(extents[3])+']'\n s += ')\\n'\n\n s += colormap + '()\\n'\n\n if colorbar:\n s += 'colorbar()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data.get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output('source', s)", "metadata": "root.ArrayImage.compute", "header": "['class', 'ArrayImage', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 65 }, { "content": " def compute(self):\n data = self.get_input_list(\"Data Array\")\n self.label_dict = None\n self.color_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n nbins = self.force_get_input(\"Bins\")\n if nbins == None:\n nbins = 10\n normed = self.force_get_input(\"Normalize\")\n if normed == None:\n normed = False\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n data_list = []\n for i in data:\n data_list.append(i.get_array().squeeze())\n\n da_ar = None\n try:\n da_ar = numpy.array(data_list)\n except:\n raise ModuleException(\"Not all Data Array inputs are the same size!\")\n\n for i in range(da_ar.shape[0]):\n lab = self.get_label(data[i], i)\n col = self.get_color(colors, i, randomcolors)\n\n s += 'hist(da_ar['+str(i)+',:], bins=' + str(nbins)\n \n if lab != None:\n s += ', label=\\'' + lab + '\\''\n if col != None:\n s += ', facecolor=' + str(col)\n\n s += ', normed='+str(normed)\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data[0].get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'Histogram Value\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output(\"source\", s) ", "metadata": "root.Histogram.compute", "header": "['class', 'Histogram', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 162 }, { "content": " def compute(self):\n xdata = self.get_input_list(\"X Array\")\n ydata = self.get_input_list(\"Y Array\")\n self.label_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n self.color_dict = None\n bg_color = self.force_get_input(\"Background\")\n markers = self.force_get_input_list(\"Markers\")\n self.marker_dict = None\n ps = self.force_get_input(\"Point Size\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n if len(xdata) != len(ydata):\n raise ModuleError(\"Cannot create scatter plot for different number of X and Y datasets.\")\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n xdata_ar = numpy.zeros((len(xdata), xdata[0].get_array().flatten().shape[0]))\n ydata_ar = numpy.zeros((len(xdata), xdata[0].get_array().flatten().shape[0]))\n\n for i in range(len(xdata)):\n xd = xdata[i]\n yd = ydata[i]\n xdata_ar[i,:] = xd.get_array().flatten()\n ydata_ar[i,:] = yd.get_array().flatten()\n \n for i in range(len(xdata)):\n xar = xdata[i]\n yar = ydata[i]\n\n lab = self.get_label(xar, i)\n col = self.get_color(colors, i, randomcolors)\n mar = self.get_marker(markers, i)\n\n s += 'scatter(xdata_ar[' + str(i) +',:], ydata_ar[' + str(i) + ',:]'\n \n if lab != None:\n s += ', label=\\'' + lab +'\\''\n if col != None:\n s += ', color=' + str(col)\n if mar != None:\n s += ', marker=\\'' + mar + '\\''\n if ps != None:\n s += ', size=' + str(ps)\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + xar.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + yar.get_domain_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n print s\n exec s\n self.set_output(\"source\", s)", "metadata": "root.ScatterPlot.compute", "header": "['class', 'ScatterPlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 404 }, { "content": " def compute(self):\n data = self.get_input(\"Input Array\")\n indexes = self.force_get_input(\"Indexes\")\n self.label_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n self.color_dict = None\n markers = self.force_get_input_list(\"Markers\")\n self.marker_dict = None\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n p_title = self.force_get_input(\"Title\")\n bg_color = self.force_get_input(\"Background\")\n\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n da_ar = data.get_array()\n\n if da_ar.ndim > 2:\n raise ModuleError(\"Cannot plot data with dimensions > 2\")\n \n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n \n if da_ar.ndim == 1:\n da_ar.shape = (1, da_ar.shape[0])\n\n xar = self.force_get_input(\"X Values\")\n sf = self.force_get_input(\"Scaling Factor\")\n if sf == None:\n sf = 1.\n\n if xar == None:\n start_i = None\n end_i = None\n if indexes == None:\n start_i = 0\n end_i = da_ar.shape[1]\n else:\n start_i = indexes[0]\n end_i = indexes[1]\n\n xar = numpy.arange(start_i, end_i)\n xar = xar * sf\n else:\n xar = xar.get_array()\n \n print da_ar.shape\n print xar.shape\n for i in range(da_ar.shape[0]):\n lab = self.get_label(data, i)\n col = self.get_color(colors, i, randomcolors)\n mar = self.get_marker(markers, i)\n if indexes == None:\n s += 'plot(xar, da_ar[' + str(i) + ',:]'\n else:\n s += 'plot(xar, da_ar[' + str(i) + ',' + str(indexes[0]) + ':' + str(indexes[1]) + ']'\n \n if lab != None:\n s += ', label=\\'' + lab +'\\''\n if col != None:\n s += ', color=' + str(col)\n if mar != None:\n s += ', marker=\\'' + mar + '\\''\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data.get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output(\"source\", s)", "metadata": "root.LinePlot.compute", "header": "['class', 'LinePlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 518 } ]
[ { "span": "s ", "start_line": 90, "start_column": 8, "end_line": 90, "end_column": 9 }, { "span": "s ", "start_line": 181, "start_column": 8, "end_line": 181, "end_column": 9 }, { "span": "s ", "start_line": 423, "start_column": 8, "end_line": 423, "end_column": 9 }, { "span": "s ", "start_line": 536, "start_column": 8, "end_line": 536, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Array", "Image_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Data", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "\\u", "ar_", "=_", "data_", "._", "get", "\\u", "array_", "(_", ")_", "._", "squeeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Inp", "ut", " ", "Data", " ", "Array", " ", "must", " ", "have", " ", "dimension", " ", "=", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Asp", "ect", " ", "Rati", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colormap_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Color", "map", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colorbar_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Color", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extents_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Extent", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Qui", "ckl", "y", " ", "check", " ", "the", " ", "assign", "ed", " ", "colormap", " ", "to", " ", "make", " ", "sure", " ", "it", "'", "s", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "colormap_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colormap_", "=_", "\"", "jet", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "pylab_", ",_", "colormap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colormap_", "=_", "\"", "jet", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'", "ims", "how", "(", "da", "\\u", "ar", ",", " ", "interpolati", "on", "=\\\\", "'", "bic", "ubi", "c", "\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aspect", "\\u", "ratio_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "aspect", "='_", "+_", "str_", "(_", "aspect", "\\u", "ratio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extents_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "extent", "=[", "'_", "+_", "str_", "(_", "extents_", "[_", "0_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "1_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "2_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "3_", "]_", ")_", "+_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "colormap_", "+_", "'(", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "colorbar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "colorbar", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "source", "'_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Data", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nbins_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Bin", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nbins_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nbins_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "normed_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Normalize", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "normed_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "list_", "._", "append_", "(_", "i_", "._", "get", "\\u", "array_", "(_", ")_", "._", "squeeze_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "da", "\\u", "ar_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "=_", "numpy_", "._", "array_", "(_", "data\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Exception_", "(_", "\"", "Not", " ", "all", " ", "Data", " ", "Array", " ", "inputs", " ", "are", " ", "the", " ", "same", " ", "size", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", "[_", "i_", "]_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "'", "hist", "(", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "bins", "='_", "+_", "str_", "(_", "nbins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "face", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "',", " ", "norm", "ed", "='_", "+_", "str_", "(_", "normed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "Histogram", " ", "Value", "\\\\')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scatter", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xdata_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "X", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ydata_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Y", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Markers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "marker", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Point", " ", "Size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "xdata_", ")_", "!=_", "len_", "(_", "ydata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Cann", "ot", " ", "create", " ", "scatter", " ", "plot", " ", "for", " ", "different", " ", "number", " ", "of", " ", "X", " ", "and", " ", "Y", " ", "dataset", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xdat", "a", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "xdata_", ")_", ",_", "xdata_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "ta", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "xdata_", ")_", ",_", "xdata_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "xdata_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xd", "_", "=_", "xdata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yd", "_", "=_", "ydata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xdat", "a", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "xd", "_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "ta", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "yd", "_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "xdata_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xar", "_", "=_", "xdata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yar", "_", "=_", "ydata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "xar", "_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mar", "_", "=_", "self_", "._", "get", "\\u", "marker_", "(_", "markers_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "'", "scatter", "(", "xdat", "a", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "yda", "ta", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mar", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "marker", "=\\\\", "''_", "+_", "mar", "_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ps_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "size", "='_", "+_", "str_", "(_", "ps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "xar", "_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "yar", "_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indexes_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Indexe", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Markers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "marker", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "\\u", "ar_", "=_", "data_", "._", "get", "\\u", "array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Cann", "ot", " ", "plot", " ", "data", " ", "with", " ", "dimension", "s", " ", ">", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "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 ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "._", "shape_", "=_", "(_", "1_", ",_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xar", "_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Value", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Sca", "ling", " ", "Factor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sf_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sf_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xar", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "i_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indexes_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "da", "\\u", "ar_", "._", "shape_", "[_", "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 ", " _", "start", "\\u", "i_", "=_", "indexes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "indexes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xar", "_", "=_", "numpy_", "._", "arange_", "(_", "start", "\\u", "i_", ",_", "end", "\\u", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xar", "_", "=_", "xar", "_", "*_", "sf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xar", "_", "=_", "xar", "_", "._", "get", "\\u", "array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "da", "\\u", "ar_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "xar", "_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mar", "_", "=_", "self_", "._", "get", "\\u", "marker_", "(_", "markers_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indexes_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "plot", "(", "xar", ",", " ", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "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 ", " _", "s_", "+=_", "'", "plot", "(", "xar", ",", " ", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "','_", "+_", "str_", "(_", "indexes_", "[_", "0_", "]_", ")_", "+_", "':'_", "+_", "str_", "(_", "indexes_", "[_", "1_", "]_", ")_", "+_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mar", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "marker", "=\\\\", "''_", "+_", "mar", "_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
yhat/ggplot/ggplot/tests/test_legend.py
[ { "content": "from __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\nfrom . import get_assert_same_ggplot, cleanup, assert_same_elements\nassert_same_ggplot = get_assert_same_ggplot(__file__)\n\n\nfrom nose.tools import (assert_true, assert_raises, assert_is,\n assert_is_not, assert_equal)\n\nfrom ggplot import *\n\nimport six\nimport pandas as pd\nfrom ggplot.components import assign_visual_mapping\nfrom ggplot.utils.exceptions import GgplotError\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_test_df():\n df = pd.DataFrame({\n 'xmin': [1, 3, 5],\n 'xmax': [2, 3.5, 7],\n 'ymin': [1, 4, 6],\n 'ymax': [5, 5, 9],\n 'fill': ['blue', 'red', 'green'],\n 'quality': ['good', 'bad', 'ugly'],\n 'alpha': [0.1, 0.5, 0.9],\n 'texture': ['hard', 'soft', 'medium']})\n return df", "metadata": "root.get_test_df", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def test_legend_structure():\n df = get_test_df()\n\n gg = ggplot(df, aes(xmin='xmin', xmax='xmax', ymin='ymin', ymax='ymax',\n colour='quality', fill='fill', alpha='alpha',\n linetype='texture'))\n new_df, legend = assign_visual_mapping(df, gg.aesthetics, gg)\n\n # All mapped aesthetics must have an entry in the legend\n for aesthetic in ('color', 'fill', 'alpha', 'linetype'):\n assert(aesthetic in legend)\n\n # None of the unassigned aesthetic should have an entry in the legend\n assert('size' not in legend)\n assert('shape' not in legend)\n\n # legend entries should remember the column names\n # to which they were mapped\n assert(legend['fill']['column_name'] == 'fill')\n assert(legend['color']['column_name'] == 'quality')\n assert(legend['linetype']['column_name'] == 'texture')\n assert(legend['alpha']['column_name'] == 'alpha')\n\n # Discrete columns for non-numeric data\n assert(legend['fill']['scale_type'] == 'discrete')\n assert(legend['color']['scale_type'] == 'discrete')\n assert(legend['linetype']['scale_type'] == 'discrete')\n assert(legend['alpha']['scale_type'] == 'discrete')\n\n # Alternate\n df2 = pd.DataFrame.copy(df)\n df2['fill'] = [90, 3.2, 8.1]\n gg = ggplot(df2, aes(xmin='xmin', xmax='xmax', ymin='ymin', ymax='ymax',\n colour='quality', fill='fill', alpha='alpha',\n linetype='texture'))\n new_df, legend = assign_visual_mapping(df2, gg.aesthetics, gg)\n assert(legend['fill']['scale_type'] == 'discrete')\n\n # Test if legend switches to continuous for more than 8 numerical values\n df3 = pd.DataFrame({\n 'xmin': [1, 3, 5, 8, 2, 1, 4, 7, 9],\n 'xmax': [2, 3.5, 7, 12, 3, 2, 6, 8, 10],\n 'ymin': [1, 4, 6, 0, 0, 0, 0, 0, 0],\n 'ymax': [5, 5, 9, 1, 1, 1, 1, 1, 1],\n 'fill': ['blue', 'red', 'green', 'green', 'green',\n 'green', 'green', 'green', 'brown'],\n 'quality': ['good', 'bad', 'ugly', 'horrible', 'quite awful',\n 'impertinent', 'jolly', 'hazardous', 'ok'],\n 'alpha': [0.1, 0.2, 0.4, 0.5, 0.6, 0.65, 0.8, 0.82, 0.83],\n 'texture': ['hard', 'soft', 'medium', 'fluffy', 'slimy', 'rough',\n 'edgy', 'corny', 'slanted']\n })\n gg = ggplot(df2, aes(xmin='xmin', xmax='xmax', ymin='ymin', ymax='ymax',\n colour='quality', fill='fill', alpha='alpha',\n linetype='texture'))\n new_df, legend = assign_visual_mapping(df3, gg.aesthetics, gg)\n assert(legend['alpha']['scale_type'] == 'continuous')\n\n # Test if legend raises GgplotError when size and alpha is fed non numeric data\n gg = ggplot(df3, aes(size=\"fill\"))\n assert_raises(GgplotError, assign_visual_mapping, df3, gg.aesthetics, gg)\n gg = ggplot(df3, aes(alpha=\"fill\"))\n assert_raises(GgplotError, assign_visual_mapping, df3, gg.aesthetics, gg)", "metadata": "root.test_legend_structure", "header": "['module', '___EOS___']", "index": 29 }, { "content": "@cleanup\ndef test_alpha_rect():\n df = get_test_df()\n p = ggplot(df, aes(xmin='xmin', xmax='xmax', ymin='ymin', ymax='ymax',\n colour='quality', fill='fill', alpha='alpha',\n linetype='texture'))\n p += geom_rect(size=5)\n assert_same_ggplot(p, \"legend_alpha_rect\")", "metadata": "root.test_alpha_rect", "header": "['module', '___EOS___']", "index": 93 }, { "content": "@cleanup\ndef test_alpha():\n diamonds[\"test\"] = diamonds[\"clarity\"].map(len)\n p = ggplot(diamonds[::50], aes(x='carat', y='price', colour='test',\n size='test', alpha='test'))\n #p = ggplot(diamonds[1:60000:50], aes(x='carat', y='price', shape='clarity'))\n p = p + geom_point() + ggtitle(\"Diamonds: A Plot\")\n p = p + xlab(\"Carat\") + ylab(\"Price\")\n assert_same_ggplot(p, \"legend_alpha\")", "metadata": "root.test_alpha", "header": "['module', '___EOS___']", "index": 102 }, { "content": "@cleanup\ndef test_linetype():\n meat_lng = pd.melt(meat[['date', 'beef', 'pork', 'broilers']], id_vars='date')\n p = ggplot(aes(x='date', y='value', colour='variable',\n linetype='variable', shape='variable'), data=meat_lng) + \\\n geom_line() + geom_point() +\\\n ylim(0, 3000)\n assert_same_ggplot(p, \"legend_linetype\")", "metadata": "root.test_linetype", "header": "['module', '___EOS___']", "index": 112 }, { "content": "@cleanup\ndef test_shape_alpha():\n diamonds[\"test\"] = diamonds[\"clarity\"].map(len)\n df = diamonds[::50]\n p = ggplot(df, aes(x='carat', y='price', colour='test', size='test',\n alpha='test', shape='clarity')) + geom_point()\n assert_same_ggplot(p, \"legend_shape_alpha\")", "metadata": "root.test_shape_alpha", "header": "['module', '___EOS___']", "index": 121 } ]
[ { "span": "from nose.tools import (assert_true, assert_raises, assert_is,\n assert_is_not, assert_equal)", "start_line": 7, "start_column": 0, "end_line": 8, "end_column": 52 }, { "span": "import six", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "(_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode", "\\u", "literals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "get", "\\u", "assert", "\\u", "same", "\\u", "gg", "plot_", ",_", "cleanup_", ",_", "assert", "\\u", "same", "\\u", "elements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "=_", "get", "\\u", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "(_", "assert", "\\u", "true_", ",_", "assert", "\\u", "raises_", ",_", "assert", "\\u", "is_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "is", "\\u", "not_", ",_", "assert", "\\u", "equal_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gg", "plot_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gg", "plot_", "._", "components_", "import_", "assign", "\\u", "visu", "al", "\\u", "mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gg", "plot_", "._", "utils_", "._", "exceptions_", "import_", "Gg", "plot", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "get", "\\u", "test\\u", "df_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xmi", "n", "'_", ":_", "[_", "1_", ",_", "3_", ",_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xma", "x", "'_", ":_", "[_", "2_", ",_", "3.5_", ",_", "7_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ymin", "'_", ":_", "[_", "1_", ",_", "4_", ",_", "6_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ymax", "'_", ":_", "[_", "5_", ",_", "5_", ",_", "9_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fill", "'_", ":_", "[_", "'", "blue", "'_", ",_", "'", "red", "'_", ",_", "'", "green", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quali", "ty", "'_", ":_", "[_", "'", "good", "'_", ",_", "'", "bad", "'_", ",_", "'", "ug", "ly", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alpha", "'_", ":_", "[_", "0.1_", ",_", "0.5_", ",_", "0.9_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "textu", "re", "'_", ":_", "[_", "'", "hard", "'_", ",_", "'", "soft", "'_", ",_", "'", "medium", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "test\\u", "legend", "\\u", "structure_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "get", "\\u", "test\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "xmin_", "=_", "'", "xmi", "n", "'_", ",_", "xmax_", "=_", "'", "xma", "x", "'_", ",_", "ymin_", "=_", "'", "ymin", "'_", ",_", "ymax_", "=_", "'", "ymax", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colour_", "=_", "'", "quali", "ty", "'_", ",_", "fill_", "=_", "'", "fill", "'_", ",_", "alpha_", "=_", "'", "alpha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linet", "ype_", "=_", "'", "textu", "re", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "df_", ",_", "legend_", "=_", "assign", "\\u", "visu", "al", "\\u", "mapping_", "(_", "df_", ",_", "gg_", "._", "aes", "thet", "ics_", ",_", "gg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "mapp", "ed", " ", "aes", "thet", "ics", " ", "must", " ", "have", " ", "an", " ", "entry", " ", "in", " ", "the", " ", "legend_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "aes", "thet", "ic_", "in_", "(_", "'", "color", "'_", ",_", "'", "fill", "'_", ",_", "'", "alpha", "'_", ",_", "'", "linet", "ype", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "aes", "thet", "ic_", "in_", "legend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Non", "e", " ", "of", " ", "the", " ", "unassign", "ed", " ", "aes", "thet", "ic", " ", "shou", "ld", " ", "have", " ", "an", " ", "entry", " ", "in", " ", "the", " ", "legend_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "'", "size", "'_", "not_", "in_", "legend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "'", "shape", "'_", "not_", "in_", "legend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "legend", " ", "entri", "es", " ", "shou", "ld", " ", "remember", " ", "the", " ", "column", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "whi", "ch", " ", "the", "y", " ", "wer", "e", " ", "mapped_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "fill", "'_", "]_", "[_", "'", "column", "\\u", "name", "'_", "]_", "==_", "'", "fill", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "color", "'_", "]_", "[_", "'", "column", "\\u", "name", "'_", "]_", "==_", "'", "quali", "ty", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "linet", "ype", "'_", "]_", "[_", "'", "column", "\\u", "name", "'_", "]_", "==_", "'", "textu", "re", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "alpha", "'_", "]_", "[_", "'", "column", "\\u", "name", "'_", "]_", "==_", "'", "alpha", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Discr", "ete", " ", "column", "s", " ", "for", " ", "non", "-", "numeri", "c", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "fill", "'_", "]_", "[_", "'", "scale", "\\u", "type", "'_", "]_", "==_", "'", "discrete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "color", "'_", "]_", "[_", "'", "scale", "\\u", "type", "'_", "]_", "==_", "'", "discrete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "linet", "ype", "'_", "]_", "[_", "'", "scale", "\\u", "type", "'_", "]_", "==_", "'", "discrete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "alpha", "'_", "]_", "[_", "'", "scale", "\\u", "type", "'_", "]_", "==_", "'", "discrete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Alternate", "_", "\\u\\u\\uNL\\u\\u\\u_", "df2_", "=_", "pd_", "._", "Data", "Frame_", "._", "copy_", "(_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df2_", "[_", "'", "fill", "'_", "]_", "=_", "[_", "90_", ",_", "3.2", "_", ",_", "8.1", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df2_", ",_", "aes", "_", "(_", "xmin_", "=_", "'", "xmi", "n", "'_", ",_", "xmax_", "=_", "'", "xma", "x", "'_", ",_", "ymin_", "=_", "'", "ymin", "'_", ",_", "ymax_", "=_", "'", "ymax", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colour_", "=_", "'", "quali", "ty", "'_", ",_", "fill_", "=_", "'", "fill", "'_", ",_", "alpha_", "=_", "'", "alpha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linet", "ype_", "=_", "'", "textu", "re", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "df_", ",_", "legend_", "=_", "assign", "\\u", "visu", "al", "\\u", "mapping_", "(_", "df2_", ",_", "gg_", "._", "aes", "thet", "ics_", ",_", "gg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "fill", "'_", "]_", "[_", "'", "scale", "\\u", "type", "'_", "]_", "==_", "'", "discrete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "if", " ", "legend", " ", "switche", "s", " ", "to", " ", "continuous", " ", "for", " ", "more", " ", "than", " ", "8", " ", "numerical", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "df", "3_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xmi", "n", "'_", ":_", "[_", "1_", ",_", "3_", ",_", "5_", ",_", "8_", ",_", "2_", ",_", "1_", ",_", "4_", ",_", "7_", ",_", "9_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xma", "x", "'_", ":_", "[_", "2_", ",_", "3.5_", ",_", "7_", ",_", "12_", ",_", "3_", ",_", "2_", ",_", "6_", ",_", "8_", ",_", "10_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ymin", "'_", ":_", "[_", "1_", ",_", "4_", ",_", "6_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ymax", "'_", ":_", "[_", "5_", ",_", "5_", ",_", "9_", ",_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fill", "'_", ":_", "[_", "'", "blue", "'_", ",_", "'", "red", "'_", ",_", "'", "green", "'_", ",_", "'", "green", "'_", ",_", "'", "green", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "green", "'_", ",_", "'", "green", "'_", ",_", "'", "green", "'_", ",_", "'", "brow", "n", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quali", "ty", "'_", ":_", "[_", "'", "good", "'_", ",_", "'", "bad", "'_", ",_", "'", "ug", "ly", "'_", ",_", "'", "hor", "rib", "le", "'_", ",_", "'", "quite", " ", "aw", "ful", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "imper", "tin", "ent", "'_", ",_", "'", "jo", "ll", "y", "'_", ",_", "'", "hazard", "ous", "'_", ",_", "'", "ok", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alpha", "'_", ":_", "[_", "0.1_", ",_", "0.2_", ",_", "0.4_", ",_", "0.5_", ",_", "0.6_", ",_", "0.65_", ",_", "0.8_", ",_", "0.82", "_", ",_", "0.83", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "textu", "re", "'_", ":_", "[_", "'", "hard", "'_", ",_", "'", "soft", "'_", ",_", "'", "medium", "'_", ",_", "'", "flu", "ff", "y", "'_", ",_", "'", "slim", "y", "'_", ",_", "'", "rough", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "edg", "y", "'_", ",_", "'", "corn", "y", "'_", ",_", "'", "sla", "nte", "d", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df2_", ",_", "aes", "_", "(_", "xmin_", "=_", "'", "xmi", "n", "'_", ",_", "xmax_", "=_", "'", "xma", "x", "'_", ",_", "ymin_", "=_", "'", "ymin", "'_", ",_", "ymax_", "=_", "'", "ymax", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colour_", "=_", "'", "quali", "ty", "'_", ",_", "fill_", "=_", "'", "fill", "'_", ",_", "alpha_", "=_", "'", "alpha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linet", "ype_", "=_", "'", "textu", "re", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "df_", ",_", "legend_", "=_", "assign", "\\u", "visu", "al", "\\u", "mapping_", "(_", "df", "3_", ",_", "gg_", "._", "aes", "thet", "ics_", ",_", "gg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "legend_", "[_", "'", "alpha", "'_", "]_", "[_", "'", "scale", "\\u", "type", "'_", "]_", "==_", "'", "continuous", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "if", " ", "legend", " ", "raise", "s", " ", "Gg", "plot", "Error", " ", "whe", "n", " ", "size", " ", "and", " ", "alpha", " ", "is", " ", "fed", " ", "non", " ", "numeri", "c", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df", "3_", ",_", "aes", "_", "(_", "size_", "=_", "\"", "fill", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Gg", "plot", "Error_", ",_", "assign", "\\u", "visu", "al", "\\u", "mapping_", ",_", "df", "3_", ",_", "gg_", "._", "aes", "thet", "ics_", ",_", "gg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gg_", "=_", "gg", "plot_", "(_", "df", "3_", ",_", "aes", "_", "(_", "alpha_", "=_", "\"", "fill", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Gg", "plot", "Error_", ",_", "assign", "\\u", "visu", "al", "\\u", "mapping_", ",_", "df", "3_", ",_", "gg_", "._", "aes", "thet", "ics_", ",_", "gg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "alpha", "\\u", "rect_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df_", "=_", "get", "\\u", "test\\u", "df_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "xmin_", "=_", "'", "xmi", "n", "'_", ",_", "xmax_", "=_", "'", "xma", "x", "'_", ",_", "ymin_", "=_", "'", "ymin", "'_", ",_", "ymax_", "=_", "'", "ymax", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colour_", "=_", "'", "quali", "ty", "'_", ",_", "fill_", "=_", "'", "fill", "'_", ",_", "alpha_", "=_", "'", "alpha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linet", "ype_", "=_", "'", "textu", "re", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "+=_", "geom", "\\u", "rect_", "(_", "size_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "p_", ",_", "\"", "legend", "\\u", "alpha", "\\u", "rect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "alpha_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diamond", "s_", "[_", "\"", "test", "\"_", "]_", "=_", "diamond", "s_", "[_", "\"", "clari", "ty", "\"_", "]_", "._", "map_", "(_", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "gg", "plot_", "(_", "diamond", "s_", "[_", ":_", ":_", "50_", "]_", ",_", "aes", "_", "(_", "x_", "=_", "'", "cara", "t", "'_", ",_", "y_", "=_", "'", "price", "'_", ",_", "colour_", "=_", "'", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "'", "test", "'_", ",_", "alpha_", "=_", "'", "test", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "p", " ", "=", " ", "gg", "plot", "(", "diamond", "s", "[", "1", ":", "60000", ":", "50", "],", " ", "aes", "(", "x", "='", "cara", "t", "',", " ", "y", "='", "price", "',", " ", "shape", "='", "clari", "ty", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "p_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "gg", "title_", "(_", "\"", "Diam", "ond", "s", ":", " ", "A", " ", "Plot", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "p_", "+_", "xla", "b_", "(_", "\"", "Car", "at", "\"_", ")_", "+_", "yla", "b_", "(_", "\"", "Price", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "p_", ",_", "\"", "legend", "\\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_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "linet", "ype_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mea", "t", "\\u", "lng_", "=_", "pd_", "._", "mel", "t_", "(_", "mea", "t_", "[_", "[_", "'", "date", "'_", ",_", "'", "beef", "'_", ",_", "'", "por", "k", "'_", ",_", "'", "bro", "iler", "s", "'_", "]_", "]_", ",_", "id", "\\u", "vars_", "=_", "'", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "gg", "plot_", "(_", "aes", "_", "(_", "x_", "=_", "'", "date", "'_", ",_", "y_", "=_", "'", "value", "'_", ",_", "colour_", "=_", "'", "variab", "le", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linet", "ype_", "=_", "'", "variab", "le", "'_", ",_", "shape_", "=_", "'", "variab", "le", "'_", ")_", ",_", "data_", "=_", "mea", "t", "\\u", "lng_", ")_", "+_", "geom", "\\u", "line_", "(_", ")_", "+_", "geom", "\\u", "point_", "(_", ")_", "+_", "ylim_", "(_", "0_", ",_", "3000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "p_", ",_", "\"", "legend", "\\u", "linet", "ype", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "shape", "\\u", "alpha_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diamond", "s_", "[_", "\"", "test", "\"_", "]_", "=_", "diamond", "s_", "[_", "\"", "clari", "ty", "\"_", "]_", "._", "map_", "(_", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df_", "=_", "diamond", "s_", "[_", ":_", ":_", "50_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "gg", "plot_", "(_", "df_", ",_", "aes", "_", "(_", "x_", "=_", "'", "cara", "t", "'_", ",_", "y_", "=_", "'", "price", "'_", ",_", "colour_", "=_", "'", "test", "'_", ",_", "size_", "=_", "'", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "'", "test", "'_", ",_", "shape_", "=_", "'", "clari", "ty", "'_", ")_", ")_", "+_", "geom", "\\u", "point_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "same", "\\u", "gg", "plot_", "(_", "p_", ",_", "\"", "legend", "\\u", "shape", "\\u", "alpha", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ReactiveX/RxPY/tests/test_observable/test_singleordefault.py
[ { "content": "import unittest\n\nfrom rx.observable import Observable\nfrom rx.testing import TestScheduler, ReactiveTest\nfrom rx.disposables import Disposable, SerialDisposable\n\non_next = ReactiveTest.on_next\non_completed = ReactiveTest.on_completed\non_error = ReactiveTest.on_error\nsubscribe = ReactiveTest.subscribe\nsubscribed = ReactiveTest.subscribed\ndisposed = ReactiveTest.disposed\ncreated = ReactiveTest.created\n\n\n# Helper function for raising exceptions within lambdas\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RxException(Exception):\n pass", "metadata": "root.RxException", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def _raise(ex):\n raise RxException(ex)", "metadata": "root._raise", "header": "['module', '___EOS___']", "index": 18 }, { "content": "class TestSingleOrDefault(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n ", "metadata": "root.TestSingleOrDefault", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def test_single_or_default_async_empty(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_completed(250))\n\n def create():\n return xs.single_or_default(None, 0)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 0), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_empty", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def test_single_or_default_async_one(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n\n def create():\n return xs.single_or_default(None, 0)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 2), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_one", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_single_or_default_async_many(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_completed(250))\n\n def create():\n return xs.single_or_default(None, 0)\n\n res = scheduler.start(create=create)\n\n def predicate(e):\n return not e is None\n\n res.messages.assert_equal(on_error(220, predicate))\n xs.subscriptions.assert_equal(subscribe(200, 220))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_many", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_single_or_default_async_error(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex))\n\n def create():\n return xs.single_or_default(None, 0)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_error(210, ex))\n xs.subscriptions.assert_equal(subscribe(200, 210))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_error", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_single_or_default_async_predicate(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n\n def create():\n def predicate(x):\n return x % 2 == 1\n\n return xs.single_or_default(predicate, 0)\n\n res = scheduler.start(create=create)\n\n def predicate(e):\n return not e is None\n\n res.messages.assert_equal(on_error(240, predicate))\n xs.subscriptions.assert_equal(subscribe(200, 240))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_predicate", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_single_or_default_async_predicate_empty(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_completed(250))\n\n def create():\n def predicate(x):\n return x % 2 == 1\n return xs.single_or_default(predicate, 0)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 0), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_predicate_empty", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": " def test_single_or_default_async_predicate_one(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n\n def create():\n def predicate(x):\n return x == 4\n\n return xs.single_or_default(predicate, 0)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 4), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_predicate_one", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 107 }, { "content": " def test_single_or_default_async_predicate_none(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n\n def create():\n def predicate(x):\n return x > 10\n\n return xs.single_or_default(predicate, 0)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 0), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_predicate_none", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 123 }, { "content": " def test_single_or_default_async_predicate_throw(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex))\n \n def create():\n def predicate(x):\n return x > 10\n return xs.single_or_default(predicate, 0)\n \n res = scheduler.start(create=create)\n \n res.messages.assert_equal(on_error(210, ex))\n xs.subscriptions.assert_equal(subscribe(200, 210))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_predicate_throw", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def test_single_or_default_async_predicate_throws(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_next(240, 5), on_completed(250))\n \n def create():\n def predicate(x):\n if x < 4:\n return False\n else:\n raise Exception(ex)\n \n return xs.single_or_default(predicate, 0)\n res = scheduler.start(create=create)\n \n res.messages.assert_equal(on_error(230, ex))\n xs.subscriptions.assert_equal(subscribe(200, 230))", "metadata": "root.TestSingleOrDefault.test_single_or_default_async_predicate_throws", "header": "['class', 'TestSingleOrDefault', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 153 } ]
[ { "span": "from rx.observable import Observable", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 36 }, { "span": "from rx.disposables import Disposable, SerialDisposable", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "._", "observable_", "import_", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "testing_", "import_", "Test", "Scheduler_", ",_", "React", "ive", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Dispo", "sab", "le_", ",_", "Ser", "ial", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "completed_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "error_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe_", "=_", "React", "ive", "Test_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribed", "_", "=_", "React", "ive", "Test_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "React", "ive", "Test_", "._", "dispose", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "React", "ive", "Test_", "._", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Help", "er", " ", "function", " ", "for", " ", "rais", "ing", " ", "exception", "s", " ", "within", " ", "lambda", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Rx", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "raise_", "(_", "ex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Rx", "Exception_", "(_", "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_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "None_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "one_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "None_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "many_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "None_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "predicate_", "(_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "e_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "220_", ",_", "predicate_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "220_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "None_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "210_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "predicate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predicate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "%_", "2_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "predicate_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "predicate_", "(_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "e_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "240_", ",_", "predicate_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "240_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "predica", "te", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predicate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "%_", "2_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "predicate_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "predica", "te", "\\u", "one_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predicate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "predicate_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "4_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "predica", "te", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predicate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", ">_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "predicate_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "predica", "te", "\\u", "throw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predicate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", ">_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "predicate_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "210_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Sing", "le", "Or", "Default_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "or", "\\u", "default", "\\u", "async", "\\u", "predica", "te", "\\u", "throw", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predicate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "single", "\\u", "or", "\\u", "default_", "(_", "predicate_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "230_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "230_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
`__iter__` method returns a non-iterator
CGATOxford/cgat/CGAT/CSV.py
[ { "content": "class CommentStripper:\n \"\"\"Iterator for stripping comments from file.\n\n This iterator will skip any lines beginning with ``#``\n or any empty lines at the beginning of the output.\n \"\"\"\n\n\n", "metadata": "root.CommentStripper", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def __iter__(self):\n return self", "metadata": "root.CommentStripper.__iter__", "header": "['class', 'CommentStripper', ':', '___EOS___']", "index": 78 }, { "content": "class UnicodeCsvReader(object):\n\n\n\n", "metadata": "root.UnicodeCsvReader", "header": "['module', '___EOS___']", "index": 104 }, { "content": " def __iter__(self):\n return self", "metadata": "root.UnicodeCsvReader.__iter__", "header": "['class', 'UnicodeCsvReader', '(', 'object', ')', ':', '___EOS___']", "index": 110 }, { "content": "class DictReaderLarge:\n \"\"\"Substitute for :py:class:`csv.DictReader` that handles very large\n fields.\n\n :py:mod:`csv` is implemented in C and limits the number of columns\n per table. This class has no such limit, but will not be as fast.\n\n This class is only a minimal implementation. For example, it does\n not handle dialects.\n \"\"\"\n\n\n", "metadata": "root.DictReaderLarge", "header": "['module', '___EOS___']", "index": 131 }, { "content": " def __iter__(self):\n return self", "metadata": "root.DictReaderLarge.__iter__", "header": "['class', 'DictReaderLarge', ':', '___EOS___']", "index": 147 } ]
[ { "span": "class CommentStripper:", "start_line": 68, "start_column": 0, "end_line": 68, "end_column": 22 }, { "span": "class UnicodeCsvReader(object):", "start_line": 104, "start_column": 0, "end_line": 104, "end_column": 31 }, { "span": "class DictReaderLarge:", "start_line": 131, "start_column": 0, "end_line": 131, "end_column": 22 } ]
[ { "span": "def __iter__(self):", "start_line": 78, "start_column": 4, "end_line": 78, "end_column": 23 }, { "span": "def __iter__(self):", "start_line": 110, "start_column": 4, "end_line": 110, "end_column": 23 }, { "span": "def __iter__(self):", "start_line": 147, "start_column": 4, "end_line": 147, "end_column": 23 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "iter\\u\\u_", "`_", "method_", "returns_", "a_", "non", "_", "-_", "iterator_", "[SEP]_", "module_", "\\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_", "Comme", "nt", "Strip", "per_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Iterat", "or", " ", "for", " ", "strip", "ping", " ", "comment", "s", " ", "from", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "iter", "ator", " ", "will", " ", "skip", " ", "any", " ", "lines", " ", "beginn", "ing", " ", "with", " ", "``", "#", "``", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "any", " ", "empty", " ", "lines", " ", "at", " ", "the", " ", "beginn", "ing", " ", "of", " ", "the", " ", "output", ".", "\\", "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_", "Comme", "nt", "Strip", "per_", ":_", "\\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 ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Unic", "ode", "Cs", "v", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Unic", "ode", "Cs", "v", "Reader_", "(_", "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 ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dict", "Read", "er", "Large", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Subst", "itut", "e", " ", "for", " ", ":", "py", ":", "class", ":`", "csv", ".", "Dict", "Read", "er", "`", " ", "tha", "t", " ", "handle", "s", " ", "very", " ", "large", "\\", "10", ";", " ", " ", " ", " ", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "py", ":", "mod", ":`", "csv", "`", " ", "is", " ", "implemented", " ", "in", " ", "C", " ", "and", " ", "limit", "s", " ", "the", " ", "number", " ", "of", " ", "column", "s", "\\", "10", ";", " ", " ", " ", " ", "per", " ", "table", ".", " ", "Thi", "s", " ", "class", " ", "has", " ", "no", " ", "suc", "h", " ", "limit", ",", " ", "but", " ", "will", " ", "not", " ", "be", " ", "as", " ", "fast", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "is", " ", "only", " ", "a", " ", "minima", "l", " ", "implementation", ".", " ", "For", " ", "example", ",", " ", "it", " ", "doe", "s", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "handle", " ", "dialect", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Read", "er", "Large", "_", ":_", "\\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 ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2 ]
Unused local variable
gawel/panoramisk/panoramisk/utils.py
[ { "content": "def agi_code_check(code, response, line):\n \"\"\"\n Check the AGI code and return a dict to help on error handling.\n \"\"\"\n result = {'status_code': code, 'result': ('', ''), 'msg': ''}\n if code == 200:\n for key, value, data in re_kv.findall(response):\n result[key] = (value, data)\n # If user hangs up... we get 'hangup' in the data\n if data == 'hangup':\n return {'error': 'AGIResultHangup', 'msg': 'User hungup during execution'}\n if key == 'result' and value == '-1':\n return {'error': 'AGIAppError', 'msg': 'Error executing application, or hangup'}\n return result\n elif code == 510:\n result['error'] = 'AGIInvalidCommand'\n return result\n elif code == 520:\n usage = [line]\n usage = '%s\\n' % '\\n'.join(usage)\n # AGI Usage error\n result['error'] = 'AGIUsageError'\n result['msg'] = 'usage'\n return result\n else:\n # Unhandled code or undefined response\n result['error'] = 'AGIUnknownError'\n return result", "metadata": "root.agi_code_check", "header": "['module', '___EOS___']", "index": 65 } ]
[ { "span": "usage ", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "agi", "\\u", "code", "\\u", "check_", "(_", "code_", ",_", "response_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "the", " ", "AG", "I", " ", "code", " ", "and", " ", "return", " ", "a", " ", "dict", " ", "to", " ", "help", " ", "on", " ", "error", " ", "handling", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "status", "\\u", "code", "'_", ":_", "code_", ",_", "'", "result", "'_", ":_", "(_", "''_", ",_", "''_", ")_", ",_", "'", "msg", "'_", ":_", "''_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", ",_", "data_", "in_", "re", "\\u", "kv_", "._", "findall_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "key_", "]_", "=_", "(_", "value_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "user", " ", "hang", "s", " ", "up", "...", " ", "we", " ", "get", " ", "'", "hang", "up", "'", " ", "in", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data_", "==_", "'", "hang", "up", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "error", "'_", ":_", "'", "AG", "IR", "esult", "Hang", "up", "'_", ",_", "'", "msg", "'_", ":_", "'", "User", " ", "hun", "gu", "p", " ", "dur", "ing", " ", "executi", "on", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'", "result", "'_", "and_", "value_", "==_", "'-", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "error", "'_", ":_", "'", "AG", "IA", "pp", "Error", "'_", ",_", "'", "msg", "'_", ":_", "'", "Error", " ", "executi", "ng", " ", "applica", "tion", ",", " ", "or", " ", "hang", "up", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "code_", "==_", "510", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "error", "'_", "]_", "=_", "'", "AG", "II", "nval", "id", "Command", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "code_", "==_", "520", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "usage_", "=_", "[_", "line_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage_", "=_", "'%", "s", "\\\\", "n", "'_", "%_", "'\\\\", "n", "'_", "._", "join_", "(_", "usage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AG", "I", " ", "Us", "age", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "error", "'_", "]_", "=_", "'", "AG", "IU", "sage", "Error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "msg", "'_", "]_", "=_", "'", "usage", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unh", "andle", "d", " ", "code", " ", "or", " ", "undefined", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "error", "'_", "]_", "=_", "'", "AG", "IU", "nk", "now", "n", "Error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
AppScale/appscale/AppServer/lib/django-1.2/django/contrib/gis/tests/test_spatialrefsys.py
[ { "content": "import unittest\n\nfrom django.db import connection\nfrom django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis, spatialite\n\ntest_srs = ({'srid' : 4326,\n 'auth_name' : ('EPSG', True),\n 'auth_srid' : 4326,\n 'srtext' : 'GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]',\n 'srtext14' : 'GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]',\n 'proj4' : '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ',\n 'spheroid' : 'WGS 84', 'name' : 'WGS 84', \n 'geographic' : True, 'projected' : False, 'spatialite' : True,\n 'ellipsoid' : (6378137.0, 6356752.3, 298.257223563), # From proj's \"cs2cs -le\" and Wikipedia (semi-minor only)\n 'eprec' : (1, 1, 9),\n },\n {'srid' : 32140,\n 'auth_name' : ('EPSG', False),\n 'auth_srid' : 32140,\n 'srtext' : 'PROJCS[\"NAD83 / Texas South Central\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"standard_parallel_1\",30.28333333333333],PARAMETER[\"standard_parallel_2\",28.38333333333333],PARAMETER[\"latitude_of_origin\",27.83333333333333],PARAMETER[\"central_meridian\",-99],PARAMETER[\"false_easting\",600000],PARAMETER[\"false_northing\",4000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"32140\"]]',\n 'srtext14': 'PROJCS[\"NAD83 / Texas South Central\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"standard_parallel_1\",30.28333333333333],PARAMETER[\"standard_parallel_2\",28.38333333333333],PARAMETER[\"latitude_of_origin\",27.83333333333333],PARAMETER[\"central_meridian\",-99],PARAMETER[\"false_easting\",600000],PARAMETER[\"false_northing\",4000000],AUTHORITY[\"EPSG\",\"32140\"],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]',\n 'proj4' : '+proj=lcc +lat_1=30.28333333333333 +lat_2=28.38333333333333 +lat_0=27.83333333333333 +lon_0=-99 +x_0=600000 +y_0=4000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs ',\n 'spheroid' : 'GRS 1980', 'name' : 'NAD83 / Texas South Central',\n 'geographic' : False, 'projected' : True, 'spatialite' : False,\n 'ellipsoid' : (6378137.0, 6356752.31414, 298.257222101), # From proj's \"cs2cs -le\" and Wikipedia (semi-minor only)\n 'eprec' : (1, 5, 10),\n },\n )\n\nif oracle:\n from django.contrib.gis.db.backends.oracle.models import SpatialRefSys\nelif postgis:\n from django.contrib.gis.db.backends.postgis.models import SpatialRefSys\nelif spatialite:\n from django.contrib.gis.db.backends.spatialite.models import SpatialRefSys\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SpatialRefSysTest(unittest.TestCase):\n\n\n", "metadata": "root.SpatialRefSysTest", "header": "['module', '___EOS___']", "index": 36 }, { "content": " @no_mysql\n def test01_retrieve(self):\n \"Testing retrieval of SpatialRefSys model objects.\"\n for sd in test_srs:\n srs = SpatialRefSys.objects.get(srid=sd['srid'])\n self.assertEqual(sd['srid'], srs.srid)\n\n # Some of the authority names are borked on Oracle, e.g., SRID=32140.\n # also, Oracle Spatial seems to add extraneous info to fields, hence the\n # the testing with the 'startswith' flag.\n auth_name, oracle_flag = sd['auth_name']\n if postgis or (oracle and oracle_flag):\n self.assertEqual(True, srs.auth_name.startswith(auth_name))\n \n self.assertEqual(sd['auth_srid'], srs.auth_srid)\n\n # No proj.4 and different srtext on oracle backends :(\n if postgis:\n if connection.ops.spatial_version >= (1, 4, 0):\n srtext = sd['srtext14']\n else:\n srtext = sd['srtext']\n self.assertEqual(srtext, srs.wkt)\n self.assertEqual(sd['proj4'], srs.proj4text)", "metadata": "root.SpatialRefSysTest.test01_retrieve", "header": "['class', 'SpatialRefSysTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " @no_mysql\n def test02_osr(self):\n \"Testing getting OSR objects from SpatialRefSys model objects.\"\n for sd in test_srs:\n sr = SpatialRefSys.objects.get(srid=sd['srid'])\n self.assertEqual(True, sr.spheroid.startswith(sd['spheroid']))\n self.assertEqual(sd['geographic'], sr.geographic)\n self.assertEqual(sd['projected'], sr.projected)\n\n if not (spatialite and not sd['spatialite']):\n # Can't get 'NAD83 / Texas South Central' from PROJ.4 string\n # on SpatiaLite\n self.assertEqual(True, sr.name.startswith(sd['name']))\n\n # Testing the SpatialReference object directly.\n if postgis or spatialite:\n srs = sr.srs\n self.assertEqual(sd['proj4'], srs.proj4)\n # No `srtext` field in the `spatial_ref_sys` table in SpatiaLite\n if not spatialite:\n if connection.ops.spatial_version >= (1, 4, 0):\n srtext = sd['srtext14']\n else:\n srtext = sd['srtext']\n self.assertEqual(srtext, srs.wkt)", "metadata": "root.SpatialRefSysTest.test02_osr", "header": "['class', 'SpatialRefSysTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " @no_mysql\n def test03_ellipsoid(self):\n \"Testing the ellipsoid property.\"\n for sd in test_srs:\n # Getting the ellipsoid and precision parameters.\n ellps1 = sd['ellipsoid']\n prec = sd['eprec']\n\n # Getting our spatial reference and its ellipsoid\n srs = SpatialRefSys.objects.get(srid=sd['srid'])\n ellps2 = srs.ellipsoid\n\n for i in range(3):\n param1 = ellps1[i]\n param2 = ellps2[i]\n self.assertAlmostEqual(ellps1[i], ellps2[i], prec[i])", "metadata": "root.SpatialRefSysTest.test03_ellipsoid", "header": "['class', 'SpatialRefSysTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 89 }, { "content": "def suite():\n s = unittest.TestSuite()\n s.addTest(unittest.makeSuite(SpatialRefSysTest))\n return s", "metadata": "root.suite", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def run(verbosity=2):\n unittest.TextTestRunner(verbosity=verbosity).run(suite())", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 111 } ]
[ { "span": "from django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis, spatialite", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 87 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "tests_", "._", "utils_", "import_", "mysql_", ",_", "no", "\\u", "mysql_", ",_", "oracle", "_", ",_", "post", "gis_", ",_", "spat", "iali", "te_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "srs_", "=_", "(_", "{_", "'", "sri", "d", "'_", ":_", "432", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "name", "'_", ":_", "(_", "'", "EPS", "G", "'_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "sri", "d", "'_", ":_", "432", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "srt", "ext", "'_", ":_", "'", "GEO", "GC", "S", "[\"", "WG", "S", " ", "84", "\",", "DAT", "UM", "[\"", "WG", "S", "\\u", "1984", "\",", "SPH", "ERO", "ID", "[\"", "WG", "S", " ", "84", "\",", "637", "813", "7", ",", "298", ".2", "572", "235", "6", "3", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "703", "0", "\"]", "],", "TO", "WG", "S", "84", "[", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "632", "6", "\"]", "],", "PRIM", "EM", "[\"", "Green", "wic", "h", "\",", "0", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "890", "1", "\"]", "],", "UNIT", "[\"", "degr", "ee", "\",", "0.01", "745", "329", "251", "994", "328", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "912", "2", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "432", "6", "\"]", "]'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "srt", "ext", "14", "'_", ":_", "'", "GEO", "GC", "S", "[\"", "WG", "S", " ", "84", "\",", "DAT", "UM", "[\"", "WG", "S", "\\u", "1984", "\",", "SPH", "ERO", "ID", "[\"", "WG", "S", " ", "84", "\",", "637", "813", "7", ",", "298", ".2", "572", "235", "6", "3", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "703", "0", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "632", "6", "\"]", "],", "PRIM", "EM", "[\"", "Green", "wic", "h", "\",", "0", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "890", "1", "\"]", "],", "UNIT", "[\"", "degr", "ee", "\",", "0.01", "745", "329", "251", "994", "328", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "912", "2", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "432", "6", "\"]", "]'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proj", "4", "'_", ":_", "'+", "proj", "=", "long", "lat", " ", "+", "ell", "ps", "=", "WG", "S", "84", " ", "+", "dat", "um", "=", "WG", "S", "84", " ", "+", "no", "\\u", "def", "s", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sph", "ero", "id", "'_", ":_", "'", "WG", "S", " ", "84", "'_", ",_", "'", "name", "'_", ":_", "'", "WG", "S", " ", "84", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geographic", "'_", ":_", "True_", ",_", "'", "projected", "'_", ":_", "False_", ",_", "'", "spat", "iali", "te", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ellips", "oid", "'_", ":_", "(_", "637", "813", "7.0_", ",_", "635", "675", "2.3_", ",_", "298", ".2", "572", "235", "63_", ")_", ",_", "#", " ", "Fro", "m", " ", "proj", "'", "s", " ", "\"", "cs", "2c", "s", " ", "-", "le", "\"", " ", "and", " ", "Wiki", "pedi", "a", " ", "(", "semi", "-", "mino", "r", " ", "only", ")_", "\\u\\u\\uNL\\u\\u\\u_", "'", "epr", "ec", "'_", ":_", "(_", "1_", ",_", "1_", ",_", "9_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "sri", "d", "'_", ":_", "321", "40_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "name", "'_", ":_", "(_", "'", "EPS", "G", "'_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "sri", "d", "'_", ":_", "321", "40_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "srt", "ext", "'_", ":_", "'", "PROJ", "CS", "[\"", "NAD", "8", "3", " ", "/", " ", "Tex", "as", " ", "South", " ", "Cent", "ral", "\",", "GEO", "GC", "S", "[\"", "NAD", "8", "3", "\",", "DAT", "UM", "[\"", "North", "\\u", "Ame", "rica", "n", "\\u", "Dat", "um", "\\u", "1983", "\",", "SPH", "ERO", "ID", "[\"", "GR", "S", " ", "1980", "\",", "637", "813", "7", ",", "298", ".2", "572", "221", "01", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "701", "9", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "626", "9", "\"]", "],", "PRIM", "EM", "[\"", "Green", "wic", "h", "\",", "0", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "890", "1", "\"]", "],", "UNIT", "[\"", "degr", "ee", "\",", "0.01", "745", "329", "251", "994", "328", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "912", "2", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "426", "9", "\"]", "],", "PROJECT", "ION", "[\"", "Lam", "bert", "\\u", "Confo", "rmal", "\\u", "Con", "ic", "\\u", "2", "SP", "\"]", ",", "PARAMETER", "[\"", "standard", "\\u", "parall", "el", "\\u", "1", "\",", "30.", "283", "33333333333", "],", "PARAMETER", "[\"", "standard", "\\u", "parall", "el", "\\u", "2", "\",", "28.", "383", "33333333333", "],", "PARAMETER", "[\"", "latitude", "\\u", "of", "\\u", "orig", "in", "\",", "27.", "8333", "333333333", "3", "],", "PARAMETER", "[\"", "central", "\\u", "meridian", "\",", "-", "9", "9", "],", "PARAMETER", "[\"", "fal", "se", "\\u", "east", "ing", "\",", "600000", "],", "PARAMETER", "[\"", "fal", "se", "\\u", "north", "ing", "\",", "4000000", "],", "UNIT", "[\"", "metre", "\",", "1", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "900", "1", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "321", "40", "\"]", "]'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "srt", "ext", "14", "'_", ":_", "'", "PROJ", "CS", "[\"", "NAD", "8", "3", " ", "/", " ", "Tex", "as", " ", "South", " ", "Cent", "ral", "\",", "GEO", "GC", "S", "[\"", "NAD", "8", "3", "\",", "DAT", "UM", "[\"", "North", "\\u", "Ame", "rica", "n", "\\u", "Dat", "um", "\\u", "1983", "\",", "SPH", "ERO", "ID", "[\"", "GR", "S", " ", "1980", "\",", "637", "813", "7", ",", "298", ".2", "572", "221", "01", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "701", "9", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "626", "9", "\"]", "],", "PRIM", "EM", "[\"", "Green", "wic", "h", "\",", "0", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "890", "1", "\"]", "],", "UNIT", "[\"", "degr", "ee", "\",", "0.01", "745", "329", "251", "994", "328", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "912", "2", "\"]", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "426", "9", "\"]", "],", "UNIT", "[\"", "metre", "\",", "1", ",", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "900", "1", "\"]", "],", "PROJECT", "ION", "[\"", "Lam", "bert", "\\u", "Confo", "rmal", "\\u", "Con", "ic", "\\u", "2", "SP", "\"]", ",", "PARAMETER", "[\"", "standard", "\\u", "parall", "el", "\\u", "1", "\",", "30.", "283", "33333333333", "],", "PARAMETER", "[\"", "standard", "\\u", "parall", "el", "\\u", "2", "\",", "28.", "383", "33333333333", "],", "PARAMETER", "[\"", "latitude", "\\u", "of", "\\u", "orig", "in", "\",", "27.", "8333", "333333333", "3", "],", "PARAMETER", "[\"", "central", "\\u", "meridian", "\",", "-", "9", "9", "],", "PARAMETER", "[\"", "fal", "se", "\\u", "east", "ing", "\",", "600000", "],", "PARAMETER", "[\"", "fal", "se", "\\u", "north", "ing", "\",", "4000000", "],", "AUTHORI", "TY", "[\"", "EPS", "G", "\",\"", "321", "40", "\"]", ",", "AXIS", "[\"", "X", "\",", "EAS", "T", "],", "AXIS", "[\"", "Y", "\",", "NOR", "TH", "]]'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proj", "4", "'_", ":_", "'+", "proj", "=", "lc", "c", " ", "+", "lat", "\\u", "1", "=", "30.", "283", "33333333333", " ", "+", "lat", "\\u", "2", "=", "28.", "383", "33333333333", " ", "+", "lat", "\\u", "0", "=", "27.", "8333", "333333333", "3", " ", "+", "lon", "\\u", "0", "=-", "9", "9", " ", "+", "x", "\\u", "0", "=", "600000", " ", "+", "y", "\\u", "0", "=", "4000000", " ", "+", "ell", "ps", "=", "GR", "S", "80", " ", "+", "dat", "um", "=", "NAD", "8", "3", " ", "+", "unit", "s", "=", "m", " ", "+", "no", "\\u", "def", "s", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sph", "ero", "id", "'_", ":_", "'", "GR", "S", " ", "1980", "'_", ",_", "'", "name", "'_", ":_", "'", "NAD", "8", "3", " ", "/", " ", "Tex", "as", " ", "South", " ", "Cent", "ral", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "geographic", "'_", ":_", "False_", ",_", "'", "projected", "'_", ":_", "True_", ",_", "'", "spat", "iali", "te", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ellips", "oid", "'_", ":_", "(_", "637", "813", "7.0_", ",_", "635", "675", "2.3", "141", "4_", ",_", "298", ".2", "572", "221", "01_", ")_", ",_", "#", " ", "Fro", "m", " ", "proj", "'", "s", " ", "\"", "cs", "2c", "s", " ", "-", "le", "\"", " ", "and", " ", "Wiki", "pedi", "a", " ", "(", "semi", "-", "mino", "r", " ", "only", ")_", "\\u\\u\\uNL\\u\\u\\u_", "'", "epr", "ec", "'_", ":_", "(_", "1_", ",_", "5_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "oracle", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "db_", "._", "backends_", "._", "oracle", "_", "._", "models_", "import_", "Spa", "tial", "Ref", "Sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "post", "gis_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "db_", "._", "backends_", "._", "post", "gis_", "._", "models_", "import_", "Spa", "tial", "Ref", "Sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "spat", "iali", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "db_", "._", "backends_", "._", "spat", "iali", "te_", "._", "models_", "import_", "Spa", "tial", "Ref", "Sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "class_", "Spa", "tial", "Ref", "Sys", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spa", "tial", "Ref", "Sys", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "no", "\\u", "mysql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test0", "1", "\\u", "retrieve_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Test", "ing", " ", "retrie", "val", " ", "of", " ", "Spa", "tial", "Ref", "Sys", " ", "model", " ", "object", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sd_", "in_", "test\\u", "srs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "srs_", "=_", "Spa", "tial", "Ref", "Sys_", "._", "objects_", "._", "get_", "(_", "srid_", "=_", "sd_", "[_", "'", "sri", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sd_", "[_", "'", "sri", "d", "'_", "]_", ",_", "srs_", "._", "srid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", " ", "of", " ", "the", " ", "authori", "ty", " ", "names", " ", "are", " ", "bor", "ked", " ", "on", " ", "Ora", "cle", ",", " ", "e", ".", "g", ".,", " ", "SR", "ID", "=", "321", "40.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "als", "o", ",", " ", "Ora", "cle", " ", "Spa", "tial", " ", "see", "ms", " ", "to", " ", "add", " ", "extra", "neous", " ", "info", " ", "to", " ", "fields", ",", " ", "hen", "ce", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "the", " ", "testi", "ng", " ", "with", " ", "the", " ", "'", "startswith", "'", " ", "flag", "._", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "name_", ",_", "oracle", "\\u", "flag_", "=_", "sd_", "[_", "'", "auth", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "post", "gis_", "or_", "(_", "oracle", "_", "and_", "oracle", "\\u", "flag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "True_", ",_", "srs_", "._", "auth", "\\u", "name_", "._", "startswith_", "(_", "auth", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sd_", "[_", "'", "auth", "\\u", "sri", "d", "'_", "]_", ",_", "srs_", "._", "auth", "\\u", "srid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "proj", ".4", " ", "and", " ", "different", " ", "srt", "ext", " ", "on", " ", "oracle", " ", "back", "ends", " ", ":(", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "post", "gis_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "connection_", "._", "ops_", "._", "spat", "ial", "\\u", "version_", ">=_", "(_", "1_", ",_", "4_", ",_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "srt", "ext_", "=_", "sd_", "[_", "'", "srt", "ext", "14", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "srt", "ext_", "=_", "sd_", "[_", "'", "srt", "ext", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "srt", "ext_", ",_", "srs_", "._", "wkt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sd_", "[_", "'", "proj", "4", "'_", "]_", ",_", "srs_", "._", "proj", "4", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spa", "tial", "Ref", "Sys", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no", "\\u", "mysql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test0", "2", "\\u", "osr", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Test", "ing", " ", "getti", "ng", " ", "OS", "R", " ", "object", "s", " ", "from", " ", "Spa", "tial", "Ref", "Sys", " ", "model", " ", "object", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sd_", "in_", "test\\u", "srs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr_", "=_", "Spa", "tial", "Ref", "Sys_", "._", "objects_", "._", "get_", "(_", "srid_", "=_", "sd_", "[_", "'", "sri", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", ",_", "sr_", "._", "sph", "ero", "id_", "._", "startswith_", "(_", "sd_", "[_", "'", "sph", "ero", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sd_", "[_", "'", "geographic", "'_", "]_", ",_", "sr_", "._", "geographic", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sd_", "[_", "'", "projected", "'_", "]_", ",_", "sr_", "._", "projected", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "spat", "iali", "te_", "and_", "not_", "sd_", "[_", "'", "spat", "iali", "te", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Can", "'", "t", " ", "get", " ", "'", "NAD", "8", "3", " ", "/", " ", "Tex", "as", " ", "South", " ", "Cent", "ral", "'", " ", "from", " ", "PROJ", ".4", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "Spa", "tia", "Lite", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "True_", ",_", "sr_", "._", "name_", "._", "startswith_", "(_", "sd_", "[_", "'", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "ing", " ", "the", " ", "Spa", "tial", "Reference", " ", "object", " ", "direct", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "post", "gis_", "or_", "spat", "iali", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "srs_", "=_", "sr_", "._", "srs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sd_", "[_", "'", "proj", "4", "'_", "]_", ",_", "srs_", "._", "proj", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "`", "srt", "ext", "`", " ", "field", " ", "in", " ", "the", " ", "`", "spat", "ial", "\\u", "ref", "\\u", "sys", "`", " ", "table", " ", "in", " ", "Spa", "tia", "Lite", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "spat", "iali", "te_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "connection_", "._", "ops_", "._", "spat", "ial", "\\u", "version_", ">=_", "(_", "1_", ",_", "4_", ",_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "srt", "ext_", "=_", "sd_", "[_", "'", "srt", "ext", "14", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "srt", "ext_", "=_", "sd_", "[_", "'", "srt", "ext", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "srt", "ext_", ",_", "srs_", "._", "wkt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spa", "tial", "Ref", "Sys", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no", "\\u", "mysql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test0", "3", "\\u", "ellips", "oid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Test", "ing", " ", "the", " ", "ellips", "oid", " ", "property", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sd_", "in_", "test\\u", "srs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", "ting", " ", "the", " ", "ellips", "oid", " ", "and", " ", "preci", "sion", " ", "parameter", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ell", "ps", "1_", "=_", "sd_", "[_", "'", "ellips", "oid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prec_", "=_", "sd_", "[_", "'", "epr", "ec", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "ting", " ", "our", " ", "spat", "ial", " ", "reference", " ", "and", " ", "its", " ", "ellips", "oid_", "\\u\\u\\uNL\\u\\u\\u_", "srs_", "=_", "Spa", "tial", "Ref", "Sys_", "._", "objects_", "._", "get_", "(_", "srid_", "=_", "sd_", "[_", "'", "sri", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell", "ps", "2_", "=_", "srs_", "._", "ellips", "oid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param1_", "=_", "ell", "ps", "1_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "2_", "=_", "ell", "ps", "2_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Al", "most", "Equal_", "(_", "ell", "ps", "1_", "[_", "i_", "]_", ",_", "ell", "ps", "2_", "[_", "i_", "]_", ",_", "prec_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "suite_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "add", "Test_", "(_", "unittest_", "._", "make", "Suite_", "(_", "Spa", "tial", "Ref", "Sys", "Test_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "verbosity_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "verbosity_", ")_", "._", "run_", "(_", "suite_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Implicit string concatenation in a list
aws/aws-cli/tests/unit/customizations/emr/test_emrfs_utils.py
[ { "content": " def test_cse_kms(self):\n emrfs_option_value = 'Encryption=ClientSide,ProviderType=KMS,' \\\n 'KMSKeyId=my_key'\n expected_emrfs_ba_key_values = [\n 'fs.s3.cse.enabled=true', 'fs.s3.cse.encryptionMaterialsProvider='\n 'com.amazon.ws.emr.hadoop.fs.cse.KMSEncryptionMaterialsProvider',\n 'fs.s3.cse.kms.keyId=my_key'\n ]\n expected_emrfs_properties = {\n 'fs.s3.cse.enabled': 'true',\n 'fs.s3.cse.encryptionMaterialsProvider':\n 'com.amazon.ws.emr.hadoop.fs.cse.'\n 'KMSEncryptionMaterialsProvider',\n 'fs.s3.cse.kms.keyId': 'my_key'}\n self._assert_bootstrap_actions(\n emrfs_option_value, expected_emrfs_ba_key_values,\n expected_emrfs_properties)", "metadata": "root.TestEmrfsUtils.test_cse_kms", "header": "['class', 'TestEmrfsUtils', '(', 'BaseAWSCommandParamsTest', ')', ':', '___EOS___']", "index": 130 }, { "content": " def test_cse_custom(self):\n emrfs_option_value = 'Encryption=ClientSide,ProviderType=Custom,' \\\n 'CustomProviderLocation=my_location,CustomProviderClass=my_class'\n expected_emrfs_ba_key_values = [\n 'fs.s3.cse.enabled=true', 'fs.s3.cse.encryptionMaterialsProvider='\n 'my_class'\n ]\n expected_emrfs_properties = {\n 'fs.s3.cse.enabled': 'true',\n 'fs.s3.cse.encryptionMaterialsProvider': 'my_class',\n 'fs.s3.cse.encryptionMaterialsProvider.uri': 'my_location'}\n\n self._assert_bootstrap_actions(\n emrfs_option_value, expected_emrfs_ba_key_values,\n expected_emrfs_properties, 'my_location')", "metadata": "root.TestEmrfsUtils.test_cse_custom", "header": "['class', 'TestEmrfsUtils', '(', 'BaseAWSCommandParamsTest', ')', ':', '___EOS___']", "index": 148 }, { "content": " def test_cse_and_consistent(self):\n emrfs_option_value = ('Encryption=ClientSide,ProviderType=KMS,'\n 'KMSKeyId=my_key,Consistent=true')\n expected_emrfs_ba_key_values = [\n 'fs.s3.consistent=true', 'fs.s3.cse.enabled=true',\n 'fs.s3.cse.encryptionMaterialsProvider=com.amazon.ws.emr.'\n 'hadoop.fs.cse.KMSEncryptionMaterialsProvider',\n 'fs.s3.cse.kms.keyId=my_key']\n expected_emrfs_properties = {\n 'fs.s3.consistent': 'true',\n 'fs.s3.cse.enabled': 'true',\n 'fs.s3.cse.encryptionMaterialsProvider': 'com.amazon.ws.emr.'\n 'hadoop.fs.cse.KMSEncryptionMaterialsProvider',\n 'fs.s3.cse.kms.keyId': 'my_key'}\n\n self._assert_bootstrap_actions(\n emrfs_option_value, expected_emrfs_ba_key_values,\n expected_emrfs_properties)", "metadata": "root.TestEmrfsUtils.test_cse_and_consistent", "header": "['class', 'TestEmrfsUtils', '(', 'BaseAWSCommandParamsTest', ')', ':', '___EOS___']", "index": 188 }, { "content": " def test_args_and_cse(self):\n emrfs_option_value = ('Encryption=ClientSide,ProviderType=KMS,'\n 'KMSKeyId=my_key,Args=[k1=v1]')\n expected_emrfs_ba_key_values = [\n 'fs.s3.cse.enabled=true',\n 'fs.s3.cse.encryptionMaterialsProvider=com.amazon.ws.emr.'\n 'hadoop.fs.cse.KMSEncryptionMaterialsProvider',\n 'fs.s3.cse.kms.keyId=my_key', 'k1=v1']\n expected_emrfs_properties = {\n 'fs.s3.cse.enabled': 'true',\n 'fs.s3.cse.encryptionMaterialsProvider': 'com.amazon.ws.emr.'\n 'hadoop.fs.cse.KMSEncryptionMaterialsProvider',\n 'fs.s3.cse.kms.keyId': 'my_key',\n 'k1': 'v1'}\n\n self._assert_bootstrap_actions(\n emrfs_option_value, expected_emrfs_ba_key_values,\n expected_emrfs_properties)", "metadata": "root.TestEmrfsUtils.test_args_and_cse", "header": "['class', 'TestEmrfsUtils', '(', 'BaseAWSCommandParamsTest', ')', ':', '___EOS___']", "index": 221 } ]
[ { "span": "'fs.s3.cse.encryptionMaterialsProvider='\n 'com.amazon.ws.emr.hadoop.fs.cse.KMSEncryptionMaterialsProvider',", "start_line": 134, "start_column": 38, "end_line": 135, "end_column": 76 }, { "span": "'fs.s3.cse.encryptionMaterialsProvider='\n 'my_class'", "start_line": 152, "start_column": 38, "end_line": 153, "end_column": 22 }, { "span": "'fs.s3.cse.encryptionMaterialsProvider=com.amazon.ws.emr.'\n 'hadoop.fs.cse.KMSEncryptionMaterialsProvider',", "start_line": 193, "start_column": 12, "end_line": 194, "end_column": 58 }, { "span": "'fs.s3.cse.encryptionMaterialsProvider=com.amazon.ws.emr.'\n 'hadoop.fs.cse.KMSEncryptionMaterialsProvider',", "start_line": 226, "start_column": 12, "end_line": 227, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "Test", "Em", "rf", "s", "Utils_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cse", "\\u", "kms", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "emr", "fs", "\\u", "option", "\\u", "value_", "=_", "'", "Encrypt", "ion", "=", "Client", "Side", ",", "Provider", "Type", "=", "KM", "S", ",'_", "'", "KM", "SK", "ey", "Id", "=", "my", "\\u", "key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "=", "true", "'_", ",_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "='_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", ".", "amaz", "on", ".", "ws", ".", "emr", ".", "hadoop", ".", "fs", ".", "cse", ".", "KM", "SE", "ncr", "ypt", "ion", "Materials", "Provider", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "kms", ".", "key", "Id", "=", "my", "\\u", "key", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "'", "com", ".", "amaz", "on", ".", "ws", ".", "emr", ".", "hadoop", ".", "fs", ".", "cse", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "KM", "SE", "ncr", "ypt", "ion", "Materials", "Provider", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "kms", ".", "key", "Id", "'_", ":_", "'", "my", "\\u", "key", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "boots", "trap", "\\u", "actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "emr", "fs", "\\u", "option", "\\u", "value_", ",_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Em", "rf", "s", "Utils_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cse", "\\u", "custom_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "emr", "fs", "\\u", "option", "\\u", "value_", "=_", "'", "Encrypt", "ion", "=", "Client", "Side", ",", "Provider", "Type", "=", "Custom", ",'_", "'", "Custom", "Provider", "Locat", "ion", "=", "my", "\\u", "location", ",", "Custom", "Provider", "Class", "=", "my", "\\u", "class", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "=", "true", "'_", ",_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "='_", "\\u\\u\\uNL\\u\\u\\u_", "'", "my", "\\u", "class", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "'_", ":_", "'", "my", "\\u", "class", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", ".", "uri", "'_", ":_", "'", "my", "\\u", "location", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "boots", "trap", "\\u", "actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "emr", "fs", "\\u", "option", "\\u", "value_", ",_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", ",_", "'", "my", "\\u", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Em", "rf", "s", "Utils_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cse", "\\u", "and", "\\u", "consistent", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "emr", "fs", "\\u", "option", "\\u", "value_", "=_", "(_", "'", "Encrypt", "ion", "=", "Client", "Side", ",", "Provider", "Type", "=", "KM", "S", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "KM", "SK", "ey", "Id", "=", "my", "\\u", "key", ",", "Cons", "iste", "nt", "=", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "consistent", "=", "true", "'_", ",_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "=", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "=", "com", ".", "amaz", "on", ".", "ws", ".", "emr", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hadoop", ".", "fs", ".", "cse", ".", "KM", "SE", "ncr", "ypt", "ion", "Materials", "Provider", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "kms", ".", "key", "Id", "=", "my", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "consistent", "'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "'_", ":_", "'", "com", ".", "amaz", "on", ".", "ws", ".", "emr", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hadoop", ".", "fs", ".", "cse", ".", "KM", "SE", "ncr", "ypt", "ion", "Materials", "Provider", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "kms", ".", "key", "Id", "'_", ":_", "'", "my", "\\u", "key", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "boots", "trap", "\\u", "actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "emr", "fs", "\\u", "option", "\\u", "value_", ",_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Em", "rf", "s", "Utils_", "(_", "Base", "AW", "SC", "ommand", "Param", "s", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "args", "\\u", "and", "\\u", "cse", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "emr", "fs", "\\u", "option", "\\u", "value_", "=_", "(_", "'", "Encrypt", "ion", "=", "Client", "Side", ",", "Provider", "Type", "=", "KM", "S", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "KM", "SK", "ey", "Id", "=", "my", "\\u", "key", ",", "Arg", "s", "=[", "k", "1", "=", "v1", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "=", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "=", "com", ".", "amaz", "on", ".", "ws", ".", "emr", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hadoop", ".", "fs", ".", "cse", ".", "KM", "SE", "ncr", "ypt", "ion", "Materials", "Provider", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "kms", ".", "key", "Id", "=", "my", "\\u", "key", "'_", ",_", "'", "k", "1", "=", "v1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "enable", "d", "'_", ":_", "'", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "encrypt", "ion", "Materials", "Provider", "'_", ":_", "'", "com", ".", "amaz", "on", ".", "ws", ".", "emr", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hadoop", ".", "fs", ".", "cse", ".", "KM", "SE", "ncr", "ypt", "ion", "Materials", "Provider", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fs", ".", "s3", ".", "cse", ".", "kms", ".", "key", "Id", "'_", ":_", "'", "my", "\\u", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "k", "1", "'_", ":_", "'", "v1", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "boots", "trap", "\\u", "actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "emr", "fs", "\\u", "option", "\\u", "value_", ",_", "expected", "\\u", "emr", "fs", "\\u", "ba", "\\u", "key", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "emr", "fs", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
`__eq__` not overridden when adding attributes
AppScale/appscale/AppServer/lib/mox/mox.py
[ { "content": "class MockAnything:\n \"\"\"A mock that can be used to mock anything.\n\n This is helpful for mocking classes that do not provide a public interface.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MockAnything", "header": "['module', '___EOS___']", "index": 409 }, { "content": " def __init__(self, description=None):\n \"\"\"Initialize a new MockAnything.\n\n Args:\n description: str. Optionally, a descriptive name for the mock object being\n created, for debugging output purposes.\n \"\"\"\n self._description = description\n self._Reset()", "metadata": "root.MockAnything.__init__", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 415 }, { "content": " def __str__(self):\n return \"<MockAnything instance at %s>\" % id(self)", "metadata": "root.MockAnything.__str__", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 425 }, { "content": " def __repr__(self):\n return '<MockAnything instance>'", "metadata": "root.MockAnything.__repr__", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 428 }, { "content": " def __getattr__(self, method_name):\n \"\"\"Intercept method calls on this object.\n\n A new MockMethod is returned that is aware of the MockAnything's\n state (record or replay). The call will be recorded or replayed\n by the MockMethod's __call__.\n\n Args:\n # method name: the name of the method being called.\n method_name: str\n\n Returns:\n A new MockMethod aware of MockAnything's state (record or replay).\n \"\"\"\n\n return self._CreateMockMethod(method_name)", "metadata": "root.MockAnything.__getattr__", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 431 }, { "content": " def _CreateMockMethod(self, method_name, method_to_mock=None):\n \"\"\"Create a new mock method call and return it.\n\n Args:\n # method_name: the name of the method being called.\n # method_to_mock: The actual method being mocked, used for introspection.\n method_name: str\n method_to_mock: a method object\n\n Returns:\n A new MockMethod aware of MockAnything's state (record or replay).\n \"\"\"\n\n return MockMethod(method_name, self._expected_calls_queue,\n self._replay_mode, method_to_mock=method_to_mock,\n description=self._description)", "metadata": "root.MockAnything._CreateMockMethod", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 448 }, { "content": " def __nonzero__(self):\n \"\"\"Return 1 for nonzero so the mock can be used as a conditional.\"\"\"\n\n return 1", "metadata": "root.MockAnything.__nonzero__", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 465 }, { "content": " def __eq__(self, rhs):\n \"\"\"Provide custom logic to compare objects.\"\"\"\n\n return (isinstance(rhs, MockAnything) and\n self._replay_mode == rhs._replay_mode and\n self._expected_calls_queue == rhs._expected_calls_queue)", "metadata": "root.MockAnything.__eq__", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 470 }, { "content": " def __ne__(self, rhs):\n \"\"\"Provide custom logic to compare objects.\"\"\"\n\n return not self == rhs", "metadata": "root.MockAnything.__ne__", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 477 }, { "content": " def _Replay(self):\n \"\"\"Start replaying expected method calls.\"\"\"\n\n self._replay_mode = True", "metadata": "root.MockAnything._Replay", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 482 }, { "content": " def _Verify(self):\n \"\"\"Verify that all of the expected calls have been made.\n\n Raises:\n ExpectedMethodCallsError: if there are still more method calls in the\n expected queue.\n \"\"\"\n\n # If the list of expected calls is not empty, raise an exception\n if self._expected_calls_queue:\n # The last MultipleTimesGroup is not popped from the queue.\n if (len(self._expected_calls_queue) == 1 and\n isinstance(self._expected_calls_queue[0], MultipleTimesGroup) and\n self._expected_calls_queue[0].IsSatisfied()):\n pass\n else:\n raise ExpectedMethodCallsError(self._expected_calls_queue)", "metadata": "root.MockAnything._Verify", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 487 }, { "content": " def _Reset(self):\n \"\"\"Reset the state of this mock to record mode with an empty queue.\"\"\"\n\n # Maintain a list of method calls we are expecting\n self._expected_calls_queue = deque()\n\n # Make sure we are in setup mode, not replay mode\n self._replay_mode = False", "metadata": "root.MockAnything._Reset", "header": "['class', 'MockAnything', ':', '___EOS___']", "index": 505 }, { "content": "class MockObject(MockAnything, object):\n \"\"\"A mock object that simulates the public/protected interface of a class.\"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MockObject", "header": "['module', '___EOS___']", "index": 515 }, { "content": " def __init__(self, class_to_mock, attrs={}):\n \"\"\"Initialize a mock object.\n\n This determines the methods and properties of the class and stores them.\n\n Args:\n # class_to_mock: class to be mocked\n class_to_mock: class\n attrs: dict of attribute names to values that will be set on the mock\n object. Only public attributes may be set.\n\n Raises:\n PrivateAttributeError: if a supplied attribute is not public.\n ValueError: if an attribute would mask an existing method.\n \"\"\"\n\n # This is used to hack around the mixin/inheritance of MockAnything, which\n # is not a proper object (it can be anything. :-)\n MockAnything.__dict__['__init__'](self)\n\n # Get a list of all the public and special methods we should mock.\n self._known_methods = set()\n self._known_vars = set()\n self._class_to_mock = class_to_mock\n try:\n self._description = class_to_mock.__name__\n # If class_to_mock is a mock itself, then we'll get an UnknownMethodCall\n # error here from the underlying call to __getattr__('__name__')\n except (UnknownMethodCallError, AttributeError):\n try:\n self._description = type(class_to_mock).__name__\n except AttributeError:\n pass\n\n for method in dir(class_to_mock):\n attr = getattr(class_to_mock, method)\n if callable(attr):\n self._known_methods.add(method)\n elif not (type(attr) is property):\n # treating properties as class vars makes little sense.\n self._known_vars.add(method)\n\n # Set additional attributes at instantiation time; this is quicker\n # than manually setting attributes that are normally created in\n # __init__.\n for attr, value in attrs.items():\n if attr.startswith(\"_\"):\n raise PrivateAttributeError(attr)\n elif attr in self._known_methods:\n raise ValueError(\"'%s' is a method of '%s' objects.\" % (attr,\n class_to_mock))\n else:\n setattr(self, attr, value)", "metadata": "root.MockObject.__init__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 518 }, { "content": " def __getattr__(self, name):\n \"\"\"Intercept attribute request on this object.\n\n If the attribute is a public class variable, it will be returned and not\n recorded as a call.\n\n If the attribute is not a variable, it is handled like a method\n call. The method name is checked against the set of mockable\n methods, and a new MockMethod is returned that is aware of the\n MockObject's state (record or replay). The call will be recorded\n or replayed by the MockMethod's __call__.\n\n Args:\n # name: the name of the attribute being requested.\n name: str\n\n Returns:\n Either a class variable or a new MockMethod that is aware of the state\n of the mock (record or replay).\n\n Raises:\n UnknownMethodCallError if the MockObject does not mock the requested\n method.\n \"\"\"\n\n if name in self._known_vars:\n return getattr(self._class_to_mock, name)\n\n if name in self._known_methods:\n return self._CreateMockMethod(\n name,\n method_to_mock=getattr(self._class_to_mock, name))\n\n raise UnknownMethodCallError(name)", "metadata": "root.MockObject.__getattr__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 572 }, { "content": " def __eq__(self, rhs):\n \"\"\"Provide custom logic to compare objects.\"\"\"\n\n return (isinstance(rhs, MockObject) and\n self._class_to_mock == rhs._class_to_mock and\n self._replay_mode == rhs._replay_mode and\n self._expected_calls_queue == rhs._expected_calls_queue)", "metadata": "root.MockObject.__eq__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 607 }, { "content": " def __setitem__(self, key, value):\n \"\"\"Provide custom logic for mocking classes that support item assignment.\n\n Args:\n key: Key to set the value for.\n value: Value to set.\n\n Returns:\n Expected return value in replay mode. A MockMethod object for the\n __setitem__ method that has already been called if not in replay mode.\n\n Raises:\n TypeError if the underlying class does not support item assignment.\n UnexpectedMethodCallError if the object does not expect the call to\n __setitem__.\n\n \"\"\"\n # Verify the class supports item assignment.\n if '__setitem__' not in dir(self._class_to_mock):\n raise TypeError('object does not support item assignment')\n\n # If we are in replay mode then simply call the mock __setitem__ method.\n if self._replay_mode:\n return MockMethod('__setitem__', self._expected_calls_queue,\n self._replay_mode)(key, value)\n\n\n # Otherwise, create a mock method __setitem__.\n return self._CreateMockMethod('__setitem__')(key, value)", "metadata": "root.MockObject.__setitem__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 615 }, { "content": " def __getitem__(self, key):\n \"\"\"Provide custom logic for mocking classes that are subscriptable.\n\n Args:\n key: Key to return the value for.\n\n Returns:\n Expected return value in replay mode. A MockMethod object for the\n __getitem__ method that has already been called if not in replay mode.\n\n Raises:\n TypeError if the underlying class is not subscriptable.\n UnexpectedMethodCallError if the object does not expect the call to\n __getitem__.\n\n \"\"\"\n # Verify the class supports item assignment.\n if '__getitem__' not in dir(self._class_to_mock):\n raise TypeError('unsubscriptable object')\n\n # If we are in replay mode then simply call the mock __getitem__ method.\n if self._replay_mode:\n return MockMethod('__getitem__', self._expected_calls_queue,\n self._replay_mode)(key)\n\n\n # Otherwise, create a mock method __getitem__.\n return self._CreateMockMethod('__getitem__')(key)", "metadata": "root.MockObject.__getitem__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 645 }, { "content": " def __iter__(self):\n \"\"\"Provide custom logic for mocking classes that are iterable.\n\n Returns:\n Expected return value in replay mode. A MockMethod object for the\n __iter__ method that has already been called if not in replay mode.\n\n Raises:\n TypeError if the underlying class is not iterable.\n UnexpectedMethodCallError if the object does not expect the call to\n __iter__.\n\n \"\"\"\n methods = dir(self._class_to_mock)\n\n # Verify the class supports iteration.\n if '__iter__' not in methods:\n # If it doesn't have iter method and we are in replay method, then try to\n # iterate using subscripts.\n if '__getitem__' not in methods or not self._replay_mode:\n raise TypeError('not iterable object')\n else:\n results = []\n index = 0\n try:\n while True:\n results.append(self[index])\n index += 1\n except IndexError:\n return iter(results)\n\n # If we are in replay mode then simply call the mock __iter__ method.\n if self._replay_mode:\n return MockMethod('__iter__', self._expected_calls_queue,\n self._replay_mode)()\n\n\n # Otherwise, create a mock method __iter__.\n return self._CreateMockMethod('__iter__')()", "metadata": "root.MockObject.__iter__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 674 }, { "content": " def __contains__(self, key):\n \"\"\"Provide custom logic for mocking classes that contain items.\n\n Args:\n key: Key to look in container for.\n\n Returns:\n Expected return value in replay mode. A MockMethod object for the\n __contains__ method that has already been called if not in replay mode.\n\n Raises:\n TypeError if the underlying class does not implement __contains__\n UnexpectedMethodCaller if the object does not expect the call to\n __contains__.\n\n \"\"\"\n contains = self._class_to_mock.__dict__.get('__contains__', None)\n\n if contains is None:\n raise TypeError('unsubscriptable object')\n\n if self._replay_mode:\n return MockMethod('__contains__', self._expected_calls_queue,\n self._replay_mode)(key)\n\n return self._CreateMockMethod('__contains__')(key)", "metadata": "root.MockObject.__contains__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 715 }, { "content": " def __call__(self, *params, **named_params):\n \"\"\"Provide custom logic for mocking classes that are callable.\"\"\"\n\n # Verify the class we are mocking is callable.\n callable = hasattr(self._class_to_mock, '__call__')\n if not callable:\n raise TypeError('Not callable')\n\n # Because the call is happening directly on this object instead of a method,\n # the call on the mock method is made right here\n\n # If we are mocking a Function, then use the function, and not the\n # __call__ method\n method = None\n if type(self._class_to_mock) == types.FunctionType:\n method = self._class_to_mock;\n else:\n method = getattr(self._class_to_mock, '__call__')\n mock_method = self._CreateMockMethod('__call__', method_to_mock=method)\n\n return mock_method(*params, **named_params)", "metadata": "root.MockObject.__call__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 742 }, { "content": " @property\n def __class__(self):\n \"\"\"Return the class that is being mocked.\"\"\"\n\n return self._class_to_mock", "metadata": "root.MockObject.__class__", "header": "['class', 'MockObject', '(', 'MockAnything', ',', 'object', ')', ':', '___EOS___']", "index": 764 }, { "content": "class _MockObjectFactory(MockObject):\n \"\"\"A MockObjectFactory creates mocks and verifies __init__ params.\n\n A MockObjectFactory removes the boiler plate code that was previously\n necessary to stub out direction instantiation of a class.\n\n The MockObjectFactory creates new MockObjects when called and verifies the\n __init__ params are correct when in record mode. When replaying, existing\n mocks are returned, and the __init__ params are verified.\n\n See StubOutWithMock vs StubOutClassWithMocks for more detail.\n \"\"\"\n\n\n", "metadata": "root._MockObjectFactory", "header": "['module', '___EOS___']", "index": 771 }, { "content": " def __init__(self, class_to_mock, mox_instance):\n MockObject.__init__(self, class_to_mock)\n self._mox = mox_instance\n self._instance_queue = deque()", "metadata": "root._MockObjectFactory.__init__", "header": "['class', '_MockObjectFactory', '(', 'MockObject', ')', ':', '___EOS___']", "index": 784 }, { "content": " def __call__(self, *params, **named_params):\n \"\"\"Instantiate and record that a new mock has been created.\"\"\"\n\n method = getattr(self._class_to_mock, '__init__')\n mock_method = self._CreateMockMethod('__init__', method_to_mock=method)\n # Note: calling mock_method() is deferred in order to catch the\n # empty instance_queue first.\n\n if self._replay_mode:\n if not self._instance_queue:\n raise UnexpectedMockCreationError(self._class_to_mock, *params,\n **named_params)\n\n mock_method(*params, **named_params)\n\n return self._instance_queue.pop()\n else:\n mock_method(*params, **named_params)\n\n instance = self._mox.CreateMock(self._class_to_mock)\n self._instance_queue.appendleft(instance)\n return instance", "metadata": "root._MockObjectFactory.__call__", "header": "['class', '_MockObjectFactory', '(', 'MockObject', ')', ':', '___EOS___']", "index": 789 }, { "content": " def _Verify(self):\n \"\"\"Verify that all mocks have been created.\"\"\"\n if self._instance_queue:\n raise ExpectedMockCreationError(self._instance_queue)\n super(_MockObjectFactory, self)._Verify()", "metadata": "root._MockObjectFactory._Verify", "header": "['class', '_MockObjectFactory', '(', 'MockObject', ')', ':', '___EOS___']", "index": 812 }, { "content": "class Comparator:\n \"\"\"Base class for all Mox comparators.\n\n A Comparator can be used as a parameter to a mocked method when the exact\n value is not known. For example, the code you are testing might build up a\n long SQL string that is passed to your mock DAO. You're only interested that\n the IN clause contains the proper primary keys, so you can set your mock\n up as follows:\n\n mock_dao.RunQuery(StrContains('IN (1, 2, 4, 5)')).AndReturn(mock_result)\n\n Now whatever query is passed in must contain the string 'IN (1, 2, 4, 5)'.\n\n A Comparator may replace one or more parameters, for example:\n # return at most 10 rows\n mock_dao.RunQuery(StrContains('SELECT'), 10)\n\n or\n\n # Return some non-deterministic number of rows\n mock_dao.RunQuery(StrContains('SELECT'), IsA(int))\n \"\"\"\n\n\n", "metadata": "root.Comparator", "header": "['module', '___EOS___']", "index": 1182 }, { "content": " def equals(self, rhs):\n \"\"\"Special equals method that all comparators must implement.\n\n Args:\n rhs: any python object\n \"\"\"\n\n raise NotImplementedError, 'method must be implemented by a subclass.'", "metadata": "root.Comparator.equals", "header": "['class', 'Comparator', ':', '___EOS___']", "index": 1205 }, { "content": " def __eq__(self, rhs):\n return self.equals(rhs)", "metadata": "root.Comparator.__eq__", "header": "['class', 'Comparator', ':', '___EOS___']", "index": 1214 }, { "content": " def __ne__(self, rhs):\n return not self.equals(rhs)", "metadata": "root.Comparator.__ne__", "header": "['class', 'Comparator', ':', '___EOS___']", "index": 1217 }, { "content": "class IsA(Comparator):\n \"\"\"This class wraps a basic Python type or class. It is used to verify\n that a parameter is of the given type or class.\n\n Example:\n mock_dao.Connect(IsA(DbConnectInfo))\n \"\"\"\n\n\n", "metadata": "root.IsA", "header": "['module', '___EOS___']", "index": 1221 }, { "content": " def __init__(self, class_name):\n \"\"\"Initialize IsA\n\n Args:\n class_name: basic python type or a class\n \"\"\"\n\n self._class_name = class_name", "metadata": "root.IsA.__init__", "header": "['class', 'IsA', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1229 }, { "content": " def equals(self, rhs):\n \"\"\"Check to see if the RHS is an instance of class_name.\n\n Args:\n # rhs: the right hand side of the test\n rhs: object\n\n Returns:\n bool\n \"\"\"\n\n try:\n return isinstance(rhs, self._class_name)\n except TypeError:\n # Check raw types if there was a type error. This is helpful for\n # things like cStringIO.StringIO.\n return type(rhs) == type(self._class_name)", "metadata": "root.IsA.equals", "header": "['class', 'IsA', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1238 }, { "content": " def __repr__(self):\n return str(self._class_name)", "metadata": "root.IsA.__repr__", "header": "['class', 'IsA', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1256 }, { "content": "class IsAlmost(Comparator):\n \"\"\"Comparison class used to check whether a parameter is nearly equal\n to a given value. Generally useful for floating point numbers.\n\n Example mock_dao.SetTimeout((IsAlmost(3.9)))\n \"\"\"\n\n\n", "metadata": "root.IsAlmost", "header": "['module', '___EOS___']", "index": 1259 }, { "content": " def __init__(self, float_value, places=7):\n \"\"\"Initialize IsAlmost.\n\n Args:\n float_value: The value for making the comparison.\n places: The number of decimal places to round to.\n \"\"\"\n\n self._float_value = float_value\n self._places = places", "metadata": "root.IsAlmost.__init__", "header": "['class', 'IsAlmost', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1266 }, { "content": " def equals(self, rhs):\n \"\"\"Check to see if RHS is almost equal to float_value\n\n Args:\n rhs: the value to compare to float_value\n\n Returns:\n bool\n \"\"\"\n\n try:\n return round(rhs-self._float_value, self._places) == 0\n except TypeError:\n # This is probably because either float_value or rhs is not a number.\n return False", "metadata": "root.IsAlmost.equals", "header": "['class', 'IsAlmost', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1277 }, { "content": " def __repr__(self):\n return str(self._float_value)", "metadata": "root.IsAlmost.__repr__", "header": "['class', 'IsAlmost', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1293 }, { "content": "class StrContains(Comparator):\n \"\"\"Comparison class used to check whether a substring exists in a\n string parameter. This can be useful in mocking a database with SQL\n passed in as a string parameter, for example.\n\n Example:\n mock_dao.RunQuery(StrContains('IN (1, 2, 4, 5)')).AndReturn(mock_result)\n \"\"\"\n\n\n", "metadata": "root.StrContains", "header": "['module', '___EOS___']", "index": 1296 }, { "content": " def __init__(self, search_string):\n \"\"\"Initialize.\n\n Args:\n # search_string: the string you are searching for\n search_string: str\n \"\"\"\n\n self._search_string = search_string", "metadata": "root.StrContains.__init__", "header": "['class', 'StrContains', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1305 }, { "content": " def equals(self, rhs):\n \"\"\"Check to see if the search_string is contained in the rhs string.\n\n Args:\n # rhs: the right hand side of the test\n rhs: object\n\n Returns:\n bool\n \"\"\"\n\n try:\n return rhs.find(self._search_string) > -1\n except Exception:\n return False", "metadata": "root.StrContains.equals", "header": "['class', 'StrContains', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1315 }, { "content": " def __repr__(self):\n return '<str containing \\'%s\\'>' % self._search_string", "metadata": "root.StrContains.__repr__", "header": "['class', 'StrContains', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1331 }, { "content": "class Regex(Comparator):\n \"\"\"Checks if a string matches a regular expression.\n\n This uses a given regular expression to determine equality.\n \"\"\"\n\n\n", "metadata": "root.Regex", "header": "['module', '___EOS___']", "index": 1335 }, { "content": " def __init__(self, pattern, flags=0):\n \"\"\"Initialize.\n\n Args:\n # pattern is the regular expression to search for\n pattern: str\n # flags passed to re.compile function as the second argument\n flags: int\n \"\"\"\n\n self.regex = re.compile(pattern, flags=flags)", "metadata": "root.Regex.__init__", "header": "['class', 'Regex', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1341 }, { "content": " def equals(self, rhs):\n \"\"\"Check to see if rhs matches regular expression pattern.\n\n Returns:\n bool\n \"\"\"\n\n return self.regex.search(rhs) is not None", "metadata": "root.Regex.equals", "header": "['class', 'Regex', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1353 }, { "content": " def __repr__(self):\n s = '<regular expression \\'%s\\'' % self.regex.pattern\n if self.regex.flags:\n s += ', flags=%d' % self.regex.flags\n s += '>'\n return s", "metadata": "root.Regex.__repr__", "header": "['class', 'Regex', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1362 }, { "content": "class In(Comparator):\n \"\"\"Checks whether an item (or key) is in a list (or dict) parameter.\n\n Example:\n mock_dao.GetUsersInfo(In('expectedUserName')).AndReturn(mock_result)\n \"\"\"\n\n\n", "metadata": "root.In", "header": "['module', '___EOS___']", "index": 1370 }, { "content": " def __init__(self, key):\n \"\"\"Initialize.\n\n Args:\n # key is any thing that could be in a list or a key in a dict\n \"\"\"\n\n self._key = key", "metadata": "root.In.__init__", "header": "['class', 'In', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1377 }, { "content": " def equals(self, rhs):\n \"\"\"Check to see whether key is in rhs.\n\n Args:\n rhs: dict\n\n Returns:\n bool\n \"\"\"\n\n return self._key in rhs", "metadata": "root.In.equals", "header": "['class', 'In', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1386 }, { "content": " def __repr__(self):\n return '<sequence or map containing \\'%s\\'>' % self._key", "metadata": "root.In.__repr__", "header": "['class', 'In', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1398 }, { "content": "class Not(Comparator):\n \"\"\"Checks whether a predicates is False.\n\n Example:\n mock_dao.UpdateUsers(Not(ContainsKeyValue('stevepm', stevepm_user_info)))\n \"\"\"\n\n\n", "metadata": "root.Not", "header": "['module', '___EOS___']", "index": 1402 }, { "content": " def __init__(self, predicate):\n \"\"\"Initialize.\n\n Args:\n # predicate: a Comparator instance.\n \"\"\"\n\n assert isinstance(predicate, Comparator), (\"predicate %r must be a\"\n \" Comparator.\" % predicate)\n self._predicate = predicate", "metadata": "root.Not.__init__", "header": "['class', 'Not', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1409 }, { "content": " def equals(self, rhs):\n \"\"\"Check to see whether the predicate is False.\n\n Args:\n rhs: A value that will be given in argument of the predicate.\n\n Returns:\n bool\n \"\"\"\n\n return not self._predicate.equals(rhs)", "metadata": "root.Not.equals", "header": "['class', 'Not', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1420 }, { "content": " def __repr__(self):\n return '<not \\'%s\\'>' % self._predicate", "metadata": "root.Not.__repr__", "header": "['class', 'Not', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1432 }, { "content": "class ContainsKeyValue(Comparator):\n \"\"\"Checks whether a key/value pair is in a dict parameter.\n\n Example:\n mock_dao.UpdateUsers(ContainsKeyValue('stevepm', stevepm_user_info))\n \"\"\"\n\n\n", "metadata": "root.ContainsKeyValue", "header": "['module', '___EOS___']", "index": 1436 }, { "content": " def __init__(self, key, value):\n \"\"\"Initialize.\n\n Args:\n # key: a key in a dict\n # value: the corresponding value\n \"\"\"\n\n self._key = key\n self._value = value", "metadata": "root.ContainsKeyValue.__init__", "header": "['class', 'ContainsKeyValue', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1443 }, { "content": " def equals(self, rhs):\n \"\"\"Check whether the given key/value pair is in the rhs dict.\n\n Returns:\n bool\n \"\"\"\n\n try:\n return rhs[self._key] == self._value\n except Exception:\n return False", "metadata": "root.ContainsKeyValue.equals", "header": "['class', 'ContainsKeyValue', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1454 }, { "content": " def __repr__(self):\n return '<map containing the entry \\'%s: %s\\'>' % (self._key, self._value)", "metadata": "root.ContainsKeyValue.__repr__", "header": "['class', 'ContainsKeyValue', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1466 }, { "content": "class ContainsAttributeValue(Comparator):\n \"\"\"Checks whether a passed parameter contains attributes with a given value.\n\n Example:\n mock_dao.UpdateSomething(ContainsAttribute('stevepm', stevepm_user_info))\n \"\"\"\n\n", "metadata": "root.ContainsAttributeValue", "header": "['module', '___EOS___']", "index": 1470 }, { "content": " def __init__(self, key, value):\n \"\"\"Initialize.\n\n Args:\n # key: an attribute name of an object\n # value: the corresponding value\n \"\"\"\n\n self._key = key\n self._value = value", "metadata": "root.ContainsAttributeValue.__init__", "header": "['class', 'ContainsAttributeValue', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1477 }, { "content": " def equals(self, rhs):\n \"\"\"Check whether the given attribute has a matching value in the rhs object.\n\n Returns:\n bool\n \"\"\"\n\n try:\n return getattr(rhs, self._key) == self._value\n except Exception:\n return False", "metadata": "root.ContainsAttributeValue.equals", "header": "['class', 'ContainsAttributeValue', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1488 }, { "content": "class SameElementsAs(Comparator):\n \"\"\"Checks whether iterables contain the same elements (ignoring order).\n\n Example:\n mock_dao.ProcessUsers(SameElementsAs('stevepm', 'salomaki'))\n \"\"\"\n\n\n", "metadata": "root.SameElementsAs", "header": "['module', '___EOS___']", "index": 1501 }, { "content": " def __init__(self, expected_seq):\n \"\"\"Initialize.\n\n Args:\n expected_seq: a sequence\n \"\"\"\n\n self._expected_seq = expected_seq", "metadata": "root.SameElementsAs.__init__", "header": "['class', 'SameElementsAs', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1508 }, { "content": " def equals(self, actual_seq):\n \"\"\"Check to see whether actual_seq has same elements as expected_seq.\n\n Args:\n actual_seq: sequence\n\n Returns:\n bool\n \"\"\"\n\n try:\n expected = dict([(element, None) for element in self._expected_seq])\n actual = dict([(element, None) for element in actual_seq])\n except TypeError:\n # Fall back to slower list-compare if any of the objects are unhashable.\n expected = list(self._expected_seq)\n actual = list(actual_seq)\n expected.sort()\n actual.sort()\n return expected == actual", "metadata": "root.SameElementsAs.equals", "header": "['class', 'SameElementsAs', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1517 }, { "content": " def __repr__(self):\n return '<sequence with same elements as \\'%s\\'>' % self._expected_seq", "metadata": "root.SameElementsAs.__repr__", "header": "['class', 'SameElementsAs', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1538 }, { "content": "class And(Comparator):\n \"\"\"Evaluates one or more Comparators on RHS and returns an AND of the results.\n \"\"\"\n\n\n", "metadata": "root.And", "header": "['module', '___EOS___']", "index": 1542 }, { "content": " def __init__(self, *args):\n \"\"\"Initialize.\n\n Args:\n *args: One or more Comparator\n \"\"\"\n\n self._comparators = args", "metadata": "root.And.__init__", "header": "['class', 'And', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1546 }, { "content": " def equals(self, rhs):\n \"\"\"Checks whether all Comparators are equal to rhs.\n\n Args:\n # rhs: can be anything\n\n Returns:\n bool\n \"\"\"\n\n for comparator in self._comparators:\n if not comparator.equals(rhs):\n return False\n\n return True", "metadata": "root.And.equals", "header": "['class', 'And', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1555 }, { "content": " def __repr__(self):\n return '<AND %s>' % str(self._comparators)", "metadata": "root.And.__repr__", "header": "['class', 'And', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1571 }, { "content": "class Or(Comparator):\n \"\"\"Evaluates one or more Comparators on RHS and returns an OR of the results.\n \"\"\"\n\n\n", "metadata": "root.Or", "header": "['module', '___EOS___']", "index": 1575 }, { "content": " def __init__(self, *args):\n \"\"\"Initialize.\n\n Args:\n *args: One or more Mox comparators\n \"\"\"\n\n self._comparators = args", "metadata": "root.Or.__init__", "header": "['class', 'Or', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1579 }, { "content": " def equals(self, rhs):\n \"\"\"Checks whether any Comparator is equal to rhs.\n\n Args:\n # rhs: can be anything\n\n Returns:\n bool\n \"\"\"\n\n for comparator in self._comparators:\n if comparator.equals(rhs):\n return True\n\n return False", "metadata": "root.Or.equals", "header": "['class', 'Or', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1588 }, { "content": " def __repr__(self):\n return '<OR %s>' % str(self._comparators)", "metadata": "root.Or.__repr__", "header": "['class', 'Or', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1604 }, { "content": "class Func(Comparator):\n \"\"\"Call a function that should verify the parameter passed in is correct.\n\n You may need the ability to perform more advanced operations on the parameter\n in order to validate it. You can use this to have a callable validate any\n parameter. The callable should return either True or False.\n\n\n Example:\n\n def myParamValidator(param):\n # Advanced logic here\n return True\n\n mock_dao.DoSomething(Func(myParamValidator), true)\n \"\"\"\n\n\n", "metadata": "root.Func", "header": "['module', '___EOS___']", "index": 1608 }, { "content": " def __init__(self, func):\n \"\"\"Initialize.\n\n Args:\n func: callable that takes one parameter and returns a bool\n \"\"\"\n\n self._func = func", "metadata": "root.Func.__init__", "header": "['class', 'Func', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1625 }, { "content": " def equals(self, rhs):\n \"\"\"Test whether rhs passes the function test.\n\n rhs is passed into func.\n\n Args:\n rhs: any python object\n\n Returns:\n the result of func(rhs)\n \"\"\"\n\n return self._func(rhs)", "metadata": "root.Func.equals", "header": "['class', 'Func', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1634 }, { "content": " def __repr__(self):\n return str(self._func)", "metadata": "root.Func.__repr__", "header": "['class', 'Func', '(', 'Comparator', ')', ':', '___EOS___']", "index": 1648 } ]
[ { "span": "class _MockObjectFactory(MockObject):", "start_line": 771, "start_column": 0, "end_line": 771, "end_column": 37 }, { "span": "class IsA(Comparator):", "start_line": 1221, "start_column": 0, "end_line": 1221, "end_column": 22 }, { "span": "class IsAlmost(Comparator):", "start_line": 1259, "start_column": 0, "end_line": 1259, "end_column": 27 }, { "span": "class StrContains(Comparator):", "start_line": 1296, "start_column": 0, "end_line": 1296, "end_column": 30 }, { "span": "class Regex(Comparator):", "start_line": 1335, "start_column": 0, "end_line": 1335, "end_column": 24 }, { "span": "class In(Comparator):", "start_line": 1370, "start_column": 0, "end_line": 1370, "end_column": 21 }, { "span": "class Not(Comparator):", "start_line": 1402, "start_column": 0, "end_line": 1402, "end_column": 22 }, { "span": "class ContainsKeyValue(Comparator):", "start_line": 1436, "start_column": 0, "end_line": 1436, "end_column": 35 }, { "span": "class ContainsAttributeValue(Comparator):", "start_line": 1470, "start_column": 0, "end_line": 1470, "end_column": 41 }, { "span": "class SameElementsAs(Comparator):", "start_line": 1501, "start_column": 0, "end_line": 1501, "end_column": 33 }, { "span": "class And(Comparator):", "start_line": 1542, "start_column": 0, "end_line": 1542, "end_column": 22 }, { "span": "class Or(Comparator):", "start_line": 1575, "start_column": 0, "end_line": 1575, "end_column": 21 }, { "span": "class Func(Comparator):", "start_line": 1608, "start_column": 0, "end_line": 1608, "end_column": 23 } ]
[ { "span": "def __eq__(self, rhs):", "start_line": 607, "start_column": 2, "end_line": 607, "end_column": 24 }, { "span": "self._mox ", "start_line": 786, "start_column": 4, "end_line": 786, "end_column": 13 }, { "span": "self._instance_queue ", "start_line": 787, "start_column": 4, "end_line": 787, "end_column": 24 }, { "span": "def __eq__(self, rhs):", "start_line": 1214, "start_column": 2, "end_line": 1214, "end_column": 24 }, { "span": "self._class_name ", "start_line": 1236, "start_column": 4, "end_line": 1236, "end_column": 20 }, { "span": "self._float_value ", "start_line": 1274, "start_column": 4, "end_line": 1274, "end_column": 21 }, { "span": "self._places ", "start_line": 1275, "start_column": 4, "end_line": 1275, "end_column": 16 }, { "span": "self._search_string ", "start_line": 1313, "start_column": 4, "end_line": 1313, "end_column": 23 }, { "span": "self.regex ", "start_line": 1351, "start_column": 4, "end_line": 1351, "end_column": 14 }, { "span": "self._key ", "start_line": 1384, "start_column": 4, "end_line": 1384, "end_column": 13 }, { "span": "self._predicate ", "start_line": 1418, "start_column": 4, "end_line": 1418, "end_column": 19 }, { "span": "self._key ", "start_line": 1451, "start_column": 4, "end_line": 1451, "end_column": 13 }, { "span": "self._value ", "start_line": 1452, "start_column": 4, "end_line": 1452, "end_column": 15 }, { "span": "self._key ", "start_line": 1485, "start_column": 4, "end_line": 1485, "end_column": 13 }, { "span": "self._value ", "start_line": 1486, "start_column": 4, "end_line": 1486, "end_column": 15 }, { "span": "self._expected_seq ", "start_line": 1515, "start_column": 4, "end_line": 1515, "end_column": 22 }, { "span": "self._comparators ", "start_line": 1553, "start_column": 4, "end_line": 1553, "end_column": 21 }, { "span": "self._comparators ", "start_line": 1586, "start_column": 4, "end_line": 1586, "end_column": 21 }, { "span": "self._func ", "start_line": 1632, "start_column": 4, "end_line": 1632, "end_column": 14 } ]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "mock", " ", "tha", "t", " ", "can", " ", "be", " ", "used", " ", "to", " ", "mock", " ", "anyt", "hing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "help", "ful", " ", "for", " ", "mock", "ing", " ", "classe", "s", " ", "tha", "t", " ", "do", " ", "not", " ", "provide", " ", "a", " ", "public", " ", "interface", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "description_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "a", " ", "new", " ", "Moc", "k", "Any", "thing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "description", ":", " ", "str", ".", " ", "Optio", "nal", "ly", ",", " ", "a", " ", "descripti", "ve", " ", "name", " ", "for", " ", "the", " ", "mock", " ", "object", " ", "bei", "ng", "\\", "10", ";", " ", " ", " ", " ", "created", ",", " ", "for", " ", "debugg", "ing", " ", "output", " ", "purpose", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "description_", "=_", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\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_", "\"<", "Moc", "k", "Any", "thing", " ", "instance", " ", "at", " ", "%", "s", ">\"_", "%_", "id_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\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_", "'<", "Moc", "k", "Any", "thing", " ", "instance", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\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_", ",_", "method", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Interc", "ept", " ", "method", " ", "calls", " ", "on", " ", "this", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", "A", " ", "new", " ", "Moc", "k", "Meth", "od", " ", "is", " ", "return", "ed", " ", "tha", "t", " ", "is", " ", "awa", "re", " ", "of", " ", "the", " ", "Moc", "k", "Any", "thing", "'", "s", "\\", "10", ";", " ", "state", " ", "(", "record", " ", "or", " ", "repla", "y", ").", " ", " ", "The", " ", "call", " ", "will", " ", "be", " ", "recorde", "d", " ", "or", " ", "repla", "yed", "\\", "10", ";", " ", "by", " ", "the", " ", "Moc", "k", "Meth", "od", "'", "s", " ", "\\u\\u", "call", "\\u\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "method", " ", "name", ":", " ", "the", " ", "name", " ", "of", " ", "the", " ", "method", " ", "bei", "ng", " ", "call", "ed", ".", "\\", "10", ";", " ", " ", "method", "\\u", "name", ":", " ", "str", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "new", " ", "Moc", "k", "Meth", "od", " ", "awa", "re", " ", "of", " ", "Moc", "k", "Any", "thing", "'", "s", " ", "state", " ", "(", "record", " ", "or", " ", "repla", "y", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "method", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "self_", ",_", "method", "\\u", "name_", ",_", "method", "\\u", "to", "\\u", "mock_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "mock", " ", "method", " ", "call", " ", "and", " ", "return", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "method", "\\u", "name", ":", " ", "the", " ", "name", " ", "of", " ", "the", " ", "method", " ", "bei", "ng", " ", "call", "ed", ".", "\\", "10", ";", " ", " ", "#", " ", "method", "\\u", "to", "\\u", "mock", ":", " ", "The", " ", "actual", " ", "method", " ", "bei", "ng", " ", "mocked", ",", " ", "used", " ", "for", " ", "introspect", "ion", ".", "\\", "10", ";", " ", " ", "method", "\\u", "name", ":", " ", "str", "\\", "10", ";", " ", " ", "method", "\\u", "to", "\\u", "mock", ":", " ", "a", " ", "method", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "new", " ", "Moc", "k", "Meth", "od", " ", "awa", "re", " ", "of", " ", "Moc", "k", "Any", "thing", "'", "s", " ", "state", " ", "(", "record", " ", "or", " ", "repla", "y", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Moc", "k", "Method_", "(_", "method", "\\u", "name_", ",_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ",_", "method", "\\u", "to", "\\u", "mock_", "=_", "method", "\\u", "to", "\\u", "mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "self_", "._", "\\u", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "1", " ", "for", " ", "nonzero", " ", "so", " ", "the", " ", "mock", " ", "can", " ", "be", " ", "used", " ", "as", " ", "a", " ", "conditional", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\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_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "to", " ", "compare", " ", "object", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "isinstance_", "(_", "rhs_", ",_", "Moc", "k", "Any", "thing_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", "==_", "rhs_", "._", "\\u", "repla", "y", "\\u", "mode_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", "==_", "rhs_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "to", " ", "compare", " ", "object", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "not_", "self_", "==_", "rhs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Repl", "ay_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", " ", "repla", "ying", " ", "expected", " ", "method", " ", "calls", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Verify", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Verify", " ", "tha", "t", " ", "all", " ", "of", " ", "the", " ", "expected", " ", "calls", " ", "have", " ", "bee", "n", " ", "made", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Expect", "ed", "Meth", "od", "Calls", "Error", ":", " ", "if", " ", "there", " ", "are", " ", "still", " ", "more", " ", "method", " ", "calls", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "expected", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "list", " ", "of", " ", "expected", " ", "calls", " ", "is", " ", "not", " ", "empty", ",", " ", "raise", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "last", " ", "Multipl", "e", "Times", "Group", " ", "is", " ", "not", " ", "popp", "ed", " ", "from", " ", "the", " ", "queue", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ")_", "==_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", "[_", "0_", "]_", ",_", "Multipl", "e", "Times", "Group_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", "[_", "0_", "]_", "._", "Is", "Sat", "isfi", "ed_", "(_", ")_", ")_", ":_", "\\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 ", " _", "raise_", "Expect", "ed", "Meth", "od", "Calls", "Error_", "(_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Any", "thing_", ":_", "\\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", "Reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Reset", " ", "the", " ", "state", " ", "of", " ", "this", " ", "mock", " ", "to", " ", "record", " ", "mode", " ", "with", " ", "an", " ", "empty", " ", "queue", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Maint", "ain", " ", "a", " ", "list", " ", "of", " ", "method", " ", "calls", " ", "we", " ", "are", " ", "expect", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", "=_", "deque_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "are", " ", "in", " ", "setup", " ", "mode", ",", " ", "not", " ", "repla", "y", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "mock", " ", "object", " ", "tha", "t", " ", "simulat", "es", " ", "the", " ", "public", "/", "protect", "ed", " ", "interface", " ", "of", " ", "a", " ", "class", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "class", "\\u", "to", "\\u", "mock_", ",_", "attrs_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "a", " ", "mock", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "dete", "rmin", "es", " ", "the", " ", "method", "s", " ", "and", " ", "proper", "ties", " ", "of", " ", "the", " ", "class", " ", "and", " ", "store", "s", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "class", "\\u", "to", "\\u", "mock", ":", " ", "class", " ", "to", " ", "be", " ", "mocked", "\\", "10", ";", " ", " ", "class", "\\u", "to", "\\u", "mock", ":", " ", "class", "\\", "10", ";", " ", " ", "attr", "s", ":", " ", "dict", " ", "of", " ", "attribute", " ", "names", " ", "to", " ", "values", " ", "tha", "t", " ", "will", " ", "be", " ", "set", " ", "on", " ", "the", " ", "mock", "\\", "10", ";", " ", " ", " ", " ", "object", ".", " ", " ", "On", "ly", " ", "public", " ", "attribute", "s", " ", "may", " ", "be", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Priva", "te", "Attribute", "Error", ":", " ", "if", " ", "a", " ", "supplie", "d", " ", "attribute", " ", "is", " ", "not", " ", "public", ".", "\\", "10", ";", " ", " ", "Value", "Error", ":", " ", "if", " ", "an", " ", "attribute", " ", "wou", "ld", " ", "mask", " ", "an", " ", "exist", "ing", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "used", " ", "to", " ", "hack", " ", "aro", "und", " ", "the", " ", "mix", "in", "/", "inherita", "nce", " ", "of", " ", "Moc", "k", "Any", "thing", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "not", " ", "a", " ", "proper", " ", "object", " ", "(", "it", " ", "can", " ", "be", " ", "anyt", "hing", ".", " ", ":-", ")_", "\\u\\u\\uNL\\u\\u\\u_", "Moc", "k", "Any", "thing_", "._", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "\\u", "init", "\\u\\u'_", "]_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "list", " ", "of", " ", "all", " ", "the", " ", "public", " ", "and", " ", "special", " ", "method", "s", " ", "we", " ", "shou", "ld", " ", "mock", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "know", "n", "\\u", "methods_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "know", "n", "\\u", "vars_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", "=_", "class", "\\u", "to", "\\u", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "description_", "=_", "class", "\\u", "to", "\\u", "mock_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "class", "\\u", "to", "\\u", "mock", " ", "is", " ", "a", " ", "mock", " ", "its", "elf", ",", " ", "then", " ", "we", "'", "ll", " ", "get", " ", "an", " ", "Un", "know", "n", "Meth", "od", "Call_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", " ", "here", " ", "from", " ", "the", " ", "underl", "ying", " ", "call", " ", "to", " ", "\\u\\u", "getattr", "\\u\\u", "('\\", "u\\u", "name", "\\u\\u'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Un", "know", "n", "Meth", "od", "Call", "Error_", ",_", "Attribute", "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 ", " _", "self_", "._", "\\u", "description_", "=_", "type_", "(_", "class", "\\u", "to", "\\u", "mock_", ")_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "method_", "in_", "dir_", "(_", "class", "\\u", "to", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attr_", "=_", "getattr_", "(_", "class", "\\u", "to", "\\u", "mock_", ",_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callable_", "(_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "know", "n", "\\u", "methods_", "._", "add_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "(_", "type_", "(_", "attr_", ")_", "is_", "property_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "treat", "ing", " ", "proper", "ties", " ", "as", " ", "class", " ", "vars", " ", "make", "s", " ", "litt", "le", " ", "sense", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "know", "n", "\\u", "vars_", "._", "add_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "addition", "al", " ", "attribute", "s", " ", "at", " ", "instantiation", " ", "time", ";", " ", "this", " ", "is", " ", "quick", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "than", " ", "manu", "ally", " ", "setti", "ng", " ", "attribute", "s", " ", "tha", "t", " ", "are", " ", "normal", "ly", " ", "created", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "init", "\\u\\u", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "attr_", ",_", "value_", "in_", "attrs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attr_", "._", "startswith_", "(_", "\"\\u\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Priva", "te", "Attribute", "Error_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "in_", "self_", "._", "\\u", "know", "n", "\\u", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"'", "%", "s", "'", " ", "is", " ", "a", " ", "method", " ", "of", " ", "'%", "s", "'", " ", "object", "s", ".\"_", "%_", "(_", "attr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "class", "\\u", "to", "\\u", "mock_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "attr_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "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\\u", "getattr\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Interc", "ept", " ", "attribute", " ", "request", " ", "on", " ", "this", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "attribute", " ", "is", " ", "a", " ", "public", " ", "class", " ", "variab", "le", ",", " ", "it", " ", "will", " ", "be", " ", "return", "ed", " ", "and", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "recorde", "d", " ", "as", " ", "a", " ", "call", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "attribute", " ", "is", " ", "not", " ", "a", " ", "variab", "le", ",", " ", "it", " ", "is", " ", "handle", "d", " ", "like", " ", "a", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "call", ".", " ", "The", " ", "method", " ", "name", " ", "is", " ", "checke", "d", " ", "against", " ", "the", " ", "set", " ", "of", " ", "mock", "able", "\\", "10", ";", " ", " ", " ", " ", "method", "s", ",", " ", "and", " ", "a", " ", "new", " ", "Moc", "k", "Meth", "od", " ", "is", " ", "return", "ed", " ", "tha", "t", " ", "is", " ", "awa", "re", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Moc", "k", "Object", "'", "s", " ", "state", " ", "(", "record", " ", "or", " ", "repla", "y", ").", " ", " ", "The", " ", "call", " ", "will", " ", "be", " ", "recorde", "d", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "repla", "yed", " ", "by", " ", "the", " ", "Moc", "k", "Meth", "od", "'", "s", " ", "\\u\\u", "call", "\\u\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "name", ":", " ", "the", " ", "name", " ", "of", " ", "the", " ", "attribute", " ", "bei", "ng", " ", "request", "ed", ".", "\\", "10", ";", " ", " ", "name", ":", " ", "str", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Ei", "ther", " ", "a", " ", "class", " ", "variab", "le", " ", "or", " ", "a", " ", "new", " ", "Moc", "k", "Meth", "od", " ", "tha", "t", " ", "is", " ", "awa", "re", " ", "of", " ", "the", " ", "state", "\\", "10", ";", " ", " ", "of", " ", "the", " ", "mock", " ", "(", "record", " ", "or", " ", "repla", "y", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Un", "know", "n", "Meth", "od", "Call", "Error", " ", "if", " ", "the", " ", "Moc", "k", "Object", " ", "doe", "s", " ", "not", " ", "mock", " ", "the", " ", "request", "ed", "\\", "10", ";", " ", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u", "know", "n", "\\u", "vars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "\\u", "know", "n", "\\u", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method", "\\u", "to", "\\u", "mock_", "=_", "getattr_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Un", "know", "n", "Meth", "od", "Call", "Error_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "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_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "to", " ", "compare", " ", "object", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "isinstance_", "(_", "rhs_", ",_", "Moc", "k", "Object_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", "==_", "rhs_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", "==_", "rhs_", "._", "\\u", "repla", "y", "\\u", "mode_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", "==_", "rhs_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "for", " ", "mock", "ing", " ", "classe", "s", " ", "tha", "t", " ", "support", " ", "item", " ", "assign", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "key", ":", " ", "Key", " ", "to", " ", "set", " ", "the", " ", "value", " ", "for", ".", "\\", "10", ";", " ", " ", "value", ":", " ", "Value", " ", "to", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Expect", "ed", " ", "return", " ", "value", " ", "in", " ", "repla", "y", " ", "mode", ".", " ", " ", "A", " ", "Moc", "k", "Meth", "od", " ", "object", " ", "for", " ", "the", "\\", "10", ";", " ", " ", "\\u\\u", "setitem", "\\u\\u", " ", "method", " ", "tha", "t", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "call", "ed", " ", "if", " ", "not", " ", "in", " ", "repla", "y", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Type", "Error", " ", "if", " ", "the", " ", "underl", "ying", " ", "class", " ", "doe", "s", " ", "not", " ", "support", " ", "item", " ", "assign", "ment", ".", "\\", "10", ";", " ", " ", "Une", "xpe", "cte", "d", "Meth", "od", "Call", "Error", " ", "if", " ", "the", " ", "object", " ", "doe", "s", " ", "not", " ", "expect", " ", "the", " ", "call", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "setitem", "\\u\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "the", " ", "class", " ", "support", "s", " ", "item", " ", "assign", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'\\u", "\\u", "setitem", "\\u\\u'_", "not_", "in_", "dir_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "object", " ", "doe", "s", " ", "not", " ", "support", " ", "item", " ", "assign", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "are", " ", "in", " ", "repla", "y", " ", "mode", " ", "then", " ", "simp", "ly", " ", "call", " ", "the", " ", "mock", " ", "\\u\\u", "setitem", "\\u\\u", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "setitem", "\\u\\u'_", ",_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ")_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "create", " ", "a", " ", "mock", " ", "method", " ", "\\u\\u", "setitem", "\\u\\u", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "setitem", "\\u\\u'_", ")_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "for", " ", "mock", "ing", " ", "classe", "s", " ", "tha", "t", " ", "are", " ", "subscript", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "key", ":", " ", "Key", " ", "to", " ", "return", " ", "the", " ", "value", " ", "for", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Expect", "ed", " ", "return", " ", "value", " ", "in", " ", "repla", "y", " ", "mode", ".", " ", " ", "A", " ", "Moc", "k", "Meth", "od", " ", "object", " ", "for", " ", "the", "\\", "10", ";", " ", " ", "\\u\\u", "getitem", "\\u\\u", " ", "method", " ", "tha", "t", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "call", "ed", " ", "if", " ", "not", " ", "in", " ", "repla", "y", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Type", "Error", " ", "if", " ", "the", " ", "underl", "ying", " ", "class", " ", "is", " ", "not", " ", "subscript", "able", ".", "\\", "10", ";", " ", " ", "Une", "xpe", "cte", "d", "Meth", "od", "Call", "Error", " ", "if", " ", "the", " ", "object", " ", "doe", "s", " ", "not", " ", "expect", " ", "the", " ", "call", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "getitem", "\\u\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "the", " ", "class", " ", "support", "s", " ", "item", " ", "assign", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'\\u", "\\u", "getitem", "\\u\\u'_", "not_", "in_", "dir_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "uns", "ubs", "cript", "able", " ", "object", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "are", " ", "in", " ", "repla", "y", " ", "mode", " ", "then", " ", "simp", "ly", " ", "call", " ", "the", " ", "mock", " ", "\\u\\u", "getitem", "\\u\\u", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "getitem", "\\u\\u'_", ",_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ")_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "create", " ", "a", " ", "mock", " ", "method", " ", "\\u\\u", "getitem", "\\u\\u", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "getitem", "\\u\\u'_", ")_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "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 ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "for", " ", "mock", "ing", " ", "classe", "s", " ", "tha", "t", " ", "are", " ", "iterable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Expect", "ed", " ", "return", " ", "value", " ", "in", " ", "repla", "y", " ", "mode", ".", " ", " ", "A", " ", "Moc", "k", "Meth", "od", " ", "object", " ", "for", " ", "the", "\\", "10", ";", " ", " ", "\\u\\u", "iter", "\\u\\u", " ", "method", " ", "tha", "t", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "call", "ed", " ", "if", " ", "not", " ", "in", " ", "repla", "y", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Type", "Error", " ", "if", " ", "the", " ", "underl", "ying", " ", "class", " ", "is", " ", "not", " ", "iterable", ".", "\\", "10", ";", " ", " ", "Une", "xpe", "cte", "d", "Meth", "od", "Call", "Error", " ", "if", " ", "the", " ", "object", " ", "doe", "s", " ", "not", " ", "expect", " ", "the", " ", "call", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "iter", "\\u\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "methods_", "=_", "dir_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "the", " ", "class", " ", "support", "s", " ", "iterati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'\\u", "\\u", "iter", "\\u\\u'_", "not_", "in_", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "doe", "sn", "'", "t", " ", "have", " ", "iter", " ", "method", " ", "and", " ", "we", " ", "are", " ", "in", " ", "repla", "y", " ", "method", ",", " ", "then", " ", "try", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterate", " ", "usi", "ng", " ", "subscript", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'\\u", "\\u", "getitem", "\\u\\u'_", "not_", "in_", "methods_", "or_", "not_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "not", " ", "iterable", " ", "object", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "self_", "[_", "index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\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_", "iter_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "are", " ", "in", " ", "repla", "y", " ", "mode", " ", "then", " ", "simp", "ly", " ", "call", " ", "the", " ", "mock", " ", "\\u\\u", "iter", "\\u\\u", " ", "method", "._", "\\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_", "._", "\\u", "repla", "y", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "iter", "\\u\\u'_", ",_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "create", " ", "a", " ", "mock", " ", "method", " ", "\\u\\u", "iter", "\\u\\u", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "iter", "\\u\\u'_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "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_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "for", " ", "mock", "ing", " ", "classe", "s", " ", "tha", "t", " ", "contain", " ", "items", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "key", ":", " ", "Key", " ", "to", " ", "look", " ", "in", " ", "container", " ", "for", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Expect", "ed", " ", "return", " ", "value", " ", "in", " ", "repla", "y", " ", "mode", ".", " ", " ", "A", " ", "Moc", "k", "Meth", "od", " ", "object", " ", "for", " ", "the", "\\", "10", ";", " ", " ", "\\u\\u", "contain", "s", "\\u\\u", " ", "method", " ", "tha", "t", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "call", "ed", " ", "if", " ", "not", " ", "in", " ", "repla", "y", " ", "mode", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Type", "Error", " ", "if", " ", "the", " ", "underl", "ying", " ", "class", " ", "doe", "s", " ", "not", " ", "implement", " ", "\\u\\u", "contain", "s", "\\u\\u", "\\", "10", ";", " ", " ", "Une", "xpe", "cte", "d", "Meth", "od", "Caller", " ", "if", " ", "the", " ", "object", " ", "doe", "s", " ", "not", " ", "expect", " ", "the", " ", "call", " ", "to", "\\", "10", ";", " ", " ", "\\u\\u", "contain", "s", "\\u\\u", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contains_", "=_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", "._", "\\u\\u", "dict\\u\\u_", "._", "get_", "(_", "'\\u", "\\u", "contain", "s", "\\u\\u'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "contains_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "uns", "ubs", "cript", "able", " ", "object", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "contain", "s", "\\u\\u'_", ",_", "self_", "._", "\\u", "expected", "\\u", "calls", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ")_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "contain", "s", "\\u\\u'_", ")_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "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_", ",_", "*_", "params_", ",_", "**_", "named", "\\u", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ide", " ", "custom", " ", "logic", " ", "for", " ", "mock", "ing", " ", "classe", "s", " ", "tha", "t", " ", "are", " ", "calla", "ble", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "the", " ", "class", " ", "we", " ", "are", " ", "mock", "ing", " ", "is", " ", "calla", "ble", "._", "\\u\\u\\uNL\\u\\u\\u_", "callable_", "=_", "hasattr_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ",_", "'\\u", "\\u", "call", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "callable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Not", " ", "calla", "ble", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Be", "caus", "e", " ", "the", " ", "call", " ", "is", " ", "happ", "eni", "ng", " ", "direct", "ly", " ", "on", " ", "this", " ", "object", " ", "inst", "ead", " ", "of", " ", "a", " ", "method", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "call", " ", "on", " ", "the", " ", "mock", " ", "method", " ", "is", " ", "made", " ", "right", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "are", " ", "mock", "ing", " ", "a", " ", "Function", ",", " ", "then", " ", "use", " ", "the", " ", "function", ",", " ", "and", " ", "not", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "call", "\\u\\u", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "method_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ")_", "==_", "types_", "._", "Function", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "getattr_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ",_", "'\\u", "\\u", "call", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mock", "\\u", "method_", "=_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "call", "\\u\\u'_", ",_", "method", "\\u", "to", "\\u", "mock_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "mock", "\\u", "method_", "(_", "*_", "params_", ",_", "**_", "named", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Object_", "(_", "Moc", "k", "Any", "thing_", ",_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "class\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "class", " ", "tha", "t", " ", "is", " ", "bei", "ng", " ", "mocked", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Moc", "k", "Object", "Factory_", "(_", "Moc", "k", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Moc", "k", "Object", "Factor", "y", " ", "create", "s", " ", "mock", "s", " ", "and", " ", "verifie", "s", " ", "\\u\\u", "init", "\\u\\u", " ", "params", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "A", " ", "Moc", "k", "Object", "Factor", "y", " ", "remove", "s", " ", "the", " ", "boiler", " ", "plate", " ", "code", " ", "tha", "t", " ", "was", " ", "previ", "ously", "\\", "10", ";", " ", " ", "necessar", "y", " ", "to", " ", "stub", " ", "out", " ", "direction", " ", "instantiation", " ", "of", " ", "a", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "Moc", "k", "Object", "Factor", "y", " ", "create", "s", " ", "new", " ", "Moc", "k", "Object", "s", " ", "whe", "n", " ", "call", "ed", " ", "and", " ", "verifie", "s", " ", "the", "\\", "10", ";", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "params", " ", "are", " ", "correct", " ", "whe", "n", " ", "in", " ", "record", " ", "mode", ".", " ", " ", "Whe", "n", " ", "repla", "ying", ",", " ", "exist", "ing", "\\", "10", ";", " ", " ", "mock", "s", " ", "are", " ", "return", "ed", ",", " ", "and", " ", "the", " ", "\\u\\u", "init", "\\u\\u", " ", "params", " ", "are", " ", "verifie", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "Stu", "b", "Out", "With", "Moc", "k", " ", "vs", " ", "Stu", "b", "Out", "Class", "With", "Moc", "ks", " ", "for", " ", "more", " ", "deta", "il", ".", "\\", "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_", "\\u", "Moc", "k", "Object", "Factory_", "(_", "Moc", "k", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "class", "\\u", "to", "\\u", "mock_", ",_", "mo", "x", "\\u", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Moc", "k", "Object_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "class", "\\u", "to", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mox_", "=_", "mo", "x", "\\u", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "queue_", "=_", "deque_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Moc", "k", "Object", "Factory_", "(_", "Moc", "k", "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_", ",_", "*_", "params_", ",_", "**_", "named", "\\u", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Instantiate", " ", "and", " ", "record", " ", "tha", "t", " ", "a", " ", "new", " ", "mock", " ", "has", " ", "bee", "n", " ", "created", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "getattr_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ",_", "'\\u", "\\u", "init", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "method_", "=_", "self_", "._", "\\u", "Creat", "e", "Moc", "k", "Method_", "(_", "'\\u", "\\u", "init", "\\u\\u'_", ",_", "method", "\\u", "to", "\\u", "mock_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "calling", " ", "mock", "\\u", "method", "()", " ", "is", " ", "defer", "red", " ", "in", " ", "order", " ", "to", " ", "catch", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "empty", " ", "instance", "\\u", "queue", " ", "first", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "repla", "y", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "instance", "\\u", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Une", "xpe", "cte", "d", "Moc", "k", "Creat", "ion", "Error_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ",_", "*_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "named", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mock", "\\u", "method_", "(_", "*_", "params_", ",_", "**_", "named", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "instance", "\\u", "queue_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "method_", "(_", "*_", "params_", ",_", "**_", "named", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "=_", "self_", "._", "\\u", "mox_", "._", "Creat", "e", "Mock_", "(_", "self_", "._", "\\u", "class", "\\u", "to", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "queue_", "._", "append", "left_", "(_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Moc", "k", "Object", "Factory_", "(_", "Moc", "k", "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", "Verify", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Verify", " ", "tha", "t", " ", "all", " ", "mock", "s", " ", "have", " ", "bee", "n", " ", "created", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "instance", "\\u", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Expect", "ed", "Moc", "k", "Creat", "ion", "Error_", "(_", "self_", "._", "\\u", "instance", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "\\u", "Moc", "k", "Object", "Factory_", ",_", "self_", ")_", "._", "\\u", "Verify", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Compara", "tor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "all", " ", "Mo", "x", " ", "comparator", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "A", " ", "Compara", "tor", " ", "can", " ", "be", " ", "used", " ", "as", " ", "a", " ", "parameter", " ", "to", " ", "a", " ", "mocked", " ", "method", " ", "whe", "n", " ", "the", " ", "exact", "\\", "10", ";", " ", " ", "value", " ", "is", " ", "not", " ", "know", "n", ".", " ", " ", "For", " ", "example", ",", " ", "the", " ", "code", " ", "you", " ", "are", " ", "testi", "ng", " ", "mig", "ht", " ", "build", " ", "up", " ", "a", "\\", "10", ";", " ", " ", "long", " ", "SQL", " ", "string", " ", "tha", "t", " ", "is", " ", "pass", "ed", " ", "to", " ", "your", " ", "mock", " ", "DA", "O", ".", " ", "You", "'", "re", " ", "only", " ", "interest", "ed", " ", "tha", "t", "\\", "10", ";", " ", " ", "the", " ", "IN", " ", "clause", " ", "contain", "s", " ", "the", " ", "proper", " ", "primary", " ", "keys", ",", " ", "so", " ", "you", " ", "can", " ", "set", " ", "your", " ", "mock", "\\", "10", ";", " ", " ", "up", " ", "as", " ", "follow", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Run", "Query", "(", "Str", "Contain", "s", "('", "IN", " ", "(", "1", ",", " ", "2", ",", " ", "4", ",", " ", "5", ")'", "))", ".", "And", "Return", "(", "mock", "\\u", "result", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", "No", "w", " ", "what", "ever", " ", "query", " ", "is", " ", "pass", "ed", " ", "in", " ", "must", " ", "contain", " ", "the", " ", "string", " ", "'", "IN", " ", "(", "1", ",", " ", "2", ",", " ", "4", ",", " ", "5", ")'", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "A", " ", "Compara", "tor", " ", "may", " ", "replace", " ", "one", " ", "or", " ", "more", " ", "parameter", "s", ",", " ", "for", " ", "example", ":", "\\", "10", ";", " ", " ", "#", " ", "return", " ", "at", " ", "most", " ", "10", " ", "rows", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Run", "Query", "(", "Str", "Contain", "s", "('", "SELECT", "')", ",", " ", "10", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", "or", "\\", "10", ";", "\\", "10", ";", " ", " ", "#", " ", "Return", " ", "some", " ", "non", "-", "deterministic", " ", "number", " ", "of", " ", "rows", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Run", "Query", "(", "Str", "Contain", "s", "('", "SELECT", "')", ",", " ", "Is", "A", "(", "int", "))\\", "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_", "Compara", "tor_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Special", " ", "equals", " ", "method", " ", "tha", "t", " ", "all", " ", "comparator", "s", " ", "must", " ", "implement", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "rhs", ":", " ", "any", " ", "python", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", ",_", "'", "method", " ", "must", " ", "be", " ", "implemented", " ", "by", " ", "a", " ", "subclass", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compara", "tor_", ":_", "\\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_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "equals_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compara", "tor_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "._", "equals_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Is", "A_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "class", " ", "wrap", "s", " ", "a", " ", "basic", " ", "Pyth", "on", " ", "type", " ", "or", " ", "class", ".", " ", " ", "It", " ", "is", " ", "used", " ", "to", " ", "verify", "\\", "10", ";", " ", " ", "tha", "t", " ", "a", " ", "parameter", " ", "is", " ", "of", " ", "the", " ", "give", "n", " ", "type", " ", "or", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Connect", "(", "Is", "A", "(", "Db", "Connect", "Info", "))\\", "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_", "Is", "A_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "class", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "Is", "A", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "class", "\\u", "name", ":", " ", "basic", " ", "python", " ", "type", " ", "or", " ", "a", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "class", "\\u", "name_", "=_", "class", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Is", "A_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "RHS", " ", "is", " ", "an", " ", "instance", " ", "of", " ", "class", "\\u", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "rhs", ":", " ", "the", " ", "right", " ", "hand", " ", "side", " ", "of", " ", "the", " ", "test", "\\", "10", ";", " ", " ", "rhs", ":", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "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 ", " _", "return_", "isinstance_", "(_", "rhs_", ",_", "self_", "._", "\\u", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "raw", " ", "types", " ", "if", " ", "there", " ", "was", " ", "a", " ", "type", " ", "error", ".", " ", " ", "Thi", "s", " ", "is", " ", "help", "ful", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thing", "s", " ", "like", " ", "c", "String", "IO", ".", "String", "IO", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "(_", "rhs_", ")_", "==_", "type_", "(_", "self_", "._", "\\u", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Is", "A_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\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", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "\\u", "class", "\\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_", "class_", "Is", "Al", "most", "_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compari", "son", " ", "class", " ", "used", " ", "to", " ", "check", " ", "whe", "ther", " ", "a", " ", "parameter", " ", "is", " ", "near", "ly", " ", "equal", "\\", "10", ";", " ", " ", "to", " ", "a", " ", "give", "n", " ", "value", ".", " ", " ", "General", "ly", " ", "usef", "ul", " ", "for", " ", "float", "ing", " ", "point", " ", "numbers", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", " ", "mock", "\\u", "dao", ".", "Set", "Time", "out", "((", "Is", "Al", "most", "(", "3.9", ")))", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Is", "Al", "most", "_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "float", "\\u", "value_", ",_", "places_", "=_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "Is", "Al", "most", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "float", "\\u", "value", ":", " ", "The", " ", "value", " ", "for", " ", "mak", "ing", " ", "the", " ", "compa", "ris", "on", ".", "\\", "10", ";", " ", " ", "place", "s", ":", " ", "The", " ", "number", " ", "of", " ", "decima", "l", " ", "place", "s", " ", "to", " ", "round", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "float", "\\u", "value_", "=_", "float", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "places_", "=_", "places_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Is", "Al", "most", "_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "if", " ", "RHS", " ", "is", " ", "alm", "ost", " ", "equal", " ", "to", " ", "float", "\\u", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "rhs", ":", " ", "the", " ", "value", " ", "to", " ", "compare", " ", "to", " ", "float", "\\u", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "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 ", " _", "return_", "round_", "(_", "rhs_", "-_", "self_", "._", "\\u", "float", "\\u", "value_", ",_", "self_", "._", "\\u", "places_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "probab", "ly", " ", "bec", "aus", "e", " ", "eit", "her", " ", "float", "\\u", "value", " ", "or", " ", "rhs", " ", "is", " ", "not", " ", "a", " ", "number", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Is", "Al", "most", "_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\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", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "\\u", "float", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Str", "Contains_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compari", "son", " ", "class", " ", "used", " ", "to", " ", "check", " ", "whe", "ther", " ", "a", " ", "substring", " ", "exist", "s", " ", "in", " ", "a", "\\", "10", ";", " ", " ", "string", " ", "parameter", ".", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "usef", "ul", " ", "in", " ", "mock", "ing", " ", "a", " ", "databa", "se", " ", "with", " ", "SQL", "\\", "10", ";", " ", " ", "pass", "ed", " ", "in", " ", "as", " ", "a", " ", "string", " ", "parameter", ",", " ", "for", " ", "example", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Run", "Query", "(", "Str", "Contain", "s", "('", "IN", " ", "(", "1", ",", " ", "2", ",", " ", "4", ",", " ", "5", ")'", "))", ".", "And", "Return", "(", "mock", "\\u", "result", ")", "\\", "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_", "Str", "Contains_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "search", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "search", "\\u", "string", ":", " ", "the", " ", "string", " ", "you", " ", "are", " ", "search", "ing", " ", "for", "\\", "10", ";", " ", " ", "search", "\\u", "string", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "search", "\\u", "string_", "=_", "search", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Str", "Contains_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "search", "\\u", "string", " ", "is", " ", "contain", "ed", " ", "in", " ", "the", " ", "rhs", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "rhs", ":", " ", "the", " ", "right", " ", "hand", " ", "side", " ", "of", " ", "the", " ", "test", "\\", "10", ";", " ", " ", "rhs", ":", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "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 ", " _", "return_", "rhs_", "._", "find_", "(_", "self_", "._", "\\u", "search", "\\u", "string_", ")_", ">_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Str", "Contains_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\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", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "str", " ", "contain", "ing", " ", "\\\\'", "%", "s", "\\\\'", ">'_", "%_", "self_", "._", "\\u", "search", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Regex_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "if", " ", "a", " ", "string", " ", "matche", "s", " ", "a", " ", "regular", " ", "express", "ion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "use", "s", " ", "a", " ", "give", "n", " ", "regular", " ", "express", "ion", " ", "to", " ", "dete", "rmin", "e", " ", "equality", ".", "\\", "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_", "Regex_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "pattern_", ",_", "flags_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "pattern", " ", "is", " ", "the", " ", "regular", " ", "express", "ion", " ", "to", " ", "search", " ", "for", "\\", "10", ";", " ", " ", "pattern", ":", " ", "str", "\\", "10", ";", " ", " ", "#", " ", "flags", " ", "pass", "ed", " ", "to", " ", "re", ".", "compile", " ", "function", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", "\\", "10", ";", " ", " ", "flags", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "regex_", "=_", "re_", "._", "compile_", "(_", "pattern_", ",_", "flags_", "=_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Regex_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "if", " ", "rhs", " ", "matche", "s", " ", "regular", " ", "express", "ion", " ", "pattern", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "regex_", "._", "search_", "(_", "rhs_", ")_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Regex_", "(_", "Compara", "tor_", ")_", ":_", "\\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 ", " _", "s_", "=_", "'<", "regular", " ", "express", "ion", " ", "\\\\'", "%", "s", "\\\\''_", "%_", "self_", "._", "regex_", "._", "pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "regex_", "._", "flags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "flags", "=", "%", "d", "'_", "%_", "self_", "._", "regex_", "._", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "In_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "an", " ", "item", " ", "(", "or", " ", "key", ")", " ", "is", " ", "in", " ", "a", " ", "list", " ", "(", "or", " ", "dict", ")", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Get", "User", "s", "Info", "(", "In", "('", "expected", "User", "Name", "'))", ".", "And", "Return", "(", "mock", "\\u", "result", ")", "\\", "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_", "In_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "key", " ", "is", " ", "any", " ", "thing", " ", "tha", "t", " ", "coul", "d", " ", "be", " ", "in", " ", "a", " ", "list", " ", "or", " ", "a", " ", "key", " ", "in", " ", "a", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "whe", "ther", " ", "key", " ", "is", " ", "in", " ", "rhs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "rhs", ":", " ", "dict", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "key_", "in_", "rhs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In_", "(_", "Compara", "tor_", ")_", ":_", "\\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_", "'<", "sequence", " ", "or", " ", "map", " ", "contain", "ing", " ", "\\\\'", "%", "s", "\\\\'", ">'_", "%_", "self_", "._", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Not_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "a", " ", "predica", "tes", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", " ", " ", "mock", "\\u", "dao", ".", "Update", "User", "s", "(", "Not", "(", "Contain", "s", "Key", "Value", "('", "ste", "ve", "pm", "',", " ", "ste", "ve", "pm", "\\u", "user", "\\u", "info", ")))", "\\", "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_", "Not_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "predicate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "predica", "te", ":", " ", "a", " ", "Compara", "tor", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "isinstance_", "(_", "predicate_", ",_", "Compara", "tor_", ")_", ",_", "(_", "\"", "predica", "te", " ", "%", "r", " ", "must", " ", "be", " ", "a", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "Compara", "tor", ".\"_", "%_", "predicate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "predicate_", "=_", "predicate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Not_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "whe", "ther", " ", "the", " ", "predica", "te", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "rhs", ":", " ", "A", " ", "value", " ", "tha", "t", " ", "will", " ", "be", " ", "give", "n", " ", "in", " ", "argu", "ment", " ", "of", " ", "the", " ", "predica", "te", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "not_", "self_", "._", "\\u", "predicate_", "._", "equals_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Not_", "(_", "Compara", "tor_", ")_", ":_", "\\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_", "'<", "not", " ", "\\\\'", "%", "s", "\\\\'", ">'_", "%_", "self_", "._", "\\u", "predicate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Contain", "s", "Key", "Value_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "a", " ", "key", "/", "value", " ", "pair", " ", "is", " ", "in", " ", "a", " ", "dict", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Update", "User", "s", "(", "Contain", "s", "Key", "Value", "('", "ste", "ve", "pm", "',", " ", "ste", "ve", "pm", "\\u", "user", "\\u", "info", "))\\", "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_", "Contain", "s", "Key", "Value_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "key", ":", " ", "a", " ", "key", " ", "in", " ", "a", " ", "dict", "\\", "10", ";", " ", " ", "#", " ", "value", ":", " ", "the", " ", "correspond", "ing", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Contain", "s", "Key", "Value_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "whe", "ther", " ", "the", " ", "give", "n", " ", "key", "/", "value", " ", "pair", " ", "is", " ", "in", " ", "the", " ", "rhs", " ", "dict", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "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 ", " _", "return_", "rhs_", "[_", "self_", "._", "\\u", "key_", "]_", "==_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Contain", "s", "Key", "Value_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\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", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "map", " ", "contain", "ing", " ", "the", " ", "entry", " ", "\\\\'", "%", "s", ":", " ", "%", "s", "\\\\'", ">'_", "%_", "(_", "self_", "._", "\\u", "key_", ",_", "self_", "._", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Contain", "s", "Attribute", "Value_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "a", " ", "pass", "ed", " ", "parameter", " ", "contain", "s", " ", "attribute", "s", " ", "with", " ", "a", " ", "give", "n", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Update", "Some", "thing", "(", "Contain", "s", "Attribute", "('", "ste", "ve", "pm", "',", " ", "ste", "ve", "pm", "\\u", "user", "\\u", "info", "))\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Contain", "s", "Attribute", "Value_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "key", ":", " ", "an", " ", "attribute", " ", "name", " ", "of", " ", "an", " ", "object", "\\", "10", ";", " ", " ", "#", " ", "value", ":", " ", "the", " ", "correspond", "ing", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Contain", "s", "Attribute", "Value_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "whe", "ther", " ", "the", " ", "give", "n", " ", "attribute", " ", "has", " ", "a", " ", "matchi", "ng", " ", "value", " ", "in", " ", "the", " ", "rhs", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "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 ", " _", "return_", "getattr_", "(_", "rhs_", ",_", "self_", "._", "\\u", "key_", ")_", "==_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sam", "e", "Element", "s", "As_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "iterable", "s", " ", "contain", " ", "the", " ", "same", " ", "element", "s", " ", "(", "ign", "orin", "g", " ", "order", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Process", "User", "s", "(", "Sam", "e", "Element", "s", "As", "('", "ste", "ve", "pm", "',", " ", "'", "sal", "oma", "ki", "'))", "\\", "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_", "Sam", "e", "Element", "s", "As_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "expected", "\\u", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "expected", "\\u", "seq", ":", " ", "a", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "expected", "\\u", "seq_", "=_", "expected", "\\u", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sam", "e", "Element", "s", "As_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "actual", "\\u", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "to", " ", "see", " ", "whe", "ther", " ", "actual", "\\u", "seq", " ", "has", " ", "same", " ", "element", "s", " ", "as", " ", "expected", "\\u", "seq", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "actual", "\\u", "seq", ":", " ", "sequence", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "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 ", " _", "expected_", "=_", "dict_", "(_", "[_", "(_", "element_", ",_", "None_", ")_", "for_", "element_", "in_", "self_", "._", "\\u", "expected", "\\u", "seq_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "dict_", "(_", "[_", "(_", "element_", ",_", "None_", ")_", "for_", "element_", "in_", "actual", "\\u", "seq_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fall", " ", "back", " ", "to", " ", "slowe", "r", " ", "list", "-", "compare", " ", "if", " ", "any", " ", "of", " ", "the", " ", "object", "s", " ", "are", " ", "unh", "ash", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected_", "=_", "list_", "(_", "self_", "._", "\\u", "expected", "\\u", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "list_", "(_", "actual", "\\u", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "expected_", "==_", "actual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sam", "e", "Element", "s", "As_", "(_", "Compara", "tor_", ")_", ":_", "\\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_", "'<", "sequence", " ", "with", " ", "same", " ", "element", "s", " ", "as", " ", "\\\\'", "%", "s", "\\\\'", ">'_", "%_", "self_", "._", "\\u", "expected", "\\u", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "And_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Evaluate", "s", " ", "one", " ", "or", " ", "more", " ", "Compara", "tors", " ", "on", " ", "RHS", " ", "and", " ", "return", "s", " ", "an", " ", "AND", " ", "of", " ", "the", " ", "results", ".", "\\", "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_", "And_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "*", "args", ":", " ", "One", " ", "or", " ", "more", " ", "Compara", "tor", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "comparator", "s_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "And_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "all", " ", "Compara", "tors", " ", "are", " ", "equal", " ", "to", " ", "rhs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "rhs", ":", " ", "can", " ", "be", " ", "anyt", "hing", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "comparator", "_", "in_", "self_", "._", "\\u", "comparator", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "comparator", "_", "._", "equals_", "(_", "rhs_", ")_", ":_", "\\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_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "And_", "(_", "Compara", "tor_", ")_", ":_", "\\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_", "'<", "AND", " ", "%", "s", ">'_", "%_", "str_", "(_", "self_", "._", "\\u", "comparator", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Or_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Evaluate", "s", " ", "one", " ", "or", " ", "more", " ", "Compara", "tors", " ", "on", " ", "RHS", " ", "and", " ", "return", "s", " ", "an", " ", "OR", " ", "of", " ", "the", " ", "results", ".", "\\", "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_", "Or_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "*", "args", ":", " ", "One", " ", "or", " ", "more", " ", "Mo", "x", " ", "comparator", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "comparator", "s_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Or_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "whe", "ther", " ", "any", " ", "Compara", "tor", " ", "is", " ", "equal", " ", "to", " ", "rhs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "#", " ", "rhs", ":", " ", "can", " ", "be", " ", "anyt", "hing", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "comparator", "_", "in_", "self_", "._", "\\u", "comparator", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "comparator", "_", "._", "equals_", "(_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Or_", "(_", "Compara", "tor_", ")_", ":_", "\\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_", "'<", "OR", " ", "%", "s", ">'_", "%_", "str_", "(_", "self_", "._", "\\u", "comparator", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Func_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", " ", "a", " ", "function", " ", "tha", "t", " ", "shou", "ld", " ", "verify", " ", "the", " ", "parameter", " ", "pass", "ed", " ", "in", " ", "is", " ", "correct", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "You", " ", "may", " ", "need", " ", "the", " ", "abilit", "y", " ", "to", " ", "perform", " ", "more", " ", "advanced", " ", "operati", "ons", " ", "on", " ", "the", " ", "parameter", "\\", "10", ";", " ", " ", "in", " ", "order", " ", "to", " ", "validat", "e", " ", "it", ".", " ", " ", "You", " ", "can", " ", "use", " ", "this", " ", "to", " ", "have", " ", "a", " ", "calla", "ble", " ", "validat", "e", " ", "any", "\\", "10", ";", " ", " ", "parameter", ".", " ", "The", " ", "calla", "ble", " ", "shou", "ld", " ", "return", " ", "eit", "her", " ", "Tru", "e", " ", "or", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "def", " ", "my", "Param", "Validat", "or", "(", "param", "):", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Advance", "d", " ", "logic", " ", "here", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", "mock", "\\u", "dao", ".", "Do", "Some", "thing", "(", "Func", "(", "my", "Param", "Validat", "or", "),", " ", "true", ")", "\\", "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_", "Func_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "func", ":", " ", "calla", "ble", " ", "tha", "t", " ", "take", "s", " ", "one", " ", "parameter", " ", "and", " ", "return", "s", " ", "a", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "func_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Func_", "(_", "Compara", "tor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "equals_", "(_", "self_", ",_", "rhs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "whe", "ther", " ", "rhs", " ", "pass", "es", " ", "the", " ", "function", " ", "test", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "rhs", " ", "is", " ", "pass", "ed", " ", "int", "o", " ", "func", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "rhs", ":", " ", "any", " ", "python", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "the", " ", "result", " ", "of", " ", "func", "(", "rhs", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "func_", "(_", "rhs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Func_", "(_", "Compara", "tor_", ")_", ":_", "\\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_", "str_", "(_", "self_", "._", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 4, 2, 2, 2, 2, 2, 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
cloudera/hue/desktop/core/ext-py/guppy-0.1.10/guppy/heapy/test/test_heapyc.py
[ { "content": " def test_1(self):\n\timport gc\n\tfrom sys import getrefcount as grc\n\n\tsupport.TestCase.setUp(self)\n\tsets = self.guppy.sets\n\theapdefs = getattr(sets.setsc, '_NyHeapDefs_'),\n\troot = []\n\theapyc = self.guppy.heapy.heapyc\n\tnodeset = sets.mutnodeset\n\tnodegraph = heapyc.NodeGraph\n\t\n\tclass T(object):\n\t __slots__ = 'a', '_hiding_tag_', 'tonly'\n\t pass\n\n\tclass U(T):\n\t __slots__ = 'b',\n\t pass\n\n\tclass V(object):\n\t __slots__ = 'c',\n\n\n\tgc.collect()\n\n\tns = nodeset()\n\ta = [ns]\n\ta.append(a)\n\tb = []\n\the = []\n\tc = []\n\tt = T()\n\ttonly = []\n\n\tt.a = a\n\tt._hiding_tag_ = he\n\tt.tonly = tonly\n\n\tu = U()\n\tu.a = a\n\tu._hiding_tag_ = he\n\tu.b = b\n\n\tv = V()\n\tv.c = c\n\n\ta = [x for x in [list]]\n\tdel x\n\n\tli = [he, a, b, c, t, u, v, T, U, V, ns, nodeset, list]\n\trcli0 = [grc(x) for x in li]\n\tdel x\n\n\tns |= li + range(10000, 10010)\n\troot.extend(li)\n\n\trcli = [grc(x) for x in li]\n\tdel x\n\n\trec = nodeset([x for x in li])\n\tx = None\n\n\trec.append(rec)\n\tns.add(rec)\n\trec._hiding_tag_ = rec\n\n\tif 1:\n\t hv = heapyc.HeapView(root, heapdefs)\n\t hv.register__hiding_tag__type(T)\n\t h = hv.heap()\n\t assert a in h\n\t assert c in h\n\t assert tonly in h\n\t hv._hiding_tag_ = he\n\t h = hv.heap()\n\t del x\n\t del h\n\t del hv\n\n\n\tns.discard(rec)\n\trec = None\n\tgc.collect()\n\n\tnrcli = [grc(x) for x in li]\n\tdel x\n\tself.aseq(rcli, nrcli)\n\n\troot[:]=[]\n\tns.clear()\n\n\tnrcli0 = [grc(x) for x in li]\n\tdel x\n\t\n\tself.aseq(rcli0, nrcli0)", "metadata": "root.TestLeak.test_1", "header": "['class', 'TestLeak', '(', 'support', '.', 'TestCase', ')', ':', '___EOS___']", "index": 251 } ]
[ { "span": "pass", "start_line": 265, "start_column": 5, "end_line": 265, "end_column": 9 }, { "span": "pass", "start_line": 269, "start_column": 5, "end_line": 269, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Test", "Leak", "_", "(_", "support_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "getre", "fco", "unt_", "as_", "gr", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "support_", "._", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sets_", "=_", "self_", "._", "gu", "ppy", "_", "._", "sets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heap", "defs_", "=_", "getattr_", "(_", "sets_", "._", "sets", "c_", ",_", "'\\u", "Ny", "Hea", "p", "Defs", "\\u'_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heap", "yc_", "=_", "self_", "._", "gu", "ppy", "_", "._", "heap", "y_", "._", "heap", "yc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes", "et_", "=_", "sets_", "._", "mut", "nodes", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "graph_", "=_", "heap", "yc_", "._", "Node", "Graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "T_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "\\u\\u", "slots\\u\\u_", "=_", "'", "a", "'_", ",_", "'\\u", "hid", "ing", "\\u", "tag", "\\u'_", ",_", "'", "ton", "ly", "'_", "\\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_", "class_", "U_", "(_", "T_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "\\u\\u", "slots\\u\\u_", "=_", "'", "b", "'_", ",_", "\\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_", "class_", "V_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "\\u\\u", "slots\\u\\u_", "=_", "'", "c", "'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gc_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ns_", "=_", "nodes", "et_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "[_", "ns_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "append_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "he_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "T_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ton", "ly_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "\\u", "hid", "ing", "\\u", "tag", "\\u_", "=_", "he_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "ton", "ly_", "=_", "ton", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "=_", "U_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "._", "a_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "._", "\\u", "hid", "ing", "\\u", "tag", "\\u_", "=_", "he_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v_", "=_", "V_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "._", "c_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "[_", "x_", "for_", "x_", "in_", "[_", "list_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "li_", "=_", "[_", "he_", ",_", "a_", ",_", "b_", ",_", "c_", ",_", "t_", ",_", "u_", ",_", "v_", ",_", "T_", ",_", "U_", ",_", "V_", ",_", "ns_", ",_", "nodes", "et_", ",_", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rcli", "0_", "=_", "[_", "gr", "c_", "(_", "x_", ")_", "for_", "x_", "in_", "li_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ns_", "|=_", "li_", "+_", "range_", "(_", "10000_", ",_", "10010", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "extend_", "(_", "li_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rcli", "_", "=_", "[_", "gr", "c_", "(_", "x_", ")_", "for_", "x_", "in_", "li_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rec_", "=_", "nodes", "et_", "(_", "[_", "x_", "for_", "x_", "in_", "li_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rec_", "._", "append_", "(_", "rec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "add_", "(_", "rec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "._", "\\u", "hid", "ing", "\\u", "tag", "\\u_", "=_", "rec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "hv", "_", "=_", "heap", "yc_", "._", "Hea", "p", "View_", "(_", "root_", ",_", "heap", "defs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hv", "_", "._", "register", "\\u\\u", "hid", "ing", "\\u", "tag", "\\u\\u", "type_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "hv", "_", "._", "heap_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "a_", "in_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "in_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "ton", "ly_", "in_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hv", "_", "._", "\\u", "hid", "ing", "\\u", "tag", "\\u_", "=_", "he_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "hv", "_", "._", "heap_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "hv", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "._", "discard_", "(_", "rec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gc_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nr", "cli_", "=_", "[_", "gr", "c_", "(_", "x_", ")_", "for_", "x_", "in_", "li_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ase", "q_", "(_", "rcli", "_", ",_", "nr", "cli_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nr", "cli", "0_", "=_", "[_", "gr", "c_", "(_", "x_", ")_", "for_", "x_", "in_", "li_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ase", "q_", "(_", "rcli", "0_", ",_", "nr", "cli", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 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