query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
NotImplemented is not an Exception
GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/background_tasks.py
[ { "content": " @abc.abstractmethod\n def StartTask(self, target, args, kwargs, thread_context):\n \"\"\"Creates and starts a _BackgroundTask.\n\n The created task is appended to self.tasks.\n\n Args:\n target: Function that is invoked in the child thread or process.\n args: Series of unnamed arguments to be passed to the target.\n kwargs: dict. Keyword arguments to be passed to the target.\n thread_context: _BackgroundTaskThreadContext. Thread-specific state to be\n inherited from parent to child thread.\n \"\"\"\n raise NotImplemented()", "metadata": "root._BackgroundTaskManager.StartTask", "header": "['class', '_BackgroundTaskManager', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " @abc.abstractmethod\n def AwaitAnyTask(self):\n \"\"\"Waits for any of the started tasks to complete.\n\n Returns:\n int. Index of the task that completed in self.tasks.\n \"\"\"\n raise NotImplemented()", "metadata": "root._BackgroundTaskManager.AwaitAnyTask", "header": "['class', '_BackgroundTaskManager', '(', 'object', ')', ':', '___EOS___']", "index": 273 }, { "content": " @abc.abstractmethod\n def HandleKeyboardInterrupt(self):\n \"\"\"Called by the parent thread if a KeyboardInterrupt occurs.\n\n Ensures that any child thread also receives a KeyboardInterrupt, and then\n waits for each child thread to stop executing.\n \"\"\"\n raise NotImplemented()", "metadata": "root._BackgroundTaskManager.HandleKeyboardInterrupt", "header": "['class', '_BackgroundTaskManager', '(', 'object', ')', ':', '___EOS___']", "index": 282 } ]
[ { "span": "NotImplemented(", "start_line": 271, "start_column": 10, "end_line": 271, "end_column": 24 }, { "span": "NotImplemented(", "start_line": 280, "start_column": 10, "end_line": 280, "end_column": 24 }, { "span": "NotImplemented(", "start_line": 289, "start_column": 10, "end_line": 289, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Not", "Implemented_", "is_", "not_", "an_", "Exception_", "[SEP]_", "class_", "\\u", "Back", "ground", "Task", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Start", "Task_", "(_", "self_", ",_", "target_", ",_", "args_", ",_", "kwargs_", ",_", "thread", "\\u", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "and", " ", "starts", " ", "a", " ", "\\u", "Back", "ground", "Task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "created", " ", "task", " ", "is", " ", "append", "ed", " ", "to", " ", "self", ".", "task", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "target", ":", " ", "Function", " ", "tha", "t", " ", "is", " ", "invoke", "d", " ", "in", " ", "the", " ", "child", " ", "thread", " ", "or", " ", "process", ".", "\\", "10", ";", " ", " ", "args", ":", " ", "Serie", "s", " ", "of", " ", "unn", "ame", "d", " ", "argu", "ment", "s", " ", "to", " ", "be", " ", "pass", "ed", " ", "to", " ", "the", " ", "target", ".", "\\", "10", ";", " ", " ", "kwarg", "s", ":", " ", "dict", ".", " ", "Key", "word", " ", "argu", "ment", "s", " ", "to", " ", "be", " ", "pass", "ed", " ", "to", " ", "the", " ", "target", ".", "\\", "10", ";", " ", " ", "thread", "\\u", "context", ":", " ", "\\u", "Back", "ground", "Task", "Thread", "Context", ".", " ", "Thread", "-", "specific", " ", "state", " ", "to", " ", "be", "\\", "10", ";", " ", " ", "inherited", " ", "from", " ", "parent", " ", "to", " ", "child", " ", "thread", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Implemented_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Back", "ground", "Task", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Await", "Any", "Task_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wait", "s", " ", "for", " ", "any", " ", "of", " ", "the", " ", "start", "ed", " ", "task", "s", " ", "to", " ", "complete", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "int", ".", " ", "Index", " ", "of", " ", "the", " ", "task", " ", "tha", "t", " ", "complete", "d", " ", "in", " ", "self", ".", "task", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Implemented_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Back", "ground", "Task", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Handle", "Key", "board", "Interrupt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "by", " ", "the", " ", "parent", " ", "thread", " ", "if", " ", "a", " ", "Key", "board", "Interr", "upt", " ", "occur", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "any", " ", "child", " ", "thread", " ", "als", "o", " ", "receive", "s", " ", "a", " ", "Key", "board", "Interr", "upt", ",", " ", "and", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "waits", " ", "for", " ", "each", " ", "child", " ", "thread", " ", "to", " ", "stop", " ", "executi", "ng", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Implemented_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2 ]
Except block handles 'BaseException'
OpenMOOC/askbot-openmooc/askbotopenmooc/utils/openmooc-askbot-instancetool.py
[ { "content": " def create_instance(self, instance_name, instance_db_name):\n \"\"\"\n Create the main instance in the instances directory.\n \"\"\"\n INSTANCE_DIR = os.path.join(icc.DEFAULT_INSTANCE_DIR, instance_name)\n # First, copy the skel template in the destination directory\n try:\n shutil.copytree(icc.SKEL_DIR, INSTANCE_DIR)\n os.chdir(INSTANCE_DIR)\n # Second, call populate_file\n template = os.path.join(INSTANCE_DIR, 'instance_settings.py')\n\n os.symlink(\n os.path.join('/usr', 'bin', 'openmooc-askbot-admin'),\n os.path.join(INSTANCE_DIR, 'manage.py'))\n\n values = {\n 'instance_name': instance_name,\n 'instance_db_name': instance_db_name,\n 'instance_db_host': icc.DB_HOST,\n 'base_url': icc.BASE_URL\n }\n self._populate_file(template, values)\n print(' [ OK ] Instance {0} created.'.format(instance_name))\n except:\n self.abort(' [ERROR] Couldn\\'t copy the instance skeleton into '\n 'destination or populate the settings. Please check: '\n 'a) You have permission. '\n 'b) The directory doesn\\'t exist already.')", "metadata": "root.AskbotInstance.create_instance", "header": "['class', 'AskbotInstance', '(', ')', ':', '___EOS___']", "index": 100 }, { "content": " def create_db(self, instance_db_name):\n \"\"\"\n Create the database for the designated instance.\n \"\"\"\n createdb = subprocess.Popen(('su - postgres -c \"createdb %s -w -O %s '\n '-E UTF8\"') % (instance_db_name,\n icc.DB_USER), shell=True)\n createdb.wait() # Wait until it finishes\n try:\n psycopg2.connect(\n database=instance_db_name,\n user=icc.DB_USER,\n password=icc.DB_PASSWORD,\n host=icc.DB_HOST\n )\n print(' [ OK ] Database {0} created and connection '\n 'tested.'.format(instance_db_name))\n except:\n self.abort(' [ERROR] Couldn\\'t connect to the PostgreSQL server '\n '(authentication failed or server down). Aborting.')", "metadata": "root.AskbotInstance.create_db", "header": "['class', 'AskbotInstance', '(', ')', ':', '___EOS___']", "index": 130 }, { "content": " def add_instance_to_supervisor(self, instance_name):\n \"\"\"\n Creates the supervisor file into the directory\n \"\"\"\n INSTANCE_DIR = os.path.join(icc.DEFAULT_INSTANCE_DIR, instance_name)\n try:\n template = os.path.join(INSTANCE_DIR, 'supervisor.conf')\n values = {\n 'instance_name': instance_name,\n 'instance_dir': INSTANCE_DIR\n }\n self._populate_file(template, values)\n os.symlink(template, os.path.join(\n '/etc', 'supervisord.d',\n 'openmooc-askbot-%s.conf' % instance_name))\n print(' [ OK ] Populated the supervisor settings.')\n except:\n self.abort(' [ERROR] Couldn\\'t populate the supervisor settings. '\n 'Exiting.')", "metadata": "root.AskbotInstance.add_instance_to_supervisor", "header": "['class', 'AskbotInstance', '(', ')', ':', '___EOS___']", "index": 174 }, { "content": " def add_instance_to_nginx(self, instance_name):\n \"\"\"\n Creates the nginx file for the local askbot and also the nginx forward\n configuration for the proxy machine. Remember that some values of the\n forward file need to be changed manually!\n \"\"\"\n INSTANCE_DIR = os.path.join(icc.DEFAULT_INSTANCE_DIR, instance_name)\n try:\n # Populate the nginx file\n template = os.path.join(INSTANCE_DIR, 'nginx.conf')\n values = {'instance_name': instance_name}\n self._populate_file(template, values)\n # Populate the nginx.forward file\n template = os.path.join(INSTANCE_DIR, 'nginx.forward.conf')\n values = {'instance_name': instance_name}\n self._populate_file(template, values)\n print(' [ OK ] Populated nginx and nginx.forward settings.')\n except:\n self.abort(' [ERROR] Couldn\\'t populate the nginx or the '\n 'nginx.forward settings. Exiting.')\n\n # TODO\n #self._copy_to_remote(os.path.join(INSTANCE_DIR, 'nginx.forward.conf'))", "metadata": "root.AskbotInstance.add_instance_to_nginx", "header": "['class', 'AskbotInstance', '(', ')', ':', '___EOS___']", "index": 194 }, { "content": " def update_entries_metadata(self):\n \"\"\"\n Update all entries' metadata\n \"\"\"\n try:\n update_metadata = subprocess.Popen(('openmooc-askbot-admin '\n 'update_entries_metadata'),\n shell=True)\n update_metadata.wait() # Wait until it finishes\n\n url = ('https://idp.mooc.educalab.es/simplesaml/module.php/cron/'\n 'cron.php?key=%s&tag=metarefresh') % icc.META_REFRESH_KEY\n requests.get(url)\n except:\n self.abort(' [ERROR] Couldn\\'t update the entries\\' metadata. '\n 'Exiting.')", "metadata": "root.AskbotInstance.update_entries_metadata", "header": "['class', 'AskbotInstance', '(', ')', ':', '___EOS___']", "index": 227 }, { "content": " def disable_instance(self, instance_name):\n \"\"\"\n Disables an instance so it won't be available anymore.\n \"\"\"\n INSTANCE_DIR = os.path.join(icc.DEFAULT_INSTANCE_DIR, instance_name)\n try:\n # Create a disabled instances folder if it doesn't exist already\n if not os.path.isdir(icc.DEFAULT_DISABLED_INSTANCES_DIR):\n os.makedirs(icc.DEFAULT_DISABLED_INSTANCES_DIR)\n # Get the instance dir, copy the data to the disabled folder and\n # delete the instance folder.\n shutil.copy(INSTANCE_DIR, icc.DEFAULT_DISABLED_INSTANCES_DIR)\n shutil.rmtree(INSTANCE_DIR)\n # FIXME it doesn't work\n\n # TODO disable the instance at supervisor and nginx levels too\n print(' [ OK ] Instance {0} disabled.'.format(instance_name))\n except:\n self.abort(' [ERROR] Couldn\\'t disable the instance. Please check '\n 'the directories.')", "metadata": "root.AskbotInstance.disable_instance", "header": "['class', 'AskbotInstance', '(', ')', ':', '___EOS___']", "index": 244 }, { "content": " def destroy_instance(self, instance_name):\n \"\"\"\n Destroys the database and contents of the instance completely\n \"\"\"\n INSTANCE_DIR = os.path.join(icc.DEFAULT_INSTANCE_DIR, instance_name)\n # Ensure we can import the instance settings\n sys.path.insert(0, INSTANCE_DIR)\n try:\n import instance_settings\n except:\n self.abort(' [ERROR] Couldn\\'t import the instance settings to '\n 'destroy it. Check that it exists. Aborting.')\n try:\n instance_db_name = instance_settings.DATABASE_NAME\n dropdb = subprocess.Popen('su - postgres -c \"dropdb %s\"' %\n instance_db_name, shell=True)\n dropdb.wait()\n shutil.rmtree(INSTANCE_DIR)\n os.remove(os.path.join('/etc', 'supervisord.d',\n 'openmooc-askbot-%s.conf' % instance_name))\n print(' [ OK ] Instance {0} destroyed.'.format(instance_name))\n except:\n self.abort(' [ERROR] Couldn\\'t drop database or remove instance '\n 'files. Aborting.')", "metadata": "root.AskbotInstance.destroy_instance", "header": "['class', 'AskbotInstance', '(', ')', ':', '___EOS___']", "index": 265 } ]
[ { "span": "except:", "start_line": 124, "start_column": 8, "end_line": 124, "end_column": 15 }, { "span": "except:", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 15 }, { "span": "except:", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 15 }, { "span": "except:", "start_line": 211, "start_column": 8, "end_line": 211, "end_column": 15 }, { "span": "except:", "start_line": 240, "start_column": 8, "end_line": 240, "end_column": 15 }, { "span": "except:", "start_line": 261, "start_column": 8, "end_line": 261, "end_column": 15 }, { "span": "except:", "start_line": 274, "start_column": 8, "end_line": 274, "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_", "As", "kb", "ot", "Instance_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "instance_", "(_", "self_", ",_", "instance", "\\u", "name_", ",_", "instance", "\\u", "db", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "the", " ", "main", " ", "instance", " ", "in", " ", "the", " ", "instance", "s", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INSTANCE", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "join_", "(_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "INSTANCE", "\\u", "DIR_", ",_", "instance", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "copy", " ", "the", " ", "skel", " ", "template", " ", "in", " ", "the", " ", "destinat", "ion", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copytree_", "(_", "icc", "_", "._", "SK", "EL", "\\u", "DIR_", ",_", "INSTANCE", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "INSTANCE", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Second", ",", " ", "call", " ", "populate", "\\u", "file_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "os_", "._", "path_", "._", "join_", "(_", "INSTANCE", "\\u", "DIR_", ",_", "'", "instance", "\\u", "settings", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "symlink_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "'/", "usr", "'_", ",_", "'", "bin", "'_", ",_", "'", "openm", "oo", "c", "-", "ask", "bot", "-", "admin", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "INSTANCE", "\\u", "DIR_", ",_", "'", "manage", ".", "py", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ":_", "instance", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "db", "\\u", "name", "'_", ":_", "instance", "\\u", "db", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "db", "\\u", "host", "'_", ":_", "icc", "_", "._", "DB", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "base", "\\u", "url", "'_", ":_", "icc", "_", "._", "BASE", "\\u", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "populate", "\\u", "file_", "(_", "template_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "[", " ", "OK", " ", "]", " ", "Insta", "nce", " ", "{", "0", "}", " ", "created", ".'_", "._", "format_", "(_", "instance", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "copy", " ", "the", " ", "instance", " ", "skeleton", " ", "int", "o", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "destinat", "ion", " ", "or", " ", "populate", " ", "the", " ", "settings", ".", " ", "Ple", "ase", " ", "check", ":", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a", ")", " ", "You", " ", "have", " ", "permissi", "on", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "b", ")", " ", "The", " ", "director", "y", " ", "doe", "sn", "\\\\'", "t", " ", "exist", " ", "alr", "ead", "y", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "As", "kb", "ot", "Instance_", "(_", ")_", ":_", "\\u\\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", "db_", "(_", "self_", ",_", "instance", "\\u", "db", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "the", " ", "databa", "se", " ", "for", " ", "the", " ", "designate", "d", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "b_", "=_", "subprocess_", "._", "Popen_", "(_", "(_", "'", "su", " ", "-", " ", "postgres", " ", "-", "c", " ", "\"", "created", "b", " ", "%", "s", " ", "-", "w", " ", "-", "O", " ", "%", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "E", " ", "UT", "F8", "\"'_", ")_", "%_", "(_", "instance", "\\u", "db", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "icc", "_", "._", "DB", "\\u", "USER_", ")_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created", "b_", "._", "wait_", "(_", ")_", "#", " ", "Wait", " ", "unti", "l", " ", "it", " ", "finish", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "psycopg2_", "._", "connect_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "database_", "=_", "instance", "\\u", "db", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "icc", "_", "._", "DB", "\\u", "USER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "icc", "_", "._", "DB", "\\u", "PASSWORD_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "icc", "_", "._", "DB", "\\u", "HOST_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "[", " ", "OK", " ", "]", " ", "Databa", "se", " ", "{", "0", "}", " ", "created", " ", "and", " ", "connecti", "on", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tested", ".'_", "._", "format_", "(_", "instance", "\\u", "db", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "connect", " ", "to", " ", "the", " ", "Post", "gre", "SQL", " ", "server", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "authenticat", "ion", " ", "fail", "ed", " ", "or", " ", "server", " ", "down", ").", " ", "Abo", "rti", "ng", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "As", "kb", "ot", "Instance_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "instance", "\\u", "to", "\\u", "supervisor", "_", "(_", "self_", ",_", "instance", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "the", " ", "supervisor", " ", "file", " ", "int", "o", " ", "the", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INSTANCE", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "join_", "(_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "INSTANCE", "\\u", "DIR_", ",_", "instance", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "os_", "._", "path_", "._", "join_", "(_", "INSTANCE", "\\u", "DIR_", ",_", "'", "supervisor", ".", "conf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "name", "'_", ":_", "instance", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "dir", "'_", ":_", "INSTANCE", "\\u", "DIR_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "populate", "\\u", "file_", "(_", "template_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "symlink_", "(_", "template_", ",_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "etc", "'_", ",_", "'", "supervisor", "d", ".", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openm", "oo", "c", "-", "ask", "bot", "-%", "s", ".", "conf", "'_", "%_", "instance", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "[", " ", "OK", " ", "]", " ", "Populate", "d", " ", "the", " ", "supervisor", " ", "settings", ".'_", ")_", "\\u\\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_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "populate", " ", "the", " ", "supervisor", " ", "settings", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Exi", "ting", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "As", "kb", "ot", "Instance_", "(_", ")_", ":_", "\\u\\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", "instance", "\\u", "to", "\\u", "ngin", "x_", "(_", "self_", ",_", "instance", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "the", " ", "ngin", "x", " ", "file", " ", "for", " ", "the", " ", "local", " ", "ask", "bot", " ", "and", " ", "als", "o", " ", "the", " ", "ngin", "x", " ", "forward", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", " ", "for", " ", "the", " ", "proxy", " ", "machine", ".", " ", "Reme", "mber", " ", "tha", "t", " ", "some", " ", "values", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "forward", " ", "file", " ", "need", " ", "to", " ", "be", " ", "change", "d", " ", "manu", "ally", "!", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INSTANCE", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "join_", "(_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "INSTANCE", "\\u", "DIR_", ",_", "instance", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Populate", " ", "the", " ", "ngin", "x", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "os_", "._", "path_", "._", "join_", "(_", "INSTANCE", "\\u", "DIR_", ",_", "'", "ngin", "x", ".", "conf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "'", "instance", "\\u", "name", "'_", ":_", "instance", "\\u", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "populate", "\\u", "file_", "(_", "template_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Populate", " ", "the", " ", "ngin", "x", ".", "forward", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "os_", "._", "path_", "._", "join_", "(_", "INSTANCE", "\\u", "DIR_", ",_", "'", "ngin", "x", ".", "forward", ".", "conf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "'", "instance", "\\u", "name", "'_", ":_", "instance", "\\u", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "populate", "\\u", "file_", "(_", "template_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "[", " ", "OK", " ", "]", " ", "Populate", "d", " ", "ngin", "x", " ", "and", " ", "ngin", "x", ".", "forward", " ", "settings", ".'_", ")_", "\\u\\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_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "populate", " ", "the", " ", "ngin", "x", " ", "or", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ngin", "x", ".", "forward", " ", "settings", ".", " ", "Exi", "ting", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".\\u", "copy", "\\u", "to", "\\u", "remote", "(", "os", ".", "path", ".", "join", "(", "INSTANCE", "\\u", "DIR", ",", " ", "'", "ngin", "x", ".", "forward", ".", "conf", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "As", "kb", "ot", "Instance_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "entri", "es", "\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "all", " ", "entri", "es", "'", " ", "metadata", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "update", "\\u", "metadata_", "=_", "subprocess_", "._", "Popen_", "(_", "(_", "'", "openm", "oo", "c", "-", "ask", "bot", "-", "admin", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "\\u", "entri", "es", "\\u", "metadata", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "metadata_", "._", "wait_", "(_", ")_", "#", " ", "Wait", " ", "unti", "l", " ", "it", " ", "finish", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "(_", "'", "https", "://", "idp", ".", "moo", "c", ".", "educa", "lab", ".", "es", "/", "simple", "saml", "/", "module", ".", "php", "/", "cron", "/'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cron", ".", "php", "?", "key", "=", "%", "s", "&", "tag", "=", "meta", "refre", "sh", "'_", ")_", "%_", "icc", "_", "._", "MET", "A", "\\u", "REFRESH", "\\u", "KEY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "update", " ", "the", " ", "entri", "es", "\\\\'", " ", "metadata", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Exi", "ting", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "As", "kb", "ot", "Instance_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "disable", "\\u", "instance_", "(_", "self_", ",_", "instance", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Disa", "bles", " ", "an", " ", "instance", " ", "so", " ", "it", " ", "won", "'", "t", " ", "be", " ", "avail", "able", " ", "any", "more", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INSTANCE", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "join_", "(_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "INSTANCE", "\\u", "DIR_", ",_", "instance", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "disable", "d", " ", "instance", "s", " ", "folder", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "DISABLED", "\\u", "INSTANCE", "S", "\\u", "DIR_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "DISABLED", "\\u", "INSTANCE", "S", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "instance", " ", "dir", ",", " ", "copy", " ", "the", " ", "data", " ", "to", " ", "the", " ", "disable", "d", " ", "folder", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "the", " ", "instance", " ", "folder", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "INSTANCE", "\\u", "DIR_", ",_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "DISABLED", "\\u", "INSTANCE", "S", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "INSTANCE", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "it", " ", "doe", "sn", "'", "t", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "disable", " ", "the", " ", "instance", " ", "at", " ", "supervisor", " ", "and", " ", "ngin", "x", " ", "level", "s", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", " ", "[", " ", "OK", " ", "]", " ", "Insta", "nce", " ", "{", "0", "}", " ", "disable", "d", ".'_", "._", "format_", "(_", "instance", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "disable", " ", "the", " ", "instance", ".", " ", "Ple", "ase", " ", "check", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "the", " ", "director", "ies", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "As", "kb", "ot", "Instance_", "(_", ")_", ":_", "\\u\\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", "instance_", "(_", "self_", ",_", "instance", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Destr", "oy", "s", " ", "the", " ", "databa", "se", " ", "and", " ", "content", "s", " ", "of", " ", "the", " ", "instance", " ", "complete", "ly", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INSTANCE", "\\u", "DIR_", "=_", "os_", "._", "path_", "._", "join_", "(_", "icc", "_", "._", "DEF", "AUL", "T", "\\u", "INSTANCE", "\\u", "DIR_", ",_", "instance", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "we", " ", "can", " ", "import", " ", "the", " ", "instance", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "INSTANCE", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "instance", "\\u", "settings_", "\\u\\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_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "import", " ", "the", " ", "instance", " ", "settings", " ", "to", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "destroy", " ", "it", ".", " ", "Check", " ", "tha", "t", " ", "it", " ", "exist", "s", ".", " ", "Abo", "rti", "ng", ".'_", ")_", "\\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 ", " _", "instance", "\\u", "db", "\\u", "name_", "=_", "instance", "\\u", "settings_", "._", "DATA", "BASE", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop", "db_", "=_", "subprocess_", "._", "Popen_", "(_", "'", "su", " ", "-", " ", "postgres", " ", "-", "c", " ", "\"", "drop", "db", " ", "%", "s", "\"'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "db", "\\u", "name_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop", "db_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "INSTANCE", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "os_", "._", "path_", "._", "join_", "(_", "'/", "etc", "'_", ",_", "'", "supervisor", "d", ".", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openm", "oo", "c", "-", "ask", "bot", "-%", "s", ".", "conf", "'_", "%_", "instance", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "[", " ", "OK", " ", "]", " ", "Insta", "nce", " ", "{", "0", "}", " ", "destroy", "ed", ".'_", "._", "format_", "(_", "instance", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abort_", "(_", "'", " ", "[", "ERROR", "]", " ", "Cou", "ld", "n", "\\\\'", "t", " ", "drop", " ", "databa", "se", " ", "or", " ", "remove", " ", "instance", " ", "'_", "\\u\\u\\uNL\\u\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\n \"\"\"\n Register the target image into the model space\n\n Affine (or rigid + affine) registration of the target on the mean model image --> pairwise\n\n :param inverse: if True, apply the inverse warping field of the registration target -> model space\n to the result gray matter segmentation of the target\n (put it back in it's original space)\n \"\"\"\n if not inverse:\n # Registration target --> model space\n target_model_space = []\n mean_dic_im = self.model.pca.mean_image\n for i, target_slice in enumerate(self.target):\n moving_target_slice = target_slice.im\n for transfo in self.model.dictionary.coregistration_transfos:\n transfo_name = transfo + '_transfo_target2model_space_slice_' + str(i) + find_ants_transfo_name(transfo)[0]\n\n moving_target_slice = apply_ants_transfo(mean_dic_im, moving_target_slice, binary=False, transfo_type=transfo, transfo_name=transfo_name)\n self.target[i].set(im_m=moving_target_slice)\n # target_model_space.append(moving_target_slice)\n # return Image(param=np.asarray(target_model_space))\n else:\n # Inverse registration result in model space --> target original space\n res_seg = []\n # mean_dic_im = self.model.pca.mean_image\n\n # for i, slice_M in enumerate(self.target_GM_seg_M.data):\n for i, target_slice in enumerate(self.target):\n if self.model.param.seg_type == 'wm':\n moving_seg_slice = target_slice.wm_seg_M\n else:\n moving_seg_slice = target_slice.gm_seg_M\n\n for transfo in self.model.dictionary.coregistration_transfos:\n transfo_name = transfo + '_transfo_target2model_space_slice_' + str(i) + find_ants_transfo_name(transfo)[0]\n moving_seg_slice = apply_ants_transfo(self.model.dictionary.mean_seg, moving_seg_slice, search_reg=False, binary=True, inverse=1, transfo_type=transfo, transfo_name=transfo_name)\n\n if self.model.param.seg_type == 'wm':\n target_slice.set(wm_seg=moving_seg_slice)\n else:\n target_slice.set(gm_seg=moving_seg_slice)\n # res_seg.append(moving_seg_slice)\n # return Image(param=np.asarray(res_seg))", "metadata": "root.TargetSegmentationPairwise.target_pairwise_registration", "header": "['class', 'TargetSegmentationPairwise', ':', '___EOS___']", "index": 1320 } ]
[ { "span": "target_model_space ", "start_line": 1332, "start_column": 12, "end_line": 1332, "end_column": 30 }, { "span": "res_seg ", "start_line": 1345, "start_column": 12, "end_line": 1345, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Target", "Segmentation", "Pair", "wise_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "target", "\\u", "pairwise", "\\u", "registration_", "(_", "self_", ",_", "inverse_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Register", " ", "the", " ", "target", " ", "image", " ", "int", "o", " ", "the", " ", "model", " ", "space", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Affi", "ne", " ", "(", "or", " ", "rigid", " ", "+", " ", "affin", "e", ")", " ", "registration", " ", "of", " ", "the", " ", "target", " ", "on", " ", "the", " ", "mean", " ", "model", " ", "image", " ", "-->", " ", "pairwise", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "inv", "erse", ":", " ", "if", " ", "Tru", "e", ",", " ", "appl", "y", " ", "the", " ", "inv", "erse", " ", "warp", "ing", " ", "field", " ", "of", " ", "the", " ", "registration", " ", "target", " ", "->", " ", "model", " ", "space", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "result", " ", "gray", " ", "matte", "r", " ", "segmentation", " ", "of", " ", "the", " ", "target", "\\", "10", ";", " ", " ", " ", " ", "(", "put", " ", "it", " ", "back", " ", "in", " ", "it", "'", "s", " ", "original", " ", "space", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "inverse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Registration", " ", "target", " ", "-->", " ", "model", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "model", "\\u", "space_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean", "\\u", "dic", "\\u", "im_", "=_", "self_", "._", "model_", "._", "pca_", "._", "mean", "\\u", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "target", "\\u", "slice_", "in_", "enumerate_", "(_", "self_", "._", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "movin", "g", "\\u", "target", "\\u", "slice_", "=_", "target", "\\u", "slice_", "._", "im_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "transf", "o_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "transf", "o", "\\u", "name_", "=_", "transf", "o_", "+_", "'\\u", "transf", "o", "\\u", "target", "2m", "odel", "\\u", "space", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "i_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "movin", "g", "\\u", "target", "\\u", "slice_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "mean", "\\u", "dic", "\\u", "im_", ",_", "movin", "g", "\\u", "target", "\\u", "slice_", ",_", "binary_", "=_", "False_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ",_", "transf", "o", "\\u", "name_", "=_", "transf", "o", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "target_", "[_", "i_", "]_", "._", "set_", "(_", "im", "\\u", "m_", "=_", "movin", "g", "\\u", "target", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "target", "\\u", "model", "\\u", "space", ".", "append", "(", "movin", "g", "\\u", "target", "\\u", "slice", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Image", "(", "param", "=", "np", ".", "asa", "rray", "(", "target", "\\u", "model", "\\u", "space", "))", "_", "\\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_", "#", " ", "Inv", "erse", " ", "registration", " ", "result", " ", "in", " ", "model", " ", "space", " ", "-->", " ", "target", " ", "original", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "seg_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mean", "\\u", "dic", "\\u", "im", " ", "=", " ", "self", ".", "model", ".", "pca", ".", "mean", "\\u", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "i", ",", " ", "slice", "\\u", "M", " ", "in", " ", "enumerate", "(", "self", ".", "target", "\\u", "GM", "\\u", "seg", "\\u", "M", ".", "data", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "target", "\\u", "slice_", "in_", "enumerate_", "(_", "self_", "._", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "model_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "movin", "g", "\\u", "seg", "\\u", "slice_", "=_", "target", "\\u", "slice_", "._", "wm", "\\u", "seg", "\\u", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "movin", "g", "\\u", "seg", "\\u", "slice_", "=_", "target", "\\u", "slice_", "._", "gm", "\\u", "seg", "\\u", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "transf", "o_", "in_", "self_", "._", "model_", "._", "dictionary_", "._", "core", "gist", "ration", "\\u", "transf", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "transf", "o", "\\u", "name_", "=_", "transf", "o_", "+_", "'\\u", "transf", "o", "\\u", "target", "2m", "odel", "\\u", "space", "\\u", "slice", "\\u'_", "+_", "str_", "(_", "i_", ")_", "+_", "find", "\\u", "ant", "s", "\\u", "transf", "o", "\\u", "name_", "(_", "transf", "o_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "movin", "g", "\\u", "seg", "\\u", "slice_", "=_", "appl", "y", "\\u", "ant", "s", "\\u", "transf", "o_", "(_", "self_", "._", "model_", "._", "dictionary_", "._", "mean", "\\u", "seg_", ",_", "movin", "g", "\\u", "seg", "\\u", "slice_", ",_", "search", "\\u", "reg_", "=_", "False_", ",_", "binary_", "=_", "True_", ",_", "inverse_", "=_", "1_", ",_", "transf", "o", "\\u", "type_", "=_", "transf", "o_", ",_", "transf", "o", "\\u", "name_", "=_", "transf", "o", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "model_", "._", "param_", "._", "seg", "\\u", "type_", "==_", "'", "wm", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", "._", "set_", "(_", "wm", "\\u", "seg_", "=_", "movin", "g", "\\u", "seg", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target", "\\u", "slice_", "._", "set_", "(_", "gm", "\\u", "seg_", "=_", "movin", "g", "\\u", "seg", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "res", "\\u", "seg", ".", "append", "(", "movin", "g", "\\u", "seg", "\\u", "slice", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Image", "(", "param", "=", "np", ".", "asa", "rray", "(", "res", "\\u", "seg", "))", "_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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et.gl import *\n\nfrom wydget import element, event, layouts, loadxml, util\nfrom wydget.widgets.frame import Frame, ContainerFrame\nfrom wydget.widgets.slider import VerticalSlider, HorizontalSlider\nfrom wydget.widgets.label import Label\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Table(element.Element):\n name = 'table'\n h_slider = None\n v_slider = None\n\n\n inner_rect = property(get_inner_rect)\n\n", "metadata": "root.Table", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__(self, parent, size=None, is_exclusive=False,\n color=(0, 0, 0, 1), bgcolor=(1, 1, 1, 1),\n alt_bgcolor=(.9, .9, .9, 1), active_bgcolor=(1, .8, .8, 1),\n x=0, y=0, z=0, width='100%', height=None, **kw):\n font_size = parent.getStyle().font_size\n size = util.parse_value(size, None)\n if size is not None:\n height = (size + 1) * font_size\n\n self.is_exclusive = is_exclusive\n\n super(Table, self).__init__(parent, x, y, z, width, height,\n bgcolor=bgcolor, **kw)\n\n # rows go in under the heading\n #self.contents = TableContainer(self)\n self.contents = ContainerFrame(self)\n self.contents.layout = layouts.Layout(self.contents)\n self.contents.checkForScrollbars()\n\n # specific attributes for rows\n self.color = util.parse_color(color)\n self.base_bgcolor = self.bgcolor\n self.alt_bgcolor = util.parse_color(alt_bgcolor)\n self.active_bgcolor = util.parse_color(active_bgcolor)", "metadata": "root.Table.__init__", "header": "['class', 'Table', '(', 'element', '.', 'Element', ')', ':', '___EOS___']", "index": 15 }, { "content": " def get_inner_rect(self):\n p = self.padding\n font_size = self.getStyle().font_size\n return util.Rect(p, p, self.width - p*2, self.height - p*2 - font_size)", "metadata": "root.Table.get_inner_rect", "header": "['class', 'Table', '(', 'element', '.', 'Element', ')', ':', '___EOS___']", "index": 41 }, { "content": " def layoutDimensionsChanged(self, layout):\n pass", "metadata": "root.Table.layoutDimensionsChanged", "header": "['class', 'Table', '(', 'element', '.', 'Element', ')', ':', '___EOS___']", "index": 47 }, { "content": " @classmethod\n def fromXML(cls, element, parent):\n '''Create the object from the XML element and attach it to the parent.\n\n If scrollable then put all children loaded into a container frame.\n '''\n kw = loadxml.parseAttributes(element)\n obj = cls(parent, **kw)\n for child in element.getchildren():\n if child.tag == 'row':\n Row.fromXML(child, obj.contents)\n elif child.tag == 'heading':\n obj.heading = Heading.fromXML(child, obj)\n obj.heading.layout.layout()\n else:\n raise ValueError, 'unexpected tag %r'%child.tag\n obj.contents.layout.layout()\n return obj", "metadata": "root.Table.fromXML", "header": "['class', 'Table', '(', 'element', '.', 'Element', ')', ':', '___EOS___']", "index": 50 }, { "content": "class Heading(Frame):\n name = 'heading'\n", "metadata": "root.Heading", "header": "['module', '___EOS___']", "index": 69 }, { "content": " def __init__(self, parent, width='100%', bgcolor='aaa', **kw):\n kw['y'] = parent.height - parent.getStyle().font_size\n super(Heading, self).__init__(parent, width=width, **kw)\n self.layout = layouts.Horizontal(self, valign='top', halign='fill',\n padding=2)", "metadata": "root.Heading.__init__", "header": "['class', 'Heading', '(', 'Frame', ')', ':', '___EOS___']", "index": 72 }, { "content": "class Row(Frame):\n name = 'row'\n\n", "metadata": "root.Row", "header": "['module', '___EOS___']", "index": 79 }, { "content": " def __init__(self, parent, border=None, color=None, bgcolor=None,\n active_bgcolor=None, is_active=False, width='100%', **kw):\n self.is_active = is_active\n\n # default styling and width to parent settings\n n = len(parent.children)\n table = parent.parent\n if color is None:\n color = table.color\n if bgcolor is None:\n bgcolor = (table.bgcolor, table.alt_bgcolor)[n%2]\n if active_bgcolor is None:\n self.active_bgcolor = table.active_bgcolor\n else:\n self.active_bgcolor = util.parse_color(active_bgcolor)\n\n font_size = parent.getStyle().font_size\n kw['y'] = n * font_size\n kw['height'] = font_size\n super(Row, self).__init__(parent, border=border, bgcolor=bgcolor,\n width=width, **kw)\n self.base_bgcolor = bgcolor", "metadata": "root.Row.__init__", "header": "['class', 'Row', '(', 'Frame', ')', ':', '___EOS___']", "index": 82 }, { "content": " def renderBackground(self, clipped):\n '''Select the correct background color to render.\n '''\n if self.is_active and self.active_bgcolor:\n self.bgcolor = self.active_bgcolor\n else:\n self.bgcolor = self.base_bgcolor\n super(Row, self).renderBackground(clipped)", "metadata": "root.Row.renderBackground", "header": "['class', 'Row', '(', 'Frame', ')', ':', '___EOS___']", "index": 105 }, { "content": "class Cell(Label):\n name = 'cell'\n\n", "metadata": "root.Cell", "header": "['module', '___EOS___']", "index": 116 }, { "content": " def __init__(self, parent, value, type='string', **kw):\n self.value = value\n self.type = type\n self.column = len(parent.children)\n kw['x'] = parent.parent.parent.heading.children[self.column].x\n if type == 'time':\n if value.hour:\n text = '%d:%02d:%02d'%(value.hour, value.minute, value.second)\n else:\n text = '%d:%02d'%(value.minute, value.second)\n else:\n text = str(value)\n super(Cell, self).__init__(parent, text, **kw)", "metadata": "root.Cell.__init__", "header": "['class', 'Cell', '(', 'Label', ')', ':', '___EOS___']", "index": 119 }, { "content": " @classmethod\n def fromXML(cls, element, parent):\n '''Create the object from the XML element and attach it to the parent.\n '''\n kw = loadxml.parseAttributes(element)\n text = xml.sax.saxutils.unescape(element.text)\n\n t = kw.get('type')\n if t == 'integer':\n value = int(text)\n elif t == 'time':\n if ':' in text:\n # (h:)m:s value\n value = map(int, text.split(':'))\n if len(value) == 2: m, s = value[0], value[1]\n else: h, m, s = value[0], value[1], value[2]\n else:\n # seconds value\n value = int(text)\n s = value % 60\n m = (value / 60) % 60\n h = value / 360\n value = datetime.time(h, m, s)\n else:\n value = text\n\n obj = cls(parent, value, **kw)\n\n #for child in element.getchildren():\n # loadxml.getConstructor(element.tag)(child, obj)\n return obj", "metadata": "root.Cell.fromXML", "header": "['class', 'Cell', '(', 'Label', ')', ':', '___EOS___']", "index": 133 } ]
[ { "span": "from wydget import element, event, layouts, loadxml, util", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 57 }, { "span": "from wydget.widgets.slider import VerticalSlider, HorizontalSlider", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 66 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "sax_", "._", "sax", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "._", "gl_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wy", "dget", "_", "import_", "element_", ",_", "event_", ",_", "layouts", "_", ",_", "load", "xml_", ",_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wy", "dget", "_", "._", "widgets_", "._", "frame_", "import_", "Frame_", ",_", "Containe", "r", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wy", "dget", "_", "._", "widgets_", "._", "slider_", "import_", "Vertica", "l", "Slider_", ",_", "Horiz", "onta", "l", "Slider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wy", "dget", "_", "._", "widgets_", "._", "label_", "import_", "Label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Table_", "(_", "element_", "._", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "table", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "slider_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v", "\\u", "slider_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inner", "\\u", "rect_", "=_", "property_", "(_", "get", "\\u", "inner", "\\u", "rect_", ")_", "\\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_", "Table_", "(_", "element_", "._", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ",_", "size_", "=_", "None_", ",_", "is", "\\u", "exclusive_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "bgcolor_", "=_", "(_", "1_", ",_", "1_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alt", "\\u", "bgcolor_", "=_", "(_", ".9_", ",_", ".9_", ",_", ".9_", ",_", "1_", ")_", ",_", "active", "\\u", "bgcolor_", "=_", "(_", "1_", ",_", ".8_", ",_", ".8_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "0_", ",_", "y_", "=_", "0_", ",_", "z_", "=_", "0_", ",_", "width_", "=_", "'", "100", "%'_", ",_", "height_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "\\u", "size_", "=_", "parent_", "._", "get", "Style_", "(_", ")_", "._", "font", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "util_", "._", "parse", "\\u", "value_", "(_", "size_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "height_", "=_", "(_", "size_", "+_", "1_", ")_", "*_", "font", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "is", "\\u", "exclusive_", "=_", "is", "\\u", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Table_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "width_", ",_", "height_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bgcolor_", "=_", "bgcolor_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rows", " ", "go", " ", "in", " ", "under", " ", "the", " ", "heading_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "content", "s", " ", "=", " ", "Table", "Containe", "r", "(", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "contents_", "=_", "Containe", "r", "Frame_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "contents_", "._", "layout_", "=_", "layouts", "_", "._", "Layout_", "(_", "self_", "._", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "contents_", "._", "check", "For", "Scrollba", "rs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "specific", " ", "attribute", "s", " ", "for", " ", "rows_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "color_", "=_", "util_", "._", "parse", "\\u", "color_", "(_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "base", "\\u", "bgcolor_", "=_", "self_", "._", "bgcolor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "alt", "\\u", "bgcolor_", "=_", "util_", "._", "parse", "\\u", "color_", "(_", "alt", "\\u", "bgcolor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "active", "\\u", "bgcolor_", "=_", "util_", "._", "parse", "\\u", "color_", "(_", "active", "\\u", "bgcolor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table_", "(_", "element_", "._", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "inner", "\\u", "rect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "self_", "._", "padding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "font", "\\u", "size_", "=_", "self_", "._", "get", "Style_", "(_", ")_", "._", "font", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "util_", "._", "Rect_", "(_", "p_", ",_", "p_", ",_", "self_", "._", "width_", "-_", "p_", "*_", "2_", ",_", "self_", "._", "height_", "-_", "p_", "*_", "2_", "-_", "font", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table_", "(_", "element_", "._", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "layout", "Dimen", "sion", "s", "Changed_", "(_", "self_", ",_", "layout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table_", "(_", "element_", "._", "Element_", ")_", ":_", "\\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_", "from", "XML_", "(_", "cls_", ",_", "element_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Creat", "e", " ", "the", " ", "object", " ", "from", " ", "the", " ", "XML", " ", "element", " ", "and", " ", "attach", " ", "it", " ", "to", " ", "the", " ", "parent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "scroll", "able", " ", "then", " ", "put", " ", "all", " ", "child", "ren", " ", "load", "ed", " ", "int", "o", " ", "a", " ", "container", " ", "frame", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "=_", "load", "xml_", "._", "parse", "Attributes_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "cls_", "(_", "parent_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "element_", "._", "getch", "ildren_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "child_", "._", "tag_", "==_", "'", "row", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Row_", "._", "from", "XML_", "(_", "child_", ",_", "obj_", "._", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "child_", "._", "tag_", "==_", "'", "heading", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "heading_", "=_", "Head", "ing_", "._", "from", "XML_", "(_", "child_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "heading_", "._", "layout_", "._", "layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "'", "unexpected", " ", "tag", " ", "%", "r", "'_", "%_", "child_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "contents_", "._", "layout_", "._", "layout_", "(_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Head", "ing_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "heading", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Head", "ing_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ",_", "width_", "=_", "'", "100", "%'_", ",_", "bgcolor_", "=_", "'", "aaa", "'_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kw_", "[_", "'", "y", "'_", "]_", "=_", "parent_", "._", "height_", "-_", "parent_", "._", "get", "Style_", "(_", ")_", "._", "font", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Head", "ing_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent_", ",_", "width_", "=_", "width_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "layout_", "=_", "layouts", "_", "._", "Horizontal_", "(_", "self_", ",_", "vali", "gn_", "=_", "'", "top", "'_", ",_", "halign", "_", "=_", "'", "fill", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "padding_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Row_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "row", "'_", "\\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_", "Row_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ",_", "border_", "=_", "None_", ",_", "color_", "=_", "None_", ",_", "bgcolor_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "active", "\\u", "bgcolor_", "=_", "None_", ",_", "is", "\\u", "active_", "=_", "False_", ",_", "width_", "=_", "'", "100", "%'_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "\\u", "active_", "=_", "is", "\\u", "active_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "sty", "ling", " ", "and", " ", "widt", "h", " ", "to", " ", "parent", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "len_", "(_", "parent_", "._", "children_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "parent_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "color_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "table_", "._", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bgcolor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bgcolor_", "=_", "(_", "table_", "._", "bgcolor_", ",_", "table_", "._", "alt", "\\u", "bgcolor_", ")_", "[_", "n_", "%_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "active", "\\u", "bgcolor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "active", "\\u", "bgcolor_", "=_", "table_", "._", "active", "\\u", "bgcolor_", "\\u\\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_", "._", "active", "\\u", "bgcolor_", "=_", "util_", "._", "parse", "\\u", "color_", "(_", "active", "\\u", "bgcolor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "font", "\\u", "size_", "=_", "parent_", "._", "get", "Style_", "(_", ")_", "._", "font", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "y", "'_", "]_", "=_", "n_", "*_", "font", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "height", "'_", "]_", "=_", "font", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Row_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent_", ",_", "border_", "=_", "border_", ",_", "bgcolor_", "=_", "bgcolor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "width_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "base", "\\u", "bgcolor_", "=_", "bgcolor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Row_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "Background_", "(_", "self_", ",_", "clipped", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Select", " ", "the", " ", "correct", " ", "background", " ", "color", " ", "to", " ", "render", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "active_", "and_", "self_", "._", "active", "\\u", "bgcolor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bgcolor_", "=_", "self_", "._", "active", "\\u", "bgcolor_", "\\u\\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_", "._", "bgcolor_", "=_", "self_", "._", "base", "\\u", "bgcolor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Row_", ",_", "self_", ")_", "._", "render", "Background_", "(_", "clipped", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Cell_", "(_", "Label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "cell", "'_", "\\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_", "Cell_", "(_", "Label_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ",_", "value_", ",_", "type_", "=_", "'", "string", "'_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "type_", "=_", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "column_", "=_", "len_", "(_", "parent_", "._", "children_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "x", "'_", "]_", "=_", "parent_", "._", "parent_", "._", "parent_", "._", "heading_", "._", "children_", "[_", "self_", "._", "column_", "]_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "==_", "'", "time", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "hour_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "'%", "d", ":", "%", "02", "d", ":", "%", "02", "d", "'_", "%_", "(_", "value_", "._", "hour_", ",_", "value_", "._", "minute_", ",_", "value_", "._", "second_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "'%", "d", ":", "%", "02", "d", "'_", "%_", "(_", "value_", "._", "minute_", ",_", "value_", "._", "second_", ")_", "\\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 ", " _", "text_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Cell_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "parent_", ",_", "text_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cell_", "(_", "Label_", ")_", ":_", "\\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_", "from", "XML_", "(_", "cls_", ",_", "element_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Creat", "e", " ", "the", " ", "object", " ", "from", " ", "the", " ", "XML", " ", "element", " ", "and", " ", "attach", " ", "it", " ", "to", " ", "the", " ", "parent", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "=_", "load", "xml_", "._", "parse", "Attributes_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "xml_", "._", "sax_", "._", "sax", "utils_", "._", "unescape_", "(_", "element_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "kw_", "._", "get_", "(_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", "==_", "'", "integ", "er", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "int_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "==_", "'", "time", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "':'_", "in_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "h", ":)", "m", ":", "s", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "map_", "(_", "int_", ",_", "text_", "._", "split_", "(_", "':'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "==_", "2_", ":_", "m_", ",_", "s_", "=_", "value_", "[_", "0_", "]_", ",_", "value_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "h_", ",_", "m_", ",_", "s_", "=_", "value_", "[_", "0_", "]_", ",_", "value_", "[_", "1_", "]_", ",_", "value_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "second", "s", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "int_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "value_", "%_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "(_", "value_", "/_", "60_", ")_", "%_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "value_", "/_", "360_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "datetime_", "._", "time_", "(_", "h_", ",_", "m_", ",_", "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 ", " _", "value_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "=_", "cls_", "(_", "parent_", ",_", "value_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "child", " ", "in", " ", "element", ".", "getch", "ild", "ren", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "load", "xml", ".", "get", "Constructor", "(", "element", ".", "tag", ")(", "child", ",", " ", "obj", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "obj_" ]
[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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 ]
Unused import
VisTrails/VisTrails/contrib/sahm/init.py
[ { "content": "#test from marian\nimport csv\nfrom datetime import datetime\nimport glob\nimport itertools\nimport os\nimport shutil\nimport sys\nimport subprocess\nimport traceback\n\nfrom core.modules.vistrails_module import Module, ModuleError, ModuleConnector\nfrom core.modules.basic_modules import File, Directory, Path, new_constant, Constant\nfrom packages.spreadsheet.basic_widgets import SpreadsheetCell, CellLocation\nfrom packages.spreadsheet.spreadsheet_cell import QCellWidget, QCellToolBar\n#from packages.persistence.init import PersistentPath, PersistentFile, PersistentDir\n\nfrom core.modules.basic_modules import List\nfrom core.modules.basic_modules import String\n\nfrom PyQt4 import QtCore, QtGui\n\nfrom widgets import get_predictor_widget, get_predictor_config\nfrom enum_widget import build_enum_widget\n\nfrom SelectPredictorsLayers import SelectListDialog\n\nimport utils\n#import our python SAHM Processing files\nimport packages.sahm.pySAHM.FieldDataQuery as FDQ\nimport packages.sahm.pySAHM.MDSBuilder as MDSB\nimport packages.sahm.pySAHM.PARC as parc\nimport packages.sahm.pySAHM.RasterFormatConverter as RFC\nimport packages.sahm.pySAHM.MaxentRunner as MaxentRunner\nfrom SahmOutputViewer import SAHMModelOutputViewerCell\nfrom SahmSpatialOutputViewer import SAHMSpatialOutputViewerCell \n\nfrom utils import writetolog\nfrom pySAHM.utilities import TrappedError\n\nfrom SahmSpatialOutputViewer import setQGIS\n\nidentifier = 'gov.usgs.sahm' \n\n\n\n\n\n\n \n \n \n\n\n \n\n \n# def compute(self):\n# output_file = create_file_module(self.force_get_input('FilePath', []))\n# self.set_output('value', output_file)\n\n#class SingleInputPredictor(Predictor):\n# pass\n#\n#class SpatialDef(Module):\n# _output_ports = [('spatialDef', '(gov.usgs.sahm:SpatialDef:DataInput)')]\n\n \n# def compute(self, is_input=None):\n# PersistentPath.compute(self, is_input, 'blob')\n\n \n \n\n\n\n \n\n\n \n\n \n \n\n\n\n#class ClimateModel(String):\n# _input_ports = [('value', '(gov.usgs.sahm:ClimateModel:Other)')]\n# _output_ports = [('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]\n# _widget_class = build_enum_widget('ClimateModel', \n# ['CCCMA', 'CSIRO', 'hadcm3'])\n#\n# @staticmethod\n# def get_widget_class():\n# return ClimateModel._widget_class\n#\n#class ClimateScenario(String):\n# _input_ports = [('value', '(gov.usgs.sahm:ClimateScenario:Other)')]\n# _output_ports = [('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]\n# _widget_class = build_enum_widget('ClimateScenario', \n# ['A2a', 'B2b'])\n#\n# @staticmethod\n# def get_widget_class():\n# return ClimateScenario._widget_class\n#\n#class ClimateYear(String):\n# _input_ports = [('value', '(gov.usgs.sahm:ClimateYear:Other)')]\n# _output_ports = [('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]\n# _widget_class = build_enum_widget('ClimateYear', \n# ['2020', '2050', '2080'])\n#\n# @staticmethod\n# def get_widget_class():\n# return ClimateYear._widget_class\n\n \n\n\n#class ModelOutputCell(SpreadsheetCell):\n# _input_ports = [(\"row\", \"(edu.utah.sci.vistrails.basic:Integer)\"),\n# (\"column\", \"(edu.utah.sci.vistrails.basic:Integer)\"),\n# ('ProbabilityMap', '(edu.utah.sci.vistrails.basic:File)')]\n# \n# def __init__(self):\n# SpreadsheetCell.__init__(self)\n# self.cellWidget = None\n#\n# def compute(self):\n# renderView = self.force_get_input('SetRenderView')\n# if renderView==None:\n# raise ModuleError(self, 'A vtkRenderView input is required.')\n# self.cellWidget = self.displayAndWait(QVTKViewWidget, (renderView,))\n\n#class SAHMViewWidget(QCellWidget):\n# def __init__(self, parent=None, f=QtCore.Qt.WindowFlags()):\n# QCellWidget.__init__(self, parent, f | QtCore.Qt.MSWindowsOwnDC)\n# \n\n#class RasterLayer(Module):\n# _input_ports = [('file', '(edu.utah.sci.vistrails.basic:File)'), \n# ('name', '(edu.utah.sci.vistrails.basic:String)')]\n# _output_ports = [('self', '(gov.usgs.sahm:RasterLayer:DataInput)')]\n#\n# def __init__(self):\n# Module.__init__(self)\n# self.qgis_obj = None\n#\n# def compute(self):\n# fname = self.get_input('file').name\n# if self.has_input('name'):\n# name = self.get_input('name')\n# else:\n# name = os.path.splitext(os.path.basename(fname))[0]\n# self.qgis_obj = qgis.core.QgsRasterLayer(fname, name)\n# self.set_output('self', self)\n#\n#class VectorLayer(Module):\n# _input_ports = [('file', '(edu.utah.sci.vistrails.basic:File)'), \n# ('name', '(edu.utah.sci.vistrails.basic:String)')]\n# _output_ports = [('self', '(gov.usgs.sahm:VectorLayer:DataInput)')]\n#\n# def __init__(self):\n# Module.__init__(self)\n# self.qgis_obj = None\n#\n# def compute(self):\n# fname = self.get_input('file').name\n# if self.has_input('name'):\n# name = self.get_input('name')\n# else:\n# name = os.path.splitext(os.path.basename(fname))[0]\n# self.qgis_obj = qgis.core.QgsVectorLayer(fname, name, \"ogr\")\n# self.set_output('self', self)\n\n\n\n \n\n\n\n\n\n \n\n_modules = generate_namespaces({'DataInput': [\n Predictor,\n PredictorListFile,\n FieldData,\n TemplateLayer] + \\\n build_predictor_modules(),\n 'Tools': [FieldDataAggregateAndWeight,\n MDSBuilder,\n PARC,\n RasterFormatConverter,\n ProjectionLayers,\n TestTrainingSplit,\n CovariateCorrelationAndSelection,\n ApplyModel], \n 'Models': [GLM,\n RandomForest,\n MARS,\n MAXENT,\n BoostedRegressionTree],\n 'Other': [(Model, {'abstract': True}),\n (ResampleMethod, {'abstract': True}),\n (AggregationMethod, {'abstract': True}),\n (PredictorList, {'abstract': True}),\n (MergedDataSet, {'abstract': True}),\n (RastersWithPARCInfoCSV, {'abstract': True})],\n 'Output': [SAHMModelOutputViewerCell,\n SAHMSpatialOutputViewerCell,\n ]\n# ClimateModel,\n# ClimateScenario,\n# ClimateYear\n\n })", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def menu_items():\n \"\"\" Add a menu item which allows users to specify their session directory\n \"\"\"\n def change_session_folder():\n global session_dir\n \n path = str(QtGui.QFileDialog.getExistingDirectory(None,\n 'Browse to new session folder -'))\n session_dir = path\n utils.setrootdir(path)\n \n writetolog(\"*\" * 79 + \"\\n\" + \"*\" * 79)\n writetolog(\" output directory: \" + session_dir)\n writetolog(\"*\" * 79 + \"\\n\" + \"*\" * 79)\n \n lst = []\n lst.append((\"Change session folder\", change_session_folder))\n return(lst)", "metadata": "root.menu_items", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def expand_ports(port_list):\n new_port_list = []\n for port in port_list:\n port_spec = port[1]\n if type(port_spec) == str: # or unicode...\n if port_spec.startswith('('):\n port_spec = port_spec[1:]\n if port_spec.endswith(')'):\n port_spec = port_spec[:-1]\n new_spec_list = []\n for spec in port_spec.split(','):\n spec = spec.strip()\n parts = spec.split(':', 1)\n# print 'parts:', parts\n namespace = None\n if len(parts) > 1:\n mod_parts = parts[1].rsplit('|', 1)\n if len(mod_parts) > 1:\n namespace, module_name = mod_parts\n else:\n module_name = parts[1]\n if len(parts[0].split('.')) == 1:\n id_str = 'edu.utah.sci.vistrails.' + parts[0]\n else:\n id_str = parts[0]\n else:\n mod_parts = spec.rsplit('|', 1)\n if len(mod_parts) > 1:\n namespace, module_name = mod_parts\n else:\n module_name = spec\n id_str = identifier\n if namespace:\n new_spec_list.append(id_str + ':' + module_name + ':' + \\\n namespace)\n else:\n new_spec_list.append(id_str + ':' + module_name)\n port_spec = '(' + ','.join(new_spec_list) + ')'\n new_port_list.append((port[0], port_spec) + port[2:])\n# print new_port_list\n return new_port_list", "metadata": "root.expand_ports", "header": "['module', '___EOS___']", "index": 66 }, { "content": "class FieldData(Path): \n '''\n Field Data\n\n The FieldData module allows a user to add presence/absence points or count data recorded across a\n landscape for the phenomenon being modeled (e.g., plant sightings, evidence of animal presence, etc.).\n The input data for this module must be in the form of a .csv file that follows one of two formats: \n\n Format 1\n A .csv file with the following column headings, in order: \"X,\" \"Y,\" and \"responseBinary\".\n In this case, the \"X\" field should be populated with the horizontal (longitudinal) positional\n data for a sample point. The \"Y\" field should be populated with the vertical (latitudinal) data\n for a sample point. These values must be in the same coordinate system/units as the template\n layer used in the workflow. The column \"responseBinary\" should be populated with either a '0'\n (indicating absence at the point) or a '1' (indicating presence at the point).\n\n Format 2\n A .csv file with the following column headings, in order: \"X,\" \"Y,\" and \"responseCount\".\n In this case, the \"X\" field should be populated with the horizontal (longitudinal) positional\n data for a sample point. The \"Y\" field should be populated with the vertical (latitudinal) data\n for a sample point. These values must be in the same coordinate system/units as the template\n layer used in the workflow. The column \"responseCount\" should be populated with either a '-9999'\n (indicating that the point is a background point) or a numerical value (either '0' or a positive integer)\n indicating the number of incidences of the phenomenon recorded at that point.\n ''' \n# _input_ports = [('csvFile', '(edu.utah.sci.vistrails.basic:File)')]\n _output_ports = [('value', '(gov.usgs.sahm:FieldData:DataInput)'),\n ('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]", "metadata": "root.FieldData", "header": "['module', '___EOS___']", "index": 108 }, { "content": "class AggregationMethod(String):\n '''\n This module is a required class for other modules and scripts within the\n SAHM package. It is not intended for direct use or incorporation into\n the VisTrails workflow by the user.\n '''\n _input_ports = [('value', '(gov.usgs.sahm:AggregationMethod:Other)')]\n _output_ports = [('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]\n _widget_class = build_enum_widget('AggregationMethod', \n ['Mean', 'Max', 'Min', 'Majority', 'None'])\n", "metadata": "root.AggregationMethod", "header": "['module', '___EOS___']", "index": 139 }, { "content": " @staticmethod\n def get_widget_class():\n return AggregationMethod._widget_class", "metadata": "root.AggregationMethod.get_widget_class", "header": "['class', 'AggregationMethod', '(', 'String', ')', ':', '___EOS___']", "index": 150 }, { "content": "class ResampleMethod(String):\n '''\n This module is a required class for other modules and scripts within the\n SAHM package. It is not intended for direct use or incorporation into\n the VisTrails workflow by the user.\n '''\n _input_ports = [('value', '(gov.usgs.sahm:ResampleMethod:Other)')]\n _output_ports = [('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]\n _widget_class = build_enum_widget('ResampleMethod', \n ['NearestNeighbor', 'Bilinear', 'Cubic', 'CubicSpline', 'Lanczos'])\n", "metadata": "root.ResampleMethod", "header": "['module', '___EOS___']", "index": 154 }, { "content": " @staticmethod\n def get_widget_class():\n return ResampleMethod._widget_class", "metadata": "root.ResampleMethod.get_widget_class", "header": "['class', 'ResampleMethod', '(', 'String', ')', ':', '___EOS___']", "index": 165 }, { "content": "class Predictor(Constant):\n '''\n Predictor\n \n The Predictor module allows a user to select a single raster layer for consideration in the\n modeled analysis. Four parameters must be specified by the user:\n \n 1. Aggregation Method: The aggregation method to be used in the event that the raster layer\n must be up-scaled to match the template layer (e.g., generalizing a 10 m input layer to a\n 100 m output layer). Care should be taken to ensure that the aggregation method that\n best preserves the integrity of the data is used.\n \n 2. Resample Method: The resample method employed to interpolate new cell values when\n transforming the raster layer to the coordinate space or cell size of the template layer,\n if necessary. \n \n 3. Categorical (Boolean): Checking this box indicates that the data contained in the raster\n layer is categorical (e.g. landcover categories). Leaving this box unchecked indicates that\n the data contained in the raster is continuous (e.g., a DEM layer). This distinction is important\n in determining an appropriate resampling method.\n \n 4. File Path: The location of the raster predictor file, which a user can specify by navigating to the\n file's location on their file system. When a user is selecting an ESRI grid raster, the user should navigate\n to the 'hdr.adf' file contained within the grid folder.\n\n '''\n _input_ports = [('categorical', '(edu.utah.sci.vistrails.basic:Boolean)'),\n ('ResampleMethod', '(gov.usgs.sahm:ResampleMethod:Other)', {'defaults':str(['Bilinear'])}),\n ('AggregationMethod', '(gov.usgs.sahm:AggregationMethod:Other)', {'defaults':str(['Mean'])}),\n ('file', '(edu.utah.sci.vistrails.basic:Path)')]\n _output_ports = [('value', '(gov.usgs.sahm:Predictor:DataInput)'),\n ('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]\n", "metadata": "root.Predictor", "header": "['module', '___EOS___']", "index": 169 }, { "content": " def compute(self):\n if (self.has_input(\"ResampleMethod\")):\n resampleMethod = self.get_input(\"ResampleMethod\")\n if resampleMethod.lower() not in ['nearestneighbor', 'bilinear', 'cubic', 'cubicspline', 'lanczos']:\n raise ModuleError(self, \n \"Resample Method not one of 'nearestneighbor', 'bilinear', 'cubic', 'cubicspline', or 'lanczos'\")\n else:\n resampleMethod = 'Bilinear'\n \n if (self.has_input(\"AggregationMethod\")):\n aggregationMethod = self.get_input(\"AggregationMethod\")\n if self.get_input(\"AggregationMethod\").lower() not in ['mean', 'max', 'min', 'majority', 'none']:\n raise ModuleError(self, \"No Aggregation Method specified\")\n else:\n aggregationMethod = \"Mean\"\n \n if (self.has_input(\"categorical\")):\n if self.get_input(\"categorical\") == True:\n categorical = '1'\n else:\n categorical = '0'\n else:\n categorical = '0'\n \n if (self.has_input(\"file\")):\n inFile = utils.getRasterName(self.get_input(\"file\").name)\n else:\n raise ModuleError(self, \"No input file specified\")\n self.set_output('value', (inFile, categorical, resampleMethod, aggregationMethod))", "metadata": "root.Predictor.compute", "header": "['class', 'Predictor', '(', 'Constant', ')', ':', '___EOS___']", "index": 202 }, { "content": "class PredictorList(Constant):\n '''\n This module is a required class for other modules and scripts within the\n SAHM package. It is not intended for direct use or incorporation into\n the VisTrails workflow by the user.\n '''\n _input_ports = expand_ports([('value', 'Other|PredictorList'),\n ('addPredictor', 'DataInput|Predictor')])\n _output_ports = expand_ports([('value', 'Other|PredictorList')])\n \n\n\n", "metadata": "root.PredictorList", "header": "['module', '___EOS___']", "index": 232 }, { "content": " @staticmethod\n def translate_to_string(v):\n return str(v)", "metadata": "root.PredictorList.translate_to_string", "header": "['class', 'PredictorList', '(', 'Constant', ')', ':', '___EOS___']", "index": 242 }, { "content": " @staticmethod\n def translate_to_python(v):\n v_list = eval(v)\n return v_list", "metadata": "root.PredictorList.translate_to_python", "header": "['class', 'PredictorList', '(', 'Constant', ')', ':', '___EOS___']", "index": 246 }, { "content": " @staticmethod\n def validate(x):\n return type(x) == list", "metadata": "root.PredictorList.validate", "header": "['class', 'PredictorList', '(', 'Constant', ')', ':', '___EOS___']", "index": 251 }, { "content": " def compute(self):\n p_list = self.force_get_input_list(\"addPredictor\")\n v = self.force_get_input(\"value\", [])\n \n b = self.validate(v)\n if not b:\n raise ModuleError(self, \"Internal Error: Constant failed validation\")\n if len(v) > 0 and type(v[0]) == tuple:\n f_list = [utils.create_file_module(v_elt[1]) for v_elt in v]\n else:\n f_list = v\n p_list += f_list\n #self.set_output(\"value\", p_list)\n self.set_output(\"value\", v) ", "metadata": "root.PredictorList.compute", "header": "['class', 'PredictorList', '(', 'Constant', ')', ':', '___EOS___']", "index": 255 }, { "content": "class PredictorListFile(Module):\n '''\n Predictor List File\n\n The PredictorListFile module allows a user to load a .csv file containing a list\n of rasters for consideration in the modeled analysis. The .csv file should contain\n a header row and four columns containing the following information, in order, for\n each raster input. \n \n Column 1: The full file path to the input raster layer.\n \n Column 2: A binary value indicating whether the input layer is categorical or not.\n A value of \"0\" indicates that an input raster is non-categorical data (continuous),\n while a value of \"1\" indicates that an input raster is categorical data.\n \n Column 3: The resampling method employed to interpolate new cell values when\n transforming the raster layer to the coordinate space or cell size of the template\n layer, if necessary. The resampling type should be specified using one of the following\n values: \"nearestneighbor,\" \"bilinear,\" \"cubic,\" or \"lanczos.\"\n \n Column 4: The aggregation method to be used in the event that the raster layer\n must be up-scaled to match the template layer (e.g., generalizing a 10 m input layer to a\n 100 m output layer). Care should be taken to ensure that the aggregation method that\n best preserves the integrity of the data is used. The aggregation should be specified\n using one of the following values: \"Min,\" \"Mean,\" \"Max,\" \"Majority,\" or \"None.\"\n\n In formatting the list of predictor files, the titles assigned to each of the columns\n are unimportant as the module retrieves the information based on the order of the\n values in the .csv file (the ordering of the information and the permissible values\n in the file however, are strictly enforced). The module also anticipates a header row\n and will ignore the first row in the .csv file.\n\n '''\n _input_ports = expand_ports([('csvFileList', '(edu.utah.sci.vistrails.basic:File)'),\n ('addPredictor', 'DataInput|Predictor')])\n _output_ports = expand_ports([('RastersWithPARCInfoCSV', '(gov.usgs.sahm:RastersWithPARCInfoCSV:Other)')])\n\n #copies the input predictor list csv to our working directory\n #and appends any additionally added predictors\n\n\n\n", "metadata": "root.PredictorListFile", "header": "['module', '___EOS___']", "index": 270 }, { "content": " @staticmethod\n def translate_to_string(v):\n return str(v)", "metadata": "root.PredictorListFile.translate_to_string", "header": "['class', 'PredictorListFile', '(', 'Module', ')', ':', '___EOS___']", "index": 310 }, { "content": " @staticmethod\n def translate_to_python(v):\n v_list = eval(v)\n return v_list", "metadata": "root.PredictorListFile.translate_to_python", "header": "['class', 'PredictorListFile', '(', 'Module', ')', ':', '___EOS___']", "index": 314 }, { "content": " @staticmethod\n def validate(x):\n return type(x) == list", "metadata": "root.PredictorListFile.validate", "header": "['class', 'PredictorListFile', '(', 'Module', ')', ':', '___EOS___']", "index": 319 }, { "content": " def compute(self):\n if not (self.has_input(\"csvFileList\") or\n self.has_input(\"addPredictor\")):\n raise ModuleError(self, \"No inputs or CSV file provided\")\n\n output_fname = utils.mknextfile(prefix='PredictorList_', suffix='.csv')\n if (self.has_input(\"csvFileList\") and \n os.path.exists(self.get_input(\"csvFileList\").name)):\n shutil.copy(self.get_input(\"csvFileList\").name, \n output_fname)\n csv_writer = csv.writer(open(output_fname, 'ab'))\n else:\n #create an empty file to start with.\n csv_writer = csv.writer(open(output_fname, 'wb'))\n csv_writer.writerow([\"file\", \"Resampling\", \"Aggregation\"])\n \n if self.has_input(\"addPredictor\"):\n p_list = self.force_get_input_list(\"addPredictor\")\n for p in p_list:\n if p.has_input('resampleMethod'):\n resMethod = p.get_input('resampleMethod')\n else:\n resMethod = \"NearestNeighbor\"\n if p.has_input('aggregationMethod'):\n aggMethod = p.get_input('aggregationMethod')\n else:\n aggMethod = \"Mean\" \n csv_writer.writerow([os.path.normpath(p.name), resMethod, aggMethod])\n\n del csv_writer\n \n output_file = utils.create_file_module(output_fname)\n self.set_output('RastersWithPARCInfoCSV', output_file)", "metadata": "root.PredictorListFile.compute", "header": "['class', 'PredictorListFile', '(', 'Module', ')', ':', '___EOS___']", "index": 323 }, { "content": "class TemplateLayer(Path):\n '''\n Template Layer\n\n The TemplateLayer is a raster data layer with a defined coordinate system, a known cell size,\n and an extent that defines the study area. This raster layer serves as the template for all\n the other inputs in the analysis. All additional raster layers used in the analysis will be\n resampled and reprojected as needed to match the template, snapped to the template, and\n clipped to have an extent that matches the template. Users should ensure that any additional\n layers considered in the analysis have coverage within the extent of the template layer.\n\n The TemplateLayer is a required input for the PARC module.\n\n '''\n# _input_ports = [('FilePath', '(edu.utah.sci.vistrails.basic:File)')]\n _output_ports = [('value', '(gov.usgs.sahm:TemplateLayer:DataInput)'),\n ('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True)]", "metadata": "root.TemplateLayer", "header": "['module', '___EOS___']", "index": 357 }, { "content": "class MergedDataSet(File):\n '''\n This module is a required class for other modules and scripts within the\n SAHM package. It is not intended for direct use or incorporation into\n the VisTrails workflow by the user.\n '''\n _input_ports = expand_ports([('mdsFile', '(edu.utah.sci.vistrails.basic:File)')])\n _output_ports = expand_ports([('value', '(gov.usgs.sahm:MergedDataSet:Other)')])\n \n pass", "metadata": "root.MergedDataSet", "header": "['module', '___EOS___']", "index": 384 }, { "content": "class RastersWithPARCInfoCSV(File):\n '''\n This module is a required class for other modules and scripts within the\n SAHM package. It is not intended for direct use or incorporation into\n the VisTrails workflow by the user.\n '''\n _input_ports = expand_ports([('mdsFile', '(edu.utah.sci.vistrails.basic:File)')])\n _output_ports = expand_ports([('value', '(gov.usgs.sahm:MergedDataSet:Other)')])\n \n pass", "metadata": "root.RastersWithPARCInfoCSV", "header": "['module', '___EOS___']", "index": 395 }, { "content": "class ApplyModel(Module):\n '''\n Apply Model\n\n The ApplyModel module allows the user to apply a model developed using a\n particular package within the workflow and generate output probability and binary\n maps. The process of creating an output probability map and binary map based on\n a particular model can be time-consuming, depending on the input data. By\n existing as a stand-alone process in the workflow, the ApplyModel module allows\n a user to investigate the performance metrics for a particular model (such as\n the ROC curve or the AUC) before dedicating the processing time needed to generate\n the output maps. In most cases, a user will \"fine tune\" a model by exploring the\n performance metrics of different model iterations before applying the model and\n generating the actual maps as a final step.\n \n The ApplyModel module also provides the user with the option of projecting the results\n of a model developed from one set of environmental predictors onto a new modeled space\n containing that same set of environmental predictors but representing data captured at\n a different temporal or spatial location. For example, a user could generate a model\n predicting habitat suitability using recorded presence points and certain environmental\n predictors such as elevation, landcover, and proximity to water in one geographic\n location. Based on the training from this information, the modeled results could be\n generated for (or \"projected to\") a new location based on the range of values seen in\n elevation, landcover, and proximity to water in the second geographic area. Similarly,\n modeling predicted results through time is also possible. A model trained using field\n data and a set of predictor layers representative of one time period could be projected\n onto the same geographical area using a new set of layers corresponding to the same\n predictors but representing data from a different time period (e.g., different climate\n data).\n\n The ApplyModel module accepts two inputs from the user:\n\n 1. Model Workspace: The model workspace field accepts as an input a modeling\n package element (complete with all required parameters) from upstream in the workflow.\n The inputs and specifications provided in the dialogue fields of the model will be applied\n and used to generate the output maps. A user should populate the model workspace field by\n connecting a model element to the appropriate input port of the ApplyModel module in the\n visual display of the model workflow.\n \n 2. Projection Target: The projection target is an optional parameter that allows a user to\n apply a model to a particular geographic area and or set of predictors (other than those\n used to train the model) and create output maps within the spatial extent of the projection\n target layers. This input field should be populated by connecting either the output of the\n ProjectionLayers module or a separate MDSBuilder element to the appropriate input port of\n the ApplyModel module.\n \n '''\n \n _input_ports = [('projectionTarget', '(gov.usgs.sahm:MergedDataSet:Other)'),\n ('modelWorkspace', '(edu.utah.sci.vistrails.basic:File)'),\n ('makeBinMap', '(edu.utah.sci.vistrails.basic:Boolean)'),\n ('makeProbabilityMap', '(edu.utah.sci.vistrails.basic:Boolean)'),]\n _output_ports = [('BinaryMap', '(edu.utah.sci.vistrails.basic:File)'), \n ('ProbabilityMap', '(edu.utah.sci.vistrails.basic:File)')]\n \n \n ", "metadata": "root.ApplyModel", "header": "['module', '___EOS___']", "index": 408 }, { "content": " def compute(self):\n \n workspace = self.force_get_input('modelWorkspace').name\n output_dname = utils.mknextdir(prefix='AppliedModel_')\n if self.has_input('projectionTarget'):\n mdsFile = self.force_get_input('projectionTarget').name\n args = \"ws=\" + '\"' + workspace + '\"' + \" c=\" + '\"' + mdsFile + '\"' + \" o=\" + '\"' + output_dname + '\"'\n else:\n args = \"ws=\" + '\"' + workspace + '\"' + \" o=\" + '\"' + output_dname + '\"'\n \n if self.has_input('makeBinMap'):\n makeBinMap = self.force_get_input('makeBinMap')\n args += ' mbt=' + str(makeBinMap).upper()\n else:\n args += ' mbt=TRUE'\n \n if self.has_input('makeProbabilityMap'):\n makeProbabilityMap = self.force_get_input('makeProbabilityMap')\n args += ' mpt=' + str(makeProbabilityMap).upper()\n else:\n args += ' mpt=TRUE'\n \n \n utils.runRScript('PredictModel.r', args, self)\n \n input_fname = os.path.join(output_dname, \"prob_map.tif\")\n output_fname = os.path.join(output_dname, 'prob_map.jpeg')\n if os.path.exists(input_fname):\n utils.tif_to_color_jpeg(input_fname, output_fname, color_breaks_csv)\n output_file1 = utils.create_file_module(output_fname)\n self.set_output('ProbabilityMap', output_file1)\n else:\n msg = \"Expected output from ApplyModel was not found.\"\n msg += \"\\nThis likely indicates problems with the inputs to the R module.\"\n writetolog(msg, False, True)\n raise ModuleError(self, msg)\n \n if os.path.exists(os.path.join(output_dname, \"bin_map.tif\")):\n outFileName = os.path.join(output_dname, \"bin_map.tif\")\n output_file2 = utils.create_file_module(outFileName)\n self.set_output('BinaryMap', output_file2)", "metadata": "root.ApplyModel.compute", "header": "['class', 'ApplyModel', '(', 'Module', ')', ':', '___EOS___']", "index": 465 }, { "content": "class Model(Module):\n '''\n This module is a required class for other modules and scripts within the\n SAHM package. It is not intended for direct use or incorporation into\n the VisTrails workflow by the user.\n '''\n _input_ports = [('mdsFile', '(gov.usgs.sahm:MergedDataSet:Other)'),\n ('makeBinMap', '(edu.utah.sci.vistrails.basic:Boolean)', {'defaults':str(['True']), 'optional':False}),\n ('makeProbabilityMap', '(edu.utah.sci.vistrails.basic:Boolean)', {'defaults':str(['True']), 'optional':False}),\n ('makeMESMap', '(edu.utah.sci.vistrails.basic:Boolean)', {'defaults':str(['False']), 'optional':False}),\n ('ThresholdOptimizationMethod', '(edu.utah.sci.vistrails.basic:Integer)', {'defaults':str(['2']), 'optional':False})\n ]\n _output_ports = [('modelWorkspace', '(edu.utah.sci.vistrails.basic:File)'), \n ('BinaryMap', '(edu.utah.sci.vistrails.basic:File)'), \n ('ProbabilityMap', '(edu.utah.sci.vistrails.basic:File)'),\n ('AUC_plot', '(edu.utah.sci.vistrails.basic:File)'),\n ('ResponseCurves', '(edu.utah.sci.vistrails.basic:File)'),\n ('Text_Output', '(edu.utah.sci.vistrails.basic:File)')]\n", "metadata": "root.Model", "header": "['module', '___EOS___']", "index": 507 }, { "content": " def compute(self):\n global color_breaks_csv\n \n ModelOutput = {\"FIT_BRT_pluggable.r\":\"brt\",\n \"FIT_GLM_pluggable.r\":\"glm\",\n \"FIT_RF_pluggable.r\":\"rf\",\n \"FIT_MARS_pluggable.r\":\"mars\"}\n ModelAbbrev = ModelOutput[self.name]\n \n output_dname = utils.mknextdir(prefix=ModelAbbrev + 'output_')\n argsDict = utils.map_ports(self, self.port_map)\n mdsFile = self.force_get_input('mdsFile').name\n \n args = ''\n for k, v in argsDict.iteritems():\n if k == 'c':\n args += ' ' + '='.join([str(k),'\"' + str(v) + '\"'])\n else:\n args += ' ' + '='.join([str(k),str(v)])\n args += \" o=\" + '\"' + output_dname + '\"'\n args += \" rc=\" + utils.MDSresponseCol(mdsFile)\n# if self.has_input('makeBinMap'):\n# makeBinMap = self.force_get_input('makeBinMap')\n# args += ' mbt=' + str(makeBinMap).upper()\n# else:\n# makeBinMap = True\n# args += ' mbt=TRUE'\n# \n# if self.has_input('makeProbabilityMap'):\n# makeProbabilityMap = self.force_get_input('makeProbabilityMap')\n# args += ' mpt=' + str(makeProbabilityMap).upper()\n# else:\n# makeProbabilityMap = True\n# args += ' mpt=TRUE' \n# \n# if self.has_input('seed'):\n# args += ' seed=' + str(self.force_get_input('seed'))\n# \n# if self.has_input('someParam'):\n# x = self.force_get_input('someParam')\n# if x > 1:\n# msg = \"Expected output from \" + ModelAbbrev + \" was not found.\"\n# msg += \"\\nThis likely indicates problems with the inputs to the R module.\"\n# writetolog(msg, False, True)\n# args += \" abr=\" + x\n \n utils.runRScript(self.name, args, self)\n# utils.runRScript('FIT_BRT_pluggableErrorMessage.r', args, self)\n \n input_fname = os.path.join(output_dname, ModelAbbrev + \"_prob_map.tif\")\n output_fname = os.path.join(output_dname, ModelAbbrev + \"_prob_map.jpeg\")\n if os.path.exists(input_fname):\n# utils.tif_to_color_jpeg(input_fname, output_fname, color_breaks_csv)\n# output_file4 = utils.create_file_module(output_fname)\n self.set_output('ProbabilityMap', input_fname)\n elif (argsDict.has_key('mpt') and argsDict['mpt'] == True) or \\\n not argsDict.has_key('mpt'):\n msg = \"Expected output from \" + ModelAbbrev + \" was not found.\"\n msg += \"\\nThis might indicate problems with the inputs to the R module.\"\n msg += \"\\nCheck the console output for additional R warnings \"\n writetolog(msg, False, True)\n raise ModuleError(self, msg)\n \n if (argsDict.has_key('mbt') and argsDict['mbt'] == True) or \\\n not argsDict.has_key('mbt'):\n outFileName = os.path.join(output_dname, ModelAbbrev + \"_bin_map.tif\")\n output_file1 = utils.create_file_module(outFileName)\n self.set_output('BinaryMap', output_file1)\n \n outFileName = os.path.join(output_dname, ModelAbbrev + \"_output.txt\")\n output_file2 = utils.create_file_module(outFileName)\n self.set_output('Text_Output', output_file2)\n \n outFileName = os.path.join(output_dname, ModelAbbrev + \"_auc_plot.jpg\")\n# print \"out auc: \", outFileName\n output_file3 = utils.create_file_module(outFileName)\n self.set_output('AUC_plot', output_file3)\n \n outFileName = os.path.join(output_dname, ModelAbbrev + \"_response_curves.pdf\")\n output_file5 = utils.create_file_module(outFileName)\n self.set_output('ResponseCurves', output_file5)\n \n outFileName = os.path.join(output_dname, \"modelWorkspace\")\n# print \"out auc: \", outFileName\n output_file6 = utils.create_file_module(outFileName)\n self.set_output('modelWorkspace', output_file6)\n \n writetolog(\"Finished \" + ModelAbbrev + \" builder\\n\", True, True) ", "metadata": "root.Model.compute", "header": "['class', 'Model', '(', 'Module', ')', ':', '___EOS___']", "index": 526 }, { "content": "class GLM(Model):\n _input_ports = list(Model._input_ports)\n _input_ports.extend([('ModelFamily', '(edu.utah.sci.vistrails.basic:String)', {'defaults':str(['binomial']), 'optional':True}),\n ('SimplificationMethod', '(edu.utah.sci.vistrails.basic:String)', {'defaults':str(['AIC']), 'optional':True}),\n ]) ", "metadata": "root.GLM", "header": "['module', '___EOS___']", "index": 615 }, { "content": " def __init__(self):\n global models_path\n Model.__init__(self) \n self.name = 'FIT_GLM_pluggable.r'\n self.port_map = {'mdsFile':('c', None, True),#These ports are for all Models\n 'makeProbabilityMap':('mpt', utils.R_boolean, False),\n 'makeBinMap':('mbt', utils.R_boolean, False),\n 'makeMESMap':('mes', utils.R_boolean, False),\n 'ThresholdOptimizationMethod':('om', None, False),\n 'ModelFamily':('mf', None, False), #This is a GLM specific port\n 'SimplificationMethod':('sm', None, False) #This is a GLM specific port\n }", "metadata": "root.GLM.__init__", "header": "['class', 'GLM', '(', 'Model', ')', ':', '___EOS___']", "index": 620 }, { "content": "class RandomForest(Model):\n _input_ports = list(Model._input_ports)\n _input_ports.extend([('MTRY', '(edu.utah.sci.vistrails.basic:Integer)', {'defaults':str(['1']), 'optional':True}),\n ]) ", "metadata": "root.RandomForest", "header": "['module', '___EOS___']", "index": 633 }, { "content": " def __init__(self):\n global models_path\n Model.__init__(self)\n self.name = 'FIT_RF_pluggable.r'\n self.port_map = {'mdsFile':('c', None, True),#These ports are for all Models\n 'makeProbabilityMap':('mpt', utils.R_boolean, False),\n 'makeBinMap':('mbt', utils.R_boolean, False),\n 'makeMESMap':('mes', utils.R_boolean, False), \n 'ThresholdOptimizationMethod':('om', None, False),\n 'MTRY': ('mtry', None, False) #This is a Random Forest specific port\n }", "metadata": "root.RandomForest.__init__", "header": "['class', 'RandomForest', '(', 'Model', ')', ':', '___EOS___']", "index": 637 }, { "content": "class MARS(Model):\n _input_ports = list(Model._input_ports)\n _input_ports.extend([('MarsDegree', '(edu.utah.sci.vistrails.basic:Integer)', {'defaults':str(['1']), 'optional':True}),\n ('MarsPenalty', '(edu.utah.sci.vistrails.basic:Integer)', {'defaults':str(['2']), 'optional':True}),\n ])", "metadata": "root.MARS", "header": "['module', '___EOS___']", "index": 649 }, { "content": " def __init__(self):\n global models_path \n Model.__init__(self)\n self.name = 'FIT_MARS_pluggable.r'\n self.port_map = {'mdsFile':('c', None, True),#These ports are for all Models\n 'makeProbabilityMap':('mpt', utils.R_boolean, False),\n 'makeBinMap':('mbt', utils.R_boolean, False),\n 'makeMESMap':('mes', utils.R_boolean, False), \n 'ThresholdOptimizationMethod':('om', None, False),\n 'MarsDegree':('deg', None, False), #This is a MARS specific port\n 'MarsPenalty':('pen', None, False), #This is a MARS specific port\n }", "metadata": "root.MARS.__init__", "header": "['class', 'MARS', '(', 'Model', ')', ':', '___EOS___']", "index": 654 }, { "content": "class BoostedRegressionTree(Model):\n _input_ports = list(Model._input_ports)\n _input_ports.extend([('Seed', '(edu.utah.sci.vistrails.basic:Integer)', True),\n ('TreeComplexity', '(edu.utah.sci.vistrails.basic:Integer)', True),\n ('NumberOfTrees', '(edu.utah.sci.vistrails.basic:Integer)', {'defaults':str(['10000']), 'optional':True}),\n ('BagFraction', '(edu.utah.sci.vistrails.basic:Float)', {'defaults':str(['0.5']), 'optional':True}),\n ('NumberOfFolds', '(edu.utah.sci.vistrails.basic:Integer)', {'defaults':str(['3']), 'optional':True}),\n ('Alpha', '(edu.utah.sci.vistrails.basic:Float)', {'defaults':str(['1']), 'optional':True}),\n ('PrevalenceStratify', '(edu.utah.sci.vistrails.basic:Boolean)', {'defaults':str(['True']), 'optional':True}),\n ('ToleranceMethod', '(edu.utah.sci.vistrails.basic:String)', {'defaults':str(['auto']), 'optional':True}),\n ('Tolerance', '(edu.utah.sci.vistrails.basic:Float)', {'defaults':str(['0.001']), 'optional':True})\n ])", "metadata": "root.BoostedRegressionTree", "header": "['module', '___EOS___']", "index": 667 }, { "content": " def __init__(self):\n global models_path\n Model.__init__(self)\n self.name = 'FIT_BRT_pluggable.r'\n self.port_map = {'mdsFile':('c', None, True),#These ports are for all Models\n 'makeProbabilityMap':('mpt', utils.R_boolean, False),\n 'makeBinMap':('mbt', utils.R_boolean, False),\n 'makeMESMap':('mes', utils.R_boolean, False), \n 'ThresholdOptimizationMethod':('om', None, False),\n 'Seed':('seed', None, False), #This is a BRT specific port\n 'TreeComplexity':('tc', None, False), #This is a BRT specific port\n 'NumberOfTrees':('nf', None, False), #This is a BRT specific port\n 'BagFraction':('bf', None, False), #This is a BRT specific port\n 'NumberOfFolds':('nf', None, False), #This is a BRT specific port\n 'Alpha':('alp', None, False), #This is a BRT specific port\n 'PrevalenceStratify':('ps', None, False), #This is a BRT specific port\n 'ToleranceMethod':('tolm', None, False), #This is a BRT specific port\n 'Tolerance':('tol', None, False) #This is a BRT specific port\n }", "metadata": "root.BoostedRegressionTree.__init__", "header": "['class', 'BoostedRegressionTree', '(', 'Model', ')', ':', '___EOS___']", "index": 679 }, { "content": "class MDSBuilder(Module):\n '''\n MDS Builder\n\n The Merged Data Set (MDS) Builder module is a utility that extracts the values of each predictor\n layer to the point locations included in the field data set. The module produces a .csv file that\n contains the x and y locations of the sample points and a column indicating whether each point\n represents a presence recording, an absence recording, a presence count, or a background point.\n Following these first three columns, each environmental predictor layer is appended as a column\n with row entries representing the value present in the raster layer at each field sample point.\n There are a total of three header rows in the output .csv of the MDSBuilder. The first row contains\n the columns \"x,\" \"y,\" \"ResponseBinary\" or \"ResponseCount,\" and the names of each of the raster\n predictor files that were passed to the MDS Builder. The second row contains a binary value\n indicating whether the column should be included when the model is finally applied; these values\n are later modified during the Covariate Correlation and Selection process that takes place downstream\n in the workflow. The final header row contains the full path on the file system to each of the raster\n predictor files.\n\n The MDSBuilder accepts four inputs from the user:\n\n 1. Rasters with PARC Info .csv File: The raster layers listed in this file will have their values\n extracted to the points in the field data .csv file. This parameter should be supplied by connecting\n the output of a PARC module within the workflow to the MDSBuilder module. (In order to properly\n extract the values of each predictor layer to the field data points, all the layers must have matching\n coordinate systems and cell sizes; outputs from the PARC module will have had the prerequisite processing).\n \n 2. Background Point Count: This is an optional value that applies only to workflows that employ the\n Maxent modeling package. The dialogue box provides the option of specifying a number of background points\n to be randomly scattered throughout the study area (the extent of the template layer) to capture a more\n complete sample of the range of values present for each predictor layer. These points will be added to\n the field data .csv file with a value of \"-999\" denoting them as background points.\n \n 3. Background Probability Surface: This is an optional parameter that applies only to workflows that\n employ the Maxent modeling package. In some analyses, it may be appropriate to spatially limit background\n points to a particular subset of the study area (e.g., islands within a study area polygon, particular\n regions within a study area polygon, or a region determined by the known bias present in the field data).\n Specifying a background probability surface raster allows a user to control where random points will be\n scattered within the extent of the study area. The raster layer specified by a user should have the same\n projection and extent as the template layer and contain values ranging from 0 to 100. These values represent\n the probability that a randomly generated point will be retained should it fall within a particular cell.\n That is, randomly generated points will not be generated in any part of the probability grid with a value\n of \"0\" while all points falling in an area with a value of \"100\" will be retained. A point falling in an\n area with a value of \"50\" will be kept as a background point 50% of the time.\n \n 4. Field Data: The field data input corresponds to a .csv file containing presence/absence points or count\n data recorded across a landscape for the phenomenon being modeled (e.g., plant sightings, evidence of\n animal presence, etc.). This input file must be in a particular format, and in most cases, a user should\n populate this field by connecting a FieldData element to the MDSBuilder in the visual display within VisTrails.\n Please see the documention for the FieldData module for more details.\n\n '''\n\n# _input_ports = expand_ports([('RastersWithPARCInfoCSV', '(gov.usgs.sahm:RastersWithPARCInfoCSV:Other)'),\n# ('fieldData', '(gov.usgs.sahm:FieldData:DataInput)'),\n# ('backgroundPointCount', '(edu.utah.sci.vistrails.basic:Integer)'),\n# ('backgroundProbSurf', '(edu.utah.sci.vistrails.basic:File)')]\n# )\n# _input_ports = expand_ports([('RastersWithPARCInfoCSV', '(edu.utah.sci.vistrails.persistence:PersistentFile)'),\n# ('fieldData', '(gov.usgs.sahm:FieldData:DataInput)'),\n# ('backgroundPointCount', '(edu.utah.sci.vistrails.basic:Integer)'),\n# ('backgroundProbSurf', '(edu.utah.sci.vistrails.basic:File)')]\n# )\n _input_ports = expand_ports([('RastersWithPARCInfoCSV', '(edu.utah.sci.vistrails.basic:File)'),\n ('fieldData', '(gov.usgs.sahm:FieldData:DataInput)'),\n ('backgroundPointCount', '(edu.utah.sci.vistrails.basic:Integer)'),\n ('backgroundProbSurf', '(edu.utah.sci.vistrails.basic:File)')]\n )\n \n _output_ports = expand_ports([('mdsFile', '(gov.usgs.sahm:MergedDataSet:Other)')])\n", "metadata": "root.MDSBuilder", "header": "['module', '___EOS___']", "index": 699 }, { "content": " def compute(self):\n port_map = {'fieldData': ('fieldData', None, True),\n 'backgroundPointCount': ('pointcount', None, False),\n 'backgroundProbSurf': ('probsurf', None, False),}\n \n MDSParams = utils.map_ports(self, port_map) \n MDSParams['outputMDS'] = utils.mknextfile(prefix='MergedDataset_', suffix='.csv')\n \n #allow multiple CSV of inputs to be provided. \n #if more than one then combine into a single CSV before sending to MDSBuilder\n inputs_csvs = self.force_get_input_list('RastersWithPARCInfoCSV')\n if len(inputs_csvs) == 0:\n raise ModuleError(self, \"Must supply at least one 'RastersWithPARCInfoCSV'/nThis is the output from the PARC module\")\n if len(inputs_csvs) > 1:\n inputs_csv = utils.mknextfile(prefix='CombinedPARCFiles_', suffix='.csv')\n inputs_names = [f.name for f in inputs_csvs]\n utils.merge_inputs_csvs(inputs_names, inputs_csv)\n else:\n inputs_csv = inputs_csvs[0].name\n MDSParams['inputsCSV'] = inputs_csv\n \n #inputsCSV = utils.path_port(self, 'RastersWithPARCInfoCSV')\n \n ourMDSBuilder = MDSB.MDSBuilder()\n utils.PySAHM_instance_params(ourMDSBuilder, MDSParams)\n\n writetolog(\" inputsCSV=\" + ourMDSBuilder.inputsCSV, False, False)\n writetolog(\" fieldData=\" + ourMDSBuilder.fieldData, False, False)\n writetolog(\" outputMDS=\" + ourMDSBuilder.outputMDS, False, False)\n \n try:\n ourMDSBuilder.run()\n except TrappedError as e:\n raise ModuleError(self, e.message)\n except:\n utils.informative_untrapped_error(self, \"MDSBuilder\")\n\n output_file = utils.create_file_module(ourMDSBuilder.outputMDS)\n \n self.set_output('mdsFile', output_file)", "metadata": "root.MDSBuilder.compute", "header": "['class', 'MDSBuilder', '(', 'Module', ')', ':', '___EOS___']", "index": 769 }, { "content": "class FieldDataAggregateAndWeight(Module):\n '''\n Documentation to be updated when module finalized.\n '''\n _input_ports = expand_ports([('templateLayer', '(gov.usgs.sahm:TemplateLayer:DataInput)'),\n ('fieldData', '(gov.usgs.sahm:FieldData:DataInput)'),\n ('aggregateRows', 'basic:Boolean'),\n ('aggregateRowsByYear', 'basic:Boolean')])\n _output_ports = expand_ports([('fieldData', '(gov.usgs.sahm:FieldData:DataInput)')])\n ", "metadata": "root.FieldDataAggregateAndWeight", "header": "['module', '___EOS___']", "index": 810 }, { "content": " def compute(self):\n writetolog(\"\\nRunning FieldDataQuery\", True)\n port_map = {'templateLayer': ('template', None, True),\n 'fieldData': ('csv', None, True),\n 'aggregateRowsByYear': ('aggRows', None, False),\n 'addKDE': ('addKDE', None, False),}\n \n KDEParams = utils.map_ports(self, port_map)\n output_fname = utils.mknextfile(prefix='FDQ_', suffix='.csv')\n writetolog(\" output_fname=\" + output_fname, True, False)\n KDEParams['output'] = output_fname\n \n output_fname = utils.mknextfile(prefix='FDQ_', suffix='.csv')\n writetolog(\" output_fname=\" + output_fname, True, False)\n \n ourFDQ = FDQ.FieldDataQuery()\n utils.PySAHM_instance_params(ourFDQ, KDEParams)\n \n ourFDQ.processCSV()\n \n output_file = utils.create_file_module(output_fname)\n writetolog(\"Finished running FieldDataQuery\", True)\n self.set_output('fieldData', output_file)", "metadata": "root.FieldDataAggregateAndWeight.compute", "header": "['class', 'FieldDataAggregateAndWeight', '(', 'Module', ')', ':', '___EOS___']", "index": 820 }, { "content": "class PARC(Module):\n '''\n PARC\n\n The Projection, Aggregation, Resampling, and Clipping (PARC) module is a powerful\n utility that automates the preparation steps required for using raster layers in\n most geospatial modeling packages. In order to successfully consider multiple\n environmental predictors in raster format, each layer must have coincident cells\n (pixels) of the same size, have the same coordinate system (and projection, if\n applicable), and the same geographic extent. The PARC module ensures that all of\n these conditions are met for the input layers by transforming and or reprojecting\n each raster to match the coordinate system of the template layer. This process\n usually involves aggregation (necessary when an input raster layer must be up-scaled\n to match the template layer-- e.g., generalizing a 10 m input layer to a 100 m output\n layer), and or resampling (necessary for interpolating new cell values when transforming\n the raster layer to the coordinate space or cell size of the template layer). Lastly,\n each raster predictor layer is clipped to match the extent of the template layer.\n\n The settings used during these processing steps follow a particular set of decision rules\n designed to preserve the integrity of data as much as possible. However, it is important\n for a user to understand how these processing steps may modify the data inputs. For\n additional information about the PARC module, please see the extended help and\n documentation for the SAHM package. \n\n The PARC module accepts four kinds of inputs: \n\n 1. Predictor List: A user should not have to populate this field. This field is populated\n when a selection is made from the pre-loaded .csv file of raster predictor layer inputs\n (specified during the SAHM install) and connected to the PARC module in the visual display. \n \n 2. .csv File List: The .csv file list corresponds to the Predictor List File element and\n allows a user to load a .csv file containing a list of rasters for consideration in the\n modeled analysis. For additional information, please see the documentation for the Predictor\n List File element.\n \n 3. Predictor: The predictor input allows a user to select a single raster predictor layer\n to be considered in the analysis. It is recommended that a user add this input as a separate\n element in the visual display (and then link it to the PARC module) so that the aggregation\n and resampling settings can be established. The PARC module can accept multiple predictor\n elements. For additional information, please see the documentation for the Predictor element.\n \n 4. Template Layer: The template layer is a raster data layer with a defined coordinate system,\n a known cell size, and an extent that defines the study area. This raster layer serves as the\n template for all the other inputs in the analysis. All additional raster layers used in the\n analysis will be resampled and reprojected as needed to match the template, snapped to the\n template, and clipped to have an extent that matches the template. Users should ensure that\n any additional layers considered in the analysis have coverage within the extent of the\n template layer. The template layer is a required input for the PARC module.\n\n '''\n\n #configuration = []\n _input_ports = [('predictor', \"(gov.usgs.sahm:Predictor:DataInput)\"),\n ('PredictorList', '(gov.usgs.sahm:PredictorList:Other)'),\n ('RastersWithPARCInfoCSV', '(gov.usgs.sahm:RastersWithPARCInfoCSV:Other)'),\n ('templateLayer', '(gov.usgs.sahm:TemplateLayer:DataInput)'),\n ('multipleCores', '(edu.utah.sci.vistrails.basic:Boolean)', {'defaults':str(['True']), 'optional':True})]\n\n# _output_ports = [('RastersWithPARCInfoCSV', '(gov.usgs.sahm:RastersWithPARCInfoCSV:Other)')]\n# _output_ports = [('RastersWithPARCInfoCSV', '(edu.utah.sci.vistrails.persistence:PersistentFile)')]\n _output_ports = [('RastersWithPARCInfoCSV', '(edu.utah.sci.vistrails.basic:File)')]\n ", "metadata": "root.PARC", "header": "['module', '___EOS___']", "index": 844 }, { "content": " def compute(self):\n #writetolog(\"\\nRunning PARC\", True)\n \n ourPARC = parc.PARC()\n output_dname = utils.mknextdir(prefix='PARC_')\n \n if configuration.verbose:\n ourPARC.verbose = True\n ourPARC.logger = utils.getLogger()\n \n ourPARC.out_dir = output_dname\n\n if self.has_input(\"multipleCores\"):\n if self.get_input(\"multipleCores\"):\n ourPARC.multicores = \"True\"\n\n workingCSV = utils.mknextfile(prefix='tmpFilesToPARC_', suffix='.csv')\n outputCSV = utils.mknextfile(prefix='PARCOutput_', suffix='.csv')\n\n #append additional inputs to the existing CSV if one was supplied\n #otherwise start a new CSV\n if self.has_input(\"RastersWithPARCInfoCSV\"):\n inputCSV = self.force_get_input(\"RastersWithPARCInfoCSV\").name\n shutil.copy(inputCSV, workingCSV)\n f = open(workingCSV, \"ab\")\n csvWriter = csv.writer(f)\n else:\n f = open(workingCSV, \"wb\")\n csvWriter = csv.writer(f)\n csvWriter.writerow([\"FilePath\", \"Categorical\", \"Resampling\", \"Aggregation\"])\n \n if self.has_input(\"PredictorList\"):\n predictor_lists = self.force_get_input_list('PredictorList')\n for predictor_list in predictor_lists:\n for predictor in predictor_list:\n csvWriter.writerow(list(predictor))\n \n if self.has_input(\"predictor\"):\n predictor_list = self.force_get_input_list('predictor')\n for predictor in predictor_list:\n csvWriter.writerow(list(predictor))\n f.close()\n del csvWriter\n ourPARC.inputs_CSV = workingCSV\n ourPARC.template = self.force_get_input('templateLayer').name\n writetolog(' template layer = ' + self.force_get_input('templateLayer').name)\n writetolog(\" output_dname=\" + output_dname, False, False)\n writetolog(\" workingCSV=\" + workingCSV, False, False)\n try:\n ourPARC.parcFiles()\n except TrappedError as e:\n writetolog(e.message)\n raise ModuleError(self, e.message)\n except:\n utils.informative_untrapped_error(self, \"PARC\") \n \n #delete our temp working file\n os.remove(workingCSV)\n \n predictorsDir = utils.create_dir_module(output_dname)\n outputCSV = os.path.join(output_dname, \"PARC_Files.csv\")\n output_file = utils.create_file_module(outputCSV)\n \n \n writetolog(\"Finished running PARC\", True)\n self.set_output('RastersWithPARCInfoCSV', output_file)", "metadata": "root.PARC.compute", "header": "['class', 'PARC', '(', 'Module', ')', ':', '___EOS___']", "index": 906 }, { "content": "class RasterFormatConverter(Module):\n '''\n Raster Format Converter\n\n The RasterFormatConverter module allows a user to easily convert .tif raster layers\n into a different raster format for use and display in other software packages. The\n module accepts as an input either a list of rasters in a Merged Dataset File (MDS)\n or the location of a directory containing multiple raster files. All outputs will be\n sent to a folder named \"ConvertedRasters\" (followed by an underscore and a number\n corresponding to the run sequence of the module) within the user's current VisTrail\n session folder.\n\n Three parameters can be specified by the user:\n\n 1. Format: The format corresponds to the desired raster output format. The following\n output file formats are supported: Arc/Info ASCII Grid, ESRI BIL, ERDAS Imagine, and JPEG.\n \n To specify the desired output, users should enter the values shown below.\n For an ASCII (.asc) output, enter: \"asc\"\n For an ESRI BIL output, enter: \"bil\"\n For an Erdas Imagine (.img) output, enter: \"img\"\n For a JPEG (.jpg) output, enter: \"jpg\"\n \n If no value is entered by the user, the module will default to an ASCII (.asc) output\n format.\n\n 2. Input Directory: The input directory allows a user to point to an entire folder as\n an input to the RasterFormatConverter. The contents of the specified folder will be\n checked for raster files and all the raster files contained within the directory will\n be converted to the format specified in the \"Format\" dialogue box. The module will\n identify and convert files of the following raster types: .bil, .img, .tif, .jpg, and .asc. \n\n 3. Input Merged Dataset (MDS): The input merged dataset allows a user to specify a .csv\n file created in the VisTrails workflow (containing a list of .tif raster files) as an\n input to the raster converter. All of the files listed in the MDS will be converted to\n the raster format specified in the \"Format\" dialogue box.\n\n '''\n\n #configuration = []\n _input_ports = [(\"inputMDS\", \"(gov.usgs.sahm:MergedDataSet:Other)\"),\n ('inputDir', '(edu.utah.sci.vistrails.basic:Directory)'),\n ('format', '(edu.utah.sci.vistrails.basic:String)'),\n ('multipleCores', '(edu.utah.sci.vistrails.basic:Boolean)', {'defaults':str(['True']), 'optional':True})]\n\n _output_ports = [('outputDir', '(edu.utah.sci.vistrails.basic:Directory)')]\n", "metadata": "root.RasterFormatConverter", "header": "['module', '___EOS___']", "index": 974 }, { "content": " def compute(self):\n writetolog(\"\\nRunning TiffConverter\", True)\n ourRFC = RFC.FormatConverter()\n if self.has_input('inputMDS'):\n ourRFC.MDSFile = self.force_get_input('inputMDS').name\n elif self.has_input('inputDir'):\n ourRFC.inputDir = self.force_get_input('inputDir').name\n \n if self.has_input('format'):\n format = self.force_get_input('format')\n if format == '':\n format = 'asc'\n ourRFC.format = format\n \n if self.has_input(\"multipleCores\"):\n if self.get_input(\"multipleCores\"):\n ourRFC.multicores = \"True\"\n \n ourRFC.outputDir = utils.mknextdir(prefix='ConvertedRasters_')\n if configuration.verbose:\n ourRFC.verbose = True\n ourRFC.logger = utils.getLogger()\n writetolog(\" output directory = \" + ourRFC.outputDir, False, False)\n \n try:\n ourRFC.run()\n except TrappedError as e:\n raise ModuleError(self, e.message)\n except:\n utils.informative_untrapped_error(self, \"RasterFormatConverter\") \n \n \n outputDir = utils.create_dir_module(ourRFC.outputDir)\n self.set_output('outputDir', outputDir)\n writetolog(\"\\nFinished running TiffConverter\", True)", "metadata": "root.RasterFormatConverter.compute", "header": "['class', 'RasterFormatConverter', '(', 'Module', ')', ':', '___EOS___']", "index": 1021 }, { "content": "class TestTrainingSplit(Module):\n '''\n Test Training Split\n\n The TestTrainingSplit module provides the opportunity to establish specific settings\n for how field data will be used in the modeling process. Three parameters can be set\n by the user:\n\n 1. Ratio of Presence/Absence Points:\n This field is populated with a number corresponding to the desired proportion of\n presence and absence points to be used in the analysis. If populated, this entry should\n be a number greater than zero. (A value of '1' will result in an equal number of both\n presence and absence points being used, a value of '2' indicates that twice as many\n presence points will be used, a value of 0.5 indicates that twice as many absence points\n will be used, etc.). All field data points with a value equal to or greater than 1 are\n interpreted as presence points. Although the original field data is unmodified, this\n option will reduce the sample size as the merged dataset containing sample points will\n have points deleted from it to achieve the specified ratio. A warning will be generated\n if more than 50% of either the presence or absence points will be deleted based on the\n ratio specified by the user. Background points are ignored by this module (they are read\n in and written out, but not assigned to either the test or training split).\n\n When left empty, this field will default to 'null' and the model will use the existing\n presence/absence ratio present in the field data.\n\n 2. Input Merged Data Set (MDS): \n This is the input data set consisting of locational data for each sample point, the\n values of each predictor variable at those points, and if established, a field denoting\n the weight that will be assigned to each point in modeling. This input is usually provided\n by the upstream steps that precede the Test Training Split module. Any value entered here\n (e.g., specifying another existing MDS on the file system) will override the input\n specified by a model connection in the visual display.\n\n 3. Training Proportion:\n This is the proportion of the sample points that will be used to train the model, relative\n to the total number of points. Entered values should be greater than 0 but less than 1.\n For example, a value of '0.9' will result in 90% of the sample points being used to train\n the model, with 10% of the sample being held out to test the model's performance. Choosing\n an appropriate training proportion can depend on various factors, such as the total number\n of sample points available.\n\n '''\n\n _input_ports = [(\"inputMDS\", \"(gov.usgs.sahm:MergedDataSet:Other)\"),\n ('trainingProportion', '(edu.utah.sci.vistrails.basic:Float)', \n {'defaults':str(['0.7'])}),\n ('RatioPresAbs', '(edu.utah.sci.vistrails.basic:Float)')]\n _output_ports = [(\"outputMDS\", \"(gov.usgs.sahm:MergedDataSet:Other)\")]\n ", "metadata": "root.TestTrainingSplit", "header": "['module', '___EOS___']", "index": 1057 }, { "content": " def compute(self):\n if self.has_input('trainingProportion'):\n print 'real input'\n writetolog(\"\\nGenerating Test Training split \", True)\n inputMDS = utils.dir_path_value(self.force_get_input('inputMDS', []))\n outputMDS = utils.mknextfile(prefix='TestTrainingSplit_', suffix='.csv')\n\n global models_path\n \n args = \"i=\" + '\"' + inputMDS + '\"' + \" o=\" + '\"' + outputMDS + '\"'\n args += \" rc=\" + utils.MDSresponseCol(inputMDS) \n if (self.has_input(\"trainingProportion\")):\n try:\n trainingProportion = float(self.get_input(\"trainingProportion\"))\n if trainingProportion <= 0 or trainingProportion > 1:\n raise ModuleError(self, \"Train Proportion (trainProp) must be a number between 0 and 1 excluding 0\")\n args += \" p=\" + str(trainingProportion)\n except:\n raise ModuleError(self, \"Train Proportion (trainProp) must be a number between 0 and 1 excluding 0\")\n if (self.has_input(\"RatioPresAbs\")):\n try:\n RatioPresAbs = float(self.get_input(\"RatioPresAbs\"))\n if RatioPresAbs <= 0:\n raise ModuleError(self, \"The ratio of presence to absence (RatioPresAbs) must be a number greater than 0\") \n args += \" m=\" + str(trainingProportion) \n except:\n raise ModuleError(self, \"The ratio of presence to absence (RatioPresAbs) must be a number greater than 0\") \n \n utils.runRScript(\"TestTrainSplit.r\", args, self)\n\n output = os.path.join(outputMDS)\n if os.path.exists(output):\n output_file = utils.create_file_module(output)\n writetolog(\"Finished Test Training split \", True)\n else:\n msg = \"Problem encountered generating Test Training split. Expected output file not found.\"\n writetolog(msg, False)\n raise ModuleError(self, msg)\n self.set_output(\"outputMDS\", output_file)", "metadata": "root.TestTrainingSplit.compute", "header": "['class', 'TestTrainingSplit', '(', 'Module', ')', ':', '___EOS___']", "index": 1106 }, { "content": "class CovariateCorrelationAndSelection(Module):\n '''\n Covariate Correlation And Selection\n\n The CovariateCorrelationAndSelection view provides a breakpoint in the modeling workflow\n for the user to assess how well each variable explains the distribution of the sampled\n data points and to remove any variables that may exhibit high correlation with others. \n\n The display shows the 10 most correlated variables of those selected. These variables\n are displayed on the diagonal and their respective graphical display and correlation with\n other variables can be found by locating the row/column intersection between each (above\n and below the diagonal). The column heading over each variable displays the number of\n other variables with which the environmental predictor is correlated. The user defined\n \"Threshold\" option allows a user to specify the degree of correlation required between\n two variables for them to be counted in this tally.\n\n A user is provided with the opportunity to select a new set of the environmental predictor\n variables and \"Update\" the Covariate Correlation screen to investigate the relationships\n among the new variables selected. The options are provided to include or exclude the\n presence/count points, the absence points (when applicable), and the background points in\n this correlation test. Variables with a high degree of correlation with other variables\n should generally be unchecked in their respective radio buttons, and will be excluded from\n subsequent analysis steps in the model workflow.\n\n Multiple iterations can be run at this screen, allowing the user to investigate the\n relationships among the environmental predictor variables and choose the most appropriate\n set to be used in the subsequent modeling. When the desired set of variables has been chosen,\n the \"OK\" button is selected and processing will resume in the VisTrails workflow.\n\n '''\n kwargs = {}\n kwargs['defaults'] = str(['initial'])\n _input_ports = [(\"inputMDS\", \"(gov.usgs.sahm:MergedDataSet:Other)\"),\n ('selectionName', '(edu.utah.sci.vistrails.basic:String)', kwargs),\n ('ShowGUI', '(edu.utah.sci.vistrails.basic:Boolean)')]\n _output_ports = [(\"outputMDS\", \"(gov.usgs.sahm:MergedDataSet:Other)\")]\n\n", "metadata": "root.CovariateCorrelationAndSelection", "header": "['module', '___EOS___']", "index": 1146 }, { "content": " def compute(self):\n writetolog(\"\\nOpening Select Predictors Layers widget\", True)\n inputMDS = utils.dir_path_value(self.force_get_input('inputMDS'))\n selectionName = self.force_get_input('selectionName', 'initial')\n# outputMDS = utils.mknextfile(prefix='SelectPredictorsLayers_' + selectionName + \"_\", suffix='.csv')\n# displayJPEG = utils.mknextfile(prefix='PredictorCorrelation_' + selectionName + \"_\", suffix='.jpg')\n global session_dir\n outputMDS = os.path.join(session_dir, \"CovariateCorrelationOutputMDS_\" + selectionName + \".csv\")\n displayJPEG = os.path.join(session_dir, \"CovariateCorrelationDisplay.jpg\")\n writetolog(\" inputMDS = \" + inputMDS, False, False)\n writetolog(\" displayJPEG = \" + displayJPEG, False, False)\n writetolog(\" outputMDS = \" + outputMDS, False, False)\n \n if os.path.exists(outputMDS):\n utils.applyMDS_selection(outputMDS, inputMDS)\n os.remove(outputMDS)\n \n self.callDisplayMDS(inputMDS, outputMDS, displayJPEG)\n\n output_file = utils.create_file_module(outputMDS)\n writetolog(\"Finished Select Predictors Layers widget\", True)\n self.set_output(\"outputMDS\", output_file)", "metadata": "root.CovariateCorrelationAndSelection.compute", "header": "['class', 'CovariateCorrelationAndSelection', '(', 'Module', ')', ':', '___EOS___']", "index": 1183 }, { "content": " def callDisplayMDS(self, inputMDS, outputMDS, displayJPEG):\n dialog = SelectListDialog(inputMDS, outputMDS, displayJPEG, configuration.r_path)\n #dialog.setWindowFlags(QtCore.Qt.WindowMaximizeButtonHint)\n# print \" ... finished with dialog \" \n retVal = dialog.exec_()\n #outputPredictorList = dialog.outputList\n if retVal == 1:\n raise ModuleError(self, \"Cancel or Close selected (not OK) workflow halted.\")", "metadata": "root.CovariateCorrelationAndSelection.callDisplayMDS", "header": "['class', 'CovariateCorrelationAndSelection', '(', 'Module', ')', ':', '___EOS___']", "index": 1206 }, { "content": "class ProjectionLayers(Module):\n '''\n Projection Layers\n\n Note: as of June 2011, this module offers some functionality that is only available\n to users running the SAHM package within the USGS Fort Collins Science Center (FORT).\n\n The ProjectionLayers module provides the option to prepare a separate set of predictor\n layers so that the results of a model developed from one set of environmental predictors\n can be projected onto a new modeled space. This second set of environmental predictors\n (corresponding to the \"projection target\") most often contains the same environmental\n predictors but represents data captured at a different temporal or spatial location. For\n example, a user could generate a model predicting habitat suitability using recorded\n presence points and certain environmental predictors such as elevation, landcover, and\n proximity to water in one geographic location. Based on the training from this information,\n the modeled results could be generated for (or \"projected to\") a new location based on the\n range of values seen in elevation, landcover, and proximity to water in the second geographic\n area. Similarly, modeling predicted results through time is also possible. A model trained\n using field data and a set of predictor layers representative of one time period could be\n projected onto the same geographical area using a new set of predictor layers corresponding\n to the same predictors but representing data from a different time period (e.g., different\n climate data). \n\n The output of this module is subsequently used as the projection target in the ApplyModel module.\n\n (As part of the process of preparing the layers for modeling, the ProjectionLayers module runs\n the PARC module internally on the inputs. Outputs from the ProjectionLayers module will possess\n matching coordinate systems, cell sizes, and extents and do not need to be run through PARC\n before being used downstream in the workflow.)\n\n Six parameters can be set by the user:\n\n 1. Directory Crosswalk CSV: This is a .csv file containing two columns designating\n the layers that should be swapped out in the projected model. The first column\n contains a list of the full paths to the predictor layers used to develop the original\n model that will be replaced in the projection process. The second column contains the\n full paths to the new predictor layers that will substitute the respective layers used\n in the original model. Each original layer in the first column should be paired with\n its replacement in the second column (e.g., Column 1 = C:\\ModelLayers\\Precipitation1980.tif,\n Column 2 = C:\\ModelLayers\\Precipitation2000.tif). In the case of any file used to develop\n the first model that is not expressly listed in the Directory Crosswalk CSV with a\n replacement, the original file will be used in the new model projection. The module\n anticipates a header row in this .csv file (thus, the first row of data will be ignored).\n \n 2. File List CSV: This is a .csv file containing the list of predictor files used to\n develop the first model. Effectively, this file will be updated based on the information\n provided in the directory crosswalk .csv and used as the input to the training process\n for the projected model. The output of the PARC module from the first model iteration\n should be used as the input to this parameter.\n \n 3. Model (available only to users at the FORT): This parameter allows VisTrail users\n running the SAHM package on site at the USGS Science Center in Fort Collins (FORT) to\n specify one of three models to use for the projected model run (\"CCCMA,\" \"CSIRO,\"\n or \"hadcm3\").\n \n 4. Scenario (available only to users at the FORT): This parameter allows VisTrail\n users running the SAHM package on site at the USGS Science Center in Fort Collins \n FORT) to specify one of two scenarios for the projected model run (\"A2a\" or \"B2b\"). \n \n 5. Template: This parameter allows a user to specify the new template layer to be used\n in the projected model run. The template layer is a raster data layer with a defined\n coordinate system, a known cell size, and an extent that defines the (new) study area.\n This raster layer serves as the template for all the other inputs in the analysis. All\n additional raster layers used in the analysis will be resampled and reprojected as\n needed to match the template, snapped to the template, and clipped to have an extent\n that matches the template. Users should ensure that all the layers used for the projected\n analysis have coverage within the extent of the template layer.\n \n 6. Year (available only to users at the FORT): This parameter allows VisTrail users\n running the SAHM package on site at the USGS Science Center in Fort Collins (FORT)\n to specify one of three years to use for the projected model run (\"2020,\" \"2050,\" or \"2080\").\n\n '''\n _input_ports = [('RastersWithPARCInfoCSV', '(gov.usgs.sahm:RastersWithPARCInfoCSV:Other)'),\n ('templateLayer', '(gov.usgs.sahm:TemplateLayer:DataInput)'),\n ('model', '(edu.utah.sci.vistrails.basic:String)'),\n ('scenario', '(edu.utah.sci.vistrails.basic:String)'),\n ('year', '(edu.utah.sci.vistrails.basic:String)'),\n ('directoryCrosswalkCSV', '(edu.utah.sci.vistrails.basic:File)')\n ]\n _output_ports = [(\"MDS\", \"(gov.usgs.sahm:MergedDataSet:Other)\")]\n", "metadata": "root.ProjectionLayers", "header": "['module', '___EOS___']", "index": 1216 }, { "content": " def compute(self):\n models = ['CCCMA', 'CSIRO', 'hadcm3']\n scenarioss = ['A2a', 'B2b']\n years = ['2020', '2050', '2080']\n \n writetolog(\"\\nRunning make Projection Layers\", True)\n \n inputCSV = self.force_get_input('RastersWithPARCInfoCSV').name\n \n if self.has_input('templateLayer'):\n template = self.force_get_input('templateLayer').name\n else:\n template = '' #we'll get a template below\n \n fromto = []\n climargs = {}\n \n for input in ['model', 'scenario', 'year']:\n if self.has_input(input):\n climargs[input] = self.force_get_input(input)\n if climargs <> {} and climargs.keys() <> ['model', 'scenario', 'year']:\n #they did not add in one of each, Not going to fly\n raise ModuleError(self, \"All of model, scenario, and year must be supplied if any are used.\")\n elif climargs <> {} and climargs.keys <> ['model', 'scenario', 'year']:\n #they specified a alt climate scenario add this to our list to search for\n fromto.append([r'K:\\GIS_LIBRARY\\Climate\\WorldClim\\BioclimaticVariables\\bio_30s_esri\\bio',\n os.path.join('I:\\WorldClim_Future_Climate\\RenamedBILs', \n climargs['model'], climargs['scenario'], climargs['year'])])\n \n if self.has_input('directoryCrosswalkCSV'):\n crosswalkCSV = csv.reader(open(self.force_get_input('directoryCrosswalkCSV'), 'r'))\n header = crosswalkCSV\n for row in crosswalkCSV:\n fromto.append(row[0], row[1])\n del crosswalkCSV \n \n #write out the outputs to an empty MDS file (just the header is needed to PARC the outputs)\n \n \n inCSV = csv.reader(open(inputCSV, 'r'))\n inCSV.next() #skip header\n workingCSV = utils.mknextfile(prefix='tmpFilesToPARC_', suffix='.csv')\n tmpCSV = csv.writer(open(workingCSV, 'wb'))\n tmpCSV.writerow([\"FilePath\", \"Categorical\", \"Resampling\", \"Aggregation\"])\n outHeader1 = ['x', 'y', 'response']\n outHeader2 = ['', '', '']\n outHeader3 = ['', '', '']\n \n output_dname = utils.mknextdir(prefix='ProjectionLayers_')\n \n for row in inCSV:\n if template == '':\n template = row[0]\n fileShortName = utils.getShortName(row[0])\n if row[1] == 1:\n outHeader1.append(fileShortName + '_categorical')\n else:\n outHeader1.append(fileShortName)\n outHeader2.append('1')\n outHeader3.append(os.path.join(output_dname, fileShortName + '.tif'))\n\n origFile = row[4]\n newOrigFile = origFile\n for lookup in fromto:\n if lookup[0] in origFile:\n newOrigFile = origFile.replace(lookup[0], lookup[1])\n tmpCSV.writerow([newOrigFile,] + row[1:4])\n del tmpCSV\n \n #PARC the files here\n ourPARC = parc.PARC()\n \n \n if configuration.verbose:\n ourPARC.verbose = True\n writetolog(\" output_dname=\" + output_dname, False, False)\n ourPARC.outDir = output_dname\n ourPARC.inputsCSV = workingCSV\n ourPARC.template = template\n\n try:\n ourPARC.parcFiles()\n except TrappedError as e:\n raise ModuleError(self, e.message)\n except :\n utils.informative_untrapped_error(self, \"PARC\")\n \n #loop through our workingCSV and format it into an MDS header\n \n #outputMDS = utils.mknextfile(prefix='ProjectionLayersMDS_', suffix = '.csv')\n outputMDS = os.path.join(output_dname, 'ProjectionLayersMDS.csv')\n outCSV = csv.writer(open(outputMDS, 'wb'))\n outCSV.writerow(outHeader1)\n outCSV.writerow(outHeader2)\n outCSV.writerow(outHeader3)\n \n output_file = utils.create_file_module(outputMDS)\n self.set_output(\"MDS\", output_file)\n writetolog(\"Finished Select Projection Layers widget\", True)", "metadata": "root.ProjectionLayers.compute", "header": "['class', 'ProjectionLayers', '(', 'Module', ')', ':', '___EOS___']", "index": 1298 }, { "content": "class MAXENT(Module):\n\n _output_ports = [(\"lambdas\", \"(edu.utah.sci.vistrails.basic:File)\"),\n (\"report\", \"(edu.utah.sci.vistrails.basic:File)\"),\n (\"roc\", \"(edu.utah.sci.vistrails.basic:File)\")]\n", "metadata": "root.MAXENT", "header": "['module', '___EOS___']", "index": 1428 }, { "content": " def compute(self):\n global maxent_path\n\n ourMaxent = MaxentRunner.MAXENTRunner()\n ourMaxent.outputDir = utils.mknextdir(prefix='maxentFiles_')\n \n ourMaxent.inputMDS = self.force_get_input('inputMDS').name\n \n ourMaxent.maxentpath = maxent_path\n \n MaxentArgsCSV = utils.mknextfile(prefix='MaxentArgs', suffix='.csv')\n argWriter = csv.writer(open(MaxentArgsCSV, 'wb'))\n argWriter.writerow(['parameter','value'])\n for port in self._input_ports:\n #print port\n if port[0] <> 'inputMDS' and port[0] <> 'projectionlayers':\n if self.has_input(port[0]):\n port_val = self.get_input(port[0])\n if port[1] == \"(edu.utah.sci.vistrails.basic:Boolean)\":\n port_val = str(port_val).lower()\n elif (port[1] == \"(edu.utah.sci.vistrails.basic:Path)\" or \\\n port[1] == \"(edu.utah.sci.vistrails.basic:File)\"):\n port_val = port_val.name\n argWriter.writerow([port[0], port_val])\n else:\n #print \" has no input \"\n kwargs = port[2]\n #print kwargs\n try:\n if port[1] == \"(edu.utah.sci.vistrails.basic:Boolean)\":\n default = kwargs['defaults'][2:-2].lower()\n else:\n default = kwargs['defaults'][2:-2]\n #args[port[0]] = default\n argWriter.writerow([port[0], default])\n except KeyError:\n pass\n if self.has_input('projectionlayers'):\n value = self.force_get_input_list('projectionlayers')\n projlayers = ','.join([path.name for path in value])\n argWriter.writerow(['projectionlayers', projlayers])\n \n del argWriter\n ourMaxent.argsCSV = MaxentArgsCSV\n ourMaxent.logger = utils.getLogger()\n try:\n ourMaxent.run()\n except TrappedError as e:\n raise ModuleError(self, e.message) \n except:\n utils.informative_untrapped_error(self, \"Maxent\")\n \n #set outputs\n lambdasfile = os.path.join(ourMaxent.outputDir, ourMaxent.args[\"species_name\"] + \".lambdas\")\n output_file = utils.create_file_module(lambdasfile)\n self.set_output(\"lambdas\", output_file)\n \n \n rocfile = os.path.join(ourMaxent.outputDir, 'plots', ourMaxent.args[\"species_name\"] + \"_roc.png\")\n output_file = utils.create_file_module(rocfile)\n self.set_output(\"roc\", output_file)\n\n htmlfile = os.path.join(ourMaxent.outputDir, ourMaxent.args[\"species_name\"] + \".html\")\n print htmlfile\n output_file = utils.create_file_module(htmlfile)\n self.set_output(\"report\", output_file)\n\n writetolog(\"Finished Maxent widget\", True)", "metadata": "root.MAXENT.compute", "header": "['class', 'MAXENT', '(', 'Module', ')', ':', '___EOS___']", "index": 1434 }, { "content": "def load_max_ent_params(): \n maxent_fname = os.path.join(os.path.dirname(__file__), 'maxent.csv')\n csv_reader = csv.reader(open(maxent_fname, 'rU'))\n # pass on header\n csv_reader.next()\n input_ports = []\n \n input_ports.append(('inputMDS', '(gov.usgs.sahm:MergedDataSet:Other)'))\n \n docs = {}\n basic_pkg = 'edu.utah.sci.vistrails.basic'\n p_type_map = {'file/directory': 'Path',\n 'double': 'Float'}\n for row in csv_reader:\n [name, flag, p_type, default, doc, notes] = row\n name = name.strip()\n p_type = p_type.strip()\n if p_type in p_type_map:\n p_type = p_type_map[str(p_type)]\n else:\n p_type = str(p_type).capitalize()\n kwargs = {}\n default = default.strip()\n if default:\n if p_type == 'Boolean':\n default = default.capitalize()\n kwargs['defaults'] = str([default])\n if p_type == 'Boolean':\n kwargs['optional'] = True\n input_ports.append((name, '(' + basic_pkg + ':' + p_type + ')', kwargs))\n # FIXME set documentation\n #print 'port:', (name, '(' + basic_pkg + ':' + p_type + ')', kwargs)\n docs[name] = doc\n\n\n #print 'MAXENT:', input_ports\n MAXENT._input_ports = input_ports\n MAXENT._port_docs = docs\n\n def provide_input_port_documentation(cls, port_name):\n return cls._port_docs[port_name]\n MAXENT.provide_input_port_documentation = \\\n classmethod(provide_input_port_documentation)", "metadata": "root.load_max_ent_params", "header": "['module', '___EOS___']", "index": 1503 }, { "content": "def initialize(): \n global maxent_path, color_breaks_csv\n global session_dir\n utils.config = configuration\n \n r_path = os.path.abspath(configuration.r_path)\n maxent_path = os.path.abspath(configuration.maxent_path)\n \n \n #I was previously setting the following environmental variables and path additions \n #so that each user wouldn't have to do this on their individual machines. \n #I was running into problems with imports occuring before this initialize routine so \n #I moved the setting of these to an external .net application that sets these before \n #starting up VisTrails.py.\n \n #This should also make this package easier to port to other systems as this stuff would\n #only work on a windows instance.\n #the current dependencies are:\n #an installation of GDAL and Proj.4\n # this includes the GDAL_DATA and PROJ_LIB directories as environmental variables\n #GDAL bindings for python in the python path.\n #QGIS built for the version of Python, QT, PyQt, and SIP used by VisTrails.\n # This one was a painful bear on Windows.\n #All of the DLLs required by the above QGIS build must be on the path.\n #In my case these were in a folder in the OSGeoW installation that QGIS was built \n #off of.\n #And finally QGIS bindings for python in the python path.\n \n \n import qgis.core\n import qgis.gui\n globals()[\"qgis\"] = qgis\n setQGIS(qgis)\n \n qgis_prefix = os.path.join(configuration.qgis_path, \"qgis1.7.0\")\n qgis.core.QgsApplication.setPrefixPath(qgis_prefix, True)\n qgis.core.QgsApplication.initQgis() \n \n \n session_dir = utils.createrootdir(configuration.output_dir)\n utils.createLogger(session_dir, configuration.output_dir)\n #log_file = Utilities.createsessionlog(session_dir, configuration.verbose)\n \n color_breaks_csv = os.path.abspath(os.path.join(os.path.dirname(__file__), \"ColorBreaks.csv\"))\n \n load_max_ent_params()\n \n global layers_csv_fname\n \n writetolog(\"*\" * 79)\n writetolog(\"Initializing:\", True, True)\n writetolog(\" Locations of dependencies\")\n# writetolog(\" Layers CSV = \" + os.path.join(os.path.dirname(__file__), 'layers.csv'))\n writetolog(\" Layers CSV = \" + layers_csv_fname)\n writetolog(\" R path = \" + r_path)\n writetolog(\" GDAL folder = \" + os.path.abspath(configuration.gdal_path))\n writetolog(\" Must contain subfolders proj, gdal-data, GDAL\")\n writetolog(\" Maxent folder = \" + maxent_path)\n writetolog(\" QGIS folder = \" + os.path.abspath(configuration.qgis_path))\n writetolog(\" Must contain subfolders qgis1.7.0, OSGeo4W\")\n writetolog(\" \")\n writetolog(\"*\" * 79)\n \n writetolog(\"*\" * 79)\n writetolog(\" output directory: \" + session_dir)\n writetolog(\"*\" * 79)\n writetolog(\"*\" * 79)", "metadata": "root.initialize", "header": "['module', '___EOS___']", "index": 1606 }, { "content": "def finalize():\n pass\n #utils.cleantemps()#No longer used ", "metadata": "root.finalize", "header": "['module', '___EOS___']", "index": 1674 }, { "content": "def generate_namespaces(modules):\n module_list = []\n for namespace, m_list in modules.iteritems():\n for module in m_list:\n m_dict = {'namespace': namespace}\n if type(module) == tuple:\n m_dict.update(module[1])\n module_list.append((module[0], m_dict))\n #print 'm_dict:', m_dict\n else:\n module_list.append((module, m_dict))\n return module_list", "metadata": "root.generate_namespaces", "header": "['module', '___EOS___']", "index": 1678 }, { "content": "def build_available_trees():\n trees = {}\n global layers_csv_fname\n layers_csv_fname = os.path.join(os.path.dirname(__file__), 'layers.csv')\n csv_reader = csv.reader(open(layers_csv_fname, 'rU'))\n csv_reader.next()\n first_file = csv_reader.next()[0]\n \n #if the first file in the layers file does not exist assume that none\n #of them do and use the exampledata version\n if not os.path.exists(first_file):\n print ((\"!\" * 30) + \" WARNING \" + (\"!\" * 30) + \"\\n\")*3\n print \"The first grid in your layers CSV could not be found.\"\n print \"Defaulting to the example data csv.\"\n print \"fix/set paths in file \" + layers_csv_fname + \" to enable this functionality.\"\n print \"See documentation for more information on setting up the layers.csv\\n\"\n print ((\"!\" * 30) + \" WARNING \" + (\"!\" * 30) + \"\\n\")*3\n layers_csv_fname = os.path.join(os.path.dirname(__file__), 'layers.exampledata.csv')\n \n csv_reader = csv.reader(open(layers_csv_fname, 'rU'))\n # pass on header\n csv_reader.next()\n for row in csv_reader:\n if row[2] not in trees:\n trees[row[2]] = {}\n available_dict = trees[row[2]]\n# if 'Daymet' not in available_dict:\n# available_dict['Daymet'] = []\n# available_dict['Daymet'].append((row[0], row[1], row[3])) \n if row[3] not in available_dict:\n available_dict[row[3]] = []\n available_dict[row[3]].append((row[0], row[1], row[4]))\n \n return trees", "metadata": "root.build_available_trees", "header": "['module', '___EOS___']", "index": 1691 }, { "content": "def build_predictor_modules():\n available_trees = build_available_trees()\n modules = []\n for name, tree in available_trees.iteritems():\n name_arr = name.strip().split()\n class_base = ''.join(n.capitalize() for n in name_arr)\n widget_class = get_predictor_widget(class_base, tree)\n config_class = get_predictor_config(class_base, tree)\n class_name = class_base + \"Predictors\"\n def get_widget_method(w_class):\n @staticmethod\n def get_widget_class():\n return w_class\n return get_widget_class\n module = type(class_name, (PredictorList,),\n {'get_widget_class': get_widget_method(widget_class),\n '_input_ports': \\\n [('value',\n '(gov.usgs.sahm:%s:DataInput)' % class_name, True)]})\n \n modules.append((module, {'configureWidgetType': config_class}))\n for module in modules:\n module[0]._output_ports.append(('value_as_string', '(edu.utah.sci.vistrails.basic:String)', True))\n \n return modules", "metadata": "root.build_predictor_modules", "header": "['module', '___EOS___']", "index": 1726 } ]
[ { "span": "import glob", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 }, { "span": "import itertools", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 16 }, { "span": "import sys", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 10 }, { "span": "import subprocess", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 17 }, { "span": "import traceback", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 16 }, { "span": "from core.modules.vistrails_module import Module, ModuleError, ModuleConnector", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 78 }, { "span": "from core.modules.basic_modules import File, Directory, Path, new_constant, Constant", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 84 }, { "span": "from packages.spreadsheet.basic_widgets import SpreadsheetCell, CellLocation", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 76 }, { "span": "from packages.spreadsheet.spreadsheet_cell import QCellWidget, QCellToolBar", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 75 }, { "span": "from core.modules.basic_modules import List", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 43 }, { "span": "from PyQt4 import QtCore, QtGui", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "test", " ", "from", " ", "mari", "an_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", ",_", "Modul", "e", "Connector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "basic", "\\u", "modules_", "import_", "File_", ",_", "Directory_", ",_", "Path_", ",_", "new", "\\u", "constant_", ",_", "Constant_", "\\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", "cell_", "import_", "QC", "ell", "Widget_", ",_", "QC", "ell", "Tool", "Bar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "package", "s", ".", "persiste", "nce", ".", "init", " ", "import", " ", "Persisten", "t", "Path", ",", " ", "Persisten", "t", "File", ",", " ", "Persisten", "t", "Dir_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "basic", "\\u", "modules_", "import_", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "basic", "\\u", "modules_", "import_", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Py", "Qt4_", "import_", "Qt", "Core_", ",_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "widgets_", "import_", "get", "\\u", "predictor", "\\u", "widget_", ",_", "get", "\\u", "predictor", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "enum", "\\u", "widget_", "import_", "build", "\\u", "enum", "\\u", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Select", "Predictor", "s", "Layers_", "import_", "Select", "List", "Dialog_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "import", " ", "our", " ", "python", " ", "SA", "HM", " ", "Process", "ing", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "packages_", "._", "sa", "hm_", "._", "py", "SA", "HM", "_", "._", "Field", "Data", "Query_", "as_", "FD", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "packages_", "._", "sa", "hm_", "._", "py", "SA", "HM", "_", "._", "MD", "SB", "uild", "er_", "as_", "MD", "SB", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "packages_", "._", "sa", "hm_", "._", "py", "SA", "HM", "_", "._", "PAR", "C_", "as_", "parc", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "packages_", "._", "sa", "hm_", "._", "py", "SA", "HM", "_", "._", "Ras", "ter", "Format", "Converter_", "as_", "RF", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "packages_", "._", "sa", "hm_", "._", "py", "SA", "HM", "_", "._", "Max", "ent", "Runner_", "as_", "Max", "ent", "Runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sa", "hm", "Output", "Viewer_", "import_", "SA", "HMM", "odel", "Output", "View", "er", "Cell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sa", "hm", "Spa", "tial", "Output", "Viewer_", "import_", "SA", "HM", "Spa", "tial", "Output", "View", "er", "Cell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "utils_", "import_", "writet", "olog", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py", "SA", "HM", "_", "._", "utilities_", "import_", "Tra", "pped", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Sa", "hm", "Spa", "tial", "Output", "Viewer_", "import_", "set", "QG", "IS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "identifier_", "=_", "'", "gov", ".", "us", "gs", ".", "sa", "hm", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", " ", " ", " ", "def", " ", "compute", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "output", "\\u", "file", " ", "=", " ", "create", "\\u", "file", "\\u", "module", "(", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "File", "Path", "',", " ", "[]", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "set\\u", "output", "('", "value", "',", " ", "output", "\\u", "file", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Sing", "le", "Inp", "ut", "Predictor", "(", "Predictor", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Spa", "tial", "Def", "(", "Modul", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "spat", "ial", "Def", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Spa", "tial", "Def", ":", "Data", "Inp", "ut", ")'", ")]", "_", "\\u\\u\\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_", "#", " ", " ", " ", " ", "def", " ", "compute", "(", "self", ",", " ", "is", "\\u", "input", "=", "Non", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Persisten", "t", "Path", ".", "compute", "(", "self", ",", " ", "is", "\\u", "input", ",", " ", "'", "blob", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", "class", " ", "Clim", "ate", "Model", "(", "String", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "'", "value", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Clim", "ate", "Model", ":", "Ot", "her", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "value", "\\u", "as", "\\u", "string", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'", ",", " ", "Tru", "e", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "widget", "\\u", "class", " ", "=", " ", "build", "\\u", "enum", "\\u", "widget", "('", "Clim", "ate", "Model", "',", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "['", "CCC", "MA", "',", " ", "'", "CSI", "RO", "',", " ", "'", "had", "cm", "3", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "@", "staticmethod_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "get", "\\u", "widget", "\\u", "class", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "Clim", "ate", "Model", ".\\u", "widget", "\\u", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Clim", "ate", "Scen", "ario", "(", "String", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "'", "value", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Clim", "ate", "Scen", "ario", ":", "Ot", "her", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "value", "\\u", "as", "\\u", "string", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'", ",", " ", "Tru", "e", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "widget", "\\u", "class", " ", "=", " ", "build", "\\u", "enum", "\\u", "widget", "('", "Clim", "ate", "Scen", "ario", "',", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "['", "A2", "a", "',", " ", "'", "B2", "b", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "@", "staticmethod_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "get", "\\u", "widget", "\\u", "class", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "Clim", "ate", "Scen", "ario", ".\\u", "widget", "\\u", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Clim", "ate", "Year", "(", "String", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "'", "value", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Clim", "ate", "Year", ":", "Ot", "her", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "value", "\\u", "as", "\\u", "string", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'", ",", " ", "Tru", "e", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "widget", "\\u", "class", " ", "=", " ", "build", "\\u", "enum", "\\u", "widget", "('", "Clim", "ate", "Year", "',", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "['", "2020", "',", " ", "'", "2050", "',", " ", "'", "208", "0", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "@", "staticmethod_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "get", "\\u", "widget", "\\u", "class", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "Clim", "ate", "Year", ".\\u", "widget", "\\u", "class_", "\\u\\u\\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_", "#", "class", " ", "Model", "Output", "Cel", "l", "(", "Spread", "sheet", "Cel", "l", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "\"", "row", "\",", " ", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")\"", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(\"", "column", "\",", " ", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")\"", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "('", "Probabili", "ty", "Map", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Spread", "sheet", "Cel", "l", ".\\u", "\\u", "init", "\\u\\u", "(", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "cell", "Wid", "get", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "compute", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "render", "View", " ", "=", " ", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "Set", "Render", "View", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "render", "View", "==", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "raise", " ", "Modul", "e", "Error", "(", "self", ",", " ", "'", "A", " ", "vtk", "Render", "View", " ", "input", " ", "is", " ", "require", "d", ".'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "cell", "Wid", "get", " ", "=", " ", "self", ".", "display", "And", "Wait", "(", "QV", "TK", "View", "Wid", "get", ",", " ", "(", "render", "View", ",)", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "SA", "HM", "View", "Wid", "get", "(", "QC", "ell", "Wid", "get", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "parent", "=", "Non", "e", ",", " ", "f", "=", "Qt", "Core", ".", "Qt", ".", "Window", "Fla", "gs", "())", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "QC", "ell", "Wid", "get", ".\\u", "\\u", "init", "\\u\\u", "(", "self", ",", " ", "parent", ",", " ", "f", " ", "|", " ", "Qt", "Core", ".", "Qt", ".", "MS", "Window", "s", "Own", "DC", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Ras", "ter", "Layer", "(", "Modul", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "'", "file", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'", "),", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "('", "name", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "self", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Ras", "ter", "Layer", ":", "Data", "Inp", "ut", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Modul", "e", ".\\u", "\\u", "init", "\\u\\u", "(", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "qgis", "\\u", "obj", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "compute", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fname", " ", "=", " ", "self", ".", "get", "\\u", "input", "('", "file", "')", ".", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "name", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "name", " ", "=", " ", "self", ".", "get", "\\u", "input", "('", "name", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "name", " ", "=", " ", "os", ".", "path", ".", "split", "ext", "(", "os", ".", "path", ".", "basen", "ame", "(", "fname", "))", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "qgis", "\\u", "obj", " ", "=", " ", "qgis", ".", "core", ".", "Qg", "s", "Ras", "ter", "Layer", "(", "fname", ",", " ", "name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "set\\u", "output", "('", "self", "',", " ", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Vector", "Layer", "(", "Modul", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "'", "file", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'", "),", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "('", "name", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "self", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Vector", "Layer", ":", "Data", "Inp", "ut", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Modul", "e", ".\\u", "\\u", "init", "\\u\\u", "(", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "qgis", "\\u", "obj", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "def", " ", "compute", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fname", " ", "=", " ", "self", ".", "get", "\\u", "input", "('", "file", "')", ".", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "name", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "name", " ", "=", " ", "self", ".", "get", "\\u", "input", "('", "name", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "name", " ", "=", " ", "os", ".", "path", ".", "split", "ext", "(", "os", ".", "path", ".", "basen", "ame", "(", "fname", "))", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "qgis", "\\u", "obj", " ", "=", " ", "qgis", ".", "core", ".", "Qg", "s", "Vector", "Layer", "(", "fname", ",", " ", "name", ",", " ", "\"", "ogr", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "set\\u", "output", "('", "self", "',", " ", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u", "modules_", "=_", "generat", "e\\u", "namespaces_", "(_", "{_", "'", "Data", "Inp", "ut", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Predictor", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Predictor", "List", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Templa", "te", "Layer_", "]_", "+_", "build", "\\u", "predictor", "\\u", "modules_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Tool", "s", "'_", ":_", "[_", "Field", "Data", "Aggregate", "And", "Weight_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MD", "SB", "uild", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PAR", "C_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ras", "ter", "Format", "Converter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Projection", "Layers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Train", "ing", "Split_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Covar", "iate", "Correla", "tion", "And", "Selection_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Apply", "Model_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Model", "s", "'_", ":_", "[_", "GL", "M_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Random", "Fore", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MAR", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "ENT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Boost", "ed", "Regr", "ession", "Tree_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ot", "her", "'_", ":_", "[_", "(_", "Model_", ",_", "{_", "'", "abstract", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Res", "ample", "Method_", ",_", "{_", "'", "abstract", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Aggregation", "Method_", ",_", "{_", "'", "abstract", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Predictor", "List_", ",_", "{_", "'", "abstract", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Merged", "Data", "Set_", ",_", "{_", "'", "abstract", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV_", ",_", "{_", "'", "abstract", "'_", ":_", "True_", "}_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Output", "'_", ":_", "[_", "SA", "HMM", "odel", "Output", "View", "er", "Cell_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SA", "HM", "Spa", "tial", "Output", "View", "er", "Cell_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Clim", "ate", "Model", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Clim", "ate", "Scen", "ario", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Clim", "ate", "Year_", "\\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_", "menu", "\\u", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "a", " ", "menu", " ", "item", " ", "whi", "ch", " ", "allow", "s", " ", "users", " ", "to", " ", "speci", "fy", " ", "thei", "r", " ", "session", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "change", "\\u", "session", "\\u", "folder_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "session", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "str_", "(_", "Qt", "Gui_", "._", "QF", "ile", "Dialog_", "._", "get", "Exist", "ing", "Directory_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Brows", "e", " ", "to", " ", "new", " ", "session", " ", "folder", " ", "-'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session", "\\u", "dir_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "set", "rootdir_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"*\"_", "*_", "79_", "+_", "\"\\\\", "n", "\"_", "+_", "\"*\"_", "*_", "79_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", "output", " ", "director", "y", ":", " ", " ", " ", "\"_", "+_", "session", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"*\"_", "*_", "79_", "+_", "\"\\\\", "n", "\"_", "+_", "\"*\"_", "*_", "79_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lst_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lst_", "._", "append_", "(_", "(_", "\"", "Change", " ", "session", " ", "folder", "\"_", ",_", "change", "\\u", "session", "\\u", "folder_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "lst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expand", "\\u", "ports_", "(_", "port", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "port", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "port_", "in_", "port", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "\\u", "spec_", "=_", "port_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "port", "\\u", "spec_", ")_", "==_", "str_", ":_", "#", " ", "or", " ", "unicode", "..._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "port", "\\u", "spec_", "._", "startswith_", "(_", "'('_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "\\u", "spec_", "=_", "port", "\\u", "spec_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "port", "\\u", "spec_", "._", "endswith_", "(_", "')'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "\\u", "spec_", "=_", "port", "\\u", "spec_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "spec", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "spec_", "in_", "port", "\\u", "spec_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "=_", "spec_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "spec_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "'", "part", "s", ":'", ",", " ", "parts_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mod", "\\u", "parts_", "=_", "parts_", "[_", "1_", "]_", "._", "rsplit_", "(_", "'|'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "mod", "\\u", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "namespace_", ",_", "module", "\\u", "name_", "=_", "mod", "\\u", "parts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "module", "\\u", "name_", "=_", "parts_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "parts_", "[_", "0_", "]_", "._", "split_", "(_", "'.'_", ")_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "id", "\\u", "str_", "=_", "'", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".'_", "+_", "parts_", "[_", "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 ", " ", " _", "id", "\\u", "str_", "=_", "parts_", "[_", "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 ", " ", "_", "mod", "\\u", "parts_", "=_", "spec_", "._", "rsplit_", "(_", "'|'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "mod", "\\u", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "namespace_", ",_", "module", "\\u", "name_", "=_", "mod", "\\u", "parts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "module", "\\u", "name_", "=_", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "id", "\\u", "str_", "=_", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "namespace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "spec", "\\u", "list_", "._", "append_", "(_", "id", "\\u", "str_", "+_", "':'_", "+_", "module", "\\u", "name_", "+_", "':'_", "+_", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "spec", "\\u", "list_", "._", "append_", "(_", "id", "\\u", "str_", "+_", "':'_", "+_", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port", "\\u", "spec_", "=_", "'('_", "+_", "','_", "._", "join_", "(_", "new", "\\u", "spec", "\\u", "list_", ")_", "+_", "')'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "port", "\\u", "list_", "._", "append_", "(_", "(_", "port_", "[_", "0_", "]_", ",_", "port", "\\u", "spec_", ")_", "+_", "port_", "[_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "new", "\\u", "port", "\\u", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "port", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Field", "Data_", "(_", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Field", " ", "Data", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Field", "Data", " ", "module", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "add", " ", "presen", "ce", "/", "absen", "ce", " ", "points", " ", "or", " ", "count", " ", "data", " ", "recorde", "d", " ", "acro", "ss", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "landscape", " ", "for", " ", "the", " ", "pheno", "men", "on", " ", "bei", "ng", " ", "model", "ed", " ", "(", "e", ".", "g", ".,", " ", "plant", " ", "sight", "ings", ",", " ", "eviden", "ce", " ", "of", " ", "animal", " ", "presen", "ce", ",", " ", "etc", ".)", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "input", " ", "data", " ", "for", " ", "this", " ", "module", " ", "must", " ", "be", " ", "in", " ", "the", " ", "form", " ", "of", " ", "a", " ", ".", "csv", " ", "file", " ", "tha", "t", " ", "follow", "s", " ", "one", " ", "of", " ", "two", " ", "formats", ":", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Format", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "A", " ", ".", "csv", " ", "file", " ", "with", " ", "the", " ", "follow", "ing", " ", "column", " ", "heading", "s", ",", " ", "in", " ", "order", ":", " ", "\"", "X", ",\"", " ", "\"", "Y", ",\"", " ", "and", " ", "\"", "response", "Bin", "ary", "\".\\", "10", ";", " ", " ", " ", " ", "In", " ", "this", " ", "case", ",", " ", "the", " ", "\"", "X", "\"", " ", "field", " ", "shou", "ld", " ", "be", " ", "populate", "d", " ", "with", " ", "the", " ", "horizon", "tal", " ", "(", "longi", "tud", "inal", ")", " ", "positional", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "for", " ", "a", " ", "sample", " ", "point", ".", " ", "The", " ", "\"", "Y", "\"", " ", "field", " ", "shou", "ld", " ", "be", " ", "populate", "d", " ", "with", " ", "the", " ", "vertical", " ", "(", "lat", "itu", "din", "al", ")", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "sample", " ", "point", ".", " ", "The", "se", " ", "values", " ", "must", " ", "be", " ", "in", " ", "the", " ", "same", " ", "coordinate", " ", "system", "/", "unit", "s", " ", "as", " ", "the", " ", "template", "\\", "10", ";", " ", " ", " ", " ", "layer", " ", "used", " ", "in", " ", "the", " ", "workf", "low", ".", " ", "The", " ", "column", " ", "\"", "response", "Bin", "ary", "\"", " ", "shou", "ld", " ", "be", " ", "populate", "d", " ", "with", " ", "eit", "her", " ", "a", " ", "'", "0", "'", "\\", "10", ";", " ", " ", " ", " ", "(", "indicati", "ng", " ", "absen", "ce", " ", "at", " ", "the", " ", "point", ")", " ", "or", " ", "a", " ", "'", "1", "'", " ", "(", "indicati", "ng", " ", "presen", "ce", " ", "at", " ", "the", " ", "point", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Format", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "A", " ", ".", "csv", " ", "file", " ", "with", " ", "the", " ", "follow", "ing", " ", "column", " ", "heading", "s", ",", " ", "in", " ", "order", ":", " ", "\"", "X", ",\"", " ", "\"", "Y", ",\"", " ", "and", " ", "\"", "response", "Count", "\".\\", "10", ";", " ", " ", " ", " ", "In", " ", "this", " ", "case", ",", " ", "the", " ", "\"", "X", "\"", " ", "field", " ", "shou", "ld", " ", "be", " ", "populate", "d", " ", "with", " ", "the", " ", "horizon", "tal", " ", "(", "longi", "tud", "inal", ")", " ", "positional", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "for", " ", "a", " ", "sample", " ", "point", ".", " ", "The", " ", "\"", "Y", "\"", " ", "field", " ", "shou", "ld", " ", "be", " ", "populate", "d", " ", "with", " ", "the", " ", "vertical", " ", "(", "lat", "itu", "din", "al", ")", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "sample", " ", "point", ".", " ", "The", "se", " ", "values", " ", "must", " ", "be", " ", "in", " ", "the", " ", "same", " ", "coordinate", " ", "system", "/", "unit", "s", " ", "as", " ", "the", " ", "template", "\\", "10", ";", " ", " ", " ", " ", "layer", " ", "used", " ", "in", " ", "the", " ", "workf", "low", ".", " ", "The", " ", "column", " ", "\"", "response", "Count", "\"", " ", "shou", "ld", " ", "be", " ", "populate", "d", " ", "with", " ", "eit", "her", " ", "a", " ", "'-", "9999", "'", "\\", "10", ";", " ", " ", " ", " ", "(", "indicati", "ng", " ", "tha", "t", " ", "the", " ", "point", " ", "is", " ", "a", " ", "background", " ", "point", ")", " ", "or", " ", "a", " ", "numerical", " ", "value", " ", "(", "eit", "her", " ", "'", "0", "'", " ", "or", " ", "a", " ", "posit", "ive", " ", "integ", "er", ")", "\\", "10", ";", " ", " ", " ", " ", "indicati", "ng", " ", "the", " ", "number", " ", "of", " ", "inci", "denc", "es", " ", "of", " ", "the", " ", "pheno", "men", "on", " ", "recorde", "d", " ", "at", " ", "tha", "t", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "'", "csv", "File", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Field", "Data", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "\\u", "as", "\\u", "string", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "True_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Aggregation", "Method_", "(_", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "module", " ", "is", " ", "a", " ", "require", "d", " ", "class", " ", "for", " ", "other", " ", "module", "s", " ", "and", " ", "scripts", " ", "within", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "SA", "HM", " ", "package", ".", " ", "It", " ", "is", " ", "not", " ", "inten", "ded", " ", "for", " ", "direct", " ", "use", " ", "or", " ", "inco", "rpor", "ation", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Aggregation", "Meth", "od", ":", "Ot", "her", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "value", "\\u", "as", "\\u", "string", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "True_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "widget", "\\u", "class_", "=_", "build", "\\u", "enum", "\\u", "widget_", "(_", "'", "Aggregation", "Meth", "od", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Mea", "n", "'_", ",_", "'", "Max", "'_", ",_", "'", "Min", "'_", ",_", "'", "Maj", "ori", "ty", "'_", ",_", "'", "Non", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Aggregation", "Method_", "(_", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "widget", "\\u", "class_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Aggregation", "Method_", "._", "\\u", "widget", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Res", "ample", "Method_", "(_", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "module", " ", "is", " ", "a", " ", "require", "d", " ", "class", " ", "for", " ", "other", " ", "module", "s", " ", "and", " ", "scripts", " ", "within", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "SA", "HM", " ", "package", ".", " ", "It", " ", "is", " ", "not", " ", "inten", "ded", " ", "for", " ", "direct", " ", "use", " ", "or", " ", "inco", "rpor", "ation", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Res", "ample", "Meth", "od", ":", "Ot", "her", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "value", "\\u", "as", "\\u", "string", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "True_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "widget", "\\u", "class_", "=_", "build", "\\u", "enum", "\\u", "widget_", "(_", "'", "Res", "ample", "Meth", "od", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Near", "est", "Neighbor", "'_", ",_", "'", "Bil", "ine", "ar", "'_", ",_", "'", "Cub", "ic", "'_", ",_", "'", "Cub", "ic", "Spline", "'_", ",_", "'", "Lan", "cz", "os", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Res", "ample", "Method_", "(_", "String_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "widget", "\\u", "class_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Res", "ample", "Method_", "._", "\\u", "widget", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Predictor", "_", "(_", "Constant_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Predictor", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Predictor", " ", "module", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "select", " ", "a", " ", "single", " ", "rast", "er", " ", "layer", " ", "for", " ", "consider", "ation", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "model", "ed", " ", "analys", "is", ".", " ", "Four", " ", "parameter", "s", " ", "must", " ", "be", " ", "specified", " ", "by", " ", "the", " ", "user", ":", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Aggregation", " ", "Meth", "od", ":", " ", "The", " ", "aggregation", " ", "method", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "event", " ", "tha", "t", " ", "the", " ", "rast", "er", " ", "layer", "\\", "10", ";", " ", " ", " ", " ", "must", " ", "be", " ", "up", "-", "scale", "d", " ", "to", " ", "match", " ", "the", " ", "template", " ", "layer", " ", "(", "e", ".", "g", ".,", " ", "generaliz", "ing", " ", "a", " ", "10", " ", "m", " ", "input", " ", "layer", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "100", " ", "m", " ", "output", " ", "layer", ").", " ", "Care", " ", "shou", "ld", " ", "be", " ", "take", "n", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "aggregation", " ", "method", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "best", " ", "preserve", "s", " ", "the", " ", "integrity", " ", "of", " ", "the", " ", "data", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Res", "ample", " ", "Meth", "od", ":", " ", "The", " ", "resample", " ", "method", " ", "employ", "ed", " ", "to", " ", "interpolat", "e", " ", "new", " ", "cell", " ", "values", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "transform", "ing", " ", "the", " ", "rast", "er", " ", "layer", " ", "to", " ", "the", " ", "coordinate", " ", "space", " ", "or", " ", "cell", " ", "size", " ", "of", " ", "the", " ", "template", " ", "layer", ",", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "necessar", "y", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Categori", "cal", " ", "(", "Boo", "lean", "):", " ", "Check", "ing", " ", "this", " ", "box", " ", "indicat", "es", " ", "tha", "t", " ", "the", " ", "data", " ", "contain", "ed", " ", "in", " ", "the", " ", "rast", "er", "\\", "10", ";", " ", " ", " ", " ", "layer", " ", "is", " ", "categor", "ical", " ", "(", "e", ".", "g", ".", " ", "land", "cover", " ", "categor", "ies", ").", " ", "Leav", "ing", " ", "this", " ", "box", " ", "uncheck", "ed", " ", "indicat", "es", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "data", " ", "contain", "ed", " ", "in", " ", "the", " ", "rast", "er", " ", "is", " ", "continuous", " ", "(", "e", ".", "g", ".,", " ", "a", " ", "DEM", " ", "layer", ").", " ", "Thi", "s", " ", "distinct", "ion", " ", "is", " ", "importa", "nt", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "determini", "ng", " ", "an", " ", "appropr", "iate", " ", "resa", "mpli", "ng", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "4", ".", " ", "File", " ", "Path", ":", " ", "The", " ", "location", " ", "of", " ", "the", " ", "rast", "er", " ", "predictor", " ", "file", ",", " ", "whi", "ch", " ", "a", " ", "user", " ", "can", " ", "speci", "fy", " ", "by", " ", "navi", "gati", "ng", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "file", "'", "s", " ", "location", " ", "on", " ", "thei", "r", " ", "file", " ", "system", ".", " ", "Whe", "n", " ", "a", " ", "user", " ", "is", " ", "selecti", "ng", " ", "an", " ", "ESR", "I", " ", "grid", " ", "rast", "er", ",", " ", "the", " ", "user", " ", "shou", "ld", " ", "navigate", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "'", "hdr", ".", "adf", "'", " ", "file", " ", "contain", "ed", " ", "within", " ", "the", " ", "grid", " ", "folder", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "'", "categor", "ical", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Res", "ample", "Meth", "od", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Res", "ample", "Meth", "od", ":", "Ot", "her", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Bil", "ine", "ar", "'_", "]_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Aggregation", "Meth", "od", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Aggregation", "Meth", "od", ":", "Ot", "her", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Mea", "n", "'_", "]_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "file", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Path", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Predictor", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "\\u", "as", "\\u", "string", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "True_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Predictor", "_", "(_", "Constant_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Res", "ample", "Meth", "od", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resample", "Method_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Res", "ample", "Meth", "od", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resample", "Method_", "._", "lower_", "(_", ")_", "not_", "in_", "[_", "'", "near", "est", "neighbor", "'_", ",_", "'", "bili", "near", "'_", ",_", "'", "cubi", "c", "'_", ",_", "'", "cubi", "csp", "line", "'_", ",_", "'", "lanc", "zo", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Res", "ample", " ", "Meth", "od", " ", "not", " ", "one", " ", "of", " ", "'", "near", "est", "neighbor", "',", " ", "'", "bili", "near", "',", " ", "'", "cubi", "c", "',", " ", "'", "cubi", "csp", "line", "',", " ", "or", " ", "'", "lanc", "zo", "s", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resample", "Method_", "=_", "'", "Bil", "ine", "ar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Aggregation", "Meth", "od", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aggregation", "Method_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Aggregation", "Meth", "od", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Aggregation", "Meth", "od", "\"_", ")_", "._", "lower_", "(_", ")_", "not_", "in_", "[_", "'", "mean", "'_", ",_", "'", "max", "'_", ",_", "'", "min", "'_", ",_", "'", "major", "it", "y", "'_", ",_", "'", "none", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "No", " ", "Aggregation", " ", "Meth", "od", " ", "specified", "\"_", ")_", "\\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 ", " _", "aggregation", "Method_", "=_", "\"", "Mea", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "categor", "ical", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "categor", "ical", "\"_", ")_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "categorical_", "=_", "'", "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 ", " _", "categorical_", "=_", "'", "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 ", " _", "categorical_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "file", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "File_", "=_", "utils_", "._", "get", "Ras", "ter", "Name_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "file", "\"_", ")_", "._", "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 ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "No", " ", "input", " ", "file", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "value", "'_", ",_", "(_", "in", "File_", ",_", "categorical_", ",_", "resample", "Method_", ",_", "aggregation", "Method_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Predictor", "List_", "(_", "Constant_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "module", " ", "is", " ", "a", " ", "require", "d", " ", "class", " ", "for", " ", "other", " ", "module", "s", " ", "and", " ", "scripts", " ", "within", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "SA", "HM", " ", "package", ".", " ", "It", " ", "is", " ", "not", " ", "inten", "ded", " ", "for", " ", "direct", " ", "use", " ", "or", " ", "inco", "rpor", "ation", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "value", "'_", ",_", "'", "Ot", "her", "|", "Predictor", "List", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "add", "Predictor", "'_", ",_", "'", "Data", "Inp", "ut", "|", "Predictor", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "value", "'_", ",_", "'", "Ot", "her", "|", "Predictor", "List", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Predictor", "List_", "(_", "Constant_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "translat", "e\\u", "to", "\\u", "string_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Predictor", "List_", "(_", "Constant_", ")_", ":_", "\\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_", "translat", "e\\u", "to", "\\u", "python_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v", "\\u", "list_", "=_", "eval_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "v", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Predictor", "List_", "(_", "Constant_", ")_", ":_", "\\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_", "validate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "(_", "x_", ")_", "==_", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Predictor", "List_", "(_", "Constant_", ")_", ":_", "\\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 ", " _", "p", "\\u", "list_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "add", "Predictor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "value", "\"_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "self_", "._", "validate_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Intern", "al", " ", "Error", ":", " ", "Const", "ant", " ", "fail", "ed", " ", "validation", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "v_", ")_", ">_", "0_", "and_", "type_", "(_", "v_", "[_", "0_", "]_", ")_", "==_", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "list_", "=_", "[_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "v", "\\u", "elt_", "[_", "1_", "]_", ")_", "for_", "v", "\\u", "elt_", "in_", "v_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "list_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p", "\\u", "list_", "+=_", "f", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "set\\u", "output", "(\"", "value", "\",", " ", "p", "\\u", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "value", "\"_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Predictor", "List", "File_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Predictor", " ", "List", " ", "File", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Predictor", "List", "File", " ", "module", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "load", " ", "a", " ", ".", "csv", " ", "file", " ", "contain", "ing", " ", "a", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "rast", "ers", " ", "for", " ", "consider", "ation", " ", "in", " ", "the", " ", "model", "ed", " ", "analys", "is", ".", " ", "The", " ", ".", "csv", " ", "file", " ", "shou", "ld", " ", "contain", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "header", " ", "row", " ", "and", " ", "four", " ", "column", "s", " ", "contain", "ing", " ", "the", " ", "follow", "ing", " ", "informati", "on", ",", " ", "in", " ", "order", ",", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "rast", "er", " ", "input", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Colum", "n", " ", "1", ":", " ", "The", " ", "full", " ", "file", " ", "path", " ", "to", " ", "the", " ", "input", " ", "rast", "er", " ", "layer", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Colum", "n", " ", "2", ":", " ", "A", " ", "binar", "y", " ", "value", " ", "indicati", "ng", " ", "whe", "ther", " ", "the", " ", "input", " ", "layer", " ", "is", " ", "categor", "ical", " ", "or", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "value", " ", "of", " ", "\"", "0", "\"", " ", "indicat", "es", " ", "tha", "t", " ", "an", " ", "input", " ", "rast", "er", " ", "is", " ", "non", "-", "categor", "ical", " ", "data", " ", "(", "continuous", "),", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "a", " ", "value", " ", "of", " ", "\"", "1", "\"", " ", "indicat", "es", " ", "tha", "t", " ", "an", " ", "input", " ", "rast", "er", " ", "is", " ", "categor", "ical", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Colum", "n", " ", "3", ":", " ", "The", " ", "resa", "mpli", "ng", " ", "method", " ", "employ", "ed", " ", "to", " ", "interpolat", "e", " ", "new", " ", "cell", " ", "values", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "transform", "ing", " ", "the", " ", "rast", "er", " ", "layer", " ", "to", " ", "the", " ", "coordinate", " ", "space", " ", "or", " ", "cell", " ", "size", " ", "of", " ", "the", " ", "template", "\\", "10", ";", " ", " ", " ", " ", "layer", ",", " ", "if", " ", "necessar", "y", ".", " ", "The", " ", "resa", "mpli", "ng", " ", "type", " ", "shou", "ld", " ", "be", " ", "specified", " ", "usi", "ng", " ", "one", " ", "of", " ", "the", " ", "follow", "ing", "\\", "10", ";", " ", " ", " ", " ", "values", ":", " ", "\"", "near", "est", "neighbor", ",\"", " ", "\"", "bili", "near", ",\"", " ", "\"", "cubi", "c", ",\"", " ", "or", " ", "\"", "lanc", "zo", "s", ".\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Colum", "n", " ", "4", ":", " ", "The", " ", "aggregation", " ", "method", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "event", " ", "tha", "t", " ", "the", " ", "rast", "er", " ", "layer", "\\", "10", ";", " ", " ", " ", " ", "must", " ", "be", " ", "up", "-", "scale", "d", " ", "to", " ", "match", " ", "the", " ", "template", " ", "layer", " ", "(", "e", ".", "g", ".,", " ", "generaliz", "ing", " ", "a", " ", "10", " ", "m", " ", "input", " ", "layer", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "100", " ", "m", " ", "output", " ", "layer", ").", " ", "Care", " ", "shou", "ld", " ", "be", " ", "take", "n", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "aggregation", " ", "method", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "best", " ", "preserve", "s", " ", "the", " ", "integrity", " ", "of", " ", "the", " ", "data", " ", "is", " ", "used", ".", " ", "The", " ", "aggregation", " ", "shou", "ld", " ", "be", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "one", " ", "of", " ", "the", " ", "follow", "ing", " ", "values", ":", " ", "\"", "Min", ",\"", " ", "\"", "Mea", "n", ",\"", " ", "\"", "Max", ",\"", " ", "\"", "Maj", "ori", "ty", ",\"", " ", "or", " ", "\"", "Non", "e", ".\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "format", "ting", " ", "the", " ", "list", " ", "of", " ", "predictor", " ", "files", ",", " ", "the", " ", "titles", " ", "assign", "ed", " ", "to", " ", "each", " ", "of", " ", "the", " ", "column", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "unim", "porta", "nt", " ", "as", " ", "the", " ", "module", " ", "retrieve", "s", " ", "the", " ", "informati", "on", " ", "based", " ", "on", " ", "the", " ", "order", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "values", " ", "in", " ", "the", " ", ".", "csv", " ", "file", " ", "(", "the", " ", "orderi", "ng", " ", "of", " ", "the", " ", "informati", "on", " ", "and", " ", "the", " ", "permissi", "ble", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "file", " ", "how", "ever", ",", " ", "are", " ", "strict", "ly", " ", "enforce", "d", ").", " ", "The", " ", "module", " ", "als", "o", " ", "antic", "ipat", "es", " ", "a", " ", "header", " ", "row", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "will", " ", "ignore", " ", "the", " ", "first", " ", "row", " ", "in", " ", "the", " ", ".", "csv", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "csv", "File", "List", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "add", "Predictor", "'_", ",_", "'", "Data", "Inp", "ut", "|", "Predictor", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", ":", "Ot", "her", ")'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "copie", "s", " ", "the", " ", "input", " ", "predictor", " ", "list", " ", "csv", " ", "to", " ", "our", " ", "working", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "#", "and", " ", "append", "s", " ", "any", " ", "addition", "ally", " ", "adde", "d", " ", "predictor", "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_", "[SEP]_", "class_", "Predictor", "List", "File_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "translat", "e\\u", "to", "\\u", "string_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Predictor", "List", "File_", "(_", "Module_", ")_", ":_", "\\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_", "translat", "e\\u", "to", "\\u", "python_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v", "\\u", "list_", "=_", "eval_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "v", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Predictor", "List", "File_", "(_", "Module_", ")_", ":_", "\\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_", "validate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "(_", "x_", ")_", "==_", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Predictor", "List", "File_", "(_", "Module_", ")_", ":_", "\\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 ", " _", "if_", "not_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "csv", "File", "List", "\"_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "add", "Predictor", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "No", " ", "inputs", " ", "or", " ", "CSV", " ", "file", " ", "provided", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "\\u", "fname_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "Predictor", "List", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "csv", "File", "List", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "csv", "File", "List", "\"_", ")_", "._", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copy_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "csv", "File", "List", "\"_", ")_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "\\u", "writer_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "output", "\\u", "fname_", ",_", "'", "ab", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "create", " ", "an", " ", "empty", " ", "file", " ", "to", " ", "start", " ", "with", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv", "\\u", "writer_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "output", "\\u", "fname_", ",_", "'", "wb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "\\u", "writer_", "._", "writerow_", "(_", "[_", "\"", "file", "\"_", ",_", "\"", "Res", "ampling", "\"_", ",_", "\"", "Aggregation", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "add", "Predictor", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "list_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "add", "Predictor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "p", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "._", "has", "\\u", "input_", "(_", "'", "resample", "Meth", "od", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res", "Method_", "=_", "p_", "._", "get", "\\u", "input_", "(_", "'", "resample", "Meth", "od", "'_", ")_", "\\u\\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", "Method_", "=_", "\"", "Near", "est", "Neighbor", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "._", "has", "\\u", "input_", "(_", "'", "aggregation", "Meth", "od", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "agg", "Method_", "=_", "p_", "._", "get", "\\u", "input_", "(_", "'", "aggregation", "Meth", "od", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "agg", "Method_", "=_", "\"", "Mea", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "csv", "\\u", "writer_", "._", "writerow_", "(_", "[_", "os_", "._", "path_", "._", "normpath_", "(_", "p_", "._", "name_", ")_", ",_", "res", "Method_", ",_", "agg", "Method_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "csv", "\\u", "writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Templa", "te", "Layer_", "(_", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Templa", "te", " ", "Layer", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Templa", "te", "Layer", " ", "is", " ", "a", " ", "rast", "er", " ", "data", " ", "layer", " ", "with", " ", "a", " ", "defin", "ed", " ", "coordinate", " ", "system", ",", " ", "a", " ", "know", "n", " ", "cell", " ", "size", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "an", " ", "extent", " ", "tha", "t", " ", "defin", "es", " ", "the", " ", "stud", "y", " ", "area", ".", " ", "Thi", "s", " ", "rast", "er", " ", "layer", " ", "serve", "s", " ", "as", " ", "the", " ", "template", " ", "for", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "other", " ", "inputs", " ", "in", " ", "the", " ", "analys", "is", ".", " ", "All", " ", "addition", "al", " ", "rast", "er", " ", "layer", "s", " ", "used", " ", "in", " ", "the", " ", "analys", "is", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "resample", "d", " ", "and", " ", "repro", "ject", "ed", " ", "as", " ", "need", "ed", " ", "to", " ", "match", " ", "the", " ", "template", ",", " ", "snapp", "ed", " ", "to", " ", "the", " ", "template", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "clipped", " ", "to", " ", "have", " ", "an", " ", "extent", " ", "tha", "t", " ", "matche", "s", " ", "the", " ", "template", ".", " ", "User", "s", " ", "shou", "ld", " ", "ensure", " ", "tha", "t", " ", "any", " ", "addition", "al", "\\", "10", ";", " ", " ", " ", " ", "layer", "s", " ", "consider", "ed", " ", "in", " ", "the", " ", "analys", "is", " ", "have", " ", "covera", "ge", " ", "within", " ", "the", " ", "extent", " ", "of", " ", "the", " ", "template", " ", "layer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Templa", "te", "Layer", " ", "is", " ", "a", " ", "require", "d", " ", "input", " ", "for", " ", "the", " ", "PAR", "C", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "[(", "'", "File", "Path", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "value", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Templa", "te", "Layer", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "value", "\\u", "as", "\\u", "string", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "True_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Merged", "Data", "Set_", "(_", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "module", " ", "is", " ", "a", " ", "require", "d", " ", "class", " ", "for", " ", "other", " ", "module", "s", " ", "and", " ", "scripts", " ", "within", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "SA", "HM", " ", "package", ".", " ", "It", " ", "is", " ", "not", " ", "inten", "ded", " ", "for", " ", "direct", " ", "use", " ", "or", " ", "inco", "rpor", "ation", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "mds", "File", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "value", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")'_", ")_", "]_", ")_", "\\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_", "class_", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV_", "(_", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "module", " ", "is", " ", "a", " ", "require", "d", " ", "class", " ", "for", " ", "other", " ", "module", "s", " ", "and", " ", "scripts", " ", "within", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "SA", "HM", " ", "package", ".", " ", "It", " ", "is", " ", "not", " ", "inten", "ded", " ", "for", " ", "direct", " ", "use", " ", "or", " ", "inco", "rpor", "ation", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "mds", "File", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "value", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")'_", ")_", "]_", ")_", "\\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_", "class_", "Apply", "Model_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Apply", " ", "Model", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Apply", "Model", " ", "module", " ", "allow", "s", " ", "the", " ", "user", " ", "to", " ", "appl", "y", " ", "a", " ", "model", " ", "develop", "ed", " ", "usi", "ng", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "partic", "ular", " ", "package", " ", "within", " ", "the", " ", "workf", "low", " ", "and", " ", "generat", "e", " ", "output", " ", "probabilit", "y", " ", "and", " ", "binar", "y", "\\", "10", ";", " ", " ", " ", " ", "maps", ".", " ", "The", " ", "process", " ", "of", " ", "creati", "ng", " ", "an", " ", "output", " ", "probabilit", "y", " ", "map", " ", "and", " ", "binar", "y", " ", "map", " ", "based", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "partic", "ular", " ", "model", " ", "can", " ", "be", " ", "time", "-", "consum", "ing", ",", " ", "depend", "ing", " ", "on", " ", "the", " ", "input", " ", "data", ".", " ", "By", "\\", "10", ";", " ", " ", " ", " ", "exist", "ing", " ", "as", " ", "a", " ", "stand", "-", "alo", "ne", " ", "process", " ", "in", " ", "the", " ", "workf", "low", ",", " ", "the", " ", "Apply", "Model", " ", "module", " ", "allow", "s", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "user", " ", "to", " ", "investigat", "e", " ", "the", " ", "perform", "anc", "e", " ", "metric", "s", " ", "for", " ", "a", " ", "partic", "ular", " ", "model", " ", "(", "suc", "h", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "ROC", " ", "curve", " ", "or", " ", "the", " ", "AUC", ")", " ", "bef", "ore", " ", "ded", "icat", "ing", " ", "the", " ", "process", "ing", " ", "time", " ", "need", "ed", " ", "to", " ", "generat", "e", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "output", " ", "maps", ".", " ", "In", " ", "most", " ", "case", "s", ",", " ", "a", " ", "user", " ", "will", " ", "\"", "fine", " ", "tune", "\"", " ", "a", " ", "model", " ", "by", " ", "expl", "orin", "g", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "perform", "anc", "e", " ", "metric", "s", " ", "of", " ", "different", " ", "model", " ", "iterati", "ons", " ", "bef", "ore", " ", "appl", "ying", " ", "the", " ", "model", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "generat", "ing", " ", "the", " ", "actual", " ", "maps", " ", "as", " ", "a", " ", "final", " ", "step", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Apply", "Model", " ", "module", " ", "als", "o", " ", "provide", "s", " ", "the", " ", "user", " ", "with", " ", "the", " ", "option", " ", "of", " ", "projecti", "ng", " ", "the", " ", "results", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "a", " ", "model", " ", "develop", "ed", " ", "from", " ", "one", " ", "set", " ", "of", " ", "environ", "menta", "l", " ", "predictor", "s", " ", "onto", " ", "a", " ", "new", " ", "model", "ed", " ", "space", "\\", "10", ";", " ", " ", " ", " ", "contain", "ing", " ", "tha", "t", " ", "same", " ", "set", " ", "of", " ", "environ", "menta", "l", " ", "predictor", "s", " ", "but", " ", "represent", "ing", " ", "data", " ", "captured", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "different", " ", "tempora", "l", " ", "or", " ", "spat", "ial", " ", "location", ".", " ", "For", " ", "example", ",", " ", "a", " ", "user", " ", "coul", "d", " ", "generat", "e", " ", "a", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "predicti", "ng", " ", "habit", "at", " ", "suit", "abilit", "y", " ", "usi", "ng", " ", "recorde", "d", " ", "presen", "ce", " ", "points", " ", "and", " ", "cert", "ain", " ", "environ", "menta", "l", "\\", "10", ";", " ", " ", " ", " ", "predictor", "s", " ", "suc", "h", " ", "as", " ", "elevat", "ion", ",", " ", "land", "cover", ",", " ", "and", " ", "proxim", "it", "y", " ", "to", " ", "water", " ", "in", " ", "one", " ", "geographic", "\\", "10", ";", " ", " ", " ", " ", "location", ".", " ", "Base", "d", " ", "on", " ", "the", " ", "train", "ing", " ", "from", " ", "this", " ", "informati", "on", ",", " ", "the", " ", "model", "ed", " ", "results", " ", "coul", "d", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "generat", "ed", " ", "for", " ", "(", "or", " ", "\"", "projected", " ", "to", "\")", " ", "a", " ", "new", " ", "location", " ", "based", " ", "on", " ", "the", " ", "range", " ", "of", " ", "values", " ", "see", "n", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "elevat", "ion", ",", " ", "land", "cover", ",", " ", "and", " ", "proxim", "it", "y", " ", "to", " ", "water", " ", "in", " ", "the", " ", "second", " ", "geographic", " ", "area", ".", " ", "Simil", "arl", "y", ",", "\\", "10", ";", " ", " ", " ", " ", "modeling", " ", "predi", "cte", "d", " ", "results", " ", "through", " ", "time", " ", "is", " ", "als", "o", " ", "possib", "le", ".", " ", "A", " ", "model", " ", "trained", " ", "usi", "ng", " ", "field", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "and", " ", "a", " ", "set", " ", "of", " ", "predictor", " ", "layer", "s", " ", "representative", " ", "of", " ", "one", " ", "time", " ", "period", " ", "coul", "d", " ", "be", " ", "projected", "\\", "10", ";", " ", " ", " ", " ", "onto", " ", "the", " ", "same", " ", "geographic", "al", " ", "area", " ", "usi", "ng", " ", "a", " ", "new", " ", "set", " ", "of", " ", "layer", "s", " ", "correspond", "ing", " ", "to", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", " ", "predictor", "s", " ", "but", " ", "represent", "ing", " ", "data", " ", "from", " ", "a", " ", "different", " ", "time", " ", "period", " ", "(", "e", ".", "g", ".,", " ", "different", " ", "climate", "\\", "10", ";", " ", " ", " ", " ", "data", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Apply", "Model", " ", "module", " ", "accepts", " ", "two", " ", "inputs", " ", "from", " ", "the", " ", "user", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Model", " ", "Works", "pace", ":", " ", "The", " ", "model", " ", "works", "pace", " ", "field", " ", "accepts", " ", "as", " ", "an", " ", "input", " ", "a", " ", "modeling", "\\", "10", ";", " ", " ", " ", " ", "package", " ", "element", " ", "(", "complete", " ", "with", " ", "all", " ", "require", "d", " ", "parameter", "s", ")", " ", "from", " ", "ups", "tream", " ", "in", " ", "the", " ", "workf", "low", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "inputs", " ", "and", " ", "specifica", "tion", "s", " ", "provided", " ", "in", " ", "the", " ", "dialogue", " ", "fields", " ", "of", " ", "the", " ", "model", " ", "will", " ", "be", " ", "applied", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "used", " ", "to", " ", "generat", "e", " ", "the", " ", "output", " ", "maps", ".", " ", "A", " ", "user", " ", "shou", "ld", " ", "populate", " ", "the", " ", "model", " ", "works", "pace", " ", "field", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "connecti", "ng", " ", "a", " ", "model", " ", "element", " ", "to", " ", "the", " ", "appropr", "iate", " ", "input", " ", "port", " ", "of", " ", "the", " ", "Apply", "Model", " ", "module", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "visu", "al", " ", "display", " ", "of", " ", "the", " ", "model", " ", "workf", "low", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Projection", " ", "Target", ":", " ", "The", " ", "projecti", "on", " ", "target", " ", "is", " ", "an", " ", "option", "al", " ", "parameter", " ", "tha", "t", " ", "allow", "s", " ", "a", " ", "user", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "appl", "y", " ", "a", " ", "model", " ", "to", " ", "a", " ", "partic", "ular", " ", "geographic", " ", "area", " ", "and", " ", "or", " ", "set", " ", "of", " ", "predictor", "s", " ", "(", "other", " ", "than", " ", "tho", "se", "\\", "10", ";", " ", " ", " ", " ", "used", " ", "to", " ", "train", " ", "the", " ", "model", ")", " ", "and", " ", "create", " ", "output", " ", "maps", " ", "within", " ", "the", " ", "spat", "ial", " ", "extent", " ", "of", " ", "the", " ", "projecti", "on", "\\", "10", ";", " ", " ", " ", " ", "target", " ", "layer", "s", ".", " ", "Thi", "s", " ", "input", " ", "field", " ", "shou", "ld", " ", "be", " ", "populate", "d", " ", "by", " ", "connecti", "ng", " ", "eit", "her", " ", "the", " ", "output", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Projection", "Layer", "s", " ", "module", " ", "or", " ", "a", " ", "separate", " ", "MD", "SB", "uild", "er", " ", "element", " ", "to", " ", "the", " ", "appropr", "iate", " ", "input", " ", "port", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Apply", "Model", " ", "module", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "'", "projecti", "on", "Target", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "model", "Works", "pace", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "make", "Bin", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "make", "Probabili", "ty", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ")_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "Bin", "ary", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Probabili", "ty", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Apply", "Model_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workspace_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "model", "Works", "pace", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "dname_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "'", "Appl", "ied", "Model", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "projecti", "on", "Target", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mds", "File_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "projecti", "on", "Target", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "\"", "ws", "=\"_", "+_", "'\"'_", "+_", "workspace_", "+_", "'\"'_", "+_", "\"", " ", "c", "=\"_", "+_", "'\"'_", "+_", "mds", "File_", "+_", "'\"'_", "+_", "\"", " ", "o", "=\"_", "+_", "'\"'_", "+_", "output", "\\u", "dname_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "\"", "ws", "=\"_", "+_", "'\"'_", "+_", "workspace_", "+_", "'\"'_", "+_", "\"", " ", "o", "=\"_", "+_", "'\"'_", "+_", "output", "\\u", "dname_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "make", "Bin", "Map", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "Bin", "Map_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "make", "Bin", "Map", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "+=_", "'", " ", "mb", "t", "='_", "+_", "str_", "(_", "make", "Bin", "Map_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "+=_", "'", " ", "mb", "t", "=", "TRU", "E", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "make", "Probabili", "ty", "Map", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "Probabili", "ty", "Map_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "make", "Probabili", "ty", "Map", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "+=_", "'", " ", "mpt", "='_", "+_", "str_", "(_", "make", "Probabili", "ty", "Map_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "+=_", "'", " ", "mpt", "=", "TRU", "E", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utils_", "._", "run", "RS", "cript_", "(_", "'", "Predic", "t", "Model", ".", "r", "'_", ",_", "args_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "\"", "prob", "\\u", "map", ".", "tif", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "'", "prob", "\\u", "map", ".", "jpeg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "input", "\\u", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "tif", "\\u", "to", "\\u", "color", "\\u", "jpeg", "_", "(_", "input", "\\u", "fname_", ",_", "output", "\\u", "fname_", ",_", "color", "\\u", "breaks", "\\u", "csv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file1_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Probabili", "ty", "Map", "'_", ",_", "output", "\\u", "file1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Expect", "ed", " ", "output", " ", "from", " ", "Apply", "Model", " ", "was", " ", "not", " ", "found", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\"\\\\", "n", "Thi", "s", " ", "like", "ly", " ", "indicat", "es", " ", "problem", "s", " ", "with", " ", "the", " ", "inputs", " ", "to", " ", "the", " ", "R", " ", "module", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "msg_", ",_", "False_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "\"", "bin", "\\u", "map", ".", "tif", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "\"", "bin", "\\u", "map", ".", "tif", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file2_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Bin", "ary", "Map", "'_", ",_", "output", "\\u", "file2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Model_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "module", " ", "is", " ", "a", " ", "require", "d", " ", "class", " ", "for", " ", "other", " ", "module", "s", " ", "and", " ", "scripts", " ", "within", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "SA", "HM", " ", "package", ".", " ", "It", " ", "is", " ", "not", " ", "inten", "ded", " ", "for", " ", "direct", " ", "use", " ", "or", " ", "inco", "rpor", "ation", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "'", "mds", "File", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "make", "Bin", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Tru", "e", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "False_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "make", "Probabili", "ty", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Tru", "e", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "False_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "make", "MES", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Fal", "se", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "False_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Thresh", "old", "Optim", "izatio", "n", "Meth", "od", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "2", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "False_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "model", "Works", "pace", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Bin", "ary", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Probabili", "ty", "Map", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "AUC", "\\u", "plot", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Respons", "e", "Curve", "s", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Text", "\\u", "Output", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Model_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "color", "\\u", "breaks", "\\u", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Output_", "=_", "{_", "\"", "FIT", "\\u", "BR", "T", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "br", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FIT", "\\u", "GL", "M", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "glm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FIT", "\\u", "RF", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "rf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FIT", "\\u", "MAR", "S", "\\u", "plug", "gab", "le", ".", "r", "\"_", ":_", "\"", "mars", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model", "Abbr", "ev_", "=_", "Model", "Output_", "[_", "self_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "dname_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "Model", "Abbr", "ev_", "+_", "'", "output", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "Dict_", "=_", "utils_", "._", "map", "\\u", "ports_", "(_", "self_", ",_", "self_", "._", "port", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mds", "File_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "mds", "File", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "args", "Dict_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "'", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "+=_", "'", " ", "'_", "+_", "'='_", "._", "join_", "(_", "[_", "str_", "(_", "k_", ")_", ",_", "'\"'_", "+_", "str_", "(_", "v_", ")_", "+_", "'\"'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "+=_", "'", " ", "'_", "+_", "'='_", "._", "join_", "(_", "[_", "str_", "(_", "k_", ")_", ",_", "str_", "(_", "v_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "+=_", "\"", " ", "o", "=\"_", "+_", "'\"'_", "+_", "output", "\\u", "dname_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "+=_", "\"", " ", "rc", "=\"_", "+_", "utils_", "._", "MD", "Sr", "esp", "ons", "e", "Col_", "(_", "mds", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "make", "Bin", "Map", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Bin", "Map", " ", "=", " ", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "make", "Bin", "Map", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mb", "t", "='", " ", "+", " ", "str", "(", "make", "Bin", "Map", ").", "upper", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Bin", "Map", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mb", "t", "=", "TRU", "E", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "make", "Probabili", "ty", "Map", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Probabili", "ty", "Map", " ", "=", " ", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "make", "Probabili", "ty", "Map", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mpt", "='", " ", "+", " ", "str", "(", "make", "Probabili", "ty", "Map", ").", "upper", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "make", "Probabili", "ty", "Map", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "mpt", "=", "TRU", "E", "'", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "seed", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "'", " ", "seed", "='", " ", "+", " ", "str", "(", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "seed", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "has", "\\u", "input", "('", "some", "Param", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "x", " ", "=", " ", "self", ".", "force", "\\u", "get", "\\u", "input", "('", "some", "Param", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "x", " ", ">", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "msg", " ", "=", " ", "\"", "Expect", "ed", " ", "output", " ", "from", " ", "\"", " ", "+", " ", "Model", "Abbr", "ev", " ", "+", " ", "\"", " ", "was", " ", "not", " ", "found", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "msg", " ", "+=", " ", "\"\\\\", "n", "Thi", "s", " ", "like", "ly", " ", "indicat", "es", " ", "problem", "s", " ", "with", " ", "the", " ", "inputs", " ", "to", " ", "the", " ", "R", " ", "module", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writet", "olog", "(", "msg", ",", " ", "Fal", "se", ",", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "args", " ", "+=", " ", "\"", " ", "abr", "=\"", " ", "+", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "run", "RS", "cript_", "(_", "self_", "._", "name_", ",_", "args_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "util", "s", ".", "run", "RS", "cript", "('", "FIT", "\\u", "BR", "T", "\\u", "plug", "gab", "le", "Error", "Messag", "e", ".", "r", "',", " ", "args", ",", " ", "self", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "prob", "\\u", "map", ".", "tif", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "prob", "\\u", "map", ".", "jpeg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "input", "\\u", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "util", "s", ".", "tif", "\\u", "to", "\\u", "color", "\\u", "jpeg", "(", "input", "\\u", "fname", ",", " ", "output", "\\u", "fname", ",", " ", "color", "\\u", "breaks", "\\u", "csv", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "output", "\\u", "file", "4", " ", "=", " ", "util", "s", ".", "create", "\\u", "file", "\\u", "module", "(", "output", "\\u", "fname", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "output_", "(_", "'", "Probabili", "ty", "Map", "'_", ",_", "input", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mpt", "'_", ")_", "and_", "args", "Dict_", "[_", "'", "mpt", "'_", "]_", "==_", "True_", ")_", "or_", "not_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mpt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Expect", "ed", " ", "output", " ", "from", " ", "\"_", "+_", "Model", "Abbr", "ev_", "+_", "\"", " ", "was", " ", "not", " ", "found", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\"\\\\", "n", "Thi", "s", " ", "mig", "ht", " ", "indicat", "e", " ", "problem", "s", " ", "with", " ", "the", " ", "inputs", " ", "to", " ", "the", " ", "R", " ", "module", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "\"\\\\", "n", "Check", " ", "the", " ", "console", " ", "output", " ", "for", " ", "addition", "al", " ", "R", " ", "warn", "ings", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "msg_", ",_", "False_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mb", "t", "'_", ")_", "and_", "args", "Dict_", "[_", "'", "mb", "t", "'_", "]_", "==_", "True_", ")_", "or_", "not_", "args", "Dict_", "._", "has", "\\u", "key_", "(_", "'", "mb", "t", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "bin", "\\u", "map", ".", "tif", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file1_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Bin", "ary", "Map", "'_", ",_", "output", "\\u", "file1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "output", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file2_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Text", "\\u", "Output", "'_", ",_", "output", "\\u", "file2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "auc", "\\u", "plot", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "out", " ", "auc", ":", " ", "\",", " ", "out", "File", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file", "3_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "AUC", "\\u", "plot", "'_", ",_", "output", "\\u", "file", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "Model", "Abbr", "ev_", "+_", "\"\\u", "response", "\\u", "curve", "s", ".", "pdf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file", "5_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Respons", "e", "Curve", "s", "'_", ",_", "output", "\\u", "file", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out", "File", "Name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "\"", "model", "Works", "pace", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "out", " ", "auc", ":", " ", "\",", " ", "out", "File", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file", "6_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "out", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "model", "Works", "pace", "'_", ",_", "output", "\\u", "file", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "\"_", "+_", "Model", "Abbr", "ev_", "+_", "\"", " ", "builde", "r", "\\\\", "n", "\"_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "GL", "M_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "input", "\\u", "ports_", "=_", "list_", "(_", "Model_", "._", "\\u", "input", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "._", "extend_", "(_", "[_", "(_", "'", "Model", "Famil", "y", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "binomial", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Simplif", "ication", "Meth", "od", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "AI", "C", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "GL", "M_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "model", "s", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "'", "FIT", "\\u", "GL", "M", "\\u", "plug", "gab", "le", ".", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port", "\\u", "map_", "=_", "{_", "'", "mds", "File", "'_", ":_", "(_", "'", "c", "'_", ",_", "None_", ",_", "True_", ")_", ",_", "#", "The", "se", " ", "port", "s", " ", "are", " ", "for", " ", "all", " ", "Models_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Probabili", "ty", "Map", "'_", ":_", "(_", "'", "mpt", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Bin", "Map", "'_", ":_", "(_", "'", "mb", "t", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "MES", "Map", "'_", ":_", "(_", "'", "mes", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Thresh", "old", "Optim", "izatio", "n", "Meth", "od", "'_", ":_", "(_", "'", "om", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Model", "Famil", "y", "'_", ":_", "(_", "'", "mf", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "GL", "M", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Simplif", "ication", "Meth", "od", "'_", ":_", "(_", "'", "sm", "'_", ",_", "None_", ",_", "False_", ")_", "#", "Thi", "s", " ", "is", " ", "a", " ", "GL", "M", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Random", "Fore", "st_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "input", "\\u", "ports_", "=_", "list_", "(_", "Model_", "._", "\\u", "input", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "._", "extend_", "(_", "[_", "(_", "'", "MT", "RY", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "1", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Fore", "st_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "model", "s", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "'", "FIT", "\\u", "RF", "\\u", "plug", "gab", "le", ".", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port", "\\u", "map_", "=_", "{_", "'", "mds", "File", "'_", ":_", "(_", "'", "c", "'_", ",_", "None_", ",_", "True_", ")_", ",_", "#", "The", "se", " ", "port", "s", " ", "are", " ", "for", " ", "all", " ", "Models_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Probabili", "ty", "Map", "'_", ":_", "(_", "'", "mpt", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Bin", "Map", "'_", ":_", "(_", "'", "mb", "t", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "MES", "Map", "'_", ":_", "(_", "'", "mes", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Thresh", "old", "Optim", "izatio", "n", "Meth", "od", "'_", ":_", "(_", "'", "om", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MT", "RY", "'_", ":_", "(_", "'", "mtr", "y", "'_", ",_", "None_", ",_", "False_", ")_", "#", "Thi", "s", " ", "is", " ", "a", " ", "Random", " ", "Fore", "st", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "MAR", "S_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "input", "\\u", "ports_", "=_", "list_", "(_", "Model_", "._", "\\u", "input", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "._", "extend_", "(_", "[_", "(_", "'", "Mars", "Deg", "ree", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "1", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Mars", "Pen", "alty", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "2", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MAR", "S_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "model", "s", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "'", "FIT", "\\u", "MAR", "S", "\\u", "plug", "gab", "le", ".", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port", "\\u", "map_", "=_", "{_", "'", "mds", "File", "'_", ":_", "(_", "'", "c", "'_", ",_", "None_", ",_", "True_", ")_", ",_", "#", "The", "se", " ", "port", "s", " ", "are", " ", "for", " ", "all", " ", "Models_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Probabili", "ty", "Map", "'_", ":_", "(_", "'", "mpt", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Bin", "Map", "'_", ":_", "(_", "'", "mb", "t", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "MES", "Map", "'_", ":_", "(_", "'", "mes", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Thresh", "old", "Optim", "izatio", "n", "Meth", "od", "'_", ":_", "(_", "'", "om", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mars", "Deg", "ree", "'_", ":_", "(_", "'", "deg", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "MAR", "S", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mars", "Pen", "alty", "'_", ":_", "(_", "'", "pen", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "MAR", "S", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Boost", "ed", "Regr", "ession", "Tree_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "input", "\\u", "ports_", "=_", "list_", "(_", "Model_", "._", "\\u", "input", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "._", "extend_", "(_", "[_", "(_", "'", "See", "d", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Tree", "Comple", "xit", "y", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Number", "Of", "Trees", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "10000", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Bag", "Frac", "tion", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Float", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "0.", "5", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Number", "Of", "Fold", "s", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "3", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Al", "pha", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Float", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "1", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Prev", "alen", "ce", "Strat", "if", "y", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Tru", "e", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Tolerance", "Meth", "od", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "auto", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Tolerance", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Float", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "0.001", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boost", "ed", "Regr", "ession", "Tree_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "model", "s", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "'", "FIT", "\\u", "BR", "T", "\\u", "plug", "gab", "le", ".", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port", "\\u", "map_", "=_", "{_", "'", "mds", "File", "'_", ":_", "(_", "'", "c", "'_", ",_", "None_", ",_", "True_", ")_", ",_", "#", "The", "se", " ", "port", "s", " ", "are", " ", "for", " ", "all", " ", "Models_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Probabili", "ty", "Map", "'_", ":_", "(_", "'", "mpt", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "Bin", "Map", "'_", ":_", "(_", "'", "mb", "t", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "make", "MES", "Map", "'_", ":_", "(_", "'", "mes", "'_", ",_", "utils_", "._", "R", "\\u", "boolean_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Thresh", "old", "Optim", "izatio", "n", "Meth", "od", "'_", ":_", "(_", "'", "om", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "See", "d", "'_", ":_", "(_", "'", "seed", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Tree", "Comple", "xit", "y", "'_", ":_", "(_", "'", "tc", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Number", "Of", "Trees", "'_", ":_", "(_", "'", "nf", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Bag", "Frac", "tion", "'_", ":_", "(_", "'", "bf", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Number", "Of", "Fold", "s", "'_", ":_", "(_", "'", "nf", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Al", "pha", "'_", ":_", "(_", "'", "alp", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prev", "alen", "ce", "Strat", "if", "y", "'_", ":_", "(_", "'", "ps", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Tolerance", "Meth", "od", "'_", ":_", "(_", "'", "tol", "m", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Tolerance", "'_", ":_", "(_", "'", "tol", "'_", ",_", "None_", ",_", "False_", ")_", "#", "Thi", "s", " ", "is", " ", "a", " ", "BR", "T", " ", "specific", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "MD", "SB", "uild", "er_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "MD", "S", " ", "Build", "er", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Merged", " ", "Data", " ", "Set", " ", "(", "MD", "S", ")", " ", "Build", "er", " ", "module", " ", "is", " ", "a", " ", "utility", " ", "tha", "t", " ", "extracts", " ", "the", " ", "values", " ", "of", " ", "each", " ", "predictor", "\\", "10", ";", " ", " ", " ", " ", "layer", " ", "to", " ", "the", " ", "point", " ", "location", "s", " ", "include", "d", " ", "in", " ", "the", " ", "field", " ", "data", " ", "set", ".", " ", "The", " ", "module", " ", "produce", "s", " ", "a", " ", ".", "csv", " ", "file", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "contain", "s", " ", "the", " ", "x", " ", "and", " ", "y", " ", "location", "s", " ", "of", " ", "the", " ", "sample", " ", "points", " ", "and", " ", "a", " ", "column", " ", "indicati", "ng", " ", "whe", "ther", " ", "each", " ", "point", "\\", "10", ";", " ", " ", " ", " ", "represent", "s", " ", "a", " ", "presen", "ce", " ", "record", "ing", ",", " ", "an", " ", "absen", "ce", " ", "record", "ing", ",", " ", "a", " ", "presen", "ce", " ", "count", ",", " ", "or", " ", "a", " ", "background", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "Follow", "ing", " ", "these", " ", "first", " ", "three", " ", "column", "s", ",", " ", "each", " ", "environ", "menta", "l", " ", "predictor", " ", "layer", " ", "is", " ", "append", "ed", " ", "as", " ", "a", " ", "column", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "row", " ", "entri", "es", " ", "represent", "ing", " ", "the", " ", "value", " ", "presen", "t", " ", "in", " ", "the", " ", "rast", "er", " ", "layer", " ", "at", " ", "each", " ", "field", " ", "sample", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "are", " ", "a", " ", "total", " ", "of", " ", "three", " ", "header", " ", "rows", " ", "in", " ", "the", " ", "output", " ", ".", "csv", " ", "of", " ", "the", " ", "MD", "SB", "uild", "er", ".", " ", "The", " ", "first", " ", "row", " ", "contain", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "column", "s", " ", "\"", "x", ",\"", " ", "\"", "y", ",\"", " ", "\"", "Respons", "e", "Bin", "ary", "\"", " ", "or", " ", "\"", "Respons", "e", "Count", ",\"", " ", "and", " ", "the", " ", "names", " ", "of", " ", "each", " ", "of", " ", "the", " ", "rast", "er", "\\", "10", ";", " ", " ", " ", " ", "predictor", " ", "files", " ", "tha", "t", " ", "wer", "e", " ", "pass", "ed", " ", "to", " ", "the", " ", "MD", "S", " ", "Build", "er", ".", " ", "The", " ", "second", " ", "row", " ", "contain", "s", " ", "a", " ", "binar", "y", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "indicati", "ng", " ", "whe", "ther", " ", "the", " ", "column", " ", "shou", "ld", " ", "be", " ", "include", "d", " ", "whe", "n", " ", "the", " ", "model", " ", "is", " ", "final", "ly", " ", "applied", ";", " ", "these", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "late", "r", " ", "modifi", "ed", " ", "dur", "ing", " ", "the", " ", "Covar", "iate", " ", "Correla", "tion", " ", "and", " ", "Selecti", "on", " ", "process", " ", "tha", "t", " ", "take", "s", " ", "place", " ", "downstream", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "workf", "low", ".", " ", "The", " ", "final", " ", "header", " ", "row", " ", "contain", "s", " ", "the", " ", "full", " ", "path", " ", "on", " ", "the", " ", "file", " ", "system", " ", "to", " ", "each", " ", "of", " ", "the", " ", "rast", "er", "\\", "10", ";", " ", " ", " ", " ", "predictor", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "MD", "SB", "uild", "er", " ", "accepts", " ", "four", " ", "inputs", " ", "from", " ", "the", " ", "user", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Ras", "ters", " ", "with", " ", "PAR", "C", " ", "Info", " ", ".", "csv", " ", "File", ":", " ", "The", " ", "rast", "er", " ", "layer", "s", " ", "liste", "d", " ", "in", " ", "this", " ", "file", " ", "will", " ", "have", " ", "thei", "r", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "extracted", " ", "to", " ", "the", " ", "points", " ", "in", " ", "the", " ", "field", " ", "data", " ", ".", "csv", " ", "file", ".", " ", "Thi", "s", " ", "parameter", " ", "shou", "ld", " ", "be", " ", "supplie", "d", " ", "by", " ", "connecti", "ng", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "output", " ", "of", " ", "a", " ", "PAR", "C", " ", "module", " ", "within", " ", "the", " ", "workf", "low", " ", "to", " ", "the", " ", "MD", "SB", "uild", "er", " ", "module", ".", " ", "(", "In", " ", "order", " ", "to", " ", "proper", "ly", "\\", "10", ";", " ", " ", " ", " ", "extract", " ", "the", " ", "values", " ", "of", " ", "each", " ", "predictor", " ", "layer", " ", "to", " ", "the", " ", "field", " ", "data", " ", "points", ",", " ", "all", " ", "the", " ", "layer", "s", " ", "must", " ", "have", " ", "matchi", "ng", "\\", "10", ";", " ", " ", " ", " ", "coordinate", " ", "system", "s", " ", "and", " ", "cell", " ", "size", "s", ";", " ", "output", "s", " ", "from", " ", "the", " ", "PAR", "C", " ", "module", " ", "will", " ", "have", " ", "had", " ", "the", " ", "prerequisite", " ", "process", "ing", ").", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Back", "ground", " ", "Point", " ", "Count", ":", " ", "Thi", "s", " ", "is", " ", "an", " ", "option", "al", " ", "value", " ", "tha", "t", " ", "appli", "es", " ", "only", " ", "to", " ", "workf", "lows", " ", "tha", "t", " ", "employ", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Max", "ent", " ", "modeling", " ", "package", ".", " ", "The", " ", "dialogue", " ", "box", " ", "provide", "s", " ", "the", " ", "option", " ", "of", " ", "speci", "fy", "ing", " ", "a", " ", "number", " ", "of", " ", "background", " ", "points", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "random", "ly", " ", "scatter", "ed", " ", "through", "out", " ", "the", " ", "stud", "y", " ", "area", " ", "(", "the", " ", "extent", " ", "of", " ", "the", " ", "template", " ", "layer", ")", " ", "to", " ", "captur", "e", " ", "a", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "complete", " ", "sample", " ", "of", " ", "the", " ", "range", " ", "of", " ", "values", " ", "presen", "t", " ", "for", " ", "each", " ", "predictor", " ", "layer", ".", " ", "The", "se", " ", "points", " ", "will", " ", "be", " ", "adde", "d", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "field", " ", "data", " ", ".", "csv", " ", "file", " ", "with", " ", "a", " ", "value", " ", "of", " ", "\"-", "999", "\"", " ", "deno", "ting", " ", "them", " ", "as", " ", "background", " ", "points", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Back", "ground", " ", "Probabili", "ty", " ", "Surf", "ace", ":", " ", "Thi", "s", " ", "is", " ", "an", " ", "option", "al", " ", "parameter", " ", "tha", "t", " ", "appli", "es", " ", "only", " ", "to", " ", "workf", "lows", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "employ", " ", "the", " ", "Max", "ent", " ", "modeling", " ", "package", ".", " ", "In", " ", "some", " ", "analyses", ",", " ", "it", " ", "may", " ", "be", " ", "appropr", "iate", " ", "to", " ", "spat", "ial", "ly", " ", "limit", " ", "background", "\\", "10", ";", " ", " ", " ", " ", "points", " ", "to", " ", "a", " ", "partic", "ular", " ", "subse", "t", " ", "of", " ", "the", " ", "stud", "y", " ", "area", " ", "(", "e", ".", "g", ".,", " ", "island", "s", " ", "within", " ", "a", " ", "stud", "y", " ", "area", " ", "poly", "gon", ",", " ", "partic", "ular", "\\", "10", ";", " ", " ", " ", " ", "regions", " ", "within", " ", "a", " ", "stud", "y", " ", "area", " ", "poly", "gon", ",", " ", "or", " ", "a", " ", "region", " ", "dete", "rmin", "ed", " ", "by", " ", "the", " ", "know", "n", " ", "bias", " ", "presen", "t", " ", "in", " ", "the", " ", "field", " ", "data", ").", "\\", "10", ";", " ", " ", " ", " ", "Speci", "fy", "ing", " ", "a", " ", "background", " ", "probabilit", "y", " ", "surf", "ace", " ", "rast", "er", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "control", " ", "where", " ", "random", " ", "points", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "scatter", "ed", " ", "within", " ", "the", " ", "extent", " ", "of", " ", "the", " ", "stud", "y", " ", "area", ".", " ", "The", " ", "rast", "er", " ", "layer", " ", "specified", " ", "by", " ", "a", " ", "user", " ", "shou", "ld", " ", "have", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", " ", "projecti", "on", " ", "and", " ", "extent", " ", "as", " ", "the", " ", "template", " ", "layer", " ", "and", " ", "contain", " ", "values", " ", "rang", "ing", " ", "from", " ", "0", " ", "to", " ", "100", ".", " ", "The", "se", " ", "values", " ", "represent", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "probabilit", "y", " ", "tha", "t", " ", "a", " ", "random", "ly", " ", "generat", "ed", " ", "point", " ", "will", " ", "be", " ", "retained", " ", "shou", "ld", " ", "it", " ", "fall", " ", "within", " ", "a", " ", "partic", "ular", " ", "cell", ".", "\\", "10", ";", " ", " ", " ", " ", "Tha", "t", " ", "is", ",", " ", "random", "ly", " ", "generat", "ed", " ", "points", " ", "will", " ", "not", " ", "be", " ", "generat", "ed", " ", "in", " ", "any", " ", "part", " ", "of", " ", "the", " ", "probabilit", "y", " ", "grid", " ", "with", " ", "a", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "\"", "0", "\"", " ", "whi", "le", " ", "all", " ", "points", " ", "falling", " ", "in", " ", "an", " ", "area", " ", "with", " ", "a", " ", "value", " ", "of", " ", "\"", "100", "\"", " ", "will", " ", "be", " ", "retained", ".", " ", "A", " ", "point", " ", "falling", " ", "in", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "area", " ", "with", " ", "a", " ", "value", " ", "of", " ", "\"", "50", "\"", " ", "will", " ", "be", " ", "kep", "t", " ", "as", " ", "a", " ", "background", " ", "point", " ", "50", "%", " ", "of", " ", "the", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "4", ".", " ", "Field", " ", "Data", ":", " ", "The", " ", "field", " ", "data", " ", "input", " ", "correspond", "s", " ", "to", " ", "a", " ", ".", "csv", " ", "file", " ", "contain", "ing", " ", "presen", "ce", "/", "absen", "ce", " ", "points", " ", "or", " ", "count", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "recorde", "d", " ", "acro", "ss", " ", "a", " ", "landscape", " ", "for", " ", "the", " ", "pheno", "men", "on", " ", "bei", "ng", " ", "model", "ed", " ", "(", "e", ".", "g", ".,", " ", "plant", " ", "sight", "ings", ",", " ", "eviden", "ce", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "animal", " ", "presen", "ce", ",", " ", "etc", ".)", ".", " ", "Thi", "s", " ", "input", " ", "file", " ", "must", " ", "be", " ", "in", " ", "a", " ", "partic", "ular", " ", "format", ",", " ", "and", " ", "in", " ", "most", " ", "case", "s", ",", " ", "a", " ", "user", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "populate", " ", "this", " ", "field", " ", "by", " ", "connecti", "ng", " ", "a", " ", "Field", "Data", " ", "element", " ", "to", " ", "the", " ", "MD", "SB", "uild", "er", " ", "in", " ", "the", " ", "visu", "al", " ", "display", " ", "within", " ", "Vis", "Trail", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Ple", "ase", " ", "see", " ", "the", " ", "document", "ion", " ", "for", " ", "the", " ", "Field", "Data", " ", "module", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "expand", "\\u", "port", "s", "([(", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", ":", "Ot", "her", ")'", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "('", "field", "Data", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Field", "Data", ":", "Data", "Inp", "ut", ")'", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "('", "background", "Point", "Count", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "('", "background", "Prob", "Surf", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "input", "\\u", "port", "s", " ", "=", " ", "expand", "\\u", "port", "s", "([(", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "persiste", "nce", ":", "Persisten", "t", "File", ")'", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "('", "field", "Data", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Field", "Data", ":", "Data", "Inp", "ut", ")'", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "('", "background", "Point", "Count", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "('", "background", "Prob", "Surf", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "field", "Data", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Field", "Data", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "background", "Point", "Count", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Integer", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "background", "Prob", "Surf", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "mds", "File", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "MD", "SB", "uild", "er_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "\\u", "map_", "=_", "{_", "'", "field", "Data", "'_", ":_", "(_", "'", "field", "Data", "'_", ",_", "None_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "background", "Point", "Count", "'_", ":_", "(_", "'", "point", "count", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "background", "Prob", "Surf", "'_", ":_", "(_", "'", "probs", "urf", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MD", "SP", "arams_", "=_", "utils_", "._", "map", "\\u", "ports_", "(_", "self_", ",_", "port", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MD", "SP", "arams_", "[_", "'", "output", "MD", "S", "'_", "]_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "Merged", "Datas", "et", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "allow", " ", "multiple", " ", "CSV", " ", "of", " ", "inputs", " ", "to", " ", "be", " ", "provided", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "more", " ", "than", " ", "one", " ", "then", " ", "combin", "e", " ", "int", "o", " ", "a", " ", "single", " ", "CSV", " ", "bef", "ore", " ", "sendin", "g", " ", "to", " ", "MD", "SB", "uild", "er_", "\\u\\u\\uNL\\u\\u\\u_", "inputs", "\\u", "csv", "s_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "inputs", "\\u", "csv", "s_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Mus", "t", " ", "supply", " ", "at", " ", "leas", "t", " ", "one", " ", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'/", "n", "Thi", "s", " ", "is", " ", "the", " ", "output", " ", "from", " ", "the", " ", "PAR", "C", " ", "module", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "inputs", "\\u", "csv", "s_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs", "\\u", "csv_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "Combine", "d", "PAR", "CF", "iles", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs", "\\u", "names_", "=_", "[_", "f_", "._", "name_", "for_", "f_", "in_", "inputs", "\\u", "csv", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "merge", "\\u", "inputs", "\\u", "csv", "s_", "(_", "inputs", "\\u", "names_", ",_", "inputs", "\\u", "csv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inputs", "\\u", "csv_", "=_", "inputs", "\\u", "csv", "s_", "[_", "0_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "MD", "SP", "arams_", "[_", "'", "inputs", "CSV", "'_", "]_", "=_", "inputs", "\\u", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "inputs", "CSV", " ", "=", " ", "util", "s", ".", "path", "\\u", "port", "(", "self", ",", " ", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "MD", "SB", "uild", "er_", "=_", "MD", "SB", "_", "._", "MD", "SB", "uild", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Py", "SA", "HM", "\\u", "instance", "\\u", "params_", "(_", "our", "MD", "SB", "uild", "er_", ",_", "MD", "SP", "arams_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "inputs", "CSV", "=\"_", "+_", "our", "MD", "SB", "uild", "er_", "._", "inputs", "CSV_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "field", "Data", "=\"_", "+_", "our", "MD", "SB", "uild", "er_", "._", "field", "Data_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "MD", "S", "=\"_", "+_", "our", "MD", "SB", "uild", "er_", "._", "output", "MD", "S_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "MD", "SB", "uild", "er_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tra", "pped", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "informati", "ve", "\\u", "untr", "appe", "d\\u", "error_", "(_", "self_", ",_", "\"", "MD", "SB", "uild", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "our", "MD", "SB", "uild", "er_", "._", "output", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "mds", "File", "'_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Field", "Data", "Aggregate", "And", "Weight_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Document", "ation", " ", "to", " ", "be", " ", "update", "d", " ", "whe", "n", " ", "module", " ", "finalize", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "template", "Layer", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Templa", "te", "Layer", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "field", "Data", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Field", "Data", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "aggre", "gate", "Row", "s", "'_", ",_", "'", "basic", ":", "Boo", "lean", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "aggre", "gate", "Row", "s", "By", "Year", "'_", ",_", "'", "basic", ":", "Boo", "lean", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "expand", "\\u", "ports_", "(_", "[_", "(_", "'", "field", "Data", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Field", "Data", ":", "Data", "Inp", "ut", ")'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Field", "Data", "Aggregate", "And", "Weight_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writet", "olog", "_", "(_", "\"\\\\", "n", "Run", "ning", " ", "Field", "Data", "Query", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "map_", "=_", "{_", "'", "template", "Layer", "'_", ":_", "(_", "'", "template", "'_", ",_", "None_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "Data", "'_", ":_", "(_", "'", "csv", "'_", ",_", "None_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "aggre", "gate", "Row", "s", "By", "Year", "'_", ":_", "(_", "'", "agg", "Row", "s", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "KD", "E", "'_", ":_", "(_", "'", "add", "KD", "E", "'_", ",_", "None_", ",_", "False_", ")_", ",_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "KD", "EP", "arams_", "=_", "utils_", "._", "map", "\\u", "ports_", "(_", "self_", ",_", "port", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "fname_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "FD", "Q", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "\\u", "fname", "=\"_", "+_", "output", "\\u", "fname_", ",_", "True_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KD", "EP", "arams_", "[_", "'", "output", "'_", "]_", "=_", "output", "\\u", "fname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "fname_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "FD", "Q", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "\\u", "fname", "=\"_", "+_", "output", "\\u", "fname_", ",_", "True_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "FD", "Q_", "=_", "FD", "Q_", "._", "Field", "Data", "Query_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "Py", "SA", "HM", "\\u", "instance", "\\u", "params_", "(_", "our", "FD", "Q_", ",_", "KD", "EP", "arams_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "FD", "Q_", "._", "process", "CSV_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "runn", "ing", " ", "Field", "Data", "Query", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "field", "Data", "'_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "PAR", "C_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "PAR", "C", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Projection", ",", " ", "Aggregation", ",", " ", "Res", "ampling", ",", " ", "and", " ", "Clip", "ping", " ", "(", "PAR", "C", ")", " ", "module", " ", "is", " ", "a", " ", "power", "ful", "\\", "10", ";", " ", " ", " ", " ", "utility", " ", "tha", "t", " ", "automat", "es", " ", "the", " ", "preparation", " ", "step", "s", " ", "require", "d", " ", "for", " ", "usi", "ng", " ", "rast", "er", " ", "layer", "s", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "most", " ", "geos", "pati", "al", " ", "modeling", " ", "package", "s", ".", " ", "In", " ", "order", " ", "to", " ", "success", "full", "y", " ", "consider", " ", "multiple", "\\", "10", ";", " ", " ", " ", " ", "environ", "menta", "l", " ", "predictor", "s", " ", "in", " ", "rast", "er", " ", "format", ",", " ", "each", " ", "layer", " ", "must", " ", "have", " ", "coinc", "ident", " ", "cells", "\\", "10", ";", " ", " ", " ", " ", "(", "pixel", "s", ")", " ", "of", " ", "the", " ", "same", " ", "size", ",", " ", "have", " ", "the", " ", "same", " ", "coordinate", " ", "system", " ", "(", "and", " ", "projecti", "on", ",", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "applica", "ble", "),", " ", "and", " ", "the", " ", "same", " ", "geographic", " ", "extent", ".", " ", "The", " ", "PAR", "C", " ", "module", " ", "ensure", "s", " ", "tha", "t", " ", "all", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "these", " ", "condition", "s", " ", "are", " ", "met", " ", "for", " ", "the", " ", "input", " ", "layer", "s", " ", "by", " ", "transform", "ing", " ", "and", " ", "or", " ", "repro", "ject", "ing", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "rast", "er", " ", "to", " ", "match", " ", "the", " ", "coordinate", " ", "system", " ", "of", " ", "the", " ", "template", " ", "layer", ".", " ", "Thi", "s", " ", "process", "\\", "10", ";", " ", " ", " ", " ", "usual", "ly", " ", "involv", "es", " ", "aggregation", " ", "(", "necessar", "y", " ", "whe", "n", " ", "an", " ", "input", " ", "rast", "er", " ", "layer", " ", "must", " ", "be", " ", "up", "-", "scale", "d", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "match", " ", "the", " ", "template", " ", "layer", "--", " ", "e", ".", "g", ".,", " ", "generaliz", "ing", " ", "a", " ", "10", " ", "m", " ", "input", " ", "layer", " ", "to", " ", "a", " ", "100", " ", "m", " ", "output", "\\", "10", ";", " ", " ", " ", " ", "layer", "),", " ", "and", " ", "or", " ", "resa", "mpli", "ng", " ", "(", "necessar", "y", " ", "for", " ", "interpolati", "ng", " ", "new", " ", "cell", " ", "values", " ", "whe", "n", " ", "transform", "ing", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "rast", "er", " ", "layer", " ", "to", " ", "the", " ", "coordinate", " ", "space", " ", "or", " ", "cell", " ", "size", " ", "of", " ", "the", " ", "template", " ", "layer", ").", " ", "Las", "tl", "y", ",", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "rast", "er", " ", "predictor", " ", "layer", " ", "is", " ", "clipped", " ", "to", " ", "match", " ", "the", " ", "extent", " ", "of", " ", "the", " ", "template", " ", "layer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "settings", " ", "used", " ", "dur", "ing", " ", "these", " ", "process", "ing", " ", "step", "s", " ", "follow", " ", "a", " ", "partic", "ular", " ", "set", " ", "of", " ", "decision", " ", "rule", "s", "\\", "10", ";", " ", " ", " ", " ", "design", "ed", " ", "to", " ", "preserve", " ", "the", " ", "integrity", " ", "of", " ", "data", " ", "as", " ", "muc", "h", " ", "as", " ", "possib", "le", ".", " ", "Ho", "we", "ver", ",", " ", "it", " ", "is", " ", "importa", "nt", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "user", " ", "to", " ", "underst", "and", " ", "how", " ", "these", " ", "process", "ing", " ", "step", "s", " ", "may", " ", "modif", "y", " ", "the", " ", "data", " ", "inputs", ".", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "addition", "al", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "PAR", "C", " ", "module", ",", " ", "plea", "se", " ", "see", " ", "the", " ", "extend", "ed", " ", "help", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "documentation", " ", "for", " ", "the", " ", "SA", "HM", " ", "package", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "PAR", "C", " ", "module", " ", "accepts", " ", "four", " ", "kinds", " ", "of", " ", "inputs", ":", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Predictor", " ", "List", ":", " ", "A", " ", "user", " ", "shou", "ld", " ", "not", " ", "have", " ", "to", " ", "populate", " ", "this", " ", "field", ".", " ", "Thi", "s", " ", "field", " ", "is", " ", "populate", "d", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "a", " ", "selection", " ", "is", " ", "made", " ", "from", " ", "the", " ", "pre", "-", "load", "ed", " ", ".", "csv", " ", "file", " ", "of", " ", "rast", "er", " ", "predictor", " ", "layer", " ", "inputs", "\\", "10", ";", " ", " ", " ", " ", "(", "specified", " ", "dur", "ing", " ", "the", " ", "SA", "HM", " ", "install", ")", " ", "and", " ", "connect", "ed", " ", "to", " ", "the", " ", "PAR", "C", " ", "module", " ", "in", " ", "the", " ", "visu", "al", " ", "display", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", ".", "csv", " ", "File", " ", "List", ":", " ", "The", " ", ".", "csv", " ", "file", " ", "list", " ", "correspond", "s", " ", "to", " ", "the", " ", "Predictor", " ", "List", " ", "File", " ", "element", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "load", " ", "a", " ", ".", "csv", " ", "file", " ", "contain", "ing", " ", "a", " ", "list", " ", "of", " ", "rast", "ers", " ", "for", " ", "consider", "ation", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "model", "ed", " ", "analys", "is", ".", " ", "For", " ", "addition", "al", " ", "informati", "on", ",", " ", "plea", "se", " ", "see", " ", "the", " ", "documentation", " ", "for", " ", "the", " ", "Predictor", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "File", " ", "element", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Predictor", ":", " ", " ", "The", " ", "predictor", " ", "input", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "select", " ", "a", " ", "single", " ", "rast", "er", " ", "predictor", " ", "layer", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "consider", "ed", " ", "in", " ", "the", " ", "analys", "is", ".", " ", "It", " ", "is", " ", "recommende", "d", " ", "tha", "t", " ", "a", " ", "user", " ", "add", " ", "this", " ", "input", " ", "as", " ", "a", " ", "separate", "\\", "10", ";", " ", " ", " ", " ", "element", " ", "in", " ", "the", " ", "visu", "al", " ", "display", " ", "(", "and", " ", "then", " ", "link", " ", "it", " ", "to", " ", "the", " ", "PAR", "C", " ", "module", ")", " ", "so", " ", "tha", "t", " ", "the", " ", "aggregation", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "resa", "mpli", "ng", " ", "settings", " ", "can", " ", "be", " ", "establish", "ed", ".", " ", "The", " ", "PAR", "C", " ", "module", " ", "can", " ", "accept", " ", "multiple", " ", "predictor", "\\", "10", ";", " ", " ", " ", " ", "element", "s", ".", " ", "For", " ", "addition", "al", " ", "informati", "on", ",", " ", "plea", "se", " ", "see", " ", "the", " ", "documentation", " ", "for", " ", "the", " ", "Predictor", " ", "element", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "4", ".", " ", "Templa", "te", " ", "Layer", ":", " ", "The", " ", "template", " ", "layer", " ", "is", " ", "a", " ", "rast", "er", " ", "data", " ", "layer", " ", "with", " ", "a", " ", "defin", "ed", " ", "coordinate", " ", "system", ",", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "know", "n", " ", "cell", " ", "size", ",", " ", "and", " ", "an", " ", "extent", " ", "tha", "t", " ", "defin", "es", " ", "the", " ", "stud", "y", " ", "area", ".", " ", "Thi", "s", " ", "rast", "er", " ", "layer", " ", "serve", "s", " ", "as", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "template", " ", "for", " ", "all", " ", "the", " ", "other", " ", "inputs", " ", "in", " ", "the", " ", "analys", "is", ".", " ", "All", " ", "addition", "al", " ", "rast", "er", " ", "layer", "s", " ", "used", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "analys", "is", " ", "will", " ", "be", " ", "resample", "d", " ", "and", " ", "repro", "ject", "ed", " ", "as", " ", "need", "ed", " ", "to", " ", "match", " ", "the", " ", "template", ",", " ", "snapp", "ed", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "template", ",", " ", "and", " ", "clipped", " ", "to", " ", "have", " ", "an", " ", "extent", " ", "tha", "t", " ", "matche", "s", " ", "the", " ", "template", ".", " ", "User", "s", " ", "shou", "ld", " ", "ensure", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "addition", "al", " ", "layer", "s", " ", "consider", "ed", " ", "in", " ", "the", " ", "analys", "is", " ", "have", " ", "covera", "ge", " ", "within", " ", "the", " ", "extent", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "template", " ", "layer", ".", " ", "The", " ", "template", " ", "layer", " ", "is", " ", "a", " ", "require", "d", " ", "input", " ", "for", " ", "the", " ", "PAR", "C", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "configura", "tion", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "'", "predictor", "'_", ",_", "\"(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Predictor", ":", "Data", "Inp", "ut", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Predictor", "List", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Predictor", "List", ":", "Ot", "her", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", ":", "Ot", "her", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "template", "Layer", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Templa", "te", "Layer", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "multiple", "Core", "s", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Tru", "e", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "',", " ", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", ":", "Ot", "her", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "output", "\\u", "port", "s", " ", "=", " ", "[(", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "',", " ", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "persiste", "nce", ":", "Persisten", "t", "File", ")'", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "PAR", "C_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "writet", "olog", "(\"", "\\\\", "n", "Run", "ning", " ", "PAR", "C", "\",", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "=_", "parc", "_", "._", "PAR", "C_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "dname_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "'", "PAR", "C", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "configuration_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "verbose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "our", "PAR", "C_", "._", "logger_", "=_", "utils_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "PAR", "C_", "._", "out", "\\u", "dir_", "=_", "output", "\\u", "dname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "multiple", "Core", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "multiple", "Core", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "multico", "res_", "=_", "\"", "Tru", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "working", "CSV_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "tmp", "Files", "To", "PAR", "C", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "CSV_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "PAR", "CO", "ut", "put", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "append", " ", "addition", "al", " ", "inputs", " ", "to", " ", "the", " ", "exist", "ing", " ", "CSV", " ", "if", " ", "one", " ", "was", " ", "supplie", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", "other", "wis", "e", " ", "start", " ", "a", " ", "new", " ", "CSV_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "CSV_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "\"_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "input", "CSV_", ",_", "working", "CSV_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "working", "CSV_", ",_", "\"", "ab", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Writer_", "=_", "csv_", "._", "writer_", "(_", "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 ", " _", "f_", "=_", "open_", "(_", "working", "CSV_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Writer_", "=_", "csv_", "._", "writer_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Writer_", "._", "writerow_", "(_", "[_", "\"", "File", "Path", "\"_", ",_", "\"", "Categori", "cal", "\"_", ",_", "\"", "Res", "ampling", "\"_", ",_", "\"", "Aggregation", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Predictor", "List", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "predictor", "\\u", "lists_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "'", "Predictor", "List", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predictor", "\\u", "list_", "in_", "predictor", "\\u", "lists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "predictor_", "in_", "predictor", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "csv", "Writer_", "._", "writerow_", "(_", "list_", "(_", "predictor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "predictor", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "predictor", "\\u", "list_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "'", "predictor", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predictor_", "in_", "predictor", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv", "Writer_", "._", "writerow_", "(_", "list_", "(_", "predictor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "csv", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "inputs", "\\u", "CSV_", "=_", "working", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "template_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "'", " ", " ", " ", " ", "template", " ", "layer", " ", "=", " ", "'_", "+_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "\\u", "dna", "me", "=\"_", "+_", "output", "\\u", "dname_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "working", "CSV", "=\"_", "+_", "working", "CSV_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "parc", "Files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tra", "pped", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writet", "olog", "_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "informati", "ve", "\\u", "untr", "appe", "d\\u", "error_", "(_", "self_", ",_", "\"", "PAR", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "delete", " ", "our", " ", "temp", " ", "working", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "working", "CSV_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "predictor", "s", "Dir_", "=_", "utils_", "._", "create", "\\u", "dir\\u", "module_", "(_", "output", "\\u", "dname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "CSV_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "\"", "PAR", "C", "\\u", "Files", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "CSV_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "runn", "ing", " ", "PAR", "C", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ras", "ter", "Format", "Converter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Ras", "ter", " ", "Format", " ", "Converte", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Ras", "ter", "Format", "Converte", "r", " ", "module", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "easi", "ly", " ", "convert", " ", ".", "tif", " ", "rast", "er", " ", "layer", "s", "\\", "10", ";", " ", " ", " ", " ", "int", "o", " ", "a", " ", "different", " ", "rast", "er", " ", "format", " ", "for", " ", "use", " ", "and", " ", "display", " ", "in", " ", "other", " ", "software", " ", "package", "s", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "module", " ", "accepts", " ", "as", " ", "an", " ", "input", " ", "eit", "her", " ", "a", " ", "list", " ", "of", " ", "rast", "ers", " ", "in", " ", "a", " ", "Merged", " ", "Datas", "et", " ", "File", " ", "(", "MD", "S", ")", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "location", " ", "of", " ", "a", " ", "director", "y", " ", "contain", "ing", " ", "multiple", " ", "rast", "er", " ", "files", ".", " ", "All", " ", "output", "s", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "sent", " ", "to", " ", "a", " ", "folder", " ", "named", " ", "\"", "Converte", "d", "Ras", "ters", "\"", " ", "(", "followe", "d", " ", "by", " ", "an", " ", "underscore", " ", "and", " ", "a", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "correspond", "ing", " ", "to", " ", "the", " ", "run", " ", "sequence", " ", "of", " ", "the", " ", "module", ")", " ", "within", " ", "the", " ", "user", "'", "s", " ", "current", " ", "Vis", "Trail", "\\", "10", ";", " ", " ", " ", " ", "session", " ", "folder", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thre", "e", " ", "parameter", "s", " ", "can", " ", "be", " ", "specified", " ", "by", " ", "the", " ", "user", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Format", ":", " ", "The", " ", "format", " ", "correspond", "s", " ", "to", " ", "the", " ", "desi", "red", " ", "rast", "er", " ", "output", " ", "format", ".", " ", "The", " ", "follow", "ing", "\\", "10", ";", " ", " ", " ", " ", "output", " ", "file", " ", "formats", " ", "are", " ", "support", "ed", ":", " ", "Arc", "/", "Info", " ", "ASCII", " ", "Grid", ",", " ", "ESR", "I", " ", "BIL", ",", " ", "ER", "DAS", " ", "Imagin", "e", ",", " ", "and", " ", "JP", "EG", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "speci", "fy", " ", "the", " ", "desi", "red", " ", "output", ",", " ", "users", " ", "shou", "ld", " ", "enter", " ", "the", " ", "values", " ", "shown", " ", "belo", "w", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "an", " ", "ASCII", " ", "(.", "asc", ")", " ", "output", ",", " ", "enter", ":", " ", "\"", "asc", "\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "an", " ", "ESR", "I", " ", "BIL", " ", "output", ",", " ", "enter", ":", " ", "\"", "bil", "\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "an", " ", "Er", "das", " ", "Imagin", "e", " ", "(.", "img", ")", " ", "output", ",", " ", "enter", ":", " ", "\"", "img", "\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "a", " ", "JP", "EG", " ", "(.", "jp", "g", ")", " ", "output", ",", " ", "enter", ":", " ", "\"", "jp", "g", "\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "value", " ", "is", " ", "enter", "ed", " ", "by", " ", "the", " ", "user", ",", " ", "the", " ", "module", " ", "will", " ", "default", " ", "to", " ", "an", " ", "ASCII", " ", "(.", "asc", ")", " ", "output", "\\", "10", ";", " ", " ", " ", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Inp", "ut", " ", "Director", "y", ":", " ", "The", " ", "input", " ", "director", "y", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "point", " ", "to", " ", "an", " ", "entire", " ", "folder", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "input", " ", "to", " ", "the", " ", "Ras", "ter", "Format", "Converte", "r", ".", " ", "The", " ", "content", "s", " ", "of", " ", "the", " ", "specified", " ", "folder", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "checke", "d", " ", "for", " ", "rast", "er", " ", "files", " ", "and", " ", "all", " ", "the", " ", "rast", "er", " ", "files", " ", "contain", "ed", " ", "within", " ", "the", " ", "director", "y", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "convert", "ed", " ", "to", " ", "the", " ", "format", " ", "specified", " ", "in", " ", "the", " ", "\"", "Format", "\"", " ", "dialogue", " ", "box", ".", " ", "The", " ", "module", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "identify", " ", "and", " ", "convert", " ", "files", " ", "of", " ", "the", " ", "follow", "ing", " ", "rast", "er", " ", "types", ":", " ", ".", "bil", ",", " ", ".", "img", ",", " ", ".", "tif", ",", " ", ".", "jp", "g", ",", " ", "and", " ", ".", "asc", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Inp", "ut", " ", "Merged", " ", "Datas", "et", " ", "(", "MD", "S", "):", " ", "The", " ", "input", " ", "merge", "d", " ", "dataset", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "speci", "fy", " ", "a", " ", ".", "csv", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "created", " ", "in", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", " ", "(", "contain", "ing", " ", "a", " ", "list", " ", "of", " ", ".", "tif", " ", "rast", "er", " ", "files", ")", " ", "as", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "input", " ", "to", " ", "the", " ", "rast", "er", " ", "converter", ".", " ", "All", " ", "of", " ", "the", " ", "files", " ", "liste", "d", " ", "in", " ", "the", " ", "MD", "S", " ", "will", " ", "be", " ", "convert", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "rast", "er", " ", "format", " ", "specified", " ", "in", " ", "the", " ", "\"", "Format", "\"", " ", "dialogue", " ", "box", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "configura", "tion", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "\"", "input", "MD", "S", "\"_", ",_", "\"(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "input", "Dir", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Director", "y", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "format", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "multiple", "Core", "s", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ",_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "Tru", "e", "'_", "]_", ")_", ",_", "'", "option", "al", "'_", ":_", "True_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "'", "output", "Dir", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Director", "y", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ras", "ter", "Format", "Converter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writet", "olog", "_", "(_", "\"\\\\", "n", "Run", "ning", " ", "Tif", "f", "Converte", "r", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "RF", "C_", "=_", "RF", "C_", "._", "Format", "Converter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "input", "MD", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "RF", "C_", "._", "MD", "SF", "ile_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "input", "MD", "S", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "has", "\\u", "input_", "(_", "'", "input", "Dir", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "RF", "C_", "._", "input", "Dir_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "input", "Dir", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "format", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "=_", "'", "asc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "our", "RF", "C_", "._", "format_", "=_", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "multiple", "Core", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "multiple", "Core", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "RF", "C_", "._", "multico", "res_", "=_", "\"", "Tru", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "our", "RF", "C_", "._", "output", "Dir_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "'", "Converte", "d", "Ras", "ters", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "configuration_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "RF", "C_", "._", "verbose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "our", "RF", "C_", "._", "logger_", "=_", "utils_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", " ", "director", "y", " ", "=", " ", "\"_", "+_", "our", "RF", "C_", "._", "output", "Dir_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "RF", "C_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tra", "pped", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "informati", "ve", "\\u", "untr", "appe", "d\\u", "error_", "(_", "self_", ",_", "\"", "Ras", "ter", "Format", "Converte", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "Dir_", "=_", "utils_", "._", "create", "\\u", "dir\\u", "module_", "(_", "our", "RF", "C_", "._", "output", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "output", "Dir", "'_", ",_", "output", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"\\\\", "n", "Finish", "ed", " ", "runn", "ing", " ", "Tif", "f", "Converte", "r", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Train", "ing", "Split_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "Train", "ing", " ", "Split", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Test", "Train", "ing", "Split", " ", "module", " ", "provide", "s", " ", "the", " ", "opportunit", "y", " ", "to", " ", "establish", " ", "specific", " ", "settings", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "how", " ", "field", " ", "data", " ", "will", " ", "be", " ", "used", " ", "in", " ", "the", " ", "modeling", " ", "process", ".", " ", "Thre", "e", " ", "parameter", "s", " ", "can", " ", "be", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "the", " ", "user", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Rati", "o", " ", "of", " ", "Presence", "/", "Abs", "ence", " ", "Point", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "field", " ", "is", " ", "populate", "d", " ", "with", " ", "a", " ", "number", " ", "correspond", "ing", " ", "to", " ", "the", " ", "desi", "red", " ", "proportion", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "presen", "ce", " ", "and", " ", "absen", "ce", " ", "points", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "analys", "is", ".", " ", "If", " ", "populate", "d", ",", " ", "this", " ", "entry", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "a", " ", "number", " ", "great", "er", " ", "than", " ", "zero", ".", " ", "(", "A", " ", "value", " ", "of", " ", "'", "1", "'", " ", "will", " ", "result", " ", "in", " ", "an", " ", "equal", " ", "number", " ", "of", " ", "bot", "h", "\\", "10", ";", " ", " ", " ", " ", "presen", "ce", " ", "and", " ", "absen", "ce", " ", "points", " ", "bei", "ng", " ", "used", ",", " ", "a", " ", "value", " ", "of", " ", "'", "2", "'", " ", "indicat", "es", " ", "tha", "t", " ", "twi", "ce", " ", "as", " ", "many", "\\", "10", ";", " ", " ", " ", " ", "presen", "ce", " ", "points", " ", "will", " ", "be", " ", "used", ",", " ", "a", " ", "value", " ", "of", " ", "0.", "5", " ", "indicat", "es", " ", "tha", "t", " ", "twi", "ce", " ", "as", " ", "many", " ", "absen", "ce", " ", "points", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "used", ",", " ", "etc", ".)", ".", " ", "All", " ", "field", " ", "data", " ", "points", " ", "with", " ", "a", " ", "value", " ", "equal", " ", "to", " ", "or", " ", "great", "er", " ", "than", " ", "1", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "interprete", "d", " ", "as", " ", "presen", "ce", " ", "points", ".", " ", "Alt", "hou", "gh", " ", "the", " ", "original", " ", "field", " ", "data", " ", "is", " ", "unmo", "difi", "ed", ",", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "option", " ", "will", " ", "reduce", " ", "the", " ", "sample", " ", "size", " ", "as", " ", "the", " ", "merge", "d", " ", "dataset", " ", "contain", "ing", " ", "sample", " ", "points", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "points", " ", "delete", "d", " ", "from", " ", "it", " ", "to", " ", "achieve", " ", "the", " ", "specified", " ", "ratio", ".", " ", "A", " ", "warn", "ing", " ", "will", " ", "be", " ", "generat", "ed", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "more", " ", "than", " ", "50", "%", " ", "of", " ", "eit", "her", " ", "the", " ", "presen", "ce", " ", "or", " ", "absen", "ce", " ", "points", " ", "will", " ", "be", " ", "delete", "d", " ", "based", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "ratio", " ", "specified", " ", "by", " ", "the", " ", "user", ".", " ", "Back", "ground", " ", "points", " ", "are", " ", "ignore", "d", " ", "by", " ", "this", " ", "module", " ", "(", "the", "y", " ", "are", " ", "read", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "and", " ", "writt", "en", " ", "out", ",", " ", "but", " ", "not", " ", "assign", "ed", " ", "to", " ", "eit", "her", " ", "the", " ", "test", " ", "or", " ", "train", "ing", " ", "split", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "left", " ", "empty", ",", " ", "this", " ", "field", " ", "will", " ", "default", " ", "to", " ", "'", "null", "'", " ", "and", " ", "the", " ", "model", " ", "will", " ", "use", " ", "the", " ", "exist", "ing", "\\", "10", ";", " ", " ", " ", " ", "presen", "ce", "/", "absen", "ce", " ", "ratio", " ", "presen", "t", " ", "in", " ", "the", " ", "field", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Inp", "ut", " ", "Merged", " ", "Data", " ", "Set", " ", "(", "MD", "S", "):", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "input", " ", "data", " ", "set", " ", "consi", "stin", "g", " ", "of", " ", "location", "al", " ", "data", " ", "for", " ", "each", " ", "sample", " ", "point", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "values", " ", "of", " ", "each", " ", "predictor", " ", "variab", "le", " ", "at", " ", "tho", "se", " ", "points", ",", " ", "and", " ", "if", " ", "establish", "ed", ",", " ", "a", " ", "field", " ", "deno", "ting", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "weight", " ", "tha", "t", " ", "will", " ", "be", " ", "assign", "ed", " ", "to", " ", "each", " ", "point", " ", "in", " ", "modeling", ".", " ", "Thi", "s", " ", "input", " ", "is", " ", "usual", "ly", " ", "provided", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "the", " ", "ups", "tream", " ", "step", "s", " ", "tha", "t", " ", "prece", "de", " ", "the", " ", "Test", " ", "Train", "ing", " ", "Split", " ", "module", ".", " ", "Any", " ", "value", " ", "enter", "ed", " ", "here", "\\", "10", ";", " ", " ", " ", " ", "(", "e", ".", "g", ".,", " ", "speci", "fy", "ing", " ", "anot", "her", " ", "exist", "ing", " ", "MD", "S", " ", "on", " ", "the", " ", "file", " ", "system", ")", " ", "will", " ", "override", " ", "the", " ", "input", "\\", "10", ";", " ", " ", " ", " ", "specified", " ", "by", " ", "a", " ", "model", " ", "connecti", "on", " ", "in", " ", "the", " ", "visu", "al", " ", "display", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Train", "ing", " ", "Prop", "ortion", ":", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "proportion", " ", "of", " ", "the", " ", "sample", " ", "points", " ", "tha", "t", " ", "will", " ", "be", " ", "used", " ", "to", " ", "train", " ", "the", " ", "model", ",", " ", "relative", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "total", " ", "number", " ", "of", " ", "points", ".", " ", "Enter", "ed", " ", "values", " ", "shou", "ld", " ", "be", " ", "great", "er", " ", "than", " ", "0", " ", "but", " ", "less", " ", "than", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "a", " ", "value", " ", "of", " ", "'", "0.", "9", "'", " ", "will", " ", "result", " ", "in", " ", "90", "%", " ", "of", " ", "the", " ", "sample", " ", "points", " ", "bei", "ng", " ", "used", " ", "to", " ", "train", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "model", ",", " ", "with", " ", "10", "%", " ", "of", " ", "the", " ", "sample", " ", "bei", "ng", " ", "hel", "d", " ", "out", " ", "to", " ", "test", " ", "the", " ", "model", "'", "s", " ", "perform", "anc", "e", ".", " ", "Cho", "osin", "g", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "appropr", "iate", " ", "train", "ing", " ", "proportion", " ", "can", " ", "depend", " ", "on", " ", "vari", "ous", " ", "factor", "s", ",", " ", "suc", "h", " ", "as", " ", "the", " ", "total", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "sample", " ", "points", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "\"", "input", "MD", "S", "\"_", ",_", "\"(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "train", "ing", "Prop", "ortion", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Float", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "default", "s", "'_", ":_", "str_", "(_", "[_", "'", "0.", "7", "'_", "]_", ")_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Rati", "o", "Pres", "Abs", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Float", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "\"", "output", "MD", "S", "\"_", ",_", "\"(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Train", "ing", "Split_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "train", "ing", "Prop", "ortion", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "real", " ", "input", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writet", "olog", "_", "(_", "\"\\\\", "n", "Generat", "ing", " ", "Test", " ", "Train", "ing", " ", "split", " ", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "MD", "S_", "=_", "utils_", "._", "dir\\u", "path", "\\u", "value_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "input", "MD", "S", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "MD", "S_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "Test", "Train", "ing", "Split", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "model", "s", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "\"", "i", "=\"_", "+_", "'\"'_", "+_", "input", "MD", "S_", "+_", "'\"'_", "+_", "\"", " ", "o", "=\"_", "+_", "'\"'_", "+_", "output", "MD", "S_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "+=_", "\"", " ", "rc", "=\"_", "+_", "utils_", "._", "MD", "Sr", "esp", "ons", "e", "Col_", "(_", "input", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "train", "ing", "Prop", "ortion", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "ing", "Prop", "ortion", "_", "=_", "float_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "train", "ing", "Prop", "ortion", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "train", "ing", "Prop", "ortion", "_", "<=_", "0_", "or_", "train", "ing", "Prop", "ortion", "_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Train", " ", "Prop", "ortion", " ", "(", "train", "Prop", ")", " ", "must", " ", "be", " ", "a", " ", "number", " ", "bet", "ween", " ", "0", " ", "and", " ", "1", " ", "excluding", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "+=_", "\"", " ", "p", "=\"_", "+_", "str_", "(_", "train", "ing", "Prop", "ortion", "_", ")_", "\\u\\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_", ",_", "\"", "Train", " ", "Prop", "ortion", " ", "(", "train", "Prop", ")", " ", "must", " ", "be", " ", "a", " ", "number", " ", "bet", "ween", " ", "0", " ", "and", " ", "1", " ", "excluding", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Rati", "o", "Pres", "Abs", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Rati", "o", "Pres", "Abs", "_", "=_", "float_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Rati", "o", "Pres", "Abs", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Rati", "o", "Pres", "Abs", "_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "The", " ", "ratio", " ", "of", " ", "presen", "ce", " ", "to", " ", "absen", "ce", " ", "(", "Rati", "o", "Pres", "Abs", ")", " ", "must", " ", "be", " ", "a", " ", "number", " ", "great", "er", " ", "than", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "+=_", "\"", " ", "m", "=\"_", "+_", "str_", "(_", "train", "ing", "Prop", "ortion", "_", ")_", "\\u\\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_", ",_", "\"", "The", " ", "ratio", " ", "of", " ", "presen", "ce", " ", "to", " ", "absen", "ce", " ", "(", "Rati", "o", "Pres", "Abs", ")", " ", "must", " ", "be", " ", "a", " ", "number", " ", "great", "er", " ", "than", " ", "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_", "utils_", "._", "run", "RS", "cript_", "(_", "\"", "Test", "Train", "Split", ".", "r", "\"_", ",_", "args_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "output_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "Test", " ", "Train", "ing", " ", "split", " ", "\"_", ",_", "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 ", " _", "msg_", "=_", "\"", "Prob", "lem", " ", "encounter", "ed", " ", "generat", "ing", " ", "Test", " ", "Train", "ing", " ", "split", ".", " ", " ", "Expect", "ed", " ", "output", " ", "file", " ", "not", " ", "found", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "msg_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "output", "MD", "S", "\"_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Covar", "iate", "Correla", "tion", "And", "Selection_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Covar", "iate", " ", "Correla", "tion", " ", "And", " ", "Selecti", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Covar", "iate", "Correla", "tion", "And", "Selecti", "on", " ", "view", " ", "provide", "s", " ", "a", " ", "break", "point", " ", "in", " ", "the", " ", "modeling", " ", "workf", "low", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "the", " ", "user", " ", "to", " ", "assess", " ", "how", " ", "well", " ", "each", " ", "variab", "le", " ", "explain", "s", " ", "the", " ", "distribu", "tion", " ", "of", " ", "the", " ", "sample", "d", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "points", " ", "and", " ", "to", " ", "remove", " ", "any", " ", "variab", "les", " ", "tha", "t", " ", "may", " ", "exh", "ibi", "t", " ", "high", " ", "correlation", " ", "with", " ", "other", "s", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "display", " ", "show", "s", " ", "the", " ", "10", " ", "most", " ", "correlate", "d", " ", "variab", "les", " ", "of", " ", "tho", "se", " ", "selecte", "d", ".", " ", "The", "se", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "displaye", "d", " ", "on", " ", "the", " ", "diagonal", " ", "and", " ", "thei", "r", " ", "respec", "tiv", "e", " ", "graphical", " ", "display", " ", "and", " ", "correlation", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "variab", "les", " ", "can", " ", "be", " ", "found", " ", "by", " ", "locat", "ing", " ", "the", " ", "row", "/", "column", " ", "intersect", "ion", " ", "bet", "ween", " ", "each", " ", "(", "above", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "belo", "w", " ", "the", " ", "diagonal", ").", " ", "The", " ", "column", " ", "heading", " ", "over", " ", "each", " ", "variab", "le", " ", "display", "s", " ", "the", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "variab", "les", " ", "with", " ", "whi", "ch", " ", "the", " ", "environ", "menta", "l", " ", "predictor", " ", "is", " ", "correlate", "d", ".", " ", "The", " ", "user", " ", "defin", "ed", "\\", "10", ";", " ", " ", " ", " ", "\"", "Thresh", "old", "\"", " ", "option", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "speci", "fy", " ", "the", " ", "degr", "ee", " ", "of", " ", "correlation", " ", "require", "d", " ", "bet", "ween", "\\", "10", ";", " ", " ", " ", " ", "two", " ", "variab", "les", " ", "for", " ", "them", " ", "to", " ", "be", " ", "counted", " ", "in", " ", "this", " ", "tally", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "user", " ", "is", " ", "provided", " ", "with", " ", "the", " ", "opportunit", "y", " ", "to", " ", "select", " ", "a", " ", "new", " ", "set", " ", "of", " ", "the", " ", "environ", "menta", "l", " ", "predictor", "\\", "10", ";", " ", " ", " ", " ", "variab", "les", " ", "and", " ", "\"", "Update", "\"", " ", "the", " ", "Covar", "iate", " ", "Correla", "tion", " ", "screen", " ", "to", " ", "investigat", "e", " ", "the", " ", "relation", "ships", "\\", "10", ";", " ", " ", " ", " ", "amo", "ng", " ", "the", " ", "new", " ", "variab", "les", " ", "selecte", "d", ".", " ", "The", " ", "options", " ", "are", " ", "provided", " ", "to", " ", "include", " ", "or", " ", "exclu", "de", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "presen", "ce", "/", "count", " ", "points", ",", " ", "the", " ", "absen", "ce", " ", "points", " ", "(", "whe", "n", " ", "applica", "ble", "),", " ", "and", " ", "the", " ", "background", " ", "points", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "correlation", " ", "test", ".", " ", "Varia", "bles", " ", "with", " ", "a", " ", "high", " ", "degr", "ee", " ", "of", " ", "correlation", " ", "with", " ", "other", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "genera", "ll", "y", " ", "be", " ", "uncheck", "ed", " ", "in", " ", "thei", "r", " ", "respec", "tiv", "e", " ", "radio", " ", "buttons", ",", " ", "and", " ", "will", " ", "be", " ", "exclu", "ded", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "subsequen", "t", " ", "analys", "is", " ", "step", "s", " ", "in", " ", "the", " ", "model", " ", "workf", "low", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Multipl", "e", " ", "iterati", "ons", " ", "can", " ", "be", " ", "run", " ", "at", " ", "this", " ", "screen", ",", " ", "allow", "ing", " ", "the", " ", "user", " ", "to", " ", "investigat", "e", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "relation", "ships", " ", "amo", "ng", " ", "the", " ", "environ", "menta", "l", " ", "predictor", " ", "variab", "les", " ", "and", " ", "choose", " ", "the", " ", "most", " ", "appropr", "iate", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "to", " ", "be", " ", "used", " ", "in", " ", "the", " ", "subsequen", "t", " ", "modeling", ".", " ", "Whe", "n", " ", "the", " ", "desi", "red", " ", "set", " ", "of", " ", "variab", "les", " ", "has", " ", "bee", "n", " ", "chosen", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "\"", "OK", "\"", " ", "button", " ", "is", " ", "selecte", "d", " ", "and", " ", "process", "ing", " ", "will", " ", "resum", "e", " ", "in", " ", "the", " ", "Vis", "Trail", "s", " ", "workf", "low", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "default", "s", "'_", "]_", "=_", "str_", "(_", "[_", "'", "initial", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "\"", "input", "MD", "S", "\"_", ",_", "\"(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "selection", "Name", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "kwargs_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Show", "GU", "I", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "\"", "output", "MD", "S", "\"_", ",_", "\"(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")\"_", ")_", "]_", "\\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_", "Covar", "iate", "Correla", "tion", "And", "Selection_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writet", "olog", "_", "(_", "\"\\\\", "n", "Open", "ing", " ", "Select", " ", "Predictor", "s", " ", "Layer", "s", " ", "widget", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "MD", "S_", "=_", "utils_", "._", "dir\\u", "path", "\\u", "value_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "input", "MD", "S", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selection", "Name_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "selection", "Name", "'_", ",_", "'", "initial", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "output", "MD", "S", " ", "=", " ", "util", "s", ".", "mk", "next", "file", "(", "prefix", "='", "Select", "Predictor", "s", "Layer", "s", "\\u", "'", " ", "+", " ", "selection", "Name", " ", "+", " ", "\"\\u", "\",", " ", "suff", "ix", "='", ".", "csv", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "display", "JP", "EG", " ", "=", " ", "util", "s", ".", "mk", "next", "file", "(", "prefix", "='", "Predictor", "Correla", "tion", "\\u", "'", " ", "+", " ", "selection", "Name", " ", "+", " ", "\"\\u", "\",", " ", "suff", "ix", "='", ".", "jp", "g", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "session", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "MD", "S_", "=_", "os_", "._", "path_", "._", "join_", "(_", "session", "\\u", "dir_", ",_", "\"", "Covar", "iate", "Correla", "tion", "Output", "MD", "S", "\\u\"_", "+_", "selection", "Name_", "+_", "\".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display", "JP", "EG", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "session", "\\u", "dir_", ",_", "\"", "Covar", "iate", "Correla", "tion", "Display", ".", "jp", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "input", "MD", "S", " ", "=", " ", "\"_", "+_", "input", "MD", "S_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "display", "JP", "EG", " ", "=", " ", "\"_", "+_", "display", "JP", "EG", "_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "MD", "S", " ", "=", " ", "\"_", "+_", "output", "MD", "S_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "output", "MD", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "appl", "y", "MD", "S", "\\u", "selection_", "(_", "output", "MD", "S_", ",_", "input", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "output", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "call", "Display", "MD", "S_", "(_", "input", "MD", "S_", ",_", "output", "MD", "S_", ",_", "display", "JP", "EG", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "Select", " ", "Predictor", "s", " ", "Layer", "s", " ", "widget", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "output", "MD", "S", "\"_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Covar", "iate", "Correla", "tion", "And", "Selection_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "call", "Display", "MD", "S_", "(_", "self_", ",_", "input", "MD", "S_", ",_", "output", "MD", "S_", ",_", "display", "JP", "EG", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dialog_", "=_", "Select", "List", "Dialog_", "(_", "input", "MD", "S_", ",_", "output", "MD", "S_", ",_", "display", "JP", "EG", "_", ",_", "configuration_", "._", "r", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dialog", ".", "set", "Window", "Fla", "gs", "(", "Qt", "Core", ".", "Qt", ".", "Window", "Maxim", "ize", "Butt", "on", "Hint", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", " ", "...", " ", "finish", "ed", " ", "with", " ", "dialog", " ", "\"", " _", "\\u\\u\\uNL\\u\\u\\u_", "ret", "Val_", "=_", "dialog_", "._", "exec\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "output", "Predictor", "List", " ", "=", " ", "dialog", ".", "output", "List_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ret", "Val_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Cancel", " ", "or", " ", "Clos", "e", " ", "selecte", "d", " ", "(", "not", " ", "OK", ")", " ", "workf", "low", " ", "halt", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Projection", "Layers_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Projection", " ", "Layer", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "as", " ", "of", " ", "Jun", "e", " ", "2011", ",", " ", "this", " ", "module", " ", "offers", " ", "some", " ", "functional", "it", "y", " ", "tha", "t", " ", "is", " ", "only", " ", "avail", "able", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "users", " ", "runn", "ing", " ", "the", " ", "SA", "HM", " ", "package", " ", "within", " ", "the", " ", "US", "GS", " ", "Fort", " ", "Colli", "ns", " ", "Sci", "ence", " ", "Center", " ", "(", "FORT", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Projection", "Layer", "s", " ", "module", " ", "provide", "s", " ", "the", " ", "option", " ", "to", " ", "prepar", "e", " ", "a", " ", "separate", " ", "set", " ", "of", " ", "predictor", "\\", "10", ";", " ", " ", " ", " ", "layer", "s", " ", "so", " ", "tha", "t", " ", "the", " ", "results", " ", "of", " ", "a", " ", "model", " ", "develop", "ed", " ", "from", " ", "one", " ", "set", " ", "of", " ", "environ", "menta", "l", " ", "predictor", "s", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "be", " ", "projected", " ", "onto", " ", "a", " ", "new", " ", "model", "ed", " ", "space", ".", " ", "Thi", "s", " ", "second", " ", "set", " ", "of", " ", "environ", "menta", "l", " ", "predictor", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "correspond", "ing", " ", "to", " ", "the", " ", "\"", "projecti", "on", " ", "target", "\")", " ", "most", " ", "oft", "en", " ", "contain", "s", " ", "the", " ", "same", " ", "environ", "menta", "l", "\\", "10", ";", " ", " ", " ", " ", "predictor", "s", " ", "but", " ", "represent", "s", " ", "data", " ", "captured", " ", "at", " ", "a", " ", "different", " ", "tempora", "l", " ", "or", " ", "spat", "ial", " ", "location", ".", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "example", ",", " ", "a", " ", "user", " ", "coul", "d", " ", "generat", "e", " ", "a", " ", "model", " ", "predicti", "ng", " ", "habit", "at", " ", "suit", "abilit", "y", " ", "usi", "ng", " ", "recorde", "d", "\\", "10", ";", " ", " ", " ", " ", "presen", "ce", " ", "points", " ", "and", " ", "cert", "ain", " ", "environ", "menta", "l", " ", "predictor", "s", " ", "suc", "h", " ", "as", " ", "elevat", "ion", ",", " ", "land", "cover", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "proxim", "it", "y", " ", "to", " ", "water", " ", "in", " ", "one", " ", "geographic", " ", "location", ".", " ", "Base", "d", " ", "on", " ", "the", " ", "train", "ing", " ", "from", " ", "this", " ", "informati", "on", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "model", "ed", " ", "results", " ", "coul", "d", " ", "be", " ", "generat", "ed", " ", "for", " ", "(", "or", " ", "\"", "projected", " ", "to", "\")", " ", "a", " ", "new", " ", "location", " ", "based", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "range", " ", "of", " ", "values", " ", "see", "n", " ", "in", " ", "elevat", "ion", ",", " ", "land", "cover", ",", " ", "and", " ", "proxim", "it", "y", " ", "to", " ", "water", " ", "in", " ", "the", " ", "second", " ", "geographic", "\\", "10", ";", " ", " ", " ", " ", "area", ".", " ", "Simil", "arl", "y", ",", " ", "modeling", " ", "predi", "cte", "d", " ", "results", " ", "through", " ", "time", " ", "is", " ", "als", "o", " ", "possib", "le", ".", " ", "A", " ", "model", " ", "trained", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "field", " ", "data", " ", "and", " ", "a", " ", "set", " ", "of", " ", "predictor", " ", "layer", "s", " ", "representative", " ", "of", " ", "one", " ", "time", " ", "period", " ", "coul", "d", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "projected", " ", "onto", " ", "the", " ", "same", " ", "geographic", "al", " ", "area", " ", "usi", "ng", " ", "a", " ", "new", " ", "set", " ", "of", " ", "predictor", " ", "layer", "s", " ", "correspond", "ing", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "same", " ", "predictor", "s", " ", "but", " ", "represent", "ing", " ", "data", " ", "from", " ", "a", " ", "different", " ", "time", " ", "period", " ", "(", "e", ".", "g", ".,", " ", "different", "\\", "10", ";", " ", " ", " ", " ", "climate", " ", "data", ").", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "output", " ", "of", " ", "this", " ", "module", " ", "is", " ", "subsequen", "tl", "y", " ", "used", " ", "as", " ", "the", " ", "projecti", "on", " ", "target", " ", "in", " ", "the", " ", "Apply", "Model", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "As", " ", "part", " ", "of", " ", "the", " ", "process", " ", "of", " ", "prepar", "ing", " ", "the", " ", "layer", "s", " ", "for", " ", "modeling", ",", " ", "the", " ", "Projection", "Layer", "s", " ", "module", " ", "runs", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "PAR", "C", " ", "module", " ", "internal", "ly", " ", "on", " ", "the", " ", "inputs", ".", " ", "Output", "s", " ", "from", " ", "the", " ", "Projection", "Layer", "s", " ", "module", " ", "will", " ", "poss", "ess", "\\", "10", ";", " ", " ", " ", " ", "matchi", "ng", " ", "coordinate", " ", "system", "s", ",", " ", "cell", " ", "size", "s", ",", " ", "and", " ", "extent", "s", " ", "and", " ", "do", " ", "not", " ", "need", " ", "to", " ", "be", " ", "run", " ", "through", " ", "PAR", "C", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "bei", "ng", " ", "used", " ", "downstream", " ", "in", " ", "the", " ", "workf", "low", ".)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Six", " ", "parameter", "s", " ", "can", " ", "be", " ", "set", " ", "by", " ", "the", " ", "user", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Director", "y", " ", "Cross", "walk", " ", "CSV", ":", " ", "Thi", "s", " ", "is", " ", "a", " ", ".", "csv", " ", "file", " ", "contain", "ing", " ", "two", " ", "column", "s", " ", "designat", "ing", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "layer", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "swapp", "ed", " ", "out", " ", "in", " ", "the", " ", "projected", " ", "model", ".", " ", "The", " ", "first", " ", "column", "\\", "10", ";", " ", " ", " ", " ", "contain", "s", " ", "a", " ", "list", " ", "of", " ", "the", " ", "full", " ", "path", "s", " ", "to", " ", "the", " ", "predictor", " ", "layer", "s", " ", "used", " ", "to", " ", "develop", " ", "the", " ", "original", "\\", "10", ";", " ", " ", " ", " ", "model", " ", "tha", "t", " ", "will", " ", "be", " ", "replaced", " ", "in", " ", "the", " ", "projecti", "on", " ", "process", ".", " ", "The", " ", "second", " ", "column", " ", "contain", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "full", " ", "path", "s", " ", "to", " ", "the", " ", "new", " ", "predictor", " ", "layer", "s", " ", "tha", "t", " ", "will", " ", "substitute", " ", "the", " ", "respec", "tiv", "e", " ", "layer", "s", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "original", " ", "model", ".", " ", "Ea", "ch", " ", "original", " ", "layer", " ", "in", " ", "the", " ", "first", " ", "column", " ", "shou", "ld", " ", "be", " ", "paired", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "its", " ", "replace", "ment", " ", "in", " ", "the", " ", "second", " ", "column", " ", "(", "e", ".", "g", ".,", " ", "Colum", "n", " ", "1", " ", "=", " ", "C", ":\\\\", "Model", "Layer", "s", "\\\\", "Prec", "ipi", "tation", "1980", ".", "tif", ",", "\\", "10", ";", " ", " ", " ", " ", "Colum", "n", " ", "2", " ", "=", " ", "C", ":\\\\", "Model", "Layer", "s", "\\\\", "Prec", "ipi", "tation", "2000", ".", "tif", ").", " ", "In", " ", "the", " ", "case", " ", "of", " ", "any", " ", "file", " ", "used", " ", "to", " ", "develop", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "first", " ", "model", " ", "tha", "t", " ", "is", " ", "not", " ", "express", "ly", " ", "liste", "d", " ", "in", " ", "the", " ", "Director", "y", " ", "Cross", "walk", " ", "CSV", " ", "with", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "replace", "ment", ",", " ", "the", " ", "original", " ", "file", " ", "will", " ", "be", " ", "used", " ", "in", " ", "the", " ", "new", " ", "model", " ", "projecti", "on", ".", " ", "The", " ", "module", "\\", "10", ";", " ", " ", " ", " ", "antic", "ipat", "es", " ", "a", " ", "header", " ", "row", " ", "in", " ", "this", " ", ".", "csv", " ", "file", " ", "(", "thu", "s", ",", " ", "the", " ", "first", " ", "row", " ", "of", " ", "data", " ", "will", " ", "be", " ", "ignore", "d", ").", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "File", " ", "List", " ", "CSV", ":", " ", "Thi", "s", " ", "is", " ", "a", " ", ".", "csv", " ", "file", " ", "contain", "ing", " ", "the", " ", "list", " ", "of", " ", "predictor", " ", "files", " ", "used", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "develop", " ", "the", " ", "first", " ", "model", ".", " ", "Effe", "ctive", "ly", ",", " ", "this", " ", "file", " ", "will", " ", "be", " ", "update", "d", " ", "based", " ", "on", " ", "the", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "provided", " ", "in", " ", "the", " ", "director", "y", " ", "cross", "walk", " ", ".", "csv", " ", "and", " ", "used", " ", "as", " ", "the", " ", "input", " ", "to", " ", "the", " ", "train", "ing", " ", "process", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "the", " ", "projected", " ", "model", ".", " ", "The", " ", "output", " ", "of", " ", "the", " ", "PAR", "C", " ", "module", " ", "from", " ", "the", " ", "first", " ", "model", " ", "iterati", "on", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "used", " ", "as", " ", "the", " ", "input", " ", "to", " ", "this", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Model", " ", "(", "avail", "able", " ", "only", " ", "to", " ", "users", " ", "at", " ", "the", " ", "FORT", "):", " ", "Thi", "s", " ", "parameter", " ", "allow", "s", " ", "Vis", "Trail", " ", "users", "\\", "10", ";", " ", " ", " ", " ", "runn", "ing", " ", "the", " ", "SA", "HM", " ", "package", " ", "on", " ", "site", " ", "at", " ", "the", " ", "US", "GS", " ", "Sci", "ence", " ", "Center", " ", "in", " ", "Fort", " ", "Colli", "ns", " ", "(", "FORT", ")", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "speci", "fy", " ", "one", " ", "of", " ", "three", " ", "model", "s", " ", "to", " ", "use", " ", "for", " ", "the", " ", "projected", " ", "model", " ", "run", " ", "(\"", "CCC", "MA", ",\"", " ", "\"", "CSI", "RO", ",\"", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "\"", "had", "cm", "3", "\")", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "4", ".", " ", "Scen", "ario", " ", "(", "avail", "able", " ", "only", " ", "to", " ", "users", " ", "at", " ", "the", " ", "FORT", "):", " ", "Thi", "s", " ", "parameter", " ", "allow", "s", " ", "Vis", "Trail", "\\", "10", ";", " ", " ", " ", " ", "users", " ", "runn", "ing", " ", "the", " ", "SA", "HM", " ", "package", " ", "on", " ", "site", " ", "at", " ", "the", " ", "US", "GS", " ", "Sci", "ence", " ", "Center", " ", "in", " ", "Fort", " ", "Colli", "ns", " ", "\\", "10", ";", " ", " ", " ", " ", "FORT", ")", " ", "to", " ", "speci", "fy", " ", "one", " ", "of", " ", "two", " ", "scen", "ario", "s", " ", "for", " ", "the", " ", "projected", " ", "model", " ", "run", " ", "(\"", "A2", "a", "\"", " ", "or", " ", "\"", "B2", "b", "\")", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "5", ".", " ", "Templa", "te", ":", " ", "Thi", "s", " ", "parameter", " ", "allow", "s", " ", "a", " ", "user", " ", "to", " ", "speci", "fy", " ", "the", " ", "new", " ", "template", " ", "layer", " ", "to", " ", "be", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "projected", " ", "model", " ", "run", ".", " ", "The", " ", "template", " ", "layer", " ", "is", " ", "a", " ", "rast", "er", " ", "data", " ", "layer", " ", "with", " ", "a", " ", "defin", "ed", "\\", "10", ";", " ", " ", " ", " ", "coordinate", " ", "system", ",", " ", "a", " ", "know", "n", " ", "cell", " ", "size", ",", " ", "and", " ", "an", " ", "extent", " ", "tha", "t", " ", "defin", "es", " ", "the", " ", "(", "new", ")", " ", "stud", "y", " ", "area", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "rast", "er", " ", "layer", " ", "serve", "s", " ", "as", " ", "the", " ", "template", " ", "for", " ", "all", " ", "the", " ", "other", " ", "inputs", " ", "in", " ", "the", " ", "analys", "is", ".", " ", "All", "\\", "10", ";", " ", " ", " ", " ", "addition", "al", " ", "rast", "er", " ", "layer", "s", " ", "used", " ", "in", " ", "the", " ", "analys", "is", " ", "will", " ", "be", " ", "resample", "d", " ", "and", " ", "repro", "ject", "ed", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "need", "ed", " ", "to", " ", "match", " ", "the", " ", "template", ",", " ", "snapp", "ed", " ", "to", " ", "the", " ", "template", ",", " ", "and", " ", "clipped", " ", "to", " ", "have", " ", "an", " ", "extent", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "matche", "s", " ", "the", " ", "template", ".", " ", "User", "s", " ", "shou", "ld", " ", "ensure", " ", "tha", "t", " ", "all", " ", "the", " ", "layer", "s", " ", "used", " ", "for", " ", "the", " ", "projected", "\\", "10", ";", " ", " ", " ", " ", "analys", "is", " ", "have", " ", "covera", "ge", " ", "within", " ", "the", " ", "extent", " ", "of", " ", "the", " ", "template", " ", "layer", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "6", ".", " ", "Year", " ", "(", "avail", "able", " ", "only", " ", "to", " ", "users", " ", "at", " ", "the", " ", "FORT", "):", " ", "Thi", "s", " ", "parameter", " ", "allow", "s", " ", "Vis", "Trail", " ", "users", "\\", "10", ";", " ", " ", " ", " ", "runn", "ing", " ", "the", " ", "SA", "HM", " ", "package", " ", "on", " ", "site", " ", "at", " ", "the", " ", "US", "GS", " ", "Sci", "ence", " ", "Center", " ", "in", " ", "Fort", " ", "Colli", "ns", " ", "(", "FORT", ")", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "speci", "fy", " ", "one", " ", "of", " ", "three", " ", "year", "s", " ", "to", " ", "use", " ", "for", " ", "the", " ", "projected", " ", "model", " ", "run", " ", "(\"", "2020", ",\"", " ", "\"", "2050", ",\"", " ", "or", " ", "\"", "208", "0", "\")", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "input", "\\u", "ports_", "=_", "[_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", ":", "Ot", "her", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "template", "Layer", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Templa", "te", "Layer", ":", "Data", "Inp", "ut", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "model", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "scen", "ario", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "year", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "director", "y", "Cross", "walk", "CSV", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "\"", "MD", "S", "\"_", ",_", "\"(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Projection", "Layers_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "models_", "=_", "[_", "'", "CCC", "MA", "'_", ",_", "'", "CSI", "RO", "'_", ",_", "'", "had", "cm", "3", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scen", "ario", "ss_", "=_", "[_", "'", "A2", "a", "'_", ",_", "'", "B2", "b", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "years_", "=_", "[_", "'", "2020", "'_", ",_", "'", "2050", "'_", ",_", "'", "208", "0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"\\\\", "n", "Run", "ning", " ", "make", " ", "Projection", " ", "Layer", "s", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "CSV_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "Ras", "ters", "With", "PAR", "CI", "nfo", "CSV", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "template", "Layer", "'_", ")_", "._", "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 ", " _", "template_", "=_", "''_", "#", "we", "'", "ll", " ", "get", " ", "a", " ", "template", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "to_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clim", "args_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "input_", "in_", "[_", "'", "model", "'_", ",_", "'", "scen", "ario", "'_", ",_", "'", "year", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "input_", "(_", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clim", "args_", "[_", "input_", "]_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "clim", "args_", "<_", ">_", "{_", "}_", "and_", "clim", "args_", "._", "keys_", "(_", ")_", "<_", ">_", "[_", "'", "model", "'_", ",_", "'", "scen", "ario", "'_", ",_", "'", "year", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "the", "y", " ", "did", " ", "not", " ", "add", " ", "in", " ", "one", " ", "of", " ", "each", ",", " ", "Not", " ", "goi", "ng", " ", "to", " ", "fly", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "All", " ", "of", " ", "model", ",", " ", "scen", "ario", ",", " ", "and", " ", "year", " ", "must", " ", "be", " ", "supplie", "d", " ", "if", " ", "any", " ", "are", " ", "used", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "clim", "args_", "<_", ">_", "{_", "}_", "and_", "clim", "args_", "._", "keys_", "<_", ">_", "[_", "'", "model", "'_", ",_", "'", "scen", "ario", "'_", ",_", "'", "year", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "the", "y", " ", "specified", " ", "a", " ", "alt", " ", "climate", " ", "scen", "ario", " ", "add", " ", "this", " ", "to", " ", "our", " ", "list", " ", "to", " ", "search", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "to_", "._", "append_", "(_", "[_", "r", "'", "K", ":\\\\", "GI", "S", "\\u", "LIBRARY", "\\\\", "Clim", "ate", "\\\\", "Wor", "ld", "Clim", "\\\\", "Bio", "clim", "atic", "Varia", "bles", "\\\\", "bio", "\\u", "30", "s", "\\u", "esr", "i", "\\\\", "bio", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "'", "I", ":\\\\", "Wor", "ld", "Clim", "\\u", "Fu", "ture", "\\u", "Clim", "ate", "\\\\", "Rename", "d", "BIL", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clim", "args_", "[_", "'", "model", "'_", "]_", ",_", "clim", "args_", "[_", "'", "scen", "ario", "'_", "]_", ",_", "clim", "args_", "[_", "'", "year", "'_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "director", "y", "Cross", "walk", "CSV", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cross", "walk", "CSV_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "director", "y", "Cross", "walk", "CSV", "'_", ")_", ",_", "'", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "cross", "walk", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "cross", "walk", "CSV_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "to_", "._", "append_", "(_", "row_", "[_", "0_", "]_", ",_", "row_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "cross", "walk", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "write", " ", "out", " ", "the", " ", "output", "s", " ", "to", " ", "an", " ", "empty", " ", "MD", "S", " ", "file", " ", "(", "just", " ", "the", " ", "header", " ", "is", " ", "need", "ed", " ", "to", " ", "PAR", "C", " ", "the", " ", "output", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "CSV_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "input", "CSV_", ",_", "'", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "CSV_", "._", "next_", "(_", ")_", "#", "skip", " ", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "working", "CSV_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "tmp", "Files", "To", "PAR", "C", "\\u'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "CSV_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "working", "CSV_", ",_", "'", "wb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "CSV_", "._", "writerow_", "(_", "[_", "\"", "File", "Path", "\"_", ",_", "\"", "Categori", "cal", "\"_", ",_", "\"", "Res", "ampling", "\"_", ",_", "\"", "Aggregation", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er1", "_", "=_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "response", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er2", "_", "=_", "[_", "''_", ",_", "''_", ",_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er", "3_", "=_", "[_", "''_", ",_", "''_", ",_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "dname_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "'", "Projection", "Layer", "s", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "in", "CSV_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Short", "Name_", "=_", "utils_", "._", "get", "Short", "Name_", "(_", "row_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "row_", "[_", "1_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Head", "er1", "_", "._", "append_", "(_", "file", "Short", "Name_", "+_", "'\\u", "categor", "ical", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Head", "er1", "_", "._", "append_", "(_", "file", "Short", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "Head", "er2", "_", "._", "append_", "(_", "'", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Head", "er", "3_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "file", "Short", "Name_", "+_", "'.", "tif", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "File_", "=_", "row_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Orig", "File_", "=_", "orig", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lookup_", "in_", "from", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lookup_", "[_", "0_", "]_", "in_", "orig", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Orig", "File_", "=_", "orig", "File_", "._", "replace_", "(_", "lookup_", "[_", "0_", "]_", ",_", "lookup_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "CSV_", "._", "writerow_", "(_", "[_", "new", "Orig", "File_", ",_", "]_", "+_", "row_", "[_", "1_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "tmp", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "PAR", "C", " ", "the", " ", "files", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "our", "PAR", "C_", "=_", "parc", "_", "._", "PAR", "C_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "configuration_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "PAR", "C_", "._", "verbose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "output", "\\u", "dna", "me", "=\"_", "+_", "output", "\\u", "dname_", ",_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "out", "Dir_", "=_", "output", "\\u", "dname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "inputs", "CSV_", "=_", "working", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "PAR", "C_", "._", "template_", "=_", "template_", "\\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 ", " _", "our", "PAR", "C_", "._", "parc", "Files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tra", "pped", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "informati", "ve", "\\u", "untr", "appe", "d\\u", "error_", "(_", "self_", ",_", "\"", "PAR", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "loop", " ", "through", " ", "our", " ", "working", "CSV", " ", "and", " ", "format", " ", "it", " ", "int", "o", " ", "an", " ", "MD", "S", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "output", "MD", "S", " ", "=", " ", "util", "s", ".", "mk", "next", "file", "(", "prefix", "='", "Projection", "Layer", "s", "MD", "S", "\\u", "',", " ", "suff", "ix", " ", "=", " ", "'.", "csv", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "MD", "S_", "=_", "os_", "._", "path_", "._", "join_", "(_", "output", "\\u", "dname_", ",_", "'", "Projection", "Layer", "s", "MD", "S", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "output", "MD", "S_", ",_", "'", "wb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "._", "writerow_", "(_", "out", "Head", "er1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "._", "writerow_", "(_", "out", "Head", "er2", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "CSV_", "._", "writerow_", "(_", "out", "Head", "er", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "output", "MD", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "MD", "S", "\"_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "Select", " ", "Projection", " ", "Layer", "s", " ", "widget", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "MAX", "ENT_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "output", "\\u", "ports_", "=_", "[_", "(_", "\"", "lambda", "s", "\"_", ",_", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "report", "\"_", ",_", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "roc", "\"_", ",_", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "MAX", "ENT_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "maxe", "nt", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "Max", "ent_", "=_", "Max", "ent", "Runner_", "._", "MAX", "ENTR", "unne", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "Max", "ent_", "._", "output", "Dir_", "=_", "utils_", "._", "mk", "next", "dir_", "(_", "prefix_", "=_", "'", "maxe", "nt", "Files", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "Max", "ent_", "._", "input", "MD", "S_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "'", "input", "MD", "S", "'_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "our", "Max", "ent_", "._", "maxe", "ntpath", "_", "=_", "maxe", "nt", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Max", "ent", "Arg", "s", "CSV_", "=_", "utils_", "._", "mk", "next", "file_", "(_", "prefix_", "=_", "'", "Max", "ent", "Arg", "s", "'_", ",_", "suffix_", "=_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "Writer_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "Max", "ent", "Arg", "s", "CSV_", ",_", "'", "wb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "Writer_", "._", "writerow_", "(_", "[_", "'", "parameter", "'_", ",_", "'", "value", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "port_", "in_", "self_", "._", "\\u", "input", "\\u", "ports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "port_", "[_", "0_", "]_", "<_", ">_", "'", "input", "MD", "S", "'_", "and_", "port_", "[_", "0_", "]_", "<_", ">_", "'", "projecti", "onl", "aye", "rs", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "input_", "(_", "port_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "port", "\\u", "val_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "port_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "port_", "[_", "1_", "]_", "==_", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "port", "\\u", "val_", "=_", "str_", "(_", "port", "\\u", "val_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "port_", "[_", "1_", "]_", "==_", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Path", ")\"_", "or_", "port_", "[_", "1_", "]_", "==_", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "File", ")\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "port", "\\u", "val_", "=_", "port", "\\u", "val_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arg", "Writer_", "._", "writerow_", "(_", "[_", "port_", "[_", "0_", "]_", ",_", "port", "\\u", "val_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", " ", " ", " ", "has", " ", "no", " ", "input", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "=_", "port_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "port_", "[_", "1_", "]_", "==_", "\"(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "Boo", "lean", ")\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "default_", "=_", "kwargs_", "[_", "'", "default", "s", "'_", "]_", "[_", "2_", ":_", "-_", "2_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "default_", "=_", "kwargs_", "[_", "'", "default", "s", "'_", "]_", "[_", "2_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "args", "[", "port", "[", "0", "]]", " ", "=", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arg", "Writer_", "._", "writerow_", "(_", "[_", "port_", "[_", "0_", "]_", ",_", "default_", "]_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "projecti", "onl", "aye", "rs", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "'", "projecti", "onl", "aye", "rs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proj", "layers_", "=_", "','_", "._", "join_", "(_", "[_", "path_", "._", "name_", "for_", "path_", "in_", "value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "Writer_", "._", "writerow_", "(_", "[_", "'", "projecti", "onl", "aye", "rs", "'_", ",_", "proj", "layers_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "arg", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "Max", "ent_", "._", "args", "CSV_", "=_", "Max", "ent", "Arg", "s", "CSV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "our", "Max", "ent_", "._", "logger_", "=_", "utils_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "our", "Max", "ent_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tra", "pped", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "informati", "ve", "\\u", "untr", "appe", "d\\u", "error_", "(_", "self_", ",_", "\"", "Max", "ent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "outputs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lambda", "sfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "our", "Max", "ent_", "._", "output", "Dir_", ",_", "our", "Max", "ent_", "._", "args_", "[_", "\"", "specie", "s", "\\u", "name", "\"_", "]_", "+_", "\".", "lambda", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "lambda", "sfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "lambda", "s", "\"_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "roc", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "our", "Max", "ent_", "._", "output", "Dir_", ",_", "'", "plots", "'_", ",_", "our", "Max", "ent_", "._", "args_", "[_", "\"", "specie", "s", "\\u", "name", "\"_", "]_", "+_", "\"\\u", "roc", ".", "png", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "roc", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "roc", "\"_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "our", "Max", "ent_", "._", "output", "Dir_", ",_", "our", "Max", "ent_", "._", "args_", "[_", "\"", "specie", "s", "\\u", "name", "\"_", "]_", "+_", "\".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "html", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "file_", "=_", "utils_", "._", "create", "\\u", "file", "\\u", "module_", "(_", "html", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "report", "\"_", ",_", "output", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Finish", "ed", " ", "Max", "ent", " ", "widget", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "max", "\\u", "ent", "\\u", "params_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxe", "nt", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "maxe", "nt", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "\\u", "reader_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "maxe", "nt", "\\u", "fname_", ",_", "'", "r", "U", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pass", " ", "on", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "csv", "\\u", "reader_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "ports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "ports_", "._", "append_", "(_", "(_", "'", "input", "MD", "S", "'_", ",_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "Merged", "Data", "Set", ":", "Ot", "her", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basic", "\\u", "pkg_", "=_", "'", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "type", "\\u", "map_", "=_", "{_", "'", "file", "/", "director", "y", "'_", ":_", "'", "Path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "double", "'_", ":_", "'", "Float", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "csv", "\\u", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "name_", ",_", "flag_", ",_", "p", "\\u", "type_", ",_", "default_", ",_", "doc_", ",_", "notes_", "]_", "=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "type_", "=_", "p", "\\u", "type_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p", "\\u", "type_", "in_", "p", "\\u", "type", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "type_", "=_", "p", "\\u", "type", "\\u", "map_", "[_", "str_", "(_", "p", "\\u", "type_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "type_", "=_", "str_", "(_", "p", "\\u", "type_", ")_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "default_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p", "\\u", "type_", "==_", "'", "Boo", "lean", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default_", "=_", "default_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "default", "s", "'_", "]_", "=_", "str_", "(_", "[_", "default_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "type_", "==_", "'", "Boo", "lean", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "option", "al", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "\\u", "ports_", "._", "append_", "(_", "(_", "name_", ",_", "'('_", "+_", "basic", "\\u", "pkg_", "+_", "':'_", "+_", "p", "\\u", "type_", "+_", "')'_", ",_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "set", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "port", ":'", ",", " ", "(", "name", ",", " ", "'(", "'", " ", "+", " ", "basic", "\\u", "pkg", " ", "+", " ", "':", "'", " ", "+", " ", "p", "\\u", "type", " ", "+", " ", "')", "',", " ", "kwarg", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "docs_", "[_", "name_", "]_", "=_", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "MAX", "ENT", ":'", ",", " ", "input", "\\u", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "MAX", "ENT_", "._", "\\u", "input", "\\u", "ports_", "=_", "input", "\\u", "ports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "ENT_", "._", "\\u", "port", "\\u", "docs_", "=_", "docs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "provide", "\\u", "input", "\\u", "port", "\\u", "documentation", "_", "(_", "cls_", ",_", "port", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "\\u", "port", "\\u", "docs_", "[_", "port", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "MAX", "ENT_", "._", "provide", "\\u", "input", "\\u", "port", "\\u", "documentation", "_", "=_", "classmethod_", "(_", "provide", "\\u", "input", "\\u", "port", "\\u", "documentation", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "initialize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "maxe", "nt", "\\u", "path_", ",_", "color", "\\u", "breaks", "\\u", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "session", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "config_", "=_", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "configuration_", "._", "r", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxe", "nt", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "configuration_", "._", "maxe", "nt", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", " ", "was", " ", "previ", "ously", " ", "setti", "ng", " ", "the", " ", "follow", "ing", " ", "environ", "menta", "l", " ", "variab", "les", " ", "and", " ", "path", " ", "additions", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "so", " ", "tha", "t", " ", "each", " ", "user", " ", "wou", "ld", "n", "'", "t", " ", "have", " ", "to", " ", "do", " ", "this", " ", "on", " ", "thei", "r", " ", "individual", " ", "machine", "s", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", " ", "was", " ", "runn", "ing", " ", "int", "o", " ", "problem", "s", " ", "with", " ", "import", "s", " ", "occur", "ing", " ", "bef", "ore", " ", "this", " ", "initialize", " ", "routin", "e", " ", "so", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "I", " ", "moved", " ", "the", " ", "setti", "ng", " ", "of", " ", "these", " ", "to", " ", "an", " ", "external", " ", ".", "net", " ", "applica", "tion", " ", "tha", "t", " ", "sets", " ", "these", " ", "bef", "ore", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "startin", "g", " ", "up", " ", "Vis", "Trail", "s", ".", "py", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Thi", "s", " ", "shou", "ld", " ", "als", "o", " ", "make", " ", "this", " ", "package", " ", "easi", "er", " ", "to", " ", "port", " ", "to", " ", "other", " ", "system", "s", " ", "as", " ", "this", " ", "stu", "ff", " ", "wou", "ld_", "\\u\\u\\uNL\\u\\u\\u_", "#", "only", " ", "work", " ", "on", " ", "a", " ", "windows", " ", "instance", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "the", " ", "current", " ", "dependen", "cies", " ", "are", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "an", " ", "installation", " ", "of", " ", "GDA", "L", " ", "and", " ", "Proj", ".4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "include", "s", " ", "the", " ", "GDA", "L", "\\u", "DATA", " ", "and", " ", "PROJ", "\\u", "LIB", " ", "director", "ies", " ", "as", " ", "environ", "menta", "l", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "#", "GDA", "L", " ", "bindi", "ngs", " ", "for", " ", "python", " ", "in", " ", "the", " ", "python", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "QG", "IS", " ", "bui", "lt", " ", "for", " ", "the", " ", "version", " ", "of", " ", "Pyth", "on", ",", " ", "QT", ",", " ", "Py", "Qt", ",", " ", "and", " ", "SI", "P", " ", "used", " ", "by", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Thi", "s", " ", "one", " ", "was", " ", "a", " ", "pain", "ful", " ", "bear", " ", "on", " ", "Window", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "All", " ", "of", " ", "the", " ", "DLL", "s", " ", "require", "d", " ", "by", " ", "the", " ", "above", " ", "QG", "IS", " ", "build", " ", "must", " ", "be", " ", "on", " ", "the", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "In", " ", "my", " ", "case", " ", "these", " ", "wer", "e", " ", "in", " ", "a", " ", "folder", " ", "in", " ", "the", " ", "OS", "Geo", "W", " ", "installation", " ", "tha", "t", " ", "QG", "IS", " ", "was", " ", "bui", "lt", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "off", " ", "of", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "And", " ", "final", "ly", " ", "QG", "IS", " ", "bindi", "ngs", " ", "for", " ", "python", " ", "in", " ", "the", " ", "python", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "qgis_", "._", "core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qgis_", "._", "gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "(_", ")_", "[_", "\"", "qgis", "\"_", "]_", "=_", "qgis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set", "QG", "IS_", "(_", "qgis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qgis", "\\u", "prefix_", "=_", "os_", "._", "path_", "._", "join_", "(_", "configuration_", "._", "qgis", "\\u", "path_", ",_", "\"", "qgis", "1.7", ".0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qgis_", "._", "core_", "._", "Qg", "s", "Application_", "._", "set", "Pref", "ix", "Path_", "(_", "qgis", "\\u", "prefix_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qgis_", "._", "core_", "._", "Qg", "s", "Application_", "._", "init", "Qg", "is_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session", "\\u", "dir_", "=_", "utils_", "._", "create", "rootdir_", "(_", "configuration_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utils_", "._", "create", "Logger_", "(_", "session", "\\u", "dir_", ",_", "configuration_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "log", "\\u", "file", " ", "=", " ", "Utili", "ties", ".", "create", "session", "log", "(", "session", "\\u", "dir", ",", " ", "configura", "tion", ".", "verbo", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "color", "\\u", "breaks", "\\u", "csv_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "\"", "Color", "Break", "s", ".", "csv", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "max", "\\u", "ent", "\\u", "params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "layer", "s", "\\u", "csv", "\\u", "fname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"*\"_", "*_", "79_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", "Initializ", "ing", ":\"_", ",_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", "Locat", "ion", "s", " ", "of", " ", "dependen", "cies", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "writet", "olog", "(\"", " ", " ", " ", "Layer", "s", " ", "CSV", " ", "=", " ", "\"", " ", "+", " ", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dir", "name", "(\\u", "\\u", "file", "\\u\\u)", ",", " ", "'", "layer", "s", ".", "csv", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", "Layer", "s", " ", "CSV", " ", "=", " ", "\"_", "+_", "layer", "s", "\\u", "csv", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", "R", " ", "path", " ", "=", " ", "\"_", "+_", "r", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", "GDA", "L", " ", "folder", " ", "=", " ", "\"_", "+_", "os_", "._", "path_", "._", "abspath_", "(_", "configuration_", "._", "gdal", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "Mus", "t", " ", "contain", " ", "subfolder", "s", " ", "proj", ",", " ", "gdal", "-", "data", ",", " ", "GDA", "L", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", "Max", "ent", " ", "folder", " ", "=", " ", "\"_", "+_", "maxe", "nt", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", "QG", "IS", " ", "folder", " ", "=", " ", "\"_", "+_", "os_", "._", "path_", "._", "abspath_", "(_", "configuration_", "._", "qgis", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "Mus", "t", " ", "contain", " ", "subfolder", "s", " ", "qgis", "1.7", ".0", ",", " ", "OS", "Geo", "4", "W", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", " ", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"*\"_", "*_", "79_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writet", "olog", "_", "(_", "\"*\"_", "*_", "79_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"", " ", "output", " ", "director", "y", ":", " ", " ", " ", "\"_", "+_", "session", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"*\"_", "*_", "79_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "\"*\"_", "*_", "79_", ")_", "\\u\\u\\uNEWLINE\\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_", "#", "util", "s", ".", "clean", "temps", "()", "#", "No", " ", "long", "er", " ", "used", " _", "\\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\\u", "namespaces_", "(_", "modules_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "namespace_", ",_", "m", "\\u", "list_", "in_", "modules_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "module_", "in_", "m", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "dict_", "=_", "{_", "'", "namespace", "'_", ":_", "namespace_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "module_", ")_", "==_", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "dict_", "._", "update_", "(_", "module_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "list_", "._", "append_", "(_", "(_", "module_", "[_", "0_", "]_", ",_", "m", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "m", "\\u", "dict", ":'", ",", " ", "m", "\\u", "dict_", "\\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 ", " _", "module", "\\u", "list_", "._", "append_", "(_", "(_", "module_", ",_", "m", "\\u", "dict_", ")_", ")_", "\\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_", "module", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "avail", "able", "\\u", "trees_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trees_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "layer", "s", "\\u", "csv", "\\u", "fname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer", "s", "\\u", "csv", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "layer", "s", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "\\u", "reader_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "layer", "s", "\\u", "csv", "\\u", "fname_", ",_", "'", "r", "U", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "\\u", "reader_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "file_", "=_", "csv", "\\u", "reader_", "._", "next_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "the", " ", "first", " ", "file", " ", "in", " ", "the", " ", "layer", "s", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", " ", "assume", " ", "tha", "t", " ", "none_", "\\u\\u\\uNL\\u\\u\\u_", "#", "of", " ", "them", " ", "do", " ", "and", " ", "use", " ", "the", " ", "example", "data", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "first", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "(_", "\"!\"_", "*_", "30_", ")_", "+_", "\"", " ", "WARN", "ING", " ", "\"_", "+_", "(_", "\"!\"_", "*_", "30_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "*_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "The", " ", "first", " ", "grid", " ", "in", " ", "your", " ", "layer", "s", " ", "CSV", " ", "coul", "d", " ", "not", " ", "be", " ", "found", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Default", "ing", " ", "to", " ", "the", " ", "example", " ", "data", " ", "csv", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "fix", "/", "set", " ", "path", "s", " ", "in", " ", "file", " ", "\"_", "+_", "layer", "s", "\\u", "csv", "\\u", "fname_", "+_", "\"", " ", "to", " ", "enable", " ", "this", " ", "functional", "it", "y", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "See", " ", "documentation", " ", "for", " ", "more", " ", "informati", "on", " ", "on", " ", "setti", "ng", " ", "up", " ", "the", " ", "layer", "s", ".", "csv", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "(_", "\"!\"_", "*_", "30_", ")_", "+_", "\"", " ", "WARN", "ING", " ", "\"_", "+_", "(_", "\"!\"_", "*_", "30_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "*_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layer", "s", "\\u", "csv", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "layer", "s", ".", "example", "data", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "csv", "\\u", "reader_", "=_", "csv_", "._", "reader_", "(_", "open_", "(_", "layer", "s", "\\u", "csv", "\\u", "fname_", ",_", "'", "r", "U", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pass", " ", "on", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "csv", "\\u", "reader_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "csv", "\\u", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "row_", "[_", "2_", "]_", "not_", "in_", "trees_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trees_", "[_", "row_", "[_", "2_", "]_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avail", "able", "\\u", "dict_", "=_", "trees_", "[_", "row_", "[_", "2_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "'", "Day", "met", "'", " ", "not", " ", "in", " ", "avail", "able", "\\u", "dict", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "avail", "able", "\\u", "dict", "['", "Day", "met", "']", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "avail", "able", "\\u", "dict", "['", "Day", "met", "']", ".", "append", "((", "row", "[", "0", "],", " ", "row", "[", "1", "],", " ", "row", "[", "3", "]))", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "row_", "[_", "3_", "]_", "not_", "in_", "avail", "able", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "avail", "able", "\\u", "dict_", "[_", "row_", "[_", "3_", "]_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avail", "able", "\\u", "dict_", "[_", "row_", "[_", "3_", "]_", "]_", "._", "append_", "(_", "(_", "row_", "[_", "0_", "]_", ",_", "row_", "[_", "1_", "]_", ",_", "row_", "[_", "4_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "trees_", "\\u\\u\\uNEWLINE\\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", "predictor", "\\u", "modules_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "avail", "able", "\\u", "trees_", "=_", "build", "\\u", "avail", "able", "\\u", "trees_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "tree_", "in_", "avail", "able", "\\u", "trees_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "arr_", "=_", "name_", "._", "strip_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "base_", "=_", "''_", "._", "join_", "(_", "n_", "._", "capitalize_", "(_", ")_", "for_", "n_", "in_", "name", "\\u", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget", "\\u", "class_", "=_", "get", "\\u", "predictor", "\\u", "widget_", "(_", "class", "\\u", "base_", ",_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "class_", "=_", "get", "\\u", "predictor", "\\u", "config_", "(_", "class", "\\u", "base_", ",_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "name_", "=_", "class", "\\u", "base_", "+_", "\"", "Predictor", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "widget", "\\u", "method_", "(_", "w", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "widget", "\\u", "class_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "w", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "get", "\\u", "widget", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module_", "=_", "type_", "(_", "class", "\\u", "name_", ",_", "(_", "Predictor", "List_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "get", "\\u", "widget", "\\u", "class", "'_", ":_", "get", "\\u", "widget", "\\u", "method_", "(_", "widget", "\\u", "class_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "input", "\\u", "port", "s", "'_", ":_", "[_", "(_", "'", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "gov", ".", "us", "gs", ".", "sa", "hm", ":", "%", "s", ":", "Data", "Inp", "ut", ")'_", "%_", "class", "\\u", "name_", ",_", "True_", ")_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "modules_", "._", "append_", "(_", "(_", "module_", ",_", "{_", "'", "configur", "e", "Wid", "get", "Type", "'_", ":_", "config", "\\u", "class_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "module_", "in_", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "[_", "0_", "]_", "._", "\\u", "output", "\\u", "ports_", "._", "append_", "(_", "(_", "'", "value", "\\u", "as", "\\u", "string", "'_", ",_", "'(", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "basic", ":", "String", ")'_", ",_", "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_", "modules_", "\\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, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 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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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 ]
Unused import
hyperopt/hyperopt/hyperopt/mongoexp.py
[ { "content": "\"\"\"\nMongodb-based Trials Object\n===========================\n\nComponents involved:\n\n- mongo\n e.g. mongod ...\n\n- driver\n e.g. hyperopt-mongo-search mongo://address bandit_json bandit_algo_json\n\n- worker\n e.g. hyperopt-mongo-worker --loop mongo://address\n\n\nMongo\n=====\n\nMongo (daemon process mongod) is used for IPC between the driver and worker.\nConfigure it as you like, so that hyperopt-mongo-search can communicate with it.\nI think there is some support in this file for an ssh+mongo connection type.\n\nThe experiment uses the following collections for IPC:\n\n* jobs - documents of a standard form used to store suggested trials and their\n results. These documents have keys:\n * spec : subdocument returned by bandit_algo.suggest\n * exp_key: an identifier of which driver suggested this trial\n * cmd: a tuple (protocol, ...) identifying bandit.evaluate\n * state: 0, 1, 2, 3 for job state (new, running, ok, fail)\n * owner: None for new jobs, (hostname, pid) for started jobs\n * book_time: time a job was reserved\n * refresh_time: last time the process running the job checked in\n * result: the subdocument returned by bandit.evaluate\n * error: for jobs of state 3, a reason for failure.\n * logs: a dict of sequences of strings received by ctrl object\n * info: info messages\n * warn: warning messages\n * error: error messages\n\n* fs - a gridfs storage collection (used for pickling)\n\n* drivers - documents describing drivers. These are used to prevent two drivers\n from using the same exp_key simultaneously, and to attach saved states.\n * exp_key\n * workdir: [optional] path where workers should chdir to\n Attachments:\n * pkl: [optional] saved state of experiment class\n * bandit_args_kwargs: [optional] pickled (clsname, args, kwargs) to\n reconstruct bandit in worker processes\n\nThe MongoJobs, and CtrlObj classes as well as the main_worker\nmethod form the abstraction barrier around this database layout.\n\n\nWorker\n======\n\nA worker looks up a job in a mongo database, maps that job document to a\nrunnable python object, calls that object, and writes the return value back to\nthe database.\n\nA worker *reserves* a job by atomically identifying a document in the jobs\ncollection whose owner is None and whose state is 0, and setting the state to\n1. If it fails to identify such a job, it loops with a random sleep interval\nof a few seconds and polls the database.\n\nIf hyperopt-mongo-worker is called with a --loop argument then it goes back to\nthe database after finishing a job to identify and perform another one.\n\nCtrlObj\n-------\n\nThe worker allocates a CtrlObj and passes it to bandit.evaluate in addition to\nthe subdocument found at job['spec']. A bandit can use ctrl.info, ctrl.warn,\nctrl.error and so on like logger methods, and those messages will be written\nto the mongo database (to job['logs']). They are not written synchronously\nthough, they are written when the bandit.evaluate function calls\nctrl.checkpoint().\n\nCtrl.checkpoint does several things:\n* flushes logging messages to the database\n* updates the refresh_time\n* optionally updates the result subdocument\n\nThe main_worker routine calls Ctrl.checkpoint(rval) once after the\nbandit.evalute function has returned before setting the state to 2 or 3 to\nfinalize the job in the database.\n\n\"\"\"\n\n__authors__ = [\"James Bergstra\", \"Dan Yamins\"]\n__license__ = \"3-clause BSD License\"\n__contact__ = \"github.com/hyperopt/hyperopt\"\n\nimport copy\ntry:\n import dill as cPickle\nexcept ImportError:\n import cPickle\nimport hashlib\nimport logging\nimport optparse\nimport os\nimport shutil\nimport signal\nimport socket\nimport subprocess\nimport sys\nimport time\nimport urlparse\nimport warnings\n\nimport numpy\nimport pymongo\nimport gridfs\nfrom bson import SON\n\n\nlogger = logging.getLogger(__name__)\n\nfrom .base import JOB_STATES\nfrom .base import (JOB_STATE_NEW, JOB_STATE_RUNNING, JOB_STATE_DONE,\n JOB_STATE_ERROR)\nfrom .base import Trials\nfrom .base import trials_from_docs\nfrom .base import InvalidTrial\nfrom .base import Ctrl\nfrom .base import SONify\nfrom .base import spec_from_misc\nfrom .utils import coarse_utcnow\nfrom .utils import fast_isin\nfrom .utils import get_most_recent_inds\nfrom .utils import json_call\nfrom .utils import working_dir, temp_dir\nimport plotting\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OperationFailure(Exception):\n \"\"\"Proxy that could be factored out if we also want to use CouchDB and\n JobmanDB classes with this interface\n \"\"\"", "metadata": "root.OperationFailure", "header": "['module', '___EOS___']", "index": 139 }, { "content": "class Shutdown(Exception):\n \"\"\"\n Exception for telling mongo_worker loop to quit\n \"\"\"", "metadata": "root.Shutdown", "header": "['module', '___EOS___']", "index": 145 }, { "content": "class WaitQuit(Exception):\n \"\"\"\n Exception for telling mongo_worker loop to quit\n \"\"\"", "metadata": "root.WaitQuit", "header": "['module', '___EOS___']", "index": 151 }, { "content": "class InvalidMongoTrial(InvalidTrial):\n pass", "metadata": "root.InvalidMongoTrial", "header": "['module', '___EOS___']", "index": 157 }, { "content": "class DomainSwapError(Exception):\n \"\"\"Raised when the search program tries to change the bandit attached to\n an experiment.\n \"\"\"", "metadata": "root.DomainSwapError", "header": "['module', '___EOS___']", "index": 161 }, { "content": "class ReserveTimeout(Exception):\n \"\"\"No job was reserved in the alotted time\n \"\"\"", "metadata": "root.ReserveTimeout", "header": "['module', '___EOS___']", "index": 167 }, { "content": "def read_pw():\n username = 'hyperopt'\n password = open(os.path.join(os.getenv('HOME'), \".hyperopt\")).read()[:-1]\n return dict(\n username=username,\n password=password)", "metadata": "root.read_pw", "header": "['module', '___EOS___']", "index": 172 }, { "content": "def authenticate_for_db(db):\n d = read_pw()\n db.authenticate(d['username'], d['password'])", "metadata": "root.authenticate_for_db", "header": "['module', '___EOS___']", "index": 180 }, { "content": "def parse_url(url, pwfile=None):\n \"\"\"Unpacks a url of the form\n protocol://[username[:pw]]@hostname[:port]/db/collection\n\n :rtype: tuple of strings\n :returns: protocol, username, password, hostname, port, dbname, collection\n\n :note:\n If the password is not given in the url but the username is, then\n this function will read the password from file by calling\n ``open(pwfile).read()[:-1]``\n\n \"\"\"\n\n protocol=url[:url.find(':')]\n ftp_url='ftp'+url[url.find(':'):]\n\n # -- parse the string as if it were an ftp address\n tmp = urlparse.urlparse(ftp_url)\n\n logger.info( 'PROTOCOL %s'% protocol)\n logger.info( 'USERNAME %s'% tmp.username)\n logger.info( 'HOSTNAME %s'% tmp.hostname)\n logger.info( 'PORT %s'% tmp.port)\n logger.info( 'PATH %s'% tmp.path)\n try:\n _, dbname, collection = tmp.path.split('/')\n except:\n print >> sys.stderr, \"Failed to parse '%s'\"%(str(tmp.path))\n raise\n logger.info( 'DB %s'% dbname)\n logger.info( 'COLLECTION %s'% collection)\n\n if tmp.password is None:\n if (tmp.username is not None) and pwfile:\n password = open(pwfile).read()[:-1]\n else:\n password = None\n else:\n password = tmp.password\n logger.info( 'PASS %s'% password)\n\n return (protocol, tmp.username, password, tmp.hostname, tmp.port, dbname,\n collection)", "metadata": "root.parse_url", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def connection_with_tunnel(host='localhost',\n auth_dbname='admin', port=27017,\n ssh=False, user='hyperopt', pw=None):\n if ssh:\n local_port=numpy.random.randint(low=27500, high=28000)\n # -- forward from local to remote machine\n ssh_tunnel = subprocess.Popen(\n ['ssh', '-NTf', '-L',\n '%i:%s:%i'%(local_port, '127.0.0.1', port),\n host],\n #stdin=subprocess.PIPE,\n #stdout=subprocess.PIPE,\n #stderr=subprocess.PIPE,\n )\n # -- give the subprocess time to set up\n time.sleep(.5)\n connection = pymongo.Connection('127.0.0.1', local_port,\n document_class=SON)\n else:\n connection = pymongo.Connection(host, port, document_class=SON)\n if user:\n if user == 'hyperopt':\n authenticate_for_db(connection[auth_dbname])\n else:\n raise NotImplementedError()\n ssh_tunnel=None\n\n # -- Ensure that changes are written to at least once server.\n connection.write_concern['w'] = 1\n # -- Ensure that changes are written to the journal if there is one.\n connection.write_concern['j'] = True\n\n return connection, ssh_tunnel", "metadata": "root.connection_with_tunnel", "header": "['module', '___EOS___']", "index": 231 }, { "content": "def connection_from_string(s):\n protocol, user, pw, host, port, db, collection = parse_url(s)\n if protocol == 'mongo':\n ssh=False\n elif protocol in ('mongo+ssh', 'ssh+mongo'):\n ssh=True\n else:\n raise ValueError('unrecognized protocol for MongoJobs', protocol)\n connection, tunnel = connection_with_tunnel(\n ssh=ssh,\n user=user,\n pw=pw,\n host=host,\n port=port,\n )\n return connection, tunnel, connection[db], connection[db][collection]", "metadata": "root.connection_from_string", "header": "['module', '___EOS___']", "index": 266 }, { "content": "class MongoJobs(object):\n \"\"\"\n # Interface to a Jobs database structured like this\n #\n # Collections:\n #\n # db.jobs - structured {config_name, 'cmd', 'owner', 'book_time',\n # 'refresh_time', 'state', 'exp_key', 'owner', 'result'}\n # This is the collection that the worker nodes write to\n #\n # db.gfs - file storage via gridFS for all collections\n #\n \"\"\"\n\n # TODO: rename jobs -> coll throughout\n coll = property(lambda s : s.jobs)\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.MongoJobs", "header": "['module', '___EOS___']", "index": 284 }, { "content": " def __init__(self, db, jobs, gfs, conn, tunnel, config_name):\n \"\"\"\n Parameters\n ----------\n\n db - Mongo Database (e.g. `Connection()[dbname]`)\n database in which all job-related info is stored\n\n jobs - Mongo Collection handle\n collection within `db` to use for job arguments, return vals,\n and various bookkeeping stuff and meta-data. Typically this is\n `db['jobs']`\n\n gfs - Mongo GridFS handle\n GridFS is used to store attachments - binary blobs that don't fit\n or are awkward to store in the `jobs` collection directly.\n\n conn - Mongo Connection\n Why we need to keep this, I'm not sure.\n\n tunnel - something for ssh tunneling if you're doing that\n See `connection_with_tunnel` for more info.\n\n config_name - string\n XXX: No idea what this is for, seems unimportant.\n\n \"\"\"\n self.db = db\n self.jobs = jobs\n assert jobs.write_concern['w'] >= 1\n self.gfs = gfs\n self.conn = conn\n self.tunnel = tunnel\n self.config_name = config_name", "metadata": "root.MongoJobs.__init__", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 297 }, { "content": " @classmethod\n def alloc(cls, dbname, host='localhost',\n auth_dbname='admin', port=27017,\n jobs_coll='jobs', gfs_coll='fs', ssh=False, user=None, pw=None):\n connection, tunnel = connection_with_tunnel(\n host, auth_dbname, port, ssh, user, pw)\n db = connection[dbname]\n gfs = gridfs.GridFS(db, collection=gfs_coll)\n return cls(db, db[jobs_coll], gfs, connection, tunnel)", "metadata": "root.MongoJobs.alloc", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 335 }, { "content": " @classmethod\n def new_from_connection_str(cls, conn_str, gfs_coll='fs', config_name='spec'):\n connection, tunnel, db, coll = connection_from_string(conn_str)\n gfs = gridfs.GridFS(db, collection=gfs_coll)\n return cls(db, coll, gfs, connection, tunnel, config_name)", "metadata": "root.MongoJobs.new_from_connection_str", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 345 }, { "content": " def __iter__(self):\n return self.jobs.find()", "metadata": "root.MongoJobs.__iter__", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 351 }, { "content": " def __len__(self):\n try:\n return self.jobs.count()\n except:\n return 0", "metadata": "root.MongoJobs.__len__", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 354 }, { "content": " def create_jobs_indexes(self):\n jobs = self.db.jobs\n for k in ['exp_key', 'result.loss', 'book_time']:\n jobs.create_index(k)", "metadata": "root.MongoJobs.create_jobs_indexes", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 360 }, { "content": " def create_drivers_indexes(self):\n drivers = self.db.drivers\n drivers.create_index('exp_key', unique=True)", "metadata": "root.MongoJobs.create_drivers_indexes", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 365 }, { "content": " def create_indexes(self):\n self.create_jobs_indexes()\n self.create_drivers_indexes()", "metadata": "root.MongoJobs.create_indexes", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 369 }, { "content": " def jobs_complete(self, cursor=False):\n c = self.jobs.find(spec=dict(state=JOB_STATE_DONE))\n return c if cursor else list(c)", "metadata": "root.MongoJobs.jobs_complete", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 373 }, { "content": " def jobs_error(self, cursor=False):\n c = self.jobs.find(spec=dict(state=JOB_STATE_ERROR))\n return c if cursor else list(c)", "metadata": "root.MongoJobs.jobs_error", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 377 }, { "content": " def jobs_running(self, cursor=False):\n if cursor:\n raise NotImplementedError()\n rval = list(self.jobs.find(spec=dict(state=JOB_STATE_RUNNING)))\n #TODO: mark some as MIA\n rval = [r for r in rval if not r.get('MIA', False)]\n return rval", "metadata": "root.MongoJobs.jobs_running", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 381 }, { "content": " def jobs_dead(self, cursor=False):\n if cursor:\n raise NotImplementedError()\n rval = list(self.jobs.find(spec=dict(state=JOB_STATE_RUNNING)))\n #TODO: mark some as MIA\n rval = [r for r in rval if r.get('MIA', False)]\n return rval", "metadata": "root.MongoJobs.jobs_dead", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 389 }, { "content": " def jobs_queued(self, cursor=False):\n c = self.jobs.find(spec=dict(state=JOB_STATE_NEW))\n return c if cursor else list(c)", "metadata": "root.MongoJobs.jobs_queued", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 397 }, { "content": " def insert(self, job):\n \"\"\"Return a job dictionary by inserting the job dict into the database\"\"\"\n try:\n cpy = copy.deepcopy(job)\n # -- this call adds an _id field to cpy\n _id = self.jobs.insert(cpy, check_keys=True)\n # -- so now we return the dict with the _id field\n assert _id == cpy['_id']\n return cpy\n except pymongo.errors.OperationFailure, e:\n # -- translate pymongo error class into hyperopt error class\n # This was meant to make it easier to catch insertion errors\n # in a generic way even if different databases were used.\n # ... but there's just MongoDB so far, so kinda goofy.\n raise OperationFailure(e)", "metadata": "root.MongoJobs.insert", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 401 }, { "content": " def delete(self, job):\n \"\"\"Delete job[s]\"\"\"\n try:\n self.jobs.remove(job)\n except pymongo.errors.OperationFailure, e:\n # -- translate pymongo error class into hyperopt error class\n # see insert() code for rationale.\n raise OperationFailure(e)", "metadata": "root.MongoJobs.delete", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 417 }, { "content": " def delete_all(self, cond=None):\n \"\"\"Delete all jobs and attachments\"\"\"\n if cond is None:\n cond = {}\n try:\n for d in self.jobs.find(spec=cond, fields=['_id', '_attachments']):\n logger.info('deleting job %s' % d['_id'])\n for name, file_id in d.get('_attachments', []):\n try:\n self.gfs.delete(file_id)\n except gridfs.errors.NoFile:\n logger.error('failed to remove attachment %s:%s' % (\n name, file_id))\n self.jobs.remove(d)\n except pymongo.errors.OperationFailure, e:\n # -- translate pymongo error class into hyperopt error class\n # see insert() code for rationale.\n raise OperationFailure(e)", "metadata": "root.MongoJobs.delete_all", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 426 }, { "content": " def delete_all_error_jobs(self):\n return self.delete_all(cond={'state': JOB_STATE_ERROR})", "metadata": "root.MongoJobs.delete_all_error_jobs", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 445 }, { "content": " def reserve(self, host_id, cond=None, exp_key=None):\n now = coarse_utcnow()\n if cond is None:\n cond = {}\n else:\n cond = copy.copy(cond) #copy is important, will be modified, but only the top-level\n\n if exp_key is not None:\n cond['exp_key'] = exp_key\n\n #having an owner of None implies state==JOB_STATE_NEW, so this effectively\n #acts as a filter to make sure that only new jobs get reserved.\n if cond.get('owner') is not None:\n raise ValueError('refusing to reserve owned job')\n else:\n cond['owner'] = None\n cond['state'] = JOB_STATE_NEW #theoretically this is redundant, theoretically\n\n try:\n rval = self.jobs.find_and_modify(\n cond,\n {'$set':\n {'owner': host_id,\n 'book_time': now,\n 'state': JOB_STATE_RUNNING,\n 'refresh_time': now,\n }\n },\n new=True,\n upsert=False)\n except pymongo.errors.OperationFailure, e:\n logger.error('Error during reserve_job: %s'%str(e))\n rval = None\n return rval", "metadata": "root.MongoJobs.reserve", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 448 }, { "content": " def refresh(self, doc):\n self.update(doc, dict(refresh_time=coarse_utcnow()))", "metadata": "root.MongoJobs.refresh", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 483 }, { "content": " def update(self, doc, dct, collection=None, do_sanity_checks=True):\n \"\"\"Return union of doc and dct, after making sure that dct has been\n added to doc in `collection`.\n\n This function does not modify either `doc` or `dct`.\n\n \"\"\"\n if collection is None:\n collection = self.coll\n\n dct = copy.deepcopy(dct)\n if '_id' not in doc:\n raise ValueError('doc must have an \"_id\" key to be updated')\n\n if '_id' in dct:\n if dct['_id'] != doc['_id']:\n raise ValueError('cannot update the _id field')\n del dct['_id']\n\n if 'version' in dct:\n if dct['version'] != doc['version']:\n warnings.warn('Ignoring \"version\" field in update dictionary')\n\n if 'version' in doc:\n doc_query = dict(_id=doc['_id'], version=doc['version'])\n dct['version'] = doc['version']+1\n else:\n doc_query = dict(_id=doc['_id'])\n dct['version'] = 1\n try:\n # warning - if doc matches nothing then this function succeeds\n # N.B. this matches *at most* one entry, and possibly zero\n collection.update(\n doc_query,\n {'$set': dct},\n upsert=False,\n multi=False,)\n except pymongo.errors.OperationFailure, e:\n # -- translate pymongo error class into hyperopt error class\n # see insert() code for rationale.\n raise OperationFailure(e)\n\n # update doc in-place to match what happened on the server side\n doc.update(dct)\n\n if do_sanity_checks:\n server_doc = collection.find_one(\n dict(_id=doc['_id'], version=doc['version']))\n if server_doc is None:\n raise OperationFailure('updated doc not found : %s'\n % str(doc))\n elif server_doc != doc:\n if 0:# This is all commented out because it is tripping on the fact that\n # str('a') != unicode('a').\n # TODO: eliminate false alarms and catch real ones\n mismatching_keys = []\n for k, v in server_doc.items():\n if k in doc:\n if doc[k] != v:\n mismatching_keys.append((k, v, doc[k]))\n else:\n mismatching_keys.append((k, v, '<missing>'))\n for k,v in doc.items():\n if k not in server_doc:\n mismatching_keys.append((k, '<missing>', v))\n\n raise OperationFailure('local and server doc documents are out of sync: %s'%\n repr((doc, server_doc, mismatching_keys)))\n return doc", "metadata": "root.MongoJobs.update", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 486 }, { "content": " def attachment_names(self, doc):\n def as_str(name_id):\n assert isinstance(name_id[0], basestring), name_id\n return str(name_id[0])\n return map(as_str, doc.get('_attachments', []))", "metadata": "root.MongoJobs.attachment_names", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 556 }, { "content": " def set_attachment(self, doc, blob, name, collection=None):\n \"\"\"Attach potentially large data string `blob` to `doc` by name `name`\n\n blob must be a string\n\n doc must have been saved in some collection (must have an _id), but not\n necessarily the jobs collection.\n\n name must be a string\n\n Returns None\n \"\"\"\n\n # If there is already a file with the given name for this doc, then we will delete it\n # after writing the new file\n attachments = doc.get('_attachments', [])\n name_matches = [a for a in attachments if a[0] == name]\n\n # the filename is set to something so that fs.list() will display the file\n new_file_id = self.gfs.put(blob, filename='%s_%s' % (doc['_id'], name))\n logger.info('stored blob of %i bytes with id=%s and filename %s_%s' % (\n len(blob), str(new_file_id), doc['_id'], name))\n\n new_attachments = ([a for a in attachments if a[0] != name]\n + [(name, new_file_id)])\n\n try:\n ii = 0\n doc = self.update(doc, {'_attachments': new_attachments},\n collection=collection)\n # there is a database leak until we actually delete the files that\n # are no longer pointed to by new_attachments\n while ii < len(name_matches):\n self.gfs.delete(name_matches[ii][1])\n ii += 1\n except:\n while ii < len(name_matches):\n logger.warning(\"Leak during set_attachment: old_file_id=%s\" % (\n name_matches[ii][1]))\n ii += 1\n raise\n assert len([n for n in self.attachment_names(doc) if n == name]) == 1\n #return new_file_id", "metadata": "root.MongoJobs.set_attachment", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 562 }, { "content": " def get_attachment(self, doc, name):\n \"\"\"Retrieve data attached to `doc` by `attach_blob`.\n\n Raises OperationFailure if `name` does not correspond to an attached blob.\n\n Returns the blob as a string.\n \"\"\"\n attachments = doc.get('_attachments', [])\n file_ids = [a[1] for a in attachments if a[0] == name]\n if not file_ids:\n raise OperationFailure('Attachment not found: %s' % name)\n if len(file_ids) > 1:\n raise OperationFailure('multiple name matches', (name, file_ids))\n return self.gfs.get(file_ids[0]).read()", "metadata": "root.MongoJobs.get_attachment", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 606 }, { "content": " def delete_attachment(self, doc, name, collection=None):\n attachments = doc.get('_attachments', [])\n file_id = None\n for i,a in enumerate(attachments):\n if a[0] == name:\n file_id = a[1]\n break\n if file_id is None:\n raise OperationFailure('Attachment not found: %s' % name)\n #print \"Deleting\", file_id\n del attachments[i]\n self.update(doc, {'_attachments':attachments}, collection=collection)\n self.gfs.delete(file_id)", "metadata": "root.MongoJobs.delete_attachment", "header": "['class', 'MongoJobs', '(', 'object', ')', ':', '___EOS___']", "index": 621 }, { "content": "class MongoTrials(Trials):\n \"\"\"Trials maps on to an entire mongo collection. It's basically a wrapper\n around MongoJobs for now.\n\n As a concession to performance, this object permits trial filtering based\n on the exp_key, but I feel that's a hack. The case of `cmd` is similar--\n the exp_key and cmd are semantically coupled.\n\n WRITING TO THE DATABASE\n -----------------------\n The trials object is meant for *reading* a trials database. Writing\n to a database is different enough from writing to an in-memory\n collection that no attempt has been made to abstract away that\n difference. If you want to update the documents within\n a MongoTrials collection, then retrieve the `.handle` attribute (a\n MongoJobs instance) and use lower-level methods, or pymongo's\n interface directly. When you are done writing, call refresh() or\n refresh_tids() to bring the MongoTrials up to date.\n \"\"\"\n async = True\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MongoTrials", "header": "['module', '___EOS___']", "index": 636 }, { "content": " def __init__(self, arg, exp_key=None, cmd=None, workdir=None,\n refresh=True):\n if isinstance(arg, MongoJobs):\n self.handle = arg\n else:\n connection_string = arg\n self.handle = MongoJobs.new_from_connection_str(connection_string)\n self.handle.create_indexes()\n self._exp_key = exp_key\n self.cmd = cmd\n self.workdir = workdir\n if refresh:\n self.refresh()", "metadata": "root.MongoTrials.__init__", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 657 }, { "content": " def view(self, exp_key=None, cmd=None, workdir=None, refresh=True):\n rval = self.__class__(self.handle,\n exp_key=self._exp_key if exp_key is None else exp_key,\n cmd=self.cmd if cmd is None else cmd,\n workdir=self.workdir if workdir is None else workdir,\n refresh=refresh)\n return rval", "metadata": "root.MongoTrials.view", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 671 }, { "content": " def refresh_tids(self, tids):\n \"\"\" Sync documents with `['tid']` in the list of `tids` from the\n database (not *to* the database).\n\n Local trial documents whose tid is not in `tids` are not\n affected by this call. Local trial documents whose tid is in `tids` may\n be:\n\n * *deleted* (if db no longer has corresponding document), or\n * *updated* (if db has an updated document) or,\n * *left alone* (if db document matches local one).\n\n Additionally, if the db has a matching document, but there is no\n local trial with a matching tid, then the db document will be\n *inserted* into the local collection.\n\n \"\"\"\n exp_key = self._exp_key\n if exp_key != None:\n query = {'exp_key' : exp_key}\n else:\n query = {}\n t0 = time.time()\n query['state'] = {'$ne': JOB_STATE_ERROR}\n if tids is not None:\n query['tid'] = {'$in': list(tids)}\n orig_trials = getattr(self, '_trials', [])\n _trials = orig_trials[:] #copy to make sure it doesn't get screwed up\n if _trials:\n db_data = list(self.handle.jobs.find(query,\n fields=['_id', 'version']))\n # -- pull down a fresh list of ids from mongo\n if db_data:\n #make numpy data arrays\n db_data = numpy.rec.array([(x['_id'], int(x['version']))\n for x in db_data],\n names=['_id', 'version'])\n db_data.sort(order=['_id', 'version'])\n db_data = db_data[get_most_recent_inds(db_data)]\n\n existing_data = numpy.rec.array([(x['_id'],\n int(x['version'])) for x in _trials],\n names=['_id', 'version'])\n existing_data.sort(order=['_id', 'version'])\n\n #which records are in db but not in existing, and vice versa\n db_in_existing = fast_isin(db_data['_id'], existing_data['_id'])\n existing_in_db = fast_isin(existing_data['_id'], db_data['_id'])\n\n #filtering out out-of-date records\n _trials = [_trials[_ind] for _ind in existing_in_db.nonzero()[0]]\n\n #new data is what's in db that's not in existing\n new_data = db_data[numpy.invert(db_in_existing)]\n\n #having removed the new and out of data data,\n #concentrating on data in db and existing for state changes\n db_data = db_data[db_in_existing]\n existing_data = existing_data[existing_in_db]\n try:\n assert len(db_data) == len(existing_data)\n assert (existing_data['_id'] == db_data['_id']).all()\n assert (existing_data['version'] <= db_data['version']).all()\n except:\n reportpath = os.path.join(os.getcwd(),\n 'hyperopt_refresh_crash_report_' + \\\n str(numpy.random.randint(1e8)) + '.pkl')\n logger.error('HYPEROPT REFRESH ERROR: writing error file to %s' % reportpath)\n _file = open(reportpath, 'w')\n cPickle.dump({'db_data': db_data,\n 'existing_data': existing_data},\n _file)\n _file.close()\n raise\n\n same_version = existing_data['version'] == db_data['version']\n _trials = [_trials[_ind] for _ind in same_version.nonzero()[0]]\n version_changes = existing_data[numpy.invert(same_version)]\n\n #actually get the updated records\n update_ids = new_data['_id'].tolist() + version_changes['_id'].tolist()\n num_new = len(update_ids)\n update_query = copy.deepcopy(query)\n update_query['_id'] = {'$in': update_ids}\n updated_trials = list(self.handle.jobs.find(update_query))\n _trials.extend(updated_trials)\n else:\n num_new = 0\n _trials = []\n else:\n #this case is for performance, though should be able to be removed\n #without breaking correctness.\n _trials = list(self.handle.jobs.find(query))\n if _trials:\n _trials = [_trials[_i] for _i in get_most_recent_inds(_trials)]\n num_new = len(_trials)\n\n logger.debug('Refresh data download took %f seconds for %d ids' %\n (time.time() - t0, num_new))\n\n if tids is not None:\n # -- If tids were given, then _trials only contains\n # documents with matching tids. Here we augment these\n # fresh matching documents, with our current ones whose\n # tids don't match.\n new_trials = _trials\n tids_set = set(tids)\n assert all(t['tid'] in tids_set for t in new_trials)\n old_trials = [t for t in orig_trials if t['tid'] not in tids_set]\n _trials = new_trials + old_trials\n\n # -- reassign new trials to self, in order of increasing tid\n jarray = numpy.array([j['_id'] for j in _trials])\n jobsort = jarray.argsort()\n self._trials = [_trials[_idx] for _idx in jobsort]\n self._specs = [_trials[_idx]['spec'] for _idx in jobsort]\n self._results = [_trials[_idx]['result'] for _idx in jobsort]\n self._miscs = [_trials[_idx]['misc'] for _idx in jobsort]", "metadata": "root.MongoTrials.refresh_tids", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 679 }, { "content": " def refresh(self):\n self.refresh_tids(None)", "metadata": "root.MongoTrials.refresh", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 798 }, { "content": " def _insert_trial_docs(self, docs):\n rval = []\n for doc in docs:\n rval.append(self.handle.jobs.insert(doc))\n return rval", "metadata": "root.MongoTrials._insert_trial_docs", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 801 }, { "content": " def count_by_state_unsynced(self, arg):\n exp_key = self._exp_key\n # TODO: consider searching by SON rather than dict\n if isinstance(arg, int):\n if arg not in JOB_STATES:\n raise ValueError('invalid state', arg)\n query = dict(state=arg)\n else:\n assert hasattr(arg, '__iter__')\n states = list(arg)\n assert all([x in JOB_STATES for x in states])\n query = dict(state={'$in': states})\n if exp_key != None:\n query['exp_key'] = exp_key\n rval = self.handle.jobs.find(query).count()\n return rval", "metadata": "root.MongoTrials.count_by_state_unsynced", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 807 }, { "content": " def delete_all(self, cond=None):\n if cond is None:\n cond = {}\n else:\n cond = dict(cond)\n\n if self._exp_key:\n cond['exp_key'] = self._exp_key\n # -- remove all documents matching condition\n self.handle.delete_all(cond)\n gfs = self.handle.gfs\n for filename in gfs.list():\n try:\n fdoc = gfs.get_last_version(filename=filename, **cond)\n except gridfs.errors.NoFile:\n continue\n gfs.delete(fdoc._id)\n self.refresh()", "metadata": "root.MongoTrials.delete_all", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 824 }, { "content": " def new_trial_ids(self, N):\n db = self.handle.db\n # N.B. that the exp key is *not* used here. It was once, but it caused\n # a nasty bug: tids were generated by a global experiment\n # with exp_key=None, running a suggest() that introduced sub-experiments\n # with exp_keys, which ran jobs that did result injection. The tids of\n # injected jobs were sometimes unique within an experiment, and\n # sometimes not. Hilarious!\n #\n # Solution: tids are generated to be unique across the db, not just\n # within an exp_key.\n #\n\n # -- mongo docs say you can't upsert an empty document\n query = {'a': 0}\n\n doc = None\n while doc is None:\n doc = db.job_ids.find_and_modify(\n query,\n {'$inc' : {'last_id': N}},\n upsert=True)\n if doc is None:\n logger.warning('no last_id found, re-trying')\n time.sleep(1.0)\n lid = doc.get('last_id', 0)\n return range(lid, lid + N)", "metadata": "root.MongoTrials.new_trial_ids", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 843 }, { "content": " def trial_attachments(self, trial):\n \"\"\"\n Attachments to a single trial (e.g. learned weights)\n\n Returns a dictionary interface to the attachments.\n \"\"\"\n\n # don't offer more here than in MongoCtrl\n class Attachments(object):\n def __contains__(_self, name):\n return name in self.handle.attachment_names(doc=trial)\n\n def __len__(_self):\n return len(self.handle.attachment_names(doc=trial))\n\n def __iter__(_self):\n return iter(self.handle.attachment_names(doc=trial))\n\n def __getitem__(_self, name):\n try:\n return self.handle.get_attachment(\n doc=trial,\n name=name)\n except OperationFailure:\n raise KeyError(name)\n\n def __setitem__(_self, name, value):\n self.handle.set_attachment(\n doc=trial,\n blob=value,\n name=name,\n collection=self.handle.db.jobs)\n\n def __delitem__(_self, name):\n raise NotImplementedError('delete trial_attachment')\n\n def keys(self):\n return [k for k in self]\n\n def values(self):\n return [self[k] for k in self]\n\n def items(self):\n return [(k, self[k]) for k in self]\n\n return Attachments()", "metadata": "root.MongoTrials.trial_attachments", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 871 }, { "content": " @property\n def attachments(self):\n \"\"\"\n Attachments to a Trials set (such as bandit args).\n\n Support syntax for load: self.attachments[name]\n Support syntax for store: self.attachments[name] = value\n \"\"\"\n gfs = self.handle.gfs\n\n query = {}\n if self._exp_key:\n query['exp_key'] = self._exp_key\n\n class Attachments(object):\n def __iter__(_self):\n if query:\n # -- gfs.list does not accept query kwargs\n # (at least, as of pymongo 2.4)\n filenames = [fname\n for fname in gfs.list()\n if fname in _self]\n else:\n filenames = gfs.list()\n return iter(filenames)\n\n def __contains__(_self, name):\n return gfs.exists(filename=name, **query)\n\n def __getitem__(_self, name):\n try:\n rval = gfs.get_version(filename=name, **query).read()\n return rval\n except gridfs.NoFile:\n raise KeyError(name)\n\n def __setitem__(_self, name, value):\n if gfs.exists(filename=name, **query):\n gout = gfs.get_last_version(filename=name, **query)\n gfs.delete(gout._id)\n gfs.put(value, filename=name, **query)\n\n def __delitem__(_self, name):\n gout = gfs.get_last_version(filename=name, **query)\n gfs.delete(gout._id)\n\n return Attachments()", "metadata": "root.MongoTrials.attachments", "header": "['class', 'MongoTrials', '(', 'Trials', ')', ':', '___EOS___']", "index": 918 }, { "content": "class MongoWorker(object):\n poll_interval = 3.0 # -- seconds\n workdir = None\n\n\n", "metadata": "root.MongoWorker", "header": "['module', '___EOS___']", "index": 967 }, { "content": " def __init__(self, mj,\n poll_interval=poll_interval,\n workdir=workdir,\n exp_key=None,\n logfilename='logfile.txt',\n ):\n \"\"\"\n mj - MongoJobs interface to jobs collection\n poll_interval - seconds\n workdir - string\n exp_key - restrict reservations to this key\n \"\"\"\n self.mj = mj\n self.poll_interval = poll_interval\n self.workdir = workdir\n self.exp_key = exp_key\n self.logfilename = logfilename", "metadata": "root.MongoWorker.__init__", "header": "['class', 'MongoWorker', '(', 'object', ')', ':', '___EOS___']", "index": 971 }, { "content": " def make_log_handler(self):\n self.log_handler = logging.FileHandler(self.logfilename)\n self.log_handler.setFormatter(\n logging.Formatter(\n fmt='%(levelname)s (%(name)s): %(message)s'))\n self.log_handler.setLevel(logging.INFO)", "metadata": "root.MongoWorker.make_log_handler", "header": "['class', 'MongoWorker', '(', 'object', ')', ':', '___EOS___']", "index": 989 }, { "content": " def run_one(self,\n host_id=None,\n reserve_timeout=None,\n erase_created_workdir=False,\n ):\n if host_id == None:\n host_id = '%s:%i'%(socket.gethostname(), os.getpid()),\n job = None\n start_time = time.time()\n mj = self.mj\n while job is None:\n if (reserve_timeout\n and (time.time() - start_time) > reserve_timeout):\n raise ReserveTimeout()\n job = mj.reserve(host_id, exp_key=self.exp_key)\n if not job:\n interval = (1 +\n numpy.random.rand()\n * (float(self.poll_interval) - 1.0))\n logger.info('no job found, sleeping for %.1fs' % interval)\n time.sleep(interval)\n\n logger.debug('job found: %s' % str(job))\n\n # -- don't let the cmd mess up our trial object\n spec = spec_from_misc(job['misc'])\n\n ctrl = MongoCtrl(\n trials=MongoTrials(mj, exp_key=job['exp_key'], refresh=False),\n read_only=False,\n current_trial=job)\n if self.workdir is None:\n workdir = job['misc'].get('workdir', os.getcwd())\n if workdir is None:\n workdir = ''\n workdir = os.path.join(workdir, str(job['_id']))\n else:\n workdir = self.workdir\n workdir = os.path.abspath(os.path.expanduser(workdir))\n try:\n root_logger = logging.getLogger()\n if self.logfilename:\n self.make_log_handler()\n root_logger.addHandler(self.log_handler)\n\n cmd = job['misc']['cmd']\n cmd_protocol = cmd[0]\n try:\n if cmd_protocol == 'cpickled fn':\n worker_fn = cPickle.loads(cmd[1])\n elif cmd_protocol == 'call evaluate':\n bandit = cPickle.loads(cmd[1])\n worker_fn = bandit.evaluate\n elif cmd_protocol == 'token_load':\n cmd_toks = cmd[1].split('.')\n cmd_module = '.'.join(cmd_toks[:-1])\n worker_fn = exec_import(cmd_module, cmd[1])\n elif cmd_protocol == 'bandit_json evaluate':\n bandit = json_call(cmd[1])\n worker_fn = bandit.evaluate\n elif cmd_protocol == 'driver_attachment':\n #name = 'driver_attachment_%s' % job['exp_key']\n blob = ctrl.trials.attachments[cmd[1]]\n bandit_name, bandit_args, bandit_kwargs = cPickle.loads(blob)\n worker_fn = json_call(bandit_name,\n args=bandit_args,\n kwargs=bandit_kwargs).evaluate\n elif cmd_protocol == 'domain_attachment':\n blob = ctrl.trials.attachments[cmd[1]]\n try:\n domain = cPickle.loads(blob)\n except BaseException, e:\n logger.info('Error while unpickling. Try installing dill via \"pip install dill\" for enhanced pickling support.')\n raise\n worker_fn = domain.evaluate\n else:\n raise ValueError('Unrecognized cmd protocol', cmd_protocol)\n\n with temp_dir(workdir, erase_created_workdir), working_dir(workdir):\n result = worker_fn(spec, ctrl)\n result = SONify(result)\n except BaseException, e:\n #XXX: save exception to database, but if this fails, then\n # at least raise the original traceback properly\n logger.info('job exception: %s' % str(e))\n ctrl.checkpoint()\n mj.update(job,\n {'state': JOB_STATE_ERROR,\n 'error': (str(type(e)), str(e))})\n raise\n finally:\n if self.logfilename:\n root_logger.removeHandler(self.log_handler)\n\n logger.info('job finished: %s' % str(job['_id']))\n attachments = result.pop('attachments', {})\n for aname, aval in attachments.items():\n logger.info(\n 'mongoexp: saving attachment name=%s (%i bytes)' % (\n aname, len(aval)))\n ctrl.attachments[aname] = aval\n ctrl.checkpoint(result)\n mj.update(job, {'state': JOB_STATE_DONE})", "metadata": "root.MongoWorker.run_one", "header": "['class', 'MongoWorker', '(', 'object', ')', ':', '___EOS___']", "index": 996 }, { "content": "class MongoCtrl(Ctrl):\n \"\"\"\n Attributes:\n\n current_trial - current job document\n jobs - MongoJobs object in which current_trial resides\n read_only - True means don't change the db\n\n \"\"\"\n\n\n\n\n\n\n", "metadata": "root.MongoCtrl", "header": "['module', '___EOS___']", "index": 1100 }, { "content": " def __init__(self, trials, current_trial, read_only):\n self.trials = trials\n self.current_trial = current_trial\n self.read_only = read_only", "metadata": "root.MongoCtrl.__init__", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1109 }, { "content": " def debug(self, *args, **kwargs):\n # XXX: This is supposed to log to db\n return logger.debug(*args, **kwargs)", "metadata": "root.MongoCtrl.debug", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1114 }, { "content": " def info(self, *args, **kwargs):\n # XXX: This is supposed to log to db\n return logger.info(*args, **kwargs)", "metadata": "root.MongoCtrl.info", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1118 }, { "content": " def warn(self, *args, **kwargs):\n # XXX: This is supposed to log to db\n return logger.warn(*args, **kwargs)", "metadata": "root.MongoCtrl.warn", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1122 }, { "content": " def error(self, *args, **kwargs):\n # XXX: This is supposed to log to db\n return logger.error(*args, **kwargs)", "metadata": "root.MongoCtrl.error", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1126 }, { "content": " def checkpoint(self, result=None):\n if not self.read_only:\n handle = self.trials.handle\n handle.refresh(self.current_trial)\n if result is not None:\n return handle.update(self.current_trial, dict(result=result))", "metadata": "root.MongoCtrl.checkpoint", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1130 }, { "content": " @property\n def attachments(self):\n \"\"\"\n Support syntax for load: self.attachments[name]\n Support syntax for store: self.attachments[name] = value\n \"\"\"\n return self.trials.trial_attachments(trial=self.current_trial)", "metadata": "root.MongoCtrl.attachments", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1137 }, { "content": " @property\n def set_attachment(self):\n # XXX: Is there a better deprecation error?\n raise RuntimeError(\n 'set_attachment deprecated. Use `self.attachments[name] = value`')", "metadata": "root.MongoCtrl.set_attachment", "header": "['class', 'MongoCtrl', '(', 'Ctrl', ')', ':', '___EOS___']", "index": 1145 }, { "content": "def exec_import(cmd_module, cmd):\n worker_fn = None\n exec('import %s; worker_fn = %s' % (cmd_module, cmd))\n return worker_fn", "metadata": "root.exec_import", "header": "['module', '___EOS___']", "index": 1152 }, { "content": "def as_mongo_str(s):\n if s.startswith('mongo://'):\n return s\n else:\n return 'mongo://%s' % s", "metadata": "root.as_mongo_str", "header": "['module', '___EOS___']", "index": 1158 }, { "content": "def main_worker_helper(options, args):\n N = int(options.max_jobs)\n if options.last_job_timeout is not None:\n last_job_timeout = time.time() + float(options.last_job_timeout)\n else:\n last_job_timeout = None\n\n def sighandler_shutdown(signum, frame):\n logger.info('Caught signal %i, shutting down.' % signum)\n raise Shutdown(signum)\n\n def sighandler_wait_quit(signum, frame):\n logger.info('Caught signal %i, shutting down.' % signum)\n raise WaitQuit(signum)\n\n signal.signal(signal.SIGINT, sighandler_shutdown)\n signal.signal(signal.SIGHUP, sighandler_shutdown)\n signal.signal(signal.SIGTERM, sighandler_shutdown)\n signal.signal(signal.SIGUSR1, sighandler_wait_quit)\n\n if N > 1:\n proc = None\n cons_errs = 0\n if last_job_timeout and time.time() > last_job_timeout:\n logger.info(\"Exiting due to last_job_timeout\")\n return\n\n while N and cons_errs < int(options.max_consecutive_failures):\n try:\n # recursive Popen, dropping N from the argv\n # By using another process to run this job\n # we protect ourselves from memory leaks, bad cleanup\n # and other annoying details.\n # The tradeoff is that a large dataset must be reloaded once for\n # each subprocess.\n sub_argv = [sys.argv[0],\n '--poll-interval=%s' % options.poll_interval,\n '--max-jobs=1',\n '--mongo=%s' % options.mongo,\n '--reserve-timeout=%s' % options.reserve_timeout]\n if options.workdir is not None:\n sub_argv.append('--workdir=%s' % options.workdir)\n if options.exp_key is not None:\n sub_argv.append('--exp-key=%s' % options.exp_key)\n proc = subprocess.Popen(sub_argv)\n retcode = proc.wait()\n proc = None\n\n except Shutdown:\n #this is the normal way to stop the infinite loop (if originally N=-1)\n if proc:\n #proc.terminate() is only available as of 2.6\n os.kill(proc.pid, signal.SIGTERM)\n return proc.wait()\n else:\n return 0\n\n except WaitQuit:\n # -- sending SIGUSR1 to a looping process will cause it to\n # break out of the loop after the current subprocess finishes\n # normally.\n if proc:\n return proc.wait()\n else:\n return 0\n\n if retcode != 0:\n cons_errs += 1\n else:\n cons_errs = 0\n N -= 1\n logger.info(\"exiting with N=%i after %i consecutive exceptions\" %(\n N, cons_errs))\n elif N == 1:\n # XXX: the name of the jobs collection is a parameter elsewhere,\n # so '/jobs' should not be hard-coded here\n mj = MongoJobs.new_from_connection_str(\n as_mongo_str(options.mongo) + '/jobs')\n\n mworker = MongoWorker(mj,\n float(options.poll_interval),\n workdir=options.workdir,\n exp_key=options.exp_key)\n mworker.run_one(reserve_timeout=float(options.reserve_timeout))\n else:\n raise ValueError(\"N <= 0\")", "metadata": "root.main_worker_helper", "header": "['module', '___EOS___']", "index": 1165 }, { "content": "def main_worker():\n parser = optparse.OptionParser(usage=\"%prog [options]\")\n\n parser.add_option(\"--exp-key\",\n dest='exp_key',\n default = None,\n metavar='str',\n help=\"identifier for this workers's jobs\")\n parser.add_option(\"--last-job-timeout\",\n dest='last_job_timeout',\n metavar='T',\n default=None,\n help=\"Do not reserve a job after T seconds have passed\")\n parser.add_option(\"--max-consecutive-failures\",\n dest=\"max_consecutive_failures\",\n metavar='N',\n default=4,\n help=\"stop if N consecutive jobs fail (default: 4)\")\n parser.add_option(\"--max-jobs\",\n dest='max_jobs',\n default=sys.maxint,\n help=\"stop after running this many jobs (default: inf)\")\n parser.add_option(\"--mongo\",\n dest='mongo',\n default='localhost/hyperopt',\n help=\"<host>[:port]/<db> for IPC and job storage\")\n parser.add_option(\"--poll-interval\",\n dest='poll_interval',\n metavar='N',\n default=5,\n help=\"check work queue every 1 < T < N seconds (default: 5\")\n parser.add_option(\"--reserve-timeout\",\n dest='reserve_timeout',\n metavar='T',\n default=120.0,\n help=\"poll database for up to T seconds to reserve a job\")\n parser.add_option(\"--workdir\",\n dest=\"workdir\",\n default=None,\n help=\"root workdir (default: load from mongo)\",\n metavar=\"DIR\")\n\n (options, args) = parser.parse_args()\n\n if args:\n parser.print_help()\n return -1\n\n return main_worker_helper(options, args)", "metadata": "root.main_worker", "header": "['module', '___EOS___']", "index": 1253 } ]
[ { "span": "import hashlib", "start_line": 101, "start_column": 0, "end_line": 101, "end_column": 14 }, { "span": "import shutil", "start_line": 105, "start_column": 0, "end_line": 105, "end_column": 13 }, { "span": "import plotting", "start_line": 136, "start_column": 0, "end_line": 136, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Mon", "god", "b", "-", "based", " ", "Trial", "s", " ", "Object", "\\", "10", ";", "==============", "============", "=", "\\", "10", ";", "\\", "10", ";", "Compo", "nent", "s", " ", "involved", ":", "\\", "10", ";", "\\", "10", ";", "-", " ", "mongo", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "mongo", "d", " ", "...", "\\", "10", ";", "\\", "10", ";", "-", " ", "driver", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "hyper", "opt", "-", "mongo", "-", "search", " ", "mongo", "://", "address", " ", "bandi", "t", "\\u", "json", " ", "bandi", "t", "\\u", "algo", "\\u", "json", "\\", "10", ";", "\\", "10", ";", "-", " ", "worker", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "hyper", "opt", "-", "mongo", "-", "worker", " ", "--", "loop", " ", "mongo", "://", "address", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "Mon", "go", "\\", "10", ";", "=====", "\\", "10", ";", "\\", "10", ";", "Mon", "go", " ", "(", "daemon", " ", "process", " ", "mongo", "d", ")", " ", "is", " ", "used", " ", "for", " ", "IPC", " ", "bet", "ween", " ", "the", " ", "driver", " ", "and", " ", "worker", ".", "\\", "10", ";", "Configure", " ", "it", " ", "as", " ", "you", " ", "like", ",", " ", "so", " ", "tha", "t", " ", "hyper", "opt", "-", "mongo", "-", "search", " ", "can", " ", "communi", "cate", " ", "with", " ", "it", ".", "\\", "10", ";", "I", " ", "think", " ", "there", " ", "is", " ", "some", " ", "support", " ", "in", " ", "this", " ", "file", " ", "for", " ", "an", " ", "ssh", "+", "mongo", " ", "connecti", "on", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "experiment", " ", "use", "s", " ", "the", " ", "follow", "ing", " ", "collection", "s", " ", "for", " ", "IPC", ":", "\\", "10", ";", "\\", "10", ";", "*", " ", "jobs", " ", "-", " ", "document", "s", " ", "of", " ", "a", " ", "standard", " ", "form", " ", "used", " ", "to", " ", "store", " ", "suggested", " ", "tria", "ls", " ", "and", " ", "thei", "r", "\\", "10", ";", " ", " ", " ", " ", "results", ".", " ", " ", "The", "se", " ", "document", "s", " ", "have", " ", "keys", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "spec", " ", ":", " ", "subd", "ocu", "ment", " ", "return", "ed", " ", "by", " ", "bandi", "t", "\\u", "algo", ".", "suggest", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "exp", "\\u", "key", ":", " ", "an", " ", "identifi", "er", " ", "of", " ", "whi", "ch", " ", "driver", " ", "suggested", " ", "this", " ", "tria", "l", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "cmd", ":", " ", "a", " ", "tuple", " ", "(", "protoc", "ol", ",", " ", "...)", " ", "identify", "ing", " ", "bandi", "t", ".", "evaluate", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "state", ":", " ", "0", ",", " ", "1", ",", " ", "2", ",", " ", "3", " ", "for", " ", "job", " ", "state", " ", "(", "new", ",", " ", "runn", "ing", ",", " ", "ok", ",", " ", "fail", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "owner", ":", " ", "Non", "e", " ", "for", " ", "new", " ", "jobs", ",", " ", "(", "host", "name", ",", " ", "pid", ")", " ", "for", " ", "start", "ed", " ", "jobs", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "book", "\\u", "time", ":", " ", "time", " ", "a", " ", "job", " ", "was", " ", "reserve", "d", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "refre", "sh", "\\u", "time", ":", " ", "last", " ", "time", " ", "the", " ", "process", " ", "runn", "ing", " ", "the", " ", "job", " ", "checke", "d", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "result", ":", " ", "the", " ", "subd", "ocu", "ment", " ", "return", "ed", " ", "by", " ", "bandi", "t", ".", "evaluate", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "error", ":", " ", "for", " ", "jobs", " ", "of", " ", "state", " ", "3", ",", " ", "a", " ", "reason", " ", "for", " ", "fail", "ure", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "logs", ":", " ", "a", " ", "dict", " ", "of", " ", "sequence", "s", " ", "of", " ", "string", "s", " ", "receive", "d", " ", "by", " ", "ctrl", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "info", ":", " ", "info", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "warn", ":", " ", "warn", "ing", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "error", ":", " ", "error", " ", "message", "s", "\\", "10", ";", "\\", "10", ";", "*", " ", "fs", " ", "-", " ", "a", " ", "grid", "fs", " ", "storage", " ", "collection", " ", "(", "used", " ", "for", " ", "pick", "ling", ")", "\\", "10", ";", "\\", "10", ";", "*", " ", "driver", "s", " ", "-", " ", "document", "s", " ", "descri", "bing", " ", "driver", "s", ".", " ", "The", "se", " ", "are", " ", "used", " ", "to", " ", "prevent", " ", "two", " ", "driver", "s", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "usi", "ng", " ", "the", " ", "same", " ", "exp", "\\u", "key", " ", "simultaneous", "ly", ",", " ", "and", " ", "to", " ", "attach", " ", "saved", " ", "state", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "exp", "\\u", "key", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "workdir", ":", " ", "[", "option", "al", "]", " ", "path", " ", "where", " ", "worker", "s", " ", "shou", "ld", " ", "chd", "ir", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "Attach", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "pkl", ":", " ", "[", "option", "al", "]", " ", "saved", " ", "state", " ", "of", " ", "experiment", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "bandi", "t", "\\u", "args", "\\u", "kwarg", "s", ":", " ", "[", "option", "al", "]", " ", "pickled", " ", "(", "cls", "name", ",", " ", "args", ",", " ", "kwarg", "s", ")", " ", "to", "\\", "10", ";", " ", " ", " ", " ", " ", "reconstruct", " ", "bandi", "t", " ", "in", " ", "worker", " ", "process", "es", "\\", "10", ";", "\\", "10", ";", "The", " ", "Mon", "go", "Jo", "bs", ",", " ", "and", " ", "Ctrl", "Obj", " ", "classe", "s", " ", "as", " ", "well", " ", "as", " ", "the", " ", "main", "\\u", "worker", "\\", "10", ";", "method", " ", "form", " ", "the", " ", "abstract", "ion", " ", "barrier", " ", "aro", "und", " ", "this", " ", "databa", "se", " ", "layout", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "Worke", "r", "\\", "10", ";", "=====", "=", "\\", "10", ";", "\\", "10", ";", "A", " ", "worker", " ", "look", "s", " ", "up", " ", "a", " ", "job", " ", "in", " ", "a", " ", "mongo", " ", "databa", "se", ",", " ", "maps", " ", "tha", "t", " ", "job", " ", "document", " ", "to", " ", "a", "\\", "10", ";", "runnable", " ", "python", " ", "object", ",", " ", "calls", " ", "tha", "t", " ", "object", ",", " ", "and", " ", "writes", " ", "the", " ", "return", " ", "value", " ", "back", " ", "to", "\\", "10", ";", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", "A", " ", "worker", " ", "*", "reserve", "s", "*", " ", "a", " ", "job", " ", "by", " ", "atomi", "call", "y", " ", "identify", "ing", " ", "a", " ", "document", " ", "in", " ", "the", " ", "jobs", "\\", "10", ";", "collection", " ", "who", "se", " ", "owner", " ", "is", " ", "Non", "e", " ", "and", " ", "who", "se", " ", "state", " ", "is", " ", "0", ",", " ", "and", " ", "setti", "ng", " ", "the", " ", "state", " ", "to", "\\", "10", ";", "1", ".", " ", " ", "If", " ", "it", " ", "fail", "s", " ", "to", " ", "identify", " ", "suc", "h", " ", "a", " ", "job", ",", " ", "it", " ", "loop", "s", " ", "with", " ", "a", " ", "random", " ", "sleep", " ", "interval", "\\", "10", ";", "of", " ", "a", " ", "few", " ", "second", "s", " ", "and", " ", "polls", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", "If", " ", "hyper", "opt", "-", "mongo", "-", "worker", " ", "is", " ", "call", "ed", " ", "with", " ", "a", " ", "--", "loop", " ", "argu", "ment", " ", "then", " ", "it", " ", "go", "es", " ", "back", " ", "to", "\\", "10", ";", "the", " ", "databa", "se", " ", "after", " ", "finish", "ing", " ", "a", " ", "job", " ", "to", " ", "identify", " ", "and", " ", "perform", " ", "anot", "her", " ", "one", ".", "\\", "10", ";", "\\", "10", ";", "Ctrl", "Obj", "\\", "10", ";", "-------", "\\", "10", ";", "\\", "10", ";", "The", " ", "worker", " ", "allocate", "s", " ", "a", " ", "Ctrl", "Obj", " ", "and", " ", "pass", "es", " ", "it", " ", "to", " ", "bandi", "t", ".", "evaluate", " ", "in", " ", "addition", " ", "to", "\\", "10", ";", "the", " ", "subd", "ocu", "ment", " ", "found", " ", "at", " ", "job", "['", "spec", "']", ".", " ", " ", "A", " ", "bandi", "t", " ", "can", " ", "use", " ", "ctrl", ".", "info", ",", " ", "ctrl", ".", "warn", ",", "\\", "10", ";", "ctrl", ".", "error", " ", "and", " ", "so", " ", "on", " ", "like", " ", "logg", "er", " ", "method", "s", ",", " ", "and", " ", "tho", "se", " ", "message", "s", " ", "will", " ", "be", " ", "writt", "en", "\\", "10", ";", "to", " ", "the", " ", "mongo", " ", "databa", "se", " ", "(", "to", " ", "job", "['", "logs", "'])", ".", " ", " ", "The", "y", " ", "are", " ", "not", " ", "writt", "en", " ", "synchron", "ously", "\\", "10", ";", "tho", "ugh", ",", " ", "the", "y", " ", "are", " ", "writt", "en", " ", "whe", "n", " ", "the", " ", "bandi", "t", ".", "evaluate", " ", "function", " ", "calls", "\\", "10", ";", "ctrl", ".", "checkp", "oint", "()", ".", "\\", "10", ";", "\\", "10", ";", "Ctrl", ".", "checkp", "oint", " ", "doe", "s", " ", "sever", "al", " ", "thing", "s", ":", "\\", "10", ";", "*", " ", "flush", "es", " ", "logg", "ing", " ", "message", "s", " ", "to", " ", "the", " ", "databa", "se", "\\", "10", ";", "*", " ", "update", "s", " ", "the", " ", "refre", "sh", "\\u", "time", "\\", "10", ";", "*", " ", "option", "ally", " ", "update", "s", " ", "the", " ", "result", " ", "subd", "ocu", "ment", "\\", "10", ";", "\\", "10", ";", "The", " ", "main", "\\u", "worker", " ", "routin", "e", " ", "calls", " ", "Ctrl", ".", "checkp", "oint", "(", "rval", ")", " ", "onc", "e", " ", "after", " ", "the", "\\", "10", ";", "bandi", "t", ".", "eval", "ute", " ", "function", " ", "has", " ", "return", "ed", " ", "bef", "ore", " ", "setti", "ng", " ", "the", " ", "state", " ", "to", " ", "2", " ", "or", " ", "3", " ", "to", "\\", "10", ";", "finalize", " ", "the", " ", "job", " ", "in", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "authors\\u", "\\u_", "=_", "[_", "\"", "Jam", "es", " ", "Ber", "gst", "ra", "\"_", ",_", "\"", "Dan", " ", "Ya", "mins", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "3", "-", "clause", " ", "BS", "D", " ", "License", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "contact", "\\u\\u_", "=_", "\"", "git", "hub", ".", "com", "/", "hyper", "opt", "/", "hyper", "opt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "dil", "l_", "as_", "c", "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_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pymongo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "grid", "fs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "import_", "SON", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "from_", "._", "base_", "import_", "JOB", "\\u", "STATES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "(_", "JOB", "\\u", "STATE", "\\u", "NEW_", ",_", "JOB", "\\u", "STATE", "\\u", "RUNNING_", ",_", "JOB", "\\u", "STATE", "\\u", "DONE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "JOB", "\\u", "STATE", "\\u", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "Trial", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "tria", "ls", "\\u", "from", "\\u", "docs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "Inva", "lid", "Trial", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "Ctrl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "SON", "ify_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "spec", "\\u", "from", "\\u", "misc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "coarse", "\\u", "utcnow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "fast", "\\u", "isin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "get", "\\u", "most", "\\u", "recent", "\\u", "inds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "json", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "working", "\\u", "dir_", ",_", "temp", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "plotting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Opera", "tion", "Failure_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pro", "xy", " ", "tha", "t", " ", "coul", "d", " ", "be", " ", "factor", "ed", " ", "out", " ", "if", " ", "we", " ", "als", "o", " ", "want", " ", "to", " ", "use", " ", "Cou", "ch", "DB", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "Jo", "bma", "n", "DB", " ", "classe", "s", " ", "with", " ", "this", " ", "interface", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Shut", "down_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Except", "ion", " ", "for", " ", "tell", "ing", " ", "mongo", "\\u", "worker", " ", "loop", " ", "to", " ", "quit", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Wait", "Quit_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Except", "ion", " ", "for", " ", "tell", "ing", " ", "mongo", "\\u", "worker", " ", "loop", " ", "to", " ", "quit", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Inva", "lid", "Mon", "go", "Trial", "_", "(_", "Inva", "lid", "Trial", "_", ")_", ":_", "\\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_", "Doma", "in", "Swa", "p", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Rai", "sed", " ", "whe", "n", " ", "the", " ", "search", " ", "program", " ", "trie", "s", " ", "to", " ", "change", " ", "the", " ", "bandi", "t", " ", "attache", "d", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "experiment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reserve", "Timeout_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "No", " ", "job", " ", "was", " ", "reserve", "d", " ", "in", " ", "the", " ", "alo", "tted", " ", "time", "\\", "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_", "read", "\\u", "pw_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "'", "hyper", "opt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "getenv_", "(_", "'", "HOM", "E", "'_", ")_", ",_", "\".", "hyper", "opt", "\"_", ")_", ")_", "._", "read_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "authenticat", "e\\u", "for", "\\u", "db_", "(_", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "read", "\\u", "pw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "authenticate_", "(_", "d_", "[_", "'", "user", "name", "'_", "]_", ",_", "d_", "[_", "'", "password", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "url_", "(_", "url_", ",_", "pw", "file_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unpack", "s", " ", "a", " ", "url", " ", "of", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "protoc", "ol", "://", "[", "user", "name", "[:", "pw", "]]", "@", "host", "name", "[:", "port", "]/", "db", "/", "collection", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "tuple", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "protoc", "ol", ",", " ", "user", "name", ",", " ", "password", ",", " ", "host", "name", ",", " ", "port", ",", " ", "db", "name", ",", " ", "collection", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "note", ":", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "password", " ", "is", " ", "not", " ", "give", "n", " ", "in", " ", "the", " ", "url", " ", "but", " ", "the", " ", "user", "name", " ", "is", ",", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "function", " ", "will", " ", "read", " ", "the", " ", "password", " ", "from", " ", "file", " ", "by", " ", "calling", "\\", "10", ";", " ", " ", " ", " ", "``", "open", "(", "pw", "file", ").", "read", "()[", ":-", "1", "]``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "protocol_", "=_", "url_", "[_", ":_", "url_", "._", "find_", "(_", "':'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp", "\\u", "url_", "=_", "'", "ftp", "'_", "+_", "url_", "[_", "url_", "._", "find_", "(_", "':'_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "parse", " ", "the", " ", "string", " ", "as", " ", "if", " ", "it", " ", "wer", "e", " ", "an", " ", "ftp", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "urlparse_", "._", "urlparse_", "(_", "ftp", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "PROTOCOL", " ", "%", "s", "'_", "%_", "protocol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "USER", "NAME", " ", "%", "s", "'_", "%_", "tmp_", "._", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "HOSTNAME", " ", "%", "s", "'_", "%_", "tmp_", "._", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "PORT", " ", "%", "s", "'_", "%_", "tmp_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "PATH", " ", "%", "s", "'_", "%_", "tmp_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "dbname_", ",_", "collection_", "=_", "tmp_", "._", "path_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Fail", "ed", " ", "to", " ", "parse", " ", "'%", "s", "'\"_", "%_", "(_", "str_", "(_", "tmp_", "._", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "DB", " ", "%", "s", "'_", "%_", "dbname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "COLLECTION", " ", "%", "s", "'_", "%_", "collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tmp_", "._", "password_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "tmp_", "._", "username_", "is_", "not_", "None_", ")_", "and_", "pw", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "open_", "(_", "pw", "file_", ")_", "._", "read_", "(_", ")_", "[_", ":_", "-_", "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 ", " _", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "tmp_", "._", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "PASS", " ", "%", "s", "'_", "%_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "protocol_", ",_", "tmp_", "._", "username_", ",_", "password_", ",_", "tmp_", "._", "hostname_", ",_", "tmp_", "._", "port_", ",_", "dbname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "\\u", "with", "\\u", "tunnel_", "(_", "host_", "=_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "dbname_", "=_", "'", "admin", "'_", ",_", "port_", "=_", "27017", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssh_", "=_", "False_", ",_", "user_", "=_", "'", "hyper", "opt", "'_", ",_", "pw_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ssh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "port_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "low_", "=_", "275", "00_", ",_", "high_", "=_", "2800", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "forward", " ", "from", " ", "local", " ", "to", " ", "remote", " ", "machine_", "\\u\\u\\uNL\\u\\u\\u_", "ssh", "\\u", "tunnel_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "ssh", "'_", ",_", "'-", "NT", "f", "'_", ",_", "'-", "L", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "i", ":", "%", "s", ":", "%", "i", "'_", "%_", "(_", "local", "\\u", "port_", ",_", "'", "127", ".0", ".0", ".1", "'_", ",_", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "std", "in", "=", "subproc", "ess", ".", "PIPE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stdout", "=", "subproc", "ess", ".", "PIPE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "std", "err", "=", "subproc", "ess", ".", "PIPE", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "give", " ", "the", " ", "subproc", "ess", " ", "time", " ", "to", " ", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", ".5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "=_", "pymongo_", "._", "Connection_", "(_", "'", "127", ".0", ".0", ".1", "'_", ",_", "local", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "document", "\\u", "class_", "=_", "SON", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "pymongo_", "._", "Connection_", "(_", "host_", ",_", "port_", ",_", "document", "\\u", "class_", "=_", "SON", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "==_", "'", "hyper", "opt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "authenticat", "e\\u", "for", "\\u", "db_", "(_", "connection_", "[_", "auth", "\\u", "dbname_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ssh", "\\u", "tunnel_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Ensur", "e", " ", "tha", "t", " ", "change", "s", " ", "are", " ", "writt", "en", " ", "to", " ", "at", " ", "leas", "t", " ", "onc", "e", " ", "server", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "connection_", "._", "write", "\\u", "concern", "_", "[_", "'", "w", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "Ensur", "e", " ", "tha", "t", " ", "change", "s", " ", "are", " ", "writt", "en", " ", "to", " ", "the", " ", "journal", " ", "if", " ", "there", " ", "is", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "connection_", "._", "write", "\\u", "concern", "_", "[_", "'", "j", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "connection_", ",_", "ssh", "\\u", "tunnel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "\\u", "from", "\\u", "string_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "protocol_", ",_", "user_", ",_", "pw_", ",_", "host_", ",_", "port_", ",_", "db_", ",_", "collection_", "=_", "parse", "\\u", "url_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "protocol_", "==_", "'", "mongo", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssh_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "protocol_", "in_", "(_", "'", "mongo", "+", "ssh", "'_", ",_", "'", "ssh", "+", "mongo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssh_", "=_", "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 ", " _", "raise_", "Value", "Error_", "(_", "'", "unre", "cogni", "zed", " ", "protoc", "ol", " ", "for", " ", "Mon", "go", "Jo", "bs", "'_", ",_", "protocol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "connection_", ",_", "tunnel_", "=_", "connecti", "on", "\\u", "with", "\\u", "tunnel_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ssh_", "=_", "ssh_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pw_", "=_", "pw_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "connection_", ",_", "tunnel_", ",_", "connection_", "[_", "db_", "]_", ",_", "connection_", "[_", "db_", "]_", "[_", "collection_", "]_", "\\u\\u\\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_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Interface", " ", "to", " ", "a", " ", "Jo", "bs", " ", "databa", "se", " ", "structure", "d", " ", "like", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Collections", ":", "\\", "10", ";", " ", " ", " ", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "db", ".", "jobs", " ", "-", " ", "structure", "d", " ", "{", "config", "\\u", "name", ",", " ", "'", "cmd", "',", " ", "'", "owner", "',", " ", "'", "book", "\\u", "time", "',", "\\", "10", ";", " ", " ", " ", " ", "#", " ", " ", " ", " ", " ", " ", "'", "refre", "sh", "\\u", "time", "',", " ", "'", "state", "',", " ", "'", "exp", "\\u", "key", "',", " ", "'", "owner", "',", " ", "'", "result", "'}", "\\", "10", ";", " ", " ", " ", " ", "#", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "collection", " ", "tha", "t", " ", "the", " ", "worker", " ", "nodes", " ", "write", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "db", ".", "gf", "s", " ", "-", " ", "file", " ", "storage", " ", "via", " ", "grid", "FS", " ", "for", " ", "all", " ", "collection", "s", "\\", "10", ";", " ", " ", " ", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "rename", " ", "jobs", " ", "->", " ", "coll", " ", "through", "out_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coll_", "=_", "property_", "(_", "lambda_", "s_", ":_", "s_", "._", "jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "db_", ",_", "jobs_", ",_", "gf", "s_", ",_", "conn_", ",_", "tunnel_", ",_", "config", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "db", " ", "-", " ", "Mon", "go", " ", "Databa", "se", " ", "(", "e", ".", "g", ".", " ", "`", "Connect", "ion", "()[", "db", "name", "]`", ")", "\\", "10", ";", " ", " ", " ", " ", "databa", "se", " ", "in", " ", "whi", "ch", " ", "all", " ", "job", "-", "relate", "d", " ", "info", " ", "is", " ", "store", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "jobs", " ", "-", " ", "Mon", "go", " ", "Collecti", "on", " ", "handle", "\\", "10", ";", " ", " ", " ", " ", "collection", " ", "within", " ", "`", "db", "`", " ", "to", " ", "use", " ", "for", " ", "job", " ", "argu", "ment", "s", ",", " ", "return", " ", "vals", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "vari", "ous", " ", "book", "keep", "ing", " ", "stu", "ff", " ", "and", " ", "meta", "-", "data", ".", " ", "Typical", "ly", " ", "this", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "`", "db", "['", "jobs", "']", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "gf", "s", " ", "-", " ", "Mon", "go", " ", "Grid", "FS", " ", "handle", "\\", "10", ";", " ", " ", " ", " ", "Grid", "FS", " ", "is", " ", "used", " ", "to", " ", "store", " ", "attach", "ment", "s", " ", "-", " ", "binar", "y", " ", "blobs", " ", "tha", "t", " ", "don", "'", "t", " ", "fit", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "are", " ", "aw", "kwa", "rd", " ", "to", " ", "store", " ", "in", " ", "the", " ", "`", "jobs", "`", " ", "collection", " ", "direct", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "conn", " ", "-", " ", "Mon", "go", " ", "Connect", "ion", "\\", "10", ";", " ", " ", " ", " ", "Wh", "y", " ", "we", " ", "need", " ", "to", " ", "keep", " ", "this", ",", " ", "I", "'", "m", " ", "not", " ", "sure", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "tunnel", " ", "-", " ", "somet", "hing", " ", "for", " ", "ssh", " ", "tunnel", "ing", " ", "if", " ", "you", "'", "re", " ", "doi", "ng", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "`", "connecti", "on", "\\u", "with", "\\u", "tunnel", "`", " ", "for", " ", "more", " ", "info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "config", "\\u", "name", " ", "-", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "XX", "X", ":", " ", "No", " ", "idea", " ", "what", " ", "this", " ", "is", " ", "for", ",", " ", "see", "ms", " ", "unim", "porta", "nt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "=_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "jobs_", "=_", "jobs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "jobs_", "._", "write", "\\u", "concern", "_", "[_", "'", "w", "'_", "]_", ">=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gf", "s_", "=_", "gf", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "conn_", "=_", "conn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tunnel_", "=_", "tunnel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "name_", "=_", "config", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "alloc_", "(_", "cls_", ",_", "dbname_", ",_", "host_", "=_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "dbname_", "=_", "'", "admin", "'_", ",_", "port_", "=_", "27017", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "jobs", "\\u", "coll_", "=_", "'", "jobs", "'_", ",_", "gf", "s", "\\u", "coll_", "=_", "'", "fs", "'_", ",_", "ssh_", "=_", "False_", ",_", "user_", "=_", "None_", ",_", "pw_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", ",_", "tunnel_", "=_", "connecti", "on", "\\u", "with", "\\u", "tunnel_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "host_", ",_", "auth", "\\u", "dbname_", ",_", "port_", ",_", "ssh_", ",_", "user_", ",_", "pw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "connection_", "[_", "dbname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s_", "=_", "grid", "fs_", "._", "Grid", "FS_", "(_", "db_", ",_", "collection_", "=_", "gf", "s", "\\u", "coll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "db_", ",_", "db_", "[_", "jobs", "\\u", "coll_", "]_", ",_", "gf", "s_", ",_", "connection_", ",_", "tunnel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "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_", "new", "\\u", "from", "\\u", "connecti", "on", "\\u", "str_", "(_", "cls_", ",_", "conn", "\\u", "str_", ",_", "gf", "s", "\\u", "coll_", "=_", "'", "fs", "'_", ",_", "config", "\\u", "name_", "=_", "'", "spec", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", ",_", "tunnel_", ",_", "db_", ",_", "coll_", "=_", "connecti", "on", "\\u", "from", "\\u", "string_", "(_", "conn", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s_", "=_", "grid", "fs_", "._", "Grid", "FS_", "(_", "db_", ",_", "collection_", "=_", "gf", "s", "\\u", "coll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "db_", ",_", "coll_", ",_", "gf", "s_", ",_", "connection_", ",_", "tunnel_", ",_", "config", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "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_", "._", "jobs_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "jobs_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "jobs", "\\u", "indexes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobs_", "=_", "self_", "._", "db_", "._", "jobs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "[_", "'", "exp", "\\u", "key", "'_", ",_", "'", "result", ".", "loss", "'_", ",_", "'", "book", "\\u", "time", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobs_", "._", "create", "\\u", "index_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "driver", "s", "\\u", "indexes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drivers_", "=_", "self_", "._", "db_", "._", "drivers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drivers_", "._", "create", "\\u", "index_", "(_", "'", "exp", "\\u", "key", "'_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "indexes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "\\u", "jobs", "\\u", "indexes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "driver", "s", "\\u", "indexes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jobs", "\\u", "complete_", "(_", "self_", ",_", "cursor_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "jobs_", "._", "find_", "(_", "spec_", "=_", "dict_", "(_", "state_", "=_", "JOB", "\\u", "STATE", "\\u", "DONE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "c_", "if_", "cursor_", "else_", "list_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jobs", "\\u", "error_", "(_", "self_", ",_", "cursor_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "jobs_", "._", "find_", "(_", "spec_", "=_", "dict_", "(_", "state_", "=_", "JOB", "\\u", "STATE", "\\u", "ERROR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "c_", "if_", "cursor_", "else_", "list_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jobs", "\\u", "running_", "(_", "self_", ",_", "cursor_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rval_", "=_", "list_", "(_", "self_", "._", "jobs_", "._", "find_", "(_", "spec_", "=_", "dict_", "(_", "state_", "=_", "JOB", "\\u", "STATE", "\\u", "RUNNING_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "mark", " ", "some", " ", "as", " ", "MI", "A_", "\\u\\u\\uNL\\u\\u\\u_", "rval_", "=_", "[_", "r_", "for_", "r_", "in_", "rval_", "if_", "not_", "r_", "._", "get_", "(_", "'", "MI", "A", "'_", ",_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jobs", "\\u", "dead_", "(_", "self_", ",_", "cursor_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cursor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rval_", "=_", "list_", "(_", "self_", "._", "jobs_", "._", "find_", "(_", "spec_", "=_", "dict_", "(_", "state_", "=_", "JOB", "\\u", "STATE", "\\u", "RUNNING_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "mark", " ", "some", " ", "as", " ", "MI", "A_", "\\u\\u\\uNL\\u\\u\\u_", "rval_", "=_", "[_", "r_", "for_", "r_", "in_", "rval_", "if_", "r_", "._", "get_", "(_", "'", "MI", "A", "'_", ",_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jobs", "\\u", "queue", "d_", "(_", "self_", ",_", "cursor_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "self_", "._", "jobs_", "._", "find_", "(_", "spec_", "=_", "dict_", "(_", "state_", "=_", "JOB", "\\u", "STATE", "\\u", "NEW_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "c_", "if_", "cursor_", "else_", "list_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert_", "(_", "self_", ",_", "job_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "job", " ", "dictionar", "y", " ", "by", " ", "insert", "ing", " ", "the", " ", "job", " ", "dict", " ", "int", "o", " ", "the", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cpy", "_", "=_", "copy_", "._", "deepcopy_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "this", " ", "call", " ", "adds", " ", "an", " ", "\\u", "id", " ", "field", " ", "to", " ", "cpy", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "self_", "._", "jobs_", "._", "insert_", "(_", "cpy", "_", ",_", "check", "\\u", "keys_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "so", " ", "now", " ", "we", " ", "return", " ", "the", " ", "dict", " ", "with", " ", "the", " ", "\\u", "id", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "\\u", "id_", "==_", "cpy", "_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cpy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pymongo_", "._", "errors_", "._", "Opera", "tion", "Failure_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "translat", "e", " ", "pymong", "o", " ", "error", " ", "class", " ", "int", "o", " ", "hyper", "opt", " ", "error", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Thi", "s", " ", "was", " ", "mean", "t", " ", "to", " ", "make", " ", "it", " ", "easi", "er", " ", "to", " ", "catch", " ", "insertion", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "in", " ", "a", " ", "gener", "ic", " ", "way", " ", "even", " ", "if", " ", "different", " ", "databa", "ses", " ", "wer", "e", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "...", " ", "but", " ", "there", "'", "s", " ", "just", " ", "Mon", "go", "DB", " ", "so", " ", "far", ",", " ", "so", " ", "kind", "a", " ", "goo", "fy", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "job_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "job", "[", "s", "]\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "jobs_", "._", "remove_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pymongo_", "._", "errors_", "._", "Opera", "tion", "Failure_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "translat", "e", " ", "pymong", "o", " ", "error", " ", "class", " ", "int", "o", " ", "hyper", "opt", " ", "error", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "see", " ", "insert", "()", " ", "code", " ", "for", " ", "rational", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "all_", "(_", "self_", ",_", "cond_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "all", " ", "jobs", " ", "and", " ", "attach", "ment", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cond_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "=_", "{_", "}_", "\\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 ", " _", "for_", "d_", "in_", "self_", "._", "jobs_", "._", "find_", "(_", "spec_", "=_", "cond_", ",_", "fields_", "=_", "[_", "'\\u", "id", "'_", ",_", "'\\u", "attach", "ment", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "delet", "ing", " ", "job", " ", "%", "s", "'_", "%_", "d_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "file", "\\u", "id_", "in_", "d_", "._", "get_", "(_", "'\\u", "attach", "ment", "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 ", " ", " _", "self_", "._", "gf", "s_", "._", "delete_", "(_", "file", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "grid", "fs_", "._", "errors_", "._", "No", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "error_", "(_", "'", "fail", "ed", " ", "to", " ", "remove", " ", "attach", "ment", " ", "%", "s", ":", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "file", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "jobs_", "._", "remove_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pymongo_", "._", "errors_", "._", "Opera", "tion", "Failure_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "translat", "e", " ", "pymong", "o", " ", "error", " ", "class", " ", "int", "o", " ", "hyper", "opt", " ", "error", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "see", " ", "insert", "()", " ", "code", " ", "for", " ", "rational", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "all", "\\u", "error", "\\u", "jobs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "delete", "\\u", "all_", "(_", "cond_", "=_", "{_", "'", "state", "'_", ":_", "JOB", "\\u", "STATE", "\\u", "ERROR_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reserve", "_", "(_", "self_", ",_", "host", "\\u", "id_", ",_", "cond_", "=_", "None_", ",_", "exp", "\\u", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "coarse", "\\u", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cond_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "=_", "copy_", "._", "copy_", "(_", "cond_", ")_", "#", "copy", " ", "is", " ", "importa", "nt", ",", " ", "will", " ", "be", " ", "modifi", "ed", ",", " ", "but", " ", "only", " ", "the", " ", "top", "-", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "[_", "'", "exp", "\\u", "key", "'_", "]_", "=_", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "hav", "ing", " ", "an", " ", "owner", " ", "of", " ", "Non", "e", " ", "implies", " ", "state", "==", "JOB", "\\u", "STATE", "\\u", "NEW", ",", " ", "so", " ", "this", " ", "effective", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", "acts", " ", "as", " ", "a", " ", "filter", " ", "to", " ", "make", " ", "sure", " ", "tha", "t", " ", "only", " ", "new", " ", "jobs", " ", "get", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cond_", "._", "get_", "(_", "'", "owner", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "ref", "usi", "ng", " ", "to", " ", "reserve", " ", "owned", " ", "job", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "[_", "'", "owner", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond_", "[_", "'", "state", "'_", "]_", "=_", "JOB", "\\u", "STATE", "\\u", "NEW_", "#", "theore", "tica", "ll", "y", " ", "this", " ", "is", " ", "redundant", ",", " ", "theore", "tica", "ll", "y_", "\\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 ", " _", "rval_", "=_", "self_", "._", "jobs_", "._", "find", "\\u", "and", "\\u", "modify_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cond_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'$", "set", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "owner", "'_", ":_", "host", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "book", "\\u", "time", "'_", ":_", "now_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "JOB", "\\u", "STATE", "\\u", "RUNNING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "refre", "sh", "\\u", "time", "'_", ":_", "now_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pymongo_", "._", "errors_", "._", "Opera", "tion", "Failure_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "Error", " ", "dur", "ing", " ", "reserve", "\\u", "job", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "refresh_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update_", "(_", "doc_", ",_", "dict_", "(_", "refre", "sh", "\\u", "time_", "=_", "coarse", "\\u", "utcnow_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "doc_", ",_", "dct_", ",_", "collection_", "=_", "None_", ",_", "do", "\\u", "sanity", "\\u", "checks_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "uni", "on", " ", "of", " ", "doc", " ", "and", " ", "dct", ",", " ", "after", " ", "mak", "ing", " ", "sure", " ", "tha", "t", " ", "dct", " ", "has", " ", "bee", "n", "\\", "10", ";", " ", " ", " ", " ", "adde", "d", " ", "to", " ", "doc", " ", "in", " ", "`", "collection", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "doe", "s", " ", "not", " ", "modif", "y", " ", "eit", "her", " ", "`", "doc", "`", " ", "or", " ", "`", "dct", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "collection_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "collection_", "=_", "self_", "._", "coll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dct_", "=_", "copy_", "._", "deepcopy_", "(_", "dct_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'\\u", "id", "'_", "not_", "in_", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "doc", " ", "must", " ", "have", " ", "an", " ", "\"\\u", "id", "\"", " ", "key", " ", "to", " ", "be", " ", "update", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "id", "'_", "in_", "dct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dct_", "[_", "'\\u", "id", "'_", "]_", "!=_", "doc_", "[_", "'\\u", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "cann", "ot", " ", "update", " ", "the", " ", "\\u", "id", " ", "field", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "dct_", "[_", "'\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "version", "'_", "in_", "dct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dct_", "[_", "'", "version", "'_", "]_", "!=_", "doc_", "[_", "'", "version", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "'", "Ignor", "ing", " ", "\"", "version", "\"", " ", "field", " ", "in", " ", "update", " ", "dictionar", "y", "'_", ")_", "\\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_", "'", "version", "'_", "in_", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc", "\\u", "query_", "=_", "dict_", "(_", "\\u", "id_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", ",_", "version_", "=_", "doc_", "[_", "'", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dct_", "[_", "'", "version", "'_", "]_", "=_", "doc_", "[_", "'", "version", "'_", "]_", "+_", "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 ", " _", "doc", "\\u", "query_", "=_", "dict_", "(_", "\\u", "id_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dct_", "[_", "'", "version", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "warn", "ing", " ", "-", " ", "if", " ", "doc", " ", "matche", "s", " ", "not", "hing", " ", "then", " ", "this", " ", "function", " ", "succeeds", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "N", ".", "B", ".", " ", "this", " ", "matche", "s", " ", "*", "at", " ", "most", "*", " ", "one", " ", "entry", ",", " ", "and", " ", "possib", "ly", " ", "zero_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "collection_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'$", "set", "'_", ":_", "dct_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "multi_", "=_", "False_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pymongo_", "._", "errors_", "._", "Opera", "tion", "Failure_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "translat", "e", " ", "pymong", "o", " ", "error", " ", "class", " ", "int", "o", " ", "hyper", "opt", " ", "error", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "see", " ", "insert", "()", " ", "code", " ", "for", " ", "rational", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "doc", " ", "in", "-", "place", " ", "to", " ", "match", " ", "what", " ", "happ", "ened", " ", "on", " ", "the", " ", "server", " ", "side_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc_", "._", "update_", "(_", "dct_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "do", "\\u", "sanity", "\\u", "checks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "\\u", "doc_", "=_", "collection_", "._", "find", "\\u", "one_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "\\u", "id_", "=_", "doc_", "[_", "'\\u", "id", "'_", "]_", ",_", "version_", "=_", "doc_", "[_", "'", "version", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server", "\\u", "doc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "'", "update", "d", " ", "doc", " ", "not", " ", "found", " ", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "str_", "(_", "doc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "server", "\\u", "doc_", "!=_", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ":_", "#", " ", "Thi", "s", " ", "is", " ", "all", " ", "commente", "d", " ", "out", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "trip", "ping", " ", "on", " ", "the", " ", "fact", " ", "that_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "str", "('", "a", "')", " ", "!=", " ", "unicode", "('", "a", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "eliminat", "e", " ", "fal", "se", " ", "alarms", " ", "and", " ", "catch", " ", "real", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mism", "atch", "ing", "\\u", "keys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "server", "\\u", "doc_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "k_", "in_", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "doc_", "[_", "k_", "]_", "!=_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mism", "atch", "ing", "\\u", "keys_", "._", "append_", "(_", "(_", "k_", ",_", "v_", ",_", "doc_", "[_", "k_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mism", "atch", "ing", "\\u", "keys_", "._", "append_", "(_", "(_", "k_", ",_", "v_", ",_", "'<", "missi", "ng", ">'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "doc_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "k_", "not_", "in_", "server", "\\u", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mism", "atch", "ing", "\\u", "keys_", "._", "append_", "(_", "(_", "k_", ",_", "'<", "missi", "ng", ">'_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Opera", "tion", "Failure_", "(_", "'", "local", " ", "and", " ", "server", " ", "doc", " ", "document", "s", " ", "are", " ", "out", " ", "of", " ", "sync", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "repr_", "(_", "(_", "doc_", ",_", "server", "\\u", "doc_", ",_", "mism", "atch", "ing", "\\u", "keys_", ")_", ")_", ")_", "\\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_", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attach", "ment", "\\u", "names_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "as", "\\u", "str_", "(_", "name", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "name", "\\u", "id_", "[_", "0_", "]_", ",_", "basestring_", ")_", ",_", "name", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "str_", "(_", "name", "\\u", "id_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "map_", "(_", "as", "\\u", "str_", ",_", "doc_", "._", "get_", "(_", "'\\u", "attach", "ment", "s", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "attachment_", "(_", "self_", ",_", "doc_", ",_", "blob_", ",_", "name_", ",_", "collection_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Attach", " ", "potenti", "ally", " ", "large", " ", "data", " ", "string", " ", "`", "blob", "`", " ", "to", " ", "`", "doc", "`", " ", "by", " ", "name", " ", "`", "name", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "blob", " ", "must", " ", "be", " ", "a", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "doc", " ", "must", " ", "have", " ", "bee", "n", " ", "saved", " ", "in", " ", "some", " ", "collection", " ", "(", "must", " ", "have", " ", "an", " ", "\\u", "id", "),", " ", "but", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "necessar", "il", "y", " ", "the", " ", "jobs", " ", "collection", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "must", " ", "be", " ", "a", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "file", " ", "with", " ", "the", " ", "give", "n", " ", "name", " ", "for", " ", "this", " ", "doc", ",", " ", "then", " ", "we", " ", "will", " ", "delete", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", " ", "writ", "ing", " ", "the", " ", "new", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "attachments_", "=_", "doc_", "._", "get_", "(_", "'\\u", "attach", "ment", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "matches_", "=_", "[_", "a_", "for_", "a_", "in_", "attachments_", "if_", "a_", "[_", "0_", "]_", "==_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "filename", " ", "is", " ", "set", " ", "to", " ", "somet", "hing", " ", "so", " ", "tha", "t", " ", "fs", ".", "list", "()", " ", "will", " ", "display", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "file", "\\u", "id_", "=_", "self_", "._", "gf", "s_", "._", "put_", "(_", "blob_", ",_", "filename_", "=_", "'%", "s", "\\u", "%", "s", "'_", "%_", "(_", "doc_", "[_", "'\\u", "id", "'_", "]_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "store", "d", " ", "blob", " ", "of", " ", "%", "i", " ", "bytes", " ", "with", " ", "id", "=", "%", "s", " ", "and", " ", "filename", " ", "%", "s", "\\u", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "blob_", ")_", ",_", "str_", "(_", "new", "\\u", "file", "\\u", "id_", ")_", ",_", "doc_", "[_", "'\\u", "id", "'_", "]_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "attachments_", "=_", "(_", "[_", "a_", "for_", "a_", "in_", "attachments_", "if_", "a_", "[_", "0_", "]_", "!=_", "name_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "[_", "(_", "name_", ",_", "new", "\\u", "file", "\\u", "id_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ii_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "self_", "._", "update_", "(_", "doc_", ",_", "{_", "'\\u", "attach", "ment", "s", "'_", ":_", "new", "\\u", "attachments_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collection_", "=_", "collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "a", " ", "databa", "se", " ", "leak", " ", "unti", "l", " ", "we", " ", "actual", "ly", " ", "delete", " ", "the", " ", "files", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "no", " ", "long", "er", " ", "point", "ed", " ", "to", " ", "by", " ", "new", "\\u", "attachments_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "ii_", "<_", "len_", "(_", "name", "\\u", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "gf", "s_", "._", "delete_", "(_", "name", "\\u", "matches_", "[_", "ii_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "ii_", "<_", "len_", "(_", "name", "\\u", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Leak", " ", "dur", "ing", " ", "set\\u", "attach", "ment", ":", " ", "old", "\\u", "file", "\\u", "id", "=", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name", "\\u", "matches_", "[_", "ii_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ii_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "[_", "n_", "for_", "n_", "in_", "self_", "._", "attach", "ment", "\\u", "names_", "(_", "doc_", ")_", "if_", "n_", "==_", "name_", "]_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", " ", "new", "\\u", "file", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "attachment_", "(_", "self_", ",_", "doc_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "data", " ", "attache", "d", " ", "to", " ", "`", "doc", "`", " ", "by", " ", "`", "attach", "\\u", "blob", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Opera", "tion", "Fail", "ure", " ", "if", " ", "`", "name", "`", " ", "doe", "s", " ", "not", " ", "correspond", " ", "to", " ", "an", " ", "attache", "d", " ", "blob", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "blob", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attachments_", "=_", "doc_", "._", "get_", "(_", "'\\u", "attach", "ment", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "ids_", "=_", "[_", "a_", "[_", "1_", "]_", "for_", "a_", "in_", "attachments_", "if_", "a_", "[_", "0_", "]_", "==_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "file", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "'", "Attach", "ment", " ", "not", " ", "found", ":", " ", "%", "s", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "file", "\\u", "ids_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "'", "multiple", " ", "name", " ", "matche", "s", "'_", ",_", "(_", "name_", ",_", "file", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "gf", "s_", "._", "get_", "(_", "file", "\\u", "ids_", "[_", "0_", "]_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Jobs_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "attachment_", "(_", "self_", ",_", "doc_", ",_", "name_", ",_", "collection_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attachments_", "=_", "doc_", "._", "get_", "(_", "'\\u", "attach", "ment", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "a_", "in_", "enumerate_", "(_", "attachments_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a_", "[_", "0_", "]_", "==_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "id_", "=_", "a_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "'", "Attach", "ment", " ", "not", " ", "found", ":", " ", "%", "s", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "Del", "eti", "ng", "\",", " ", "file", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "attachments_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "doc_", ",_", "{_", "'\\u", "attach", "ment", "s", "'_", ":_", "attachments_", "}_", ",_", "collection_", "=_", "collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gf", "s_", "._", "delete_", "(_", "file", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Trial", "s", " ", "maps", " ", "on", " ", "to", " ", "an", " ", "entire", " ", "mongo", " ", "collection", ".", " ", "It", "'", "s", " ", "basic", "ally", " ", "a", " ", "wrapp", "er", "\\", "10", ";", " ", " ", " ", " ", "aro", "und", " ", "Mon", "go", "Jo", "bs", " ", "for", " ", "now", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "As", " ", "a", " ", "conce", "ssion", " ", "to", " ", "perform", "anc", "e", ",", " ", "this", " ", "object", " ", "permit", "s", " ", "tria", "l", " ", "filtering", " ", "based", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "the", " ", "exp", "\\u", "key", ",", " ", "but", " ", "I", " ", "feel", " ", "tha", "t", "'", "s", " ", "a", " ", "hack", ".", " ", "The", " ", "case", " ", "of", " ", "`", "cmd", "`", " ", "is", " ", "similar", "--", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "exp", "\\u", "key", " ", "and", " ", "cmd", " ", "are", " ", "sema", "ntic", "ally", " ", "couple", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "WR", "ITI", "NG", " ", "TO", " ", "THE", " ", "DATA", "BASE", "\\", "10", ";", " ", " ", " ", " ", "--------------", "---------", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "tria", "ls", " ", "object", " ", "is", " ", "mean", "t", " ", "for", " ", "*", "readi", "ng", "*", " ", "a", " ", "tria", "ls", " ", "databa", "se", ".", " ", "Writ", "ing", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "a", " ", "databa", "se", " ", "is", " ", "different", " ", "eno", "ugh", " ", "from", " ", "writ", "ing", " ", "to", " ", "an", " ", "in", "-", "memory", "\\", "10", ";", " ", " ", " ", " ", "collection", " ", "tha", "t", " ", "no", " ", "atte", "mpt", " ", "has", " ", "bee", "n", " ", "made", " ", "to", " ", "abstract", " ", "awa", "y", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "difference", ".", " ", " ", "If", " ", "you", " ", "want", " ", "to", " ", "update", " ", "the", " ", "document", "s", " ", "within", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "Mon", "go", "Trial", "s", " ", "collection", ",", " ", "then", " ", "retrieve", " ", "the", " ", "`.", "handle", "`", " ", "attribute", " ", "(", "a", "\\", "10", ";", " ", " ", " ", " ", "Mon", "go", "Jo", "bs", " ", "instance", ")", " ", "and", " ", "use", " ", "lower", "-", "level", " ", "method", "s", ",", " ", "or", " ", "pymong", "o", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "interface", " ", "direct", "ly", ".", " ", " ", "Whe", "n", " ", "you", " ", "are", " ", "don", "e", " ", "writ", "ing", ",", " ", "call", " ", "refre", "sh", "()", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "refre", "sh", "\\u", "tid", "s", "()", " ", "to", " ", "bring", " ", "the", " ", "Mon", "go", "Trial", "s", " ", "up", " ", "to", " ", "date", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "arg_", ",_", "exp", "\\u", "key_", "=_", "None_", ",_", "cmd_", "=_", "None_", ",_", "workdir_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "refresh_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "arg_", ",_", "Mon", "go", "Jobs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handle_", "=_", "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 ", " _", "connecti", "on", "\\u", "string_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "handle_", "=_", "Mon", "go", "Jobs_", "._", "new", "\\u", "from", "\\u", "connecti", "on", "\\u", "str_", "(_", "connecti", "on", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handle_", "._", "create", "\\u", "indexes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "exp", "\\u", "key_", "=_", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cmd_", "=_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "workdir_", "=_", "workdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "refresh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "refresh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "view_", "(_", "self_", ",_", "exp", "\\u", "key_", "=_", "None_", ",_", "cmd_", "=_", "None_", ",_", "workdir_", "=_", "None_", ",_", "refresh_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rval_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "handle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "key_", "=_", "self_", "._", "\\u", "exp", "\\u", "key_", "if_", "exp", "\\u", "key_", "is_", "None_", "else_", "exp", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "self_", "._", "cmd_", "if_", "cmd_", "is_", "None_", "else_", "cmd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workdir_", "=_", "self_", "._", "workdir_", "if_", "workdir_", "is_", "None_", "else_", "workdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "refresh_", "=_", "refresh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "refre", "sh", "\\u", "tid", "s_", "(_", "self_", ",_", "tid", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Sync", " ", "document", "s", " ", "with", " ", "`", "['", "tid", "']", "`", " ", "in", " ", "the", " ", "list", " ", "of", " ", "`", "tid", "s", "`", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "databa", "se", " ", "(", "not", " ", "*", "to", "*", " ", "the", " ", "databa", "se", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Local", " ", "tria", "l", " ", "document", "s", " ", "who", "se", " ", "tid", " ", "is", " ", "not", " ", "in", " ", "`", "tid", "s", "`", " ", "are", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "affect", "ed", " ", "by", " ", "this", " ", "call", ".", " ", " ", "Local", " ", "tria", "l", " ", "document", "s", " ", "who", "se", " ", "tid", " ", "is", " ", "in", " ", "`", "tid", "s", "`", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "be", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "*", "delete", "d", "*", " ", "(", "if", " ", "db", " ", "no", " ", "long", "er", " ", "has", " ", "correspond", "ing", " ", "document", "),", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "*", "update", "d", "*", " ", "(", "if", " ", "db", " ", "has", " ", "an", " ", "update", "d", " ", "document", ")", " ", "or", ",", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "*", "left", " ", "alo", "ne", "*", " ", "(", "if", " ", "db", " ", "document", " ", "matche", "s", " ", "local", " ", "one", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Addition", "ally", ",", " ", "if", " ", "the", " ", "db", " ", "has", " ", "a", " ", "matchi", "ng", " ", "document", ",", " ", "but", " ", "there", " ", "is", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "local", " ", "tria", "l", " ", "with", " ", "a", " ", "matchi", "ng", " ", "tid", ",", " ", "then", " ", "the", " ", "db", " ", "document", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "*", "inserted", "*", " ", "int", "o", " ", "the", " ", "local", " ", "collection", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp", "\\u", "key_", "=_", "self_", "._", "\\u", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exp", "\\u", "key_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "{_", "'", "exp", "\\u", "key", "'_", ":_", "exp", "\\u", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "[_", "'", "state", "'_", "]_", "=_", "{_", "'$", "ne", "'_", ":_", "JOB", "\\u", "STATE", "\\u", "ERROR_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tid", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "[_", "'", "tid", "'_", "]_", "=_", "{_", "'$", "in", "'_", ":_", "list_", "(_", "tid", "s_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "orig", "\\u", "trials_", "=_", "getattr_", "(_", "self_", ",_", "'\\u", "tria", "ls", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trials_", "=_", "orig", "\\u", "trials_", "[_", ":_", "]_", "#", "copy", " ", "to", " ", "make", " ", "sure", " ", "it", " ", "doe", "sn", "'", "t", " ", "get", " ", "scre", "wed", " ", "up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "trials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "data_", "=_", "list_", "(_", "self_", "._", "handle_", "._", "jobs_", "._", "find_", "(_", "query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "'\\u", "id", "'_", ",_", "'", "version", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "pull", " ", "down", " ", "a", " ", "fresh", " ", "list", " ", "of", " ", "ids", " ", "from", " ", "mongo_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "db", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "make", " ", "nump", "y", " ", "data", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "data_", "=_", "numpy_", "._", "rec_", "._", "array_", "(_", "[_", "(_", "x_", "[_", "'\\u", "id", "'_", "]_", ",_", "int_", "(_", "x_", "[_", "'", "version", "'_", "]_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "db", "\\u", "data_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "[_", "'\\u", "id", "'_", ",_", "'", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "data_", "._", "sort_", "(_", "order_", "=_", "[_", "'\\u", "id", "'_", ",_", "'", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "data_", "=_", "db", "\\u", "data_", "[_", "get", "\\u", "most", "\\u", "recent", "\\u", "inds_", "(_", "db", "\\u", "data_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "data_", "=_", "numpy_", "._", "rec_", "._", "array_", "(_", "[_", "(_", "x_", "[_", "'\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "x_", "[_", "'", "version", "'_", "]_", ")_", ")_", "for_", "x_", "in_", "\\u", "trials_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "[_", "'\\u", "id", "'_", ",_", "'", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "data_", "._", "sort_", "(_", "order_", "=_", "[_", "'\\u", "id", "'_", ",_", "'", "version", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "ch", " ", "record", "s", " ", "are", " ", "in", " ", "db", " ", "but", " ", "not", " ", "in", " ", "exist", "ing", ",", " ", "and", " ", "vice", " ", "versa", "_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "in", "\\u", "existing_", "=_", "fast", "\\u", "isin_", "(_", "db", "\\u", "data_", "[_", "'\\u", "id", "'_", "]_", ",_", "exist", "ing", "\\u", "data_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "in", "\\u", "db_", "=_", "fast", "\\u", "isin_", "(_", "exist", "ing", "\\u", "data_", "[_", "'\\u", "id", "'_", "]_", ",_", "db", "\\u", "data_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "filtering", " ", "out", " ", "out", "-", "of", "-", "date", " ", "records_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "trials_", "=_", "[_", "\\u", "trials_", "[_", "\\u", "ind_", "]_", "for_", "\\u", "ind_", "in_", "exist", "ing", "\\u", "in", "\\u", "db_", "._", "nonzero_", "(_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "new", " ", "data", " ", "is", " ", "what", "'", "s", " ", "in", " ", "db", " ", "tha", "t", "'", "s", " ", "not", " ", "in", " ", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "data_", "=_", "db", "\\u", "data_", "[_", "numpy_", "._", "invert_", "(_", "db", "\\u", "in", "\\u", "existing_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "hav", "ing", " ", "remove", "d", " ", "the", " ", "new", " ", "and", " ", "out", " ", "of", " ", "data", " ", "data", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "conce", "ntra", "ting", " ", "on", " ", "data", " ", "in", " ", "db", " ", "and", " ", "exist", "ing", " ", "for", " ", "state", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "data_", "=_", "db", "\\u", "data_", "[_", "db", "\\u", "in", "\\u", "existing_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "data_", "=_", "exist", "ing", "\\u", "data_", "[_", "exist", "ing", "\\u", "in", "\\u", "db_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "len_", "(_", "db", "\\u", "data_", ")_", "==_", "len_", "(_", "exist", "ing", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "exist", "ing", "\\u", "data_", "[_", "'\\u", "id", "'_", "]_", "==_", "db", "\\u", "data_", "[_", "'\\u", "id", "'_", "]_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "exist", "ing", "\\u", "data_", "[_", "'", "version", "'_", "]_", "<=_", "db", "\\u", "data_", "[_", "'", "version", "'_", "]_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "report", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "getcwd_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hyper", "opt", "\\u", "refre", "sh", "\\u", "crash", "\\u", "report", "\\u'_", "+_", "str_", "(_", "numpy_", "._", "random_", "._", "randint_", "(_", "1e", "8_", ")_", ")_", "+_", "'.", "pkl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "'", "HYP", "ERO", "PT", " ", "REFRESH", " ", "ERROR", ":", " ", "writ", "ing", " ", "error", " ", "file", " ", "to", " ", "%", "s", "'_", "%_", "report", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "file_", "=_", "open_", "(_", "report", "path_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "Pickle_", "._", "dump_", "(_", "{_", "'", "db", "\\u", "data", "'_", ":_", "db", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exist", "ing", "\\u", "data", "'_", ":_", "exist", "ing", "\\u", "data_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "same", "\\u", "version_", "=_", "exist", "ing", "\\u", "data_", "[_", "'", "version", "'_", "]_", "==_", "db", "\\u", "data_", "[_", "'", "version", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trials_", "=_", "[_", "\\u", "trials_", "[_", "\\u", "ind_", "]_", "for_", "\\u", "ind_", "in_", "same", "\\u", "version_", "._", "nonzero_", "(_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u", "changes_", "=_", "exist", "ing", "\\u", "data_", "[_", "numpy_", "._", "invert_", "(_", "same", "\\u", "version_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "actual", "ly", " ", "get", " ", "the", " ", "update", "d", " ", "records_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "ids_", "=_", "new", "\\u", "data_", "[_", "'\\u", "id", "'_", "]_", "._", "tolist_", "(_", ")_", "+_", "version", "\\u", "changes_", "[_", "'\\u", "id", "'_", "]_", "._", "tolist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "new_", "=_", "len_", "(_", "update", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "query_", "=_", "copy_", "._", "deepcopy_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "query_", "[_", "'\\u", "id", "'_", "]_", "=_", "{_", "'$", "in", "'_", ":_", "update", "\\u", "ids_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d\\u", "trials_", "=_", "list_", "(_", "self_", "._", "handle_", "._", "jobs_", "._", "find_", "(_", "update", "\\u", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trials_", "._", "extend_", "(_", "update", "d\\u", "trials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "new_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trials_", "=_", "[_", "]_", "\\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_", "#", "this", " ", "case", " ", "is", " ", "for", " ", "perform", "anc", "e", ",", " ", "tho", "ugh", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "be", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "with", "out", " ", "break", "ing", " ", "correct", "ness", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "trials_", "=_", "list_", "(_", "self_", "._", "handle_", "._", "jobs_", "._", "find_", "(_", "query_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "trials_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "trials_", "=_", "[_", "\\u", "trials_", "[_", "\\u", "i_", "]_", "for_", "\\u", "i_", "in_", "get", "\\u", "most", "\\u", "recent", "\\u", "inds_", "(_", "\\u", "trials_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "new_", "=_", "len_", "(_", "\\u", "trials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Refr", "esh", " ", "data", " ", "download", " ", "too", "k", " ", "%", "f", " ", "second", "s", " ", "for", " ", "%", "d", " ", "ids", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "t0_", ",_", "num", "\\u", "new_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tid", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "If", " ", "tid", "s", " ", "wer", "e", " ", "give", "n", ",", " ", "then", " ", "\\u", "tria", "ls", " ", "only", " ", "contains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "document", "s", " ", "with", " ", "matchi", "ng", " ", "tid", "s", ".", " ", "Her", "e", " ", "we", " ", "augment", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fresh", " ", "matchi", "ng", " ", "document", "s", ",", " ", "with", " ", "our", " ", "current", " ", "ones", " ", "who", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tid", "s", " ", "don", "'", "t", " ", "match", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "trials_", "=_", "\\u", "trials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tid", "s", "\\u", "set_", "=_", "set_", "(_", "tid", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "all_", "(_", "t_", "[_", "'", "tid", "'_", "]_", "in_", "tid", "s", "\\u", "set_", "for_", "t_", "in_", "new", "\\u", "trials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "trials_", "=_", "[_", "t_", "for_", "t_", "in_", "orig", "\\u", "trials_", "if_", "t_", "[_", "'", "tid", "'_", "]_", "not_", "in_", "tid", "s", "\\u", "set_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trials_", "=_", "new", "\\u", "trials_", "+_", "old", "\\u", "trials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "reass", "ign", " ", "new", " ", "tria", "ls", " ", "to", " ", "self", ",", " ", "in", " ", "order", " ", "of", " ", "incr", "easi", "ng", " ", "tid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jar", "ray_", "=_", "numpy_", "._", "array_", "(_", "[_", "j_", "[_", "'\\u", "id", "'_", "]_", "for_", "j_", "in_", "\\u", "trials_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jobs", "ort_", "=_", "jar", "ray_", "._", "argsort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "trials_", "=_", "[_", "\\u", "trials_", "[_", "\\u", "idx_", "]_", "for_", "\\u", "idx_", "in_", "jobs", "ort_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "specs_", "=_", "[_", "\\u", "trials_", "[_", "\\u", "idx_", "]_", "[_", "'", "spec", "'_", "]_", "for_", "\\u", "idx_", "in_", "jobs", "ort_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "results_", "=_", "[_", "\\u", "trials_", "[_", "\\u", "idx_", "]_", "[_", "'", "result", "'_", "]_", "for_", "\\u", "idx_", "in_", "jobs", "ort_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "misc", "s_", "=_", "[_", "\\u", "trials_", "[_", "\\u", "idx_", "]_", "[_", "'", "misc", "'_", "]_", "for_", "\\u", "idx_", "in_", "jobs", "ort_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "refresh_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "refre", "sh", "\\u", "tid", "s_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "insert", "\\u", "tria", "l\\u", "docs_", "(_", "self_", ",_", "docs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rval_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "doc_", "in_", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rval_", "._", "append_", "(_", "self_", "._", "handle_", "._", "jobs_", "._", "insert_", "(_", "doc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count", "\\u", "by", "\\u", "state", "\\u", "uns", "ync", "ed_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp", "\\u", "key_", "=_", "self_", "._", "\\u", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "consider", " ", "search", "ing", " ", "by", " ", "SON", " ", "rat", "her", " ", "than", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "arg_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "not_", "in_", "JOB", "\\u", "STATES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "invalid", " ", "state", "'_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "dict_", "(_", "state_", "=_", "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 ", " _", "assert_", "hasattr_", "(_", "arg_", ",_", "'\\u", "\\u", "iter", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "states_", "=_", "list_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "all_", "(_", "[_", "x_", "in_", "JOB", "\\u", "STATES_", "for_", "x_", "in_", "states_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "dict_", "(_", "state_", "=_", "{_", "'$", "in", "'_", ":_", "states_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp", "\\u", "key_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "[_", "'", "exp", "\\u", "key", "'_", "]_", "=_", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rval_", "=_", "self_", "._", "handle_", "._", "jobs_", "._", "find_", "(_", "query_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "all_", "(_", "self_", ",_", "cond_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cond_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "=_", "dict_", "(_", "cond_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cond_", "[_", "'", "exp", "\\u", "key", "'_", "]_", "=_", "self_", "._", "\\u", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "remove", " ", "all", " ", "document", "s", " ", "matchi", "ng", " ", "condition_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handle_", "._", "delete", "\\u", "all_", "(_", "cond_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s_", "=_", "self_", "._", "handle_", "._", "gf", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filename_", "in_", "gf", "s_", "._", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fdo", "c_", "=_", "gf", "s_", "._", "get", "\\u", "last", "\\u", "version_", "(_", "filename_", "=_", "filename_", ",_", "**_", "cond_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "grid", "fs_", "._", "errors_", "._", "No", "File_", ":_", "\\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_", "gf", "s_", "._", "delete_", "(_", "fdo", "c_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "refresh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "tria", "l\\u", "ids_", "(_", "self_", ",_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "=_", "self_", "._", "handle_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "N", ".", "B", ".", " ", "tha", "t", " ", "the", " ", "exp", " ", "key", " ", "is", " ", "*", "not", "*", " ", "used", " ", "here", ".", " ", "It", " ", "was", " ", "onc", "e", ",", " ", "but", " ", "it", " ", "caus", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "nas", "ty", " ", "bug", ":", " ", "tid", "s", " ", "wer", "e", " ", "generat", "ed", " ", "by", " ", "a", " ", "global", " ", "experiment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "exp", "\\u", "key", "=", "Non", "e", ",", " ", "runn", "ing", " ", "a", " ", "suggest", "()", " ", "tha", "t", " ", "introduce", "d", " ", "sub", "-", "experiments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "exp", "\\u", "keys", ",", " ", "whi", "ch", " ", "ran", " ", "jobs", " ", "tha", "t", " ", "did", " ", "result", " ", "injection", ".", " ", " ", "The", " ", "tid", "s", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "injected", " ", "jobs", " ", "wer", "e", " ", "somet", "imes", " ", "unique", " ", "within", " ", "an", " ", "experiment", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "imes", " ", "not", ".", " ", "Hi", "lar", "ious", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Solut", "ion", ":", " ", "tid", "s", " ", "are", " ", "generat", "ed", " ", "to", " ", "be", " ", "unique", " ", "acro", "ss", " ", "the", " ", "db", ",", " ", "not", " ", "just", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "within", " ", "an", " ", "exp", "\\u", "key", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "mongo", " ", "docs", " ", "say", " ", "you", " ", "can", "'", "t", " ", "upse", "rt", " ", "an", " ", "empty", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "{_", "'", "a", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "doc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "db_", "._", "job", "\\u", "ids_", "._", "find", "\\u", "and", "\\u", "modify_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'$", "inc", "'_", ":_", "{_", "'", "last", "\\u", "id", "'_", ":_", "N_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upsert_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "doc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "no", " ", "last", "\\u", "id", " ", "found", ",", " ", "re", "-", "try", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lid_", "=_", "doc_", "._", "get_", "(_", "'", "last", "\\u", "id", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "range_", "(_", "lid_", ",_", "lid_", "+_", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tria", "l\\u", "attachments_", "(_", "self_", ",_", "trial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Attach", "ment", "s", " ", "to", " ", "a", " ", "single", " ", "tria", "l", " ", "(", "e", ".", "g", ".", " ", "learned", " ", "weight", "s", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "dictionar", "y", " ", "interface", " ", "to", " ", "the", " ", "attach", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "off", "er", " ", "more", " ", "here", " ", "than", " ", "in", " ", "Mon", "go", "Ctrl_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Attach", "ments_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "contains\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "name_", "in_", "self_", "._", "handle_", "._", "attach", "ment", "\\u", "names_", "(_", "doc_", "=_", "trial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "handle_", "._", "attach", "ment", "\\u", "names_", "(_", "doc_", "=_", "trial_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "handle_", "._", "attach", "ment", "\\u", "names_", "(_", "doc_", "=_", "trial_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "handle_", "._", "get", "\\u", "attachment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "trial_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Opera", "tion", "Failure_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Key", "Error_", "(_", "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_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handle_", "._", "set\\u", "attachment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "trial_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blob_", "=_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collection_", "=_", "self_", "._", "handle_", "._", "db_", "._", "jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "delete", " ", "tria", "l\\u", "attach", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "k_", "for_", "k_", "in_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "self_", "[_", "k_", "]_", "for_", "k_", "in_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "k_", ",_", "self_", "[_", "k_", "]_", ")_", "for_", "k_", "in_", "self_", "]_", "\\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_", "Attach", "ments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Trial", "s_", "(_", "Trial", "s_", ")_", ":_", "\\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_", "attachments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Attach", "ment", "s", " ", "to", " ", "a", " ", "Trial", "s", " ", "set", " ", "(", "suc", "h", " ", "as", " ", "bandi", "t", " ", "args", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Supp", "ort", " ", "synta", "x", " ", "for", " ", "load", ":", " ", " ", "self", ".", "attach", "ment", "s", "[", "name", "]", "\\", "10", ";", " ", " ", " ", " ", "Supp", "ort", " ", "synta", "x", " ", "for", " ", "store", ":", " ", "self", ".", "attach", "ment", "s", "[", "name", "]", " ", "=", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s_", "=_", "self_", "._", "handle_", "._", "gf", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "exp", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "[_", "'", "exp", "\\u", "key", "'_", "]_", "=_", "self_", "._", "\\u", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Attach", "ments_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "iter\\u\\u_", "(_", "\\u", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "gf", "s", ".", "list", " ", "doe", "s", " ", "not", " ", "accept", " ", "query", " ", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "(", "at", " ", "leas", "t", ",", " ", "as", " ", "of", " ", "pymong", "o", " ", "2.4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "filenames_", "=_", "[_", "fname_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fname_", "in_", "gf", "s_", "._", "list_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fname_", "in_", "\\u", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "filenames_", "=_", "gf", "s_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "iter_", "(_", "filenames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "gf", "s_", "._", "exists_", "(_", "filename_", "=_", "name_", ",_", "**_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rval_", "=_", "gf", "s_", "._", "get", "\\u", "version_", "(_", "filename_", "=_", "name_", ",_", "**_", "query_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "grid", "fs_", "._", "No", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Key", "Error_", "(_", "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_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "gf", "s_", "._", "exists_", "(_", "filename_", "=_", "name_", ",_", "**_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "gou", "t_", "=_", "gf", "s_", "._", "get", "\\u", "last", "\\u", "version_", "(_", "filename_", "=_", "name_", ",_", "**_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s_", "._", "delete_", "(_", "gou", "t_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gf", "s_", "._", "put_", "(_", "value_", ",_", "filename_", "=_", "name_", ",_", "**_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "\\u", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gou", "t_", "=_", "gf", "s_", "._", "get", "\\u", "last", "\\u", "version_", "(_", "filename_", "=_", "name_", ",_", "**_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gf", "s_", "._", "delete_", "(_", "gou", "t_", "._", "\\u", "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_", "return_", "Attach", "ments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Mon", "go", "Worker_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "interval_", "=_", "3.0_", "#", " ", "--", " ", "seconds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "workdir_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Worker_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "mj", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "poll", "\\u", "interval_", "=_", "poll", "\\u", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workdir_", "=_", "workdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "key_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "logfile", "name_", "=_", "'", "logfile", ".", "txt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "mj", " ", "-", " ", "Mon", "go", "Jo", "bs", " ", "interface", " ", "to", " ", "jobs", " ", "collection", "\\", "10", ";", " ", " ", " ", " ", "poll", "\\u", "interval", " ", "-", " ", "second", "s", "\\", "10", ";", " ", " ", " ", " ", "workdir", " ", "-", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "exp", "\\u", "key", " ", "-", " ", "restrict", " ", "reserva", "tion", "s", " ", "to", " ", "this", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mj", "_", "=_", "mj", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "poll", "\\u", "interval_", "=_", "poll", "\\u", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "workdir_", "=_", "workdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exp", "\\u", "key_", "=_", "exp", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logfile", "name_", "=_", "logfile", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Worker_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "log", "\\u", "handler_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "\\u", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "self_", "._", "logfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "handler_", "._", "set", "Formatter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "Formatter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fmt_", "=_", "'%", "(", "level", "name", ")", "s", " ", "(%", "(", "name", ")", "s", "):", " ", "%", "(", "message", ")", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "handler_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Worker_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "one_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "id_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reserve", "\\u", "timeout_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "erase", "\\u", "created", "\\u", "workdir_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "host", "\\u", "id_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "'%", "s", ":", "%", "i", "'_", "%_", "(_", "socket_", "._", "gethostname_", "(_", ")_", ",_", "os_", "._", "getpid_", "(_", ")_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mj", "_", "=_", "self_", "._", "mj", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "job_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "reserve", "\\u", "timeout_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "start", "\\u", "time_", ")_", ">_", "reserve", "\\u", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Reserve", "Timeout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job_", "=_", "mj", "_", "._", "reserve", "_", "(_", "host", "\\u", "id_", ",_", "exp", "\\u", "key_", "=_", "self_", "._", "exp", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "job_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interval_", "=_", "(_", "1_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "random_", "._", "rand_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "(_", "float_", "(_", "self_", "._", "poll", "\\u", "interval_", ")_", "-_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "no", " ", "job", " ", "found", ",", " ", "sleep", "ing", " ", "for", " ", "%", ".1", "fs", "'_", "%_", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "job", " ", "found", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "job_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "don", "'", "t", " ", "let", " ", "the", " ", "cmd", " ", "mess", " ", "up", " ", "our", " ", "tria", "l", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "=_", "spec", "\\u", "from", "\\u", "misc_", "(_", "job_", "[_", "'", "misc", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctrl_", "=_", "Mon", "go", "Ctrl_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "trials_", "=_", "Mon", "go", "Trial", "s_", "(_", "mj", "_", ",_", "exp", "\\u", "key_", "=_", "job_", "[_", "'", "exp", "\\u", "key", "'_", "]_", ",_", "refresh_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "only_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "trial_", "=_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "workdir_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workdir_", "=_", "job_", "[_", "'", "misc", "'_", "]_", "._", "get_", "(_", "'", "workdir", "'_", ",_", "os_", "._", "getcwd_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "workdir_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workdir_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "workdir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "workdir_", ",_", "str_", "(_", "job_", "[_", "'\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workdir_", "=_", "self_", "._", "workdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "workdir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "workdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "\\u", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "logfile", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "make", "\\u", "log", "\\u", "handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "\\u", "logger_", "._", "add", "Handler_", "(_", "self_", "._", "log", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "job_", "[_", "'", "misc", "'_", "]_", "[_", "'", "cmd", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "protocol_", "=_", "cmd_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cmd", "\\u", "protocol_", "==_", "'", "cpi", "ckl", "ed", " ", "fn", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "worker", "\\u", "fn_", "=_", "c", "Pickle_", "._", "loads_", "(_", "cmd_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd", "\\u", "protocol_", "==_", "'", "call", " ", "evaluate", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bandi", "t_", "=_", "c", "Pickle_", "._", "loads_", "(_", "cmd_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker", "\\u", "fn_", "=_", "bandi", "t_", "._", "evaluate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd", "\\u", "protocol_", "==_", "'", "token", "\\u", "load", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cmd", "\\u", "toks_", "=_", "cmd_", "[_", "1_", "]_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "module_", "=_", "'.'_", "._", "join_", "(_", "cmd", "\\u", "toks_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker", "\\u", "fn_", "=_", "exec", "\\u", "import_", "(_", "cmd", "\\u", "module_", ",_", "cmd_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd", "\\u", "protocol_", "==_", "'", "bandi", "t", "\\u", "json", " ", "evaluate", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bandi", "t_", "=_", "json", "\\u", "call_", "(_", "cmd_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker", "\\u", "fn_", "=_", "bandi", "t_", "._", "evaluate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd", "\\u", "protocol_", "==_", "'", "driver", "\\u", "attach", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "name", " ", "=", " ", "'", "driver", "\\u", "attach", "ment", "\\u", "%", "s", "'", " ", "%", " ", "job", "['", "exp", "\\u", "key", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "blob_", "=_", "ctrl_", "._", "trials_", "._", "attachments_", "[_", "cmd_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bandi", "t", "\\u", "name_", ",_", "bandi", "t", "\\u", "args_", ",_", "bandi", "t", "\\u", "kwargs_", "=_", "c", "Pickle_", "._", "loads_", "(_", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker", "\\u", "fn_", "=_", "json", "\\u", "call_", "(_", "bandi", "t", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "bandi", "t", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "bandi", "t", "\\u", "kwargs_", ")_", "._", "evaluate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cmd", "\\u", "protocol_", "==_", "'", "domain", "\\u", "attach", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "blob_", "=_", "ctrl_", "._", "trials_", "._", "attachments_", "[_", "cmd_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "domain_", "=_", "c", "Pickle_", "._", "loads_", "(_", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "info_", "(_", "'", "Error", " ", "whi", "le", " ", "unp", "ick", "ling", ".", " ", "Tr", "y", " ", "install", "ing", " ", "dil", "l", " ", "via", " ", "\"", "pip", " ", "install", " ", "dil", "l", "\"", " ", "for", " ", "enhance", "d", " ", "pick", "ling", " ", "support", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "worker", "\\u", "fn_", "=_", "domain_", "._", "evaluate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "'", "Unre", "cogni", "zed", " ", "cmd", " ", "protoc", "ol", "'_", ",_", "cmd", "\\u", "protocol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "temp", "\\u", "dir_", "(_", "workdir_", ",_", "erase", "\\u", "created", "\\u", "workdir_", ")_", ",_", "working", "\\u", "dir_", "(_", "workdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "worker", "\\u", "fn_", "(_", "spec_", ",_", "ctrl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "SON", "ify_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "XX", "X", ":", " ", "save", " ", "exception", " ", "to", " ", "databa", "se", ",", " ", "but", " ", "if", " ", "this", " ", "fail", "s", ",", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "at", " ", "leas", "t", " ", "raise", " ", "the", " ", "original", " ", "traceback", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "job", " ", "exception", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctrl_", "._", "checkpoint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mj", "_", "._", "update_", "(_", "job_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "state", "'_", ":_", "JOB", "\\u", "STATE", "\\u", "ERROR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "(_", "str_", "(_", "type_", "(_", "e_", ")_", ")_", ",_", "str_", "(_", "e_", ")_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\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 ", " _", "if_", "self_", "._", "logfile", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "\\u", "logger_", "._", "remove", "Handler_", "(_", "self_", "._", "log", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "job", " ", "finish", "ed", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "job_", "[_", "'\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attachments_", "=_", "result_", "._", "pop_", "(_", "'", "attach", "ment", "s", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "aname_", ",_", "aval", "_", "in_", "attachments_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mongo", "exp", ":", " ", "saving", " ", "attach", "ment", " ", "name", "=", "%", "s", " ", "(%", "i", " ", "bytes", ")'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "aname_", ",_", "len_", "(_", "aval", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctrl_", "._", "attachments_", "[_", "aname_", "]_", "=_", "aval", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "._", "checkpoint_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mj", "_", "._", "update_", "(_", "job_", ",_", "{_", "'", "state", "'_", ":_", "JOB", "\\u", "STATE", "\\u", "DONE_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "current", "\\u", "tria", "l", " ", "-", " ", "current", " ", "job", " ", "document", "\\", "10", ";", " ", " ", " ", " ", "jobs", " ", "-", " ", "Mon", "go", "Jo", "bs", " ", "object", " ", "in", " ", "whi", "ch", " ", "current", "\\u", "tria", "l", " ", "reside", "s", "\\", "10", ";", " ", " ", " ", " ", "read", "\\u", "only", " ", "-", " ", "Tru", "e", " ", "means", " ", "don", "'", "t", " ", "change", " ", "the", " ", "db", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "trials_", ",_", "current", "\\u", "trial_", ",_", "read", "\\u", "only_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "trials_", "=_", "trials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "current", "\\u", "trial_", "=_", "current", "\\u", "trial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "\\u", "only_", "=_", "read", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "debug_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Thi", "s", " ", "is", " ", "supposed", " ", "to", " ", "log", " ", "to", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "logger_", "._", "debug_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "info_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Thi", "s", " ", "is", " ", "supposed", " ", "to", " ", "log", " ", "to", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "logger_", "._", "info_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "warn_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Thi", "s", " ", "is", " ", "supposed", " ", "to", " ", "log", " ", "to", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "logger_", "._", "warn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "error_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Thi", "s", " ", "is", " ", "supposed", " ", "to", " ", "log", " ", "to", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "logger_", "._", "error_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "checkpoint_", "(_", "self_", ",_", "result_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "read", "\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "=_", "self_", "._", "trials_", "._", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "refresh_", "(_", "self_", "._", "current", "\\u", "trial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "handle_", "._", "update_", "(_", "self_", "._", "current", "\\u", "trial_", ",_", "dict_", "(_", "result_", "=_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "attachments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Supp", "ort", " ", "synta", "x", " ", "for", " ", "load", ":", " ", " ", "self", ".", "attach", "ment", "s", "[", "name", "]", "\\", "10", ";", " ", " ", " ", " ", "Supp", "ort", " ", "synta", "x", " ", "for", " ", "store", ":", " ", "self", ".", "attach", "ment", "s", "[", "name", "]", " ", "=", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "trials_", "._", "tria", "l\\u", "attachments_", "(_", "trial_", "=_", "self_", "._", "current", "\\u", "trial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "Ctrl_", "(_", "Ctrl_", ")_", ":_", "\\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_", "set\\u", "attachment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Is", " ", "there", " ", "a", " ", "bett", "er", " ", "deprecation", " ", "error", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "attach", "ment", " ", "depre", "cated", ".", " ", "Us", "e", " ", "`", "self", ".", "attach", "ment", "s", "[", "name", "]", " ", "=", " ", "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_", "def_", "exec", "\\u", "import_", "(_", "cmd", "\\u", "module_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "worker", "\\u", "fn_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "'", "import", " ", "%", "s", ";", " ", "worker", "\\u", "fn", " ", "=", " ", "%", "s", "'_", "%_", "(_", "cmd", "\\u", "module_", ",_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "worker", "\\u", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "as", "\\u", "mongo", "\\u", "str_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "._", "startswith_", "(_", "'", "mongo", "://'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "mongo", "://", "%", "s", "'_", "%_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main", "\\u", "worker", "\\u", "helper_", "(_", "options_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "int_", "(_", "options_", "._", "max", "\\u", "jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "last", "\\u", "job", "\\u", "timeout_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "job", "\\u", "timeout_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "float_", "(_", "options_", "._", "last", "\\u", "job", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "job", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sig", "handler", "\\u", "shutdown_", "(_", "signum_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Cau", "ght", " ", "signal", " ", "%", "i", ",", " ", "shutt", "ing", " ", "down", ".'_", "%_", "signum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Shut", "down_", "(_", "signum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sig", "handler", "\\u", "wait", "\\u", "quit_", "(_", "signum_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'", "Cau", "ght", " ", "signal", " ", "%", "i", ",", " ", "shutt", "ing", " ", "down", ".'_", "%_", "signum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Wait", "Quit_", "(_", "signum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGINT_", ",_", "sig", "handler", "\\u", "shutdown_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIG", "HU", "P_", ",_", "sig", "handler", "\\u", "shutdown_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGTERM_", ",_", "sig", "handler", "\\u", "shutdown_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIG", "USR", "1_", ",_", "sig", "handler", "\\u", "wait", "\\u", "quit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "N_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cons", "\\u", "errs_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "job", "\\u", "timeout_", "and_", "time_", "._", "time_", "(_", ")_", ">_", "last", "\\u", "job", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Exi", "ting", " ", "due", " ", "to", " ", "last", "\\u", "job", "\\u", "timeo", "ut", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "N_", "and_", "cons", "\\u", "errs_", "<_", "int_", "(_", "options_", "._", "max", "\\u", "consec", "uti", "ve", "\\u", "failures_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "recurs", "ive", " ", "Pop", "en", ",", " ", "drop", "ping", " ", "N", " ", "from", " ", "the", " ", "argv_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "usi", "ng", " ", "anot", "her", " ", "process", " ", "to", " ", "run", " ", "this", " ", "job_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "protect", " ", "ours", "elv", "es", " ", "from", " ", "memory", " ", "leak", "s", ",", " ", "bad", " ", "cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "other", " ", "anno", "ying", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "trade", "off", " ", "is", " ", "tha", "t", " ", "a", " ", "large", " ", "dataset", " ", "must", " ", "be", " ", "reloade", "d", " ", "onc", "e", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "each", " ", "subproc", "ess", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub\\u", "argv_", "=_", "[_", "sys_", "._", "argv_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "poll", "-", "interval", "=", "%", "s", "'_", "%_", "options_", "._", "poll", "\\u", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "max", "-", "jobs", "=", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "mongo", "=", "%", "s", "'_", "%_", "options_", "._", "mongo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "reserve", "-", "timeo", "ut", "=", "%", "s", "'_", "%_", "options_", "._", "reserve", "\\u", "timeout_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "workdir_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sub\\u", "argv_", "._", "append_", "(_", "'--", "workdir", "=", "%", "s", "'_", "%_", "options_", "._", "workdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "exp", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sub\\u", "argv_", "._", "append_", "(_", "'--", "exp", "-", "key", "=", "%", "s", "'_", "%_", "options_", "._", "exp", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "sub\\u", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retcode_", "=_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Shut", "down_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "this", " ", "is", " ", "the", " ", "normal", " ", "way", " ", "to", " ", "stop", " ", "the", " ", "infini", "te", " ", "loop", " ", "(", "if", " ", "original", "ly", " ", "N", "=-", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "proc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "proc", ".", "terminate", "()", " ", "is", " ", "only", " ", "avail", "able", " ", "as", " ", "of", " ", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "os_", "._", "kill_", "(_", "proc_", "._", "pid_", ",_", "signal_", "._", "SIGTERM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "proc_", "._", "wait_", "(_", ")_", "\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Wait", "Quit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "sendin", "g", " ", "SIG", "USR", "1", " ", "to", " ", "a", " ", "looping", " ", "process", " ", "will", " ", "caus", "e", " ", "it", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "break", " ", "out", " ", "of", " ", "the", " ", "loop", " ", "after", " ", "the", " ", "current", " ", "subproc", "ess", " ", "finish", "es_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "normal", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "proc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "proc_", "._", "wait_", "(_", ")_", "\\u\\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_", "\\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_", "retcode_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cons", "\\u", "errs_", "+=_", "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 ", " _", "cons", "\\u", "errs_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "N_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "exit", "ing", " ", "with", " ", "N", "=", "%", "i", " ", "after", " ", "%", "i", " ", "consec", "uti", "ve", " ", "exception", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "N_", ",_", "cons", "\\u", "errs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "N_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "the", " ", "name", " ", "of", " ", "the", " ", "jobs", " ", "collection", " ", "is", " ", "a", " ", "parameter", " ", "else", "where", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "so", " ", "'/", "jobs", "'", " ", "shou", "ld", " ", "not", " ", "be", " ", "hard", "-", "code", "d", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mj", "_", "=_", "Mon", "go", "Jobs_", "._", "new", "\\u", "from", "\\u", "connecti", "on", "\\u", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "as", "\\u", "mongo", "\\u", "str_", "(_", "options_", "._", "mongo_", ")_", "+_", "'/", "jobs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mw", "ork", "er_", "=_", "Mon", "go", "Worker_", "(_", "mj", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "options_", "._", "poll", "\\u", "interval_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "workdir_", "=_", "options_", "._", "workdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "key_", "=_", "options_", "._", "exp", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mw", "ork", "er_", "._", "run", "\\u", "one_", "(_", "reserve", "\\u", "timeout_", "=_", "float_", "(_", "options_", "._", "reserve", "\\u", "timeout_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "N", " ", "<=", " ", "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_", "def_", "main", "\\u", "worker_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "optparse_", "._", "Optio", "n", "Parser_", "(_", "usage_", "=_", "\"%", "prog", " ", "[", "options", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "exp", "-", "key", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "exp", "\\u", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "str", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "identifi", "er", " ", "for", " ", "this", " ", "worker", "s", "'", "s", " ", "jobs", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "last", "-", "job", "-", "timeo", "ut", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "last", "\\u", "job", "\\u", "timeo", "ut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Do", " ", "not", " ", "reserve", " ", "a", " ", "job", " ", "after", " ", "T", " ", "second", "s", " ", "have", " ", "pass", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "max", "-", "consec", "uti", "ve", "-", "fail", "ure", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "max", "\\u", "consec", "uti", "ve", "\\u", "fail", "ure", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "stop", " ", "if", " ", "N", " ", "consec", "uti", "ve", " ", "jobs", " ", "fail", " ", "(", "default", ":", " ", "4", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "max", "-", "jobs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "max", "\\u", "jobs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "sys_", "._", "maxint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "stop", " ", "after", " ", "runn", "ing", " ", "this", " ", "many", " ", "jobs", " ", "(", "default", ":", " ", "inf", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "mongo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "mongo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "'", "local", "host", "/", "hyper", "opt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"<", "host", ">[", ":", "port", "]/", "<", "db", ">", " ", "for", " ", "IPC", " ", "and", " ", "job", " ", "storage", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "poll", "-", "interval", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "poll", "\\u", "interval", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "check", " ", "work", " ", "queue", " ", "every", " ", "1", " ", "<", " ", "T", " ", "<", " ", "N", " ", "second", "s", " ", "(", "default", ":", " ", "5", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "reserve", "-", "timeo", "ut", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "reserve", "\\u", "timeo", "ut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "120", ".0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "poll", " ", "databa", "se", " ", "for", " ", "up", " ", "to", " ", "T", " ", "second", "s", " ", "to", " ", "reserve", " ", "a", " ", "job", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "workdir", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "workdir", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "root", " ", "workdir", " ", "(", "default", ":", " ", "load", " ", "from", " ", "mongo", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "DIR", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "print", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "main", "\\u", "worker", "\\u", "helper_", "(_", "options_", ",_", "args_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
mne-tools/mne-python/mne/time_frequency/tests/test_tfr.py
[ { "content": "def test_time_frequency():\n \"\"\"Test time frequency transform (PSD and phase lock)\n \"\"\"\n # Set parameters\n event_id = 1\n tmin = -0.2\n tmax = 0.498 # Allows exhaustive decimation testing\n\n # Setup for reading the raw data\n raw = io.read_raw_fif(raw_fname)\n events = read_events(event_fname)\n\n include = []\n exclude = raw.info['bads'] + ['MEG 2443', 'EEG 053'] # bads + 2 more\n\n # picks MEG gradiometers\n picks = pick_types(raw.info, meg='grad', eeg=False,\n stim=False, include=include, exclude=exclude)\n\n picks = picks[:2]\n epochs = Epochs(raw, events, event_id, tmin, tmax, picks=picks,\n baseline=(None, 0))\n data = epochs.get_data()\n times = epochs.times\n nave = len(data)\n\n epochs_nopicks = Epochs(raw, events, event_id, tmin, tmax,\n baseline=(None, 0))\n\n freqs = np.arange(6, 20, 5) # define frequencies of interest\n n_cycles = freqs / 4.\n\n # Test first with a single epoch\n power, itc = tfr_morlet(epochs[0], freqs=freqs, n_cycles=n_cycles,\n use_fft=True, return_itc=True)\n # Now compute evoked\n evoked = epochs.average()\n power_evoked = tfr_morlet(evoked, freqs, n_cycles, use_fft=True,\n return_itc=False)\n assert_raises(ValueError, tfr_morlet, evoked, freqs, 1., return_itc=True)\n power, itc = tfr_morlet(epochs, freqs=freqs, n_cycles=n_cycles,\n use_fft=True, return_itc=True)\n # Test picks argument\n power_picks, itc_picks = tfr_morlet(epochs_nopicks, freqs=freqs,\n n_cycles=n_cycles, use_fft=True,\n return_itc=True, picks=picks)\n # the actual data arrays here are equivalent, too...\n assert_array_almost_equal(power.data, power_picks.data)\n assert_array_almost_equal(itc.data, itc_picks.data)\n assert_array_almost_equal(power.data, power_evoked.data)\n\n print(itc) # test repr\n print(itc.ch_names) # test property\n itc += power # test add\n itc -= power # test add\n\n power.apply_baseline(baseline=(-0.1, 0), mode='logratio')\n\n assert_true('meg' in power)\n assert_true('grad' in power)\n assert_false('mag' in power)\n assert_false('eeg' in power)\n\n assert_equal(power.nave, nave)\n assert_equal(itc.nave, nave)\n assert_true(power.data.shape == (len(picks), len(freqs), len(times)))\n assert_true(power.data.shape == itc.data.shape)\n assert_true(np.sum(itc.data >= 1) == 0)\n assert_true(np.sum(itc.data <= 0) == 0)\n\n # grand average\n itc2 = itc.copy()\n itc2.info['bads'] = [itc2.ch_names[0]] # test channel drop\n gave = grand_average([itc2, itc])\n assert_equal(gave.data.shape, (itc2.data.shape[0] - 1,\n itc2.data.shape[1],\n itc2.data.shape[2]))\n assert_equal(itc2.ch_names[1:], gave.ch_names)\n assert_equal(gave.nave, 2)\n itc2.drop_channels(itc2.info[\"bads\"])\n assert_array_almost_equal(gave.data, itc2.data)\n itc2.data = np.ones(itc2.data.shape)\n itc.data = np.zeros(itc.data.shape)\n itc2.nave = 2\n itc.nave = 1\n itc.drop_channels([itc.ch_names[0]])\n combined_itc = combine_tfr([itc2, itc])\n assert_array_almost_equal(combined_itc.data,\n np.ones(combined_itc.data.shape) * 2 / 3)\n\n # more tests\n power, itc = tfr_morlet(epochs, freqs=freqs, n_cycles=2, use_fft=False,\n return_itc=True)\n\n assert_true(power.data.shape == (len(picks), len(freqs), len(times)))\n assert_true(power.data.shape == itc.data.shape)\n assert_true(np.sum(itc.data >= 1) == 0)\n assert_true(np.sum(itc.data <= 0) == 0)\n\n Fs = raw.info['sfreq'] # sampling in Hz\n tfr = cwt_morlet(data[0], Fs, freqs, use_fft=True, n_cycles=2)\n assert_true(tfr.shape == (len(picks), len(freqs), len(times)))\n\n single_power = single_trial_power(data, Fs, freqs, use_fft=False,\n n_cycles=2)\n\n assert_array_almost_equal(np.mean(single_power), power.data)\n\n power_pick = power.pick_channels(power.ch_names[:10:2])\n assert_equal(len(power_pick.ch_names), len(power.ch_names[:10:2]))\n assert_equal(power_pick.data.shape[0], len(power.ch_names[:10:2]))\n power_drop = power.drop_channels(power.ch_names[1:10:2])\n assert_equal(power_drop.ch_names, power_pick.ch_names)\n assert_equal(power_pick.data.shape[0], len(power_drop.ch_names))\n\n mne.equalize_channels([power_pick, power_drop])\n assert_equal(power_pick.ch_names, power_drop.ch_names)\n assert_equal(power_pick.data.shape, power_drop.data.shape)\n\n # Test decimation:\n # 2: multiple of len(times) even\n # 3: multiple odd\n # 8: not multiple, even\n # 9: not multiple, odd\n for decim in [2, 3, 8, 9]:\n for use_fft in [True, False]:\n power, itc = tfr_morlet(epochs, freqs=freqs, n_cycles=2,\n use_fft=use_fft, return_itc=True,\n decim=decim)\n assert_equal(power.data.shape[2],\n np.ceil(float(len(times)) / decim))\n freqs = range(50, 55)\n decim = 2\n _, n_chan, n_time = data.shape\n tfr = cwt_morlet(data[0, :, :], sfreq=epochs.info['sfreq'],\n freqs=freqs, decim=decim)\n assert_equal(tfr.shape, (n_chan, len(freqs), n_time // decim))\n\n # Test cwt modes\n Ws = morlet(512, [10, 20], n_cycles=2)\n assert_raises(ValueError, cwt, data[0, :, :], Ws, mode='foo')\n for use_fft in [True, False]:\n for mode in ['same', 'valid', 'full']:\n # XXX JRK: full wavelet decomposition needs to be implemented\n if (not use_fft) and mode == 'full':\n assert_raises(ValueError, cwt, data[0, :, :], Ws,\n use_fft=use_fft, mode=mode)\n continue\n cwt(data[0, :, :], Ws, use_fft=use_fft, mode=mode)", "metadata": "root.test_time_frequency", "header": "['module', '___EOS___']", "index": 33 } ]
[ { "span": "power,", "start_line": 66, "start_column": 4, "end_line": 66, "end_column": 9 }, { "span": "itc ", "start_line": 66, "start_column": 11, "end_line": 66, "end_column": 14 } ]
[ { "span": "power,", "start_line": 73, "start_column": 4, "end_line": 73, "end_column": 9 }, { "span": "itc ", "start_line": 73, "start_column": 11, "end_line": 73, "end_column": 14 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "time", "\\u", "frequency_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "time", " ", "freque", "nc", "y", " ", "transform", " ", "(", "PS", "D", " ", "and", " ", "phase", " ", "lock", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "event", "\\u", "id_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmin_", "=_", "-_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmax_", "=_", "0.49", "8_", "#", " ", "All", "ow", "s", " ", "exhaust", "ive", " ", "decima", "tion", " ", "testing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "for", " ", "readi", "ng", " ", "the", " ", "raw", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "raw_", "=_", "io_", "._", "read", "\\u", "raw", "\\u", "fi", "f_", "(_", "raw", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", "=_", "read", "\\u", "events_", "(_", "event", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "raw_", "._", "info_", "[_", "'", "bad", "s", "'_", "]_", "+_", "[_", "'", "ME", "G", " ", "244", "3", "'_", ",_", "'", "EE", "G", " ", "053", "'_", "]_", "#", " ", "bad", "s", " ", "+", " ", "2", " ", "more_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "picks", " ", "ME", "G", " ", "gradi", "ometer", "s_", "\\u\\u\\uNL\\u\\u\\u_", "picks", "_", "=_", "pick", "\\u", "types_", "(_", "raw_", "._", "info_", ",_", "me", "g_", "=_", "'", "grad", "'_", ",_", "ee", "g_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stim", "_", "=_", "False_", ",_", "include_", "=_", "include_", ",_", "exclude_", "=_", "exclude_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "picks", "_", "=_", "picks", "_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "epochs_", "=_", "Epoch", "s_", "(_", "raw_", ",_", "events_", ",_", "event", "\\u", "id_", ",_", "tmin_", ",_", "tmax_", ",_", "picks", "_", "=_", "picks", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "baseline_", "=_", "(_", "None_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "epochs_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "times_", "=_", "epochs_", "._", "times_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nav", "e_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "epoch", "s", "\\u", "nop", "ick", "s_", "=_", "Epoch", "s_", "(_", "raw_", ",_", "events_", ",_", "event", "\\u", "id_", ",_", "tmin_", ",_", "tmax_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "baseline_", "=_", "(_", "None_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "freqs_", "=_", "np_", "._", "arange_", "(_", "6_", ",_", "20_", ",_", "5_", ")_", "#", " ", "defin", "e", " ", "freque", "ncie", "s", " ", "of", " ", "interest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "cycles_", "=_", "freqs_", "/_", "4._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "first", " ", "with", " ", "a", " ", "single", " ", "epoch_", "\\u\\u\\uNL\\u\\u\\u_", "power_", ",_", "itc", "_", "=_", "tf", "r", "\\u", "mor", "let_", "(_", "epochs_", "[_", "0_", "]_", ",_", "freqs_", "=_", "freqs_", ",_", "n", "\\u", "cycles_", "=_", "n", "\\u", "cycles_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "fft_", "=_", "True_", ",_", "return", "\\u", "itc", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "compute", " ", "evo", "ked", "_", "\\u\\u\\uNL\\u\\u\\u_", "evo", "ked", "_", "=_", "epochs_", "._", "average_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "evo", "ked", "_", "=_", "tf", "r", "\\u", "mor", "let_", "(_", "evo", "ked", "_", ",_", "freqs_", ",_", "n", "\\u", "cycles_", ",_", "use", "\\u", "fft_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "itc", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "tf", "r", "\\u", "mor", "let_", ",_", "evo", "ked", "_", ",_", "freqs_", ",_", "1._", ",_", "return", "\\u", "itc", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power_", ",_", "itc", "_", "=_", "tf", "r", "\\u", "mor", "let_", "(_", "epochs_", ",_", "freqs_", "=_", "freqs_", ",_", "n", "\\u", "cycles_", "=_", "n", "\\u", "cycles_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "fft_", "=_", "True_", ",_", "return", "\\u", "itc", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "picks", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "picks", "_", ",_", "itc", "\\u", "picks", "_", "=_", "tf", "r", "\\u", "mor", "let_", "(_", "epoch", "s", "\\u", "nop", "ick", "s_", ",_", "freqs_", "=_", "freqs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "cycles_", "=_", "n", "\\u", "cycles_", ",_", "use", "\\u", "fft_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "itc", "_", "=_", "True_", ",_", "picks", "_", "=_", "picks", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "actual", " ", "data", " ", "arrays", " ", "here", " ", "are", " ", "equivalent", ",", " ", "too", "..._", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "power_", "._", "data_", ",_", "power", "\\u", "picks", "_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "itc", "_", "._", "data_", ",_", "itc", "\\u", "picks", "_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "power_", "._", "data_", ",_", "power", "\\u", "evo", "ked", "_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "itc", "_", ")_", "#", " ", "test", " ", "repr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "itc", "_", "._", "ch", "\\u", "names_", ")_", "#", " ", "test", " ", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "_", "+=_", "power_", "#", " ", "test", " ", "add_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "_", "-=_", "power_", "#", " ", "test", " ", "add_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "power_", "._", "appl", "y", "\\u", "baseline_", "(_", "baseline_", "=_", "(_", "-_", "0.1_", ",_", "0_", ")_", ",_", "mode_", "=_", "'", "logr", "atio", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "true_", "(_", "'", "me", "g", "'_", "in_", "power_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "'", "grad", "'_", "in_", "power_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "false_", "(_", "'", "mag", "'_", "in_", "power_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "false_", "(_", "'", "ee", "g", "'_", "in_", "power_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "power_", "._", "nav", "e_", ",_", "nav", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "itc", "_", "._", "nav", "e_", ",_", "nav", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "power_", "._", "data_", "._", "shape_", "==_", "(_", "len_", "(_", "picks", "_", ")_", ",_", "len_", "(_", "freqs_", ")_", ",_", "len_", "(_", "times_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "power_", "._", "data_", "._", "shape_", "==_", "itc", "_", "._", "data_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "np_", "._", "sum_", "(_", "itc", "_", "._", "data_", ">=_", "1_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "np_", "._", "sum_", "(_", "itc", "_", "._", "data_", "<=_", "0_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "grand", " ", "average_", "\\u\\u\\uNL\\u\\u\\u_", "itc", "2_", "=_", "itc", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "2_", "._", "info_", "[_", "'", "bad", "s", "'_", "]_", "=_", "[_", "itc", "2_", "._", "ch", "\\u", "names_", "[_", "0_", "]_", "]_", "#", " ", "test", " ", "channel", " ", "drop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ga", "ve_", "=_", "grand", "\\u", "average_", "(_", "[_", "itc", "2_", ",_", "itc", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "ga", "ve_", "._", "data_", "._", "shape_", ",_", "(_", "itc", "2_", "._", "data_", "._", "shape_", "[_", "0_", "]_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "itc", "2_", "._", "data_", "._", "shape_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "itc", "2_", "._", "data_", "._", "shape_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "itc", "2_", "._", "ch", "\\u", "names_", "[_", "1_", ":_", "]_", ",_", "ga", "ve_", "._", "ch", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "ga", "ve_", "._", "nav", "e_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "2_", "._", "drop", "\\u", "channels_", "(_", "itc", "2_", "._", "info_", "[_", "\"", "bad", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "ga", "ve_", "._", "data_", ",_", "itc", "2_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "2_", "._", "data_", "=_", "np_", "._", "ones_", "(_", "itc", "2_", "._", "data_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "_", "._", "data_", "=_", "np_", "._", "zeros_", "(_", "itc", "_", "._", "data_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "2_", "._", "nav", "e_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "_", "._", "nav", "e_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "itc", "_", "._", "drop", "\\u", "channels_", "(_", "[_", "itc", "_", "._", "ch", "\\u", "names_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "combin", "ed", "\\u", "itc", "_", "=_", "combin", "e\\u", "tf", "r_", "(_", "[_", "itc", "2_", ",_", "itc", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "combin", "ed", "\\u", "itc", "_", "._", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "ones_", "(_", "combin", "ed", "\\u", "itc", "_", "._", "data_", "._", "shape_", ")_", "*_", "2_", "/_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "more", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "power_", ",_", "itc", "_", "=_", "tf", "r", "\\u", "mor", "let_", "(_", "epochs_", ",_", "freqs_", "=_", "freqs_", ",_", "n", "\\u", "cycles_", "=_", "2_", ",_", "use", "\\u", "fft_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "itc", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "true_", "(_", "power_", "._", "data_", "._", "shape_", "==_", "(_", "len_", "(_", "picks", "_", ")_", ",_", "len_", "(_", "freqs_", ")_", ",_", "len_", "(_", "times_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "power_", "._", "data_", "._", "shape_", "==_", "itc", "_", "._", "data_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "np_", "._", "sum_", "(_", "itc", "_", "._", "data_", ">=_", "1_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "np_", "._", "sum_", "(_", "itc", "_", "._", "data_", "<=_", "0_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Fs_", "=_", "raw_", "._", "info_", "[_", "'", "sfr", "eq", "'_", "]_", "#", " ", "samp", "ling", " ", "in", " ", "Hz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "r_", "=_", "cw", "t", "\\u", "mor", "let_", "(_", "data_", "[_", "0_", "]_", ",_", "Fs_", ",_", "freqs_", ",_", "use", "\\u", "fft_", "=_", "True_", ",_", "n", "\\u", "cycles_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "tf", "r_", "._", "shape_", "==_", "(_", "len_", "(_", "picks", "_", ")_", ",_", "len_", "(_", "freqs_", ")_", ",_", "len_", "(_", "times_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "single", "\\u", "power_", "=_", "single", "\\u", "tria", "l\\u", "power_", "(_", "data_", ",_", "Fs_", ",_", "freqs_", ",_", "use", "\\u", "fft_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "cycles_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "np_", "._", "mean_", "(_", "single", "\\u", "power_", ")_", ",_", "power_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "pick_", "=_", "power_", "._", "pick", "\\u", "channels_", "(_", "power_", "._", "ch", "\\u", "names_", "[_", ":_", "10_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "len_", "(_", "power", "\\u", "pick_", "._", "ch", "\\u", "names_", ")_", ",_", "len_", "(_", "power_", "._", "ch", "\\u", "names_", "[_", ":_", "10_", ":_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "power", "\\u", "pick_", "._", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "len_", "(_", "power_", "._", "ch", "\\u", "names_", "[_", ":_", "10_", ":_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "power", "\\u", "drop_", "=_", "power_", "._", "drop", "\\u", "channels_", "(_", "power_", "._", "ch", "\\u", "names_", "[_", "1_", ":_", "10_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "power", "\\u", "drop_", "._", "ch", "\\u", "names_", ",_", "power", "\\u", "pick_", "._", "ch", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "power", "\\u", "pick_", "._", "data_", "._", "shape_", "[_", "0_", "]_", ",_", "len_", "(_", "power", "\\u", "drop_", "._", "ch", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mne", "_", "._", "equal", "ize", "\\u", "channels_", "(_", "[_", "power", "\\u", "pick_", ",_", "power", "\\u", "drop_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "power", "\\u", "pick_", "._", "ch", "\\u", "names_", ",_", "power", "\\u", "drop_", "._", "ch", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "power", "\\u", "pick_", "._", "data_", "._", "shape_", ",_", "power", "\\u", "drop_", "._", "data_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "decima", "tion", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ":", " ", "multiple", " ", "of", " ", "len", "(", "times", ")", " ", "even_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ":", " ", "multiple", " ", "odd_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "8", ":", " ", "not", " ", "multiple", ",", " ", "even_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "9", ":", " ", "not", " ", "multiple", ",", " ", "odd_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "deci", "m_", "in_", "[_", "2_", ",_", "3_", ",_", "8_", ",_", "9_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "use", "\\u", "fft_", "in_", "[_", "True_", ",_", "False_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "power_", ",_", "itc", "_", "=_", "tf", "r", "\\u", "mor", "let_", "(_", "epochs_", ",_", "freqs_", "=_", "freqs_", ",_", "n", "\\u", "cycles_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "fft_", "=_", "use", "\\u", "fft_", ",_", "return", "\\u", "itc", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deci", "m_", "=_", "deci", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "power_", "._", "data_", "._", "shape_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "ceil_", "(_", "float_", "(_", "len_", "(_", "times_", ")_", ")_", "/_", "deci", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "freqs_", "=_", "range_", "(_", "50_", ",_", "55_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deci", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "n", "\\u", "chan_", ",_", "n", "\\u", "time_", "=_", "data_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tf", "r_", "=_", "cw", "t", "\\u", "mor", "let_", "(_", "data_", "[_", "0_", ",_", ":_", ",_", ":_", "]_", ",_", "sfr", "eq_", "=_", "epochs_", "._", "info_", "[_", "'", "sfr", "eq", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "freqs_", "=_", "freqs_", ",_", "deci", "m_", "=_", "deci", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "tf", "r_", "._", "shape_", ",_", "(_", "n", "\\u", "chan_", ",_", "len_", "(_", "freqs_", ")_", ",_", "n", "\\u", "time_", "//_", "deci", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "cw", "t", " ", "modes_", "\\u\\u\\uNL\\u\\u\\u_", "Ws", "_", "=_", "mor", "let_", "(_", "512_", ",_", "[_", "10_", ",_", "20_", "]_", ",_", "n", "\\u", "cycles_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "cw", "t_", ",_", "data_", "[_", "0_", ",_", ":_", ",_", ":_", "]_", ",_", "Ws", "_", ",_", "mode_", "=_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "use", "\\u", "fft_", "in_", "[_", "True_", ",_", "False_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "mode_", "in_", "[_", "'", "same", "'_", ",_", "'", "valid", "'_", ",_", "'", "full", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "JR", "K", ":", " ", "full", " ", "wavelet", " ", "decomposition", " ", "need", "s", " ", "to", " ", "be", " ", "implemented", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "use", "\\u", "fft_", ")_", "and_", "mode_", "==_", "'", "full", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "raises_", "(_", "Value", "Error_", ",_", "cw", "t_", ",_", "data_", "[_", "0_", ",_", ":_", ",_", ":_", "]_", ",_", "Ws", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "fft_", "=_", "use", "\\u", "fft_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cw", "t_", "(_", "data_", "[_", "0_", ",_", ":_", ",_", ":_", "]_", ",_", "Ws", "_", ",_", "use", "\\u", "fft_", "=_", "use", "\\u", "fft_", ",_", "mode_", "=_", "mode_", ")_", "\\u\\u\\uNE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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 ]
Unused import
RamaneekGill/Emotion-Recognition-/NeuralNetwork.py
[ { "content": "from __future__ import division\nimport matplotlib.pyplot as plt\nimport tensorflow as tf\nimport numpy as np\nimport heapq\nimport pylab\nimport time\n\n### Used this source as reference material:\n# https://github.com/nlintz/TensorFlow-Tutorials/blob/master/5_convolutional_net.py\n\n\n\nif __name__ == \"__main__\":\n\ttop_3_validation_accuracies = []\n\tnum_hidden_units_intervals = [5, 10, 25, 50, 100, 200, 400]\n\tdecay_intervals = [0.9, 0.6, 0.3, 0.1]\n\tretain_input_intervals = [0.9, 0.6, 0.3, 0.1]\n\tretain_hidden_intervals = [0.9, 0.6, 0.3, 0.1]\n\n\taccuracies = testNetwork(100, 0.4, 0.3, 0.3)\n\tprint(accuracies)\n\texit()\n\n\titeration = 0\n\tfor num_hidden_units in num_hidden_units_intervals:\n\t\tfor decay in decay_intervals:\n\t\t\tfor retain_input in retain_input_intervals:\n\t\t\t\tfor retain_hidden in retain_hidden_intervals:\n\t\t\t\t\titeration += 1\n\t\t\t\t\taccuracies = testNetwork(num_hidden_units, decay, retain_input, retain_hidden)\n\t\t\t\t\ttop_3_validation_accuracies.append(accuracies)\n\t\t\t\t\tprint(\"hidden units: {} \\t decay: {} \\t retain input: {} \\t retain hidden: {}\"\n\t\t\t\t\t\t.format(num_hidden_units, decay, retain_input, retain_hidden))\n\t\t\t\t\tprint(iteration, accuracies)\n\n\n\tprint(\"THESE ARE THE FINAL ACCURACIES\")\n\tprint(accuracies)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def testNetwork(num_hidden_units, decay, retain_input, retain_hidden):\n\timport input_data\n\tdatasets = input_data.read_data_sets()\n\n\tNUM_PIXELS = datasets.train_set.inputs().shape[1]\n\tNUM_CLASSES = datasets.train_set.targets().shape[1]\n\n\t### Setup input pipelines\n\tx = tf.placeholder(tf.float32, [None, NUM_PIXELS])\n\ty = tf.placeholder(tf.float32, [None, NUM_CLASSES])\n\n\t# The hyperparameters of the model\n\tNUM_HIDDEN_UNITS = num_hidden_units\n\tLEARNING_RATE = 0.005\n\tDECAY = decay\n\tMOMENTUM = 0.1\n\tEPOCHS = 3000\n\tBATCH_SIZE = 100\n\tRETAIN_INPUT = retain_input\n\tRETAIN_HIDDEN = retain_hidden\n\n\t### Construct model\n\thidden_layer_1_weights = tf.Variable(tf.random_normal([NUM_PIXELS, NUM_HIDDEN_UNITS], stddev=0.01))\n\thidden_layer_2_weights = tf.Variable(tf.random_normal([NUM_HIDDEN_UNITS, NUM_HIDDEN_UNITS], stddev=0.01))\n\toutput_layer_weights = tf.Variable(tf.random_normal([NUM_HIDDEN_UNITS, NUM_CLASSES], stddev=0.01))\n\n\tp_retain_input = tf.placeholder(tf.float32)\n\tp_retain_hidden = tf.placeholder(tf.float32)\n\n\tx = tf.nn.dropout(x, p_retain_input) # use dropout training\n\n\thidden_layer_1 = tf.nn.relu(tf.matmul(x, hidden_layer_1_weights))\n\thidden_layer_1 = tf.nn.dropout(hidden_layer_1, p_retain_hidden) # use dropout training\n\n\thidden_layer_2 = tf.nn.softmax(tf.matmul(hidden_layer_1, hidden_layer_2_weights))\n\thidden_layer_2 = tf.nn.dropout(hidden_layer_2, p_retain_hidden) # use dropout training\n\n\tmodel = tf.matmul(hidden_layer_2, output_layer_weights)\n\n\t# Define the learning process\n\tcost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(model, y))\n\toptimizer = tf.train.RMSPropOptimizer(LEARNING_RATE, DECAY).minimize(cost)\n\tcorrect_prediction = tf.equal(tf.argmax(model, 1), tf.argmax(y, 1))\n\taccuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))\n\n\t# train_x = datasets.train_set.inputs()\n\t# train_y = datasets.train_set.targets()\n\t# print(train_x.shape, train_y.shape)\n\t# print(train_x)\n\t# print('sdfsdfs')\n\t# print(train_y)\n\t# exit()\n\n\t# Create a session and initialize all variables\n\tprint('Starting session')\n\tsess = tf.Session()\n\tinit = tf.initialize_all_variables()\n\tsess.run(init)\n\tavg_cost = 0.0\n\n\ttrain_accuracies = []\n\tvalidation_accuracies = []\n\n\t# Train the model\n\tfor epoch in range(EPOCHS):\n\t\tnum_batches = int(datasets.train_set.num_examples() / BATCH_SIZE)\n\t\tfor batch in range(num_batches):\n\t\t\tbatch_xs, batch_ys = datasets.train_set.next_batch(BATCH_SIZE)\n\t\t\tsess.run(optimizer, feed_dict={x: batch_xs, y: batch_ys, p_retain_input: RETAIN_INPUT, p_retain_hidden: RETAIN_HIDDEN})\n\t\t\tavg_cost += sess.run(cost, feed_dict={x: batch_xs, y: batch_ys, p_retain_input: RETAIN_INPUT, p_retain_hidden: RETAIN_HIDDEN}) / num_batches\n\t\t# print avg_cost\n\n\t\t# Print the accuracies on training and validation sets\n\t\ttrain_accuracy = sess.run(accuracy, feed_dict={x: datasets.train_set.inputs(), y: datasets.train_set.targets(), p_retain_input: 1, p_retain_hidden: 1})\n\t\ttrain_accuracies.append(train_accuracy)\n\t\tvalidation_accuracy = sess.run(accuracy, feed_dict={x: datasets.validation_set.inputs(), y: datasets.validation_set.targets(), p_retain_input: 1, p_retain_hidden: 1})\n\t\tvalidation_accuracies.append(validation_accuracy)\n\t\t# if epoch % 100 == 0:\n\t\tprint(\"Epoch: {} \\t Train accuracy: {} \\t Validation accuracy: {}\".format(epoch, train_accuracy, validation_accuracy))\n\n\treturn heapq.nlargest(3, np.array(validation_accuracies))", "metadata": "root.testNetwork", "header": "['module', '___EOS___']", "index": 11 } ]
[ { "span": "import matplotlib.pyplot as plt", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 31 }, { "span": "import pylab", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 12 }, { "span": "import time", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tensorflow_", "as_", "tf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "heapq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pylab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Us", "ed", " ", "this", " ", "source", " ", "as", " ", "reference", " ", "material", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "nli", "ntz", "/", "Tensor", "Flow", "-", "Tu", "tori", "als", "/", "blob", "/", "master", "/", "5", "\\u", "convolution", "al", "\\u", "net", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "top", "\\u", "3", "\\u", "validation", "\\u", "accu", "raci", "es_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "hidden", "\\u", "unit", "s", "\\u", "intervals_", "=_", "[_", "5_", ",_", "10_", ",_", "25_", ",_", "50_", ",_", "100_", ",_", "200_", ",_", "400_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deca", "y", "\\u", "intervals_", "=_", "[_", "0.9_", ",_", "0.6_", ",_", "0.3_", ",_", "0.1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retain", "\\u", "input", "\\u", "intervals_", "=_", "[_", "0.9_", ",_", "0.6_", ",_", "0.3_", ",_", "0.1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retain", "\\u", "hidden", "\\u", "intervals_", "=_", "[_", "0.9_", ",_", "0.6_", ",_", "0.3_", ",_", "0.1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "accu", "raci", "es_", "=_", "test", "Network_", "(_", "100_", ",_", "0.4_", ",_", "0.3_", ",_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "accu", "raci", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iteration_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "num", "\\u", "hidden", "\\u", "units_", "in_", "num", "\\u", "hidden", "\\u", "unit", "s", "\\u", "intervals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "decay_", "in_", "deca", "y", "\\u", "intervals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "retain", "\\u", "input_", "in_", "retain", "\\u", "input", "\\u", "intervals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "retain", "\\u", "hidden_", "in_", "retain", "\\u", "hidden", "\\u", "intervals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "iteration_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accu", "raci", "es_", "=_", "test", "Network_", "(_", "num", "\\u", "hidden", "\\u", "units_", ",_", "decay_", ",_", "retain", "\\u", "input_", ",_", "retain", "\\u", "hidden_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "\\u", "3", "\\u", "validation", "\\u", "accu", "raci", "es_", "._", "append_", "(_", "accu", "raci", "es_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "hidden", " ", "unit", "s", ":", " ", "{}", " ", "\\\\", "t", " ", "deca", "y", ":", " ", "{}", " ", "\\\\", "t", " ", "retain", " ", "input", ":", " ", "{}", " ", "\\\\", "t", " ", "retain", " ", "hidden", ":", " ", "{}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "num", "\\u", "hidden", "\\u", "units_", ",_", "decay_", ",_", "retain", "\\u", "input_", ",_", "retain", "\\u", "hidden_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "iteration_", ",_", "accu", "raci", "es_", ")_", "\\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_", "print_", "(_", "\"", "THE", "SE", " ", "ARE", " ", "THE", " ", "FINAL", " ", "ACC", "URA", "CIE", "S", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "accu", "raci", "es_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Network_", "(_", "num", "\\u", "hidden", "\\u", "units_", ",_", "decay_", ",_", "retain", "\\u", "input_", ",_", "retain", "\\u", "hidden_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "import_", "input", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datasets_", "=_", "input", "\\u", "data_", "._", "read", "\\u", "data\\u", "sets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NUM", "\\u", "PIXEL", "S_", "=_", "datasets_", "._", "train", "\\u", "set_", "._", "inputs_", "(_", ")_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NUM", "\\u", "CLASSES_", "=_", "datasets_", "._", "train", "\\u", "set_", "._", "targets_", "(_", ")_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", "up", " ", "input", " ", "pipeline", "s_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "tf_", "._", "placeholder_", "(_", "tf_", "._", "float32_", ",_", "[_", "None_", ",_", "NUM", "\\u", "PIXEL", "S_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "tf_", "._", "placeholder_", "(_", "tf_", "._", "float32_", ",_", "[_", "None_", ",_", "NUM", "\\u", "CLASSES_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "hyperparameters", " ", "of", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "NUM", "\\u", "HIDDEN", "\\u", "UNITS_", "=_", "num", "\\u", "hidden", "\\u", "units_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LEA", "RN", "ING", "\\u", "RATE_", "=_", "0.005_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEC", "AY", "_", "=_", "decay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MO", "MENT", "UM_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EPOCH", "S_", "=_", "3000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BATCH", "\\u", "SIZE_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RET", "AIN", "\\u", "INPUT_", "=_", "retain", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RET", "AIN", "\\u", "HIDDEN", "_", "=_", "retain", "\\u", "hidden_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Construct", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "layer", "\\u", "1", "\\u", "weights_", "=_", "tf_", "._", "Variable_", "(_", "tf_", "._", "random", "\\u", "normal_", "(_", "[_", "NUM", "\\u", "PIXEL", "S_", ",_", "NUM", "\\u", "HIDDEN", "\\u", "UNITS_", "]_", ",_", "stddev_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "layer", "\\u", "2", "\\u", "weights_", "=_", "tf_", "._", "Variable_", "(_", "tf_", "._", "random", "\\u", "normal_", "(_", "[_", "NUM", "\\u", "HIDDEN", "\\u", "UNITS_", ",_", "NUM", "\\u", "HIDDEN", "\\u", "UNITS_", "]_", ",_", "stddev_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "layer", "\\u", "weights_", "=_", "tf_", "._", "Variable_", "(_", "tf_", "._", "random", "\\u", "normal_", "(_", "[_", "NUM", "\\u", "HIDDEN", "\\u", "UNITS_", ",_", "NUM", "\\u", "CLASSES_", "]_", ",_", "stddev_", "=_", "0.01_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "retain", "\\u", "input_", "=_", "tf_", "._", "placeholder_", "(_", "tf_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "retain", "\\u", "hidden_", "=_", "tf_", "._", "placeholder_", "(_", "tf_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "tf_", "._", "nn_", "._", "dropout_", "(_", "x_", ",_", "p", "\\u", "retain", "\\u", "input_", ")_", "#", " ", "use", " ", "drop", "out", " ", "training_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "layer", "\\u", "1_", "=_", "tf_", "._", "nn_", "._", "relu_", "(_", "tf_", "._", "matmul_", "(_", "x_", ",_", "hidden", "\\u", "layer", "\\u", "1", "\\u", "weights_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "layer", "\\u", "1_", "=_", "tf_", "._", "nn_", "._", "dropout_", "(_", "hidden", "\\u", "layer", "\\u", "1_", ",_", "p", "\\u", "retain", "\\u", "hidden_", ")_", "#", " ", "use", " ", "drop", "out", " ", "training_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hidden", "\\u", "layer", "\\u", "2_", "=_", "tf_", "._", "nn_", "._", "softmax_", "(_", "tf_", "._", "matmul_", "(_", "hidden", "\\u", "layer", "\\u", "1_", ",_", "hidden", "\\u", "layer", "\\u", "2", "\\u", "weights_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "layer", "\\u", "2_", "=_", "tf_", "._", "nn_", "._", "dropout_", "(_", "hidden", "\\u", "layer", "\\u", "2_", ",_", "p", "\\u", "retain", "\\u", "hidden_", ")_", "#", " ", "use", " ", "drop", "out", " ", "training_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "tf_", "._", "matmul_", "(_", "hidden", "\\u", "layer", "\\u", "2_", ",_", "output", "\\u", "layer", "\\u", "weights_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "the", " ", "learn", "ing", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "cost_", "=_", "tf_", "._", "reduce", "\\u", "mean_", "(_", "tf_", "._", "nn_", "._", "soft", "max", "\\u", "cross", "\\u", "entr", "opy", "\\u", "with", "\\u", "logits_", "(_", "model_", ",_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "optimizer_", "=_", "tf_", "._", "train_", "._", "RMS", "Prop", "Optimizer_", "(_", "LEA", "RN", "ING", "\\u", "RATE_", ",_", "DEC", "AY", "_", ")_", "._", "minimize_", "(_", "cost_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "correct", "\\u", "prediction_", "=_", "tf_", "._", "equal_", "(_", "tf_", "._", "argmax_", "(_", "model_", ",_", "1_", ")_", ",_", "tf_", "._", "argmax_", "(_", "y_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accuracy_", "=_", "tf_", "._", "reduce", "\\u", "mean_", "(_", "tf_", "._", "cast_", "(_", "correct", "\\u", "prediction_", ",_", "tf_", "._", "float32_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "train", "\\u", "x", " ", "=", " ", "dataset", "s", ".", "train", "\\u", "set", ".", "inputs", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "train", "\\u", "y", " ", "=", " ", "dataset", "s", ".", "train", "\\u", "set", ".", "target", "s", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "train", "\\u", "x", ".", "shape", ",", " ", "train", "\\u", "y", ".", "shape", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "train", "\\u", "x", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "('", "sdf", "sdf", "s", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "train", "\\u", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exit", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "session", " ", "and", " ", "initialize", " ", "all", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Start", "ing", " ", "session", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "=_", "tf_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init_", "=_", "tf_", "._", "initialize", "\\u", "all", "\\u", "variables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "run_", "(_", "init_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avg", "\\u", "cost_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "accu", "raci", "es_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validation", "\\u", "accu", "raci", "es_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Train", " ", "the", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "epoch_", "in_", "range_", "(_", "EPOCH", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "num", "\\u", "batches_", "=_", "int_", "(_", "datasets_", "._", "train", "\\u", "set_", "._", "num", "\\u", "examples_", "(_", ")_", "/_", "BATCH", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "batch_", "in_", "range_", "(_", "num", "\\u", "batches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "batch", "\\u", "xs_", ",_", "batch", "\\u", "ys_", "=_", "datasets_", "._", "train", "\\u", "set_", "._", "next", "\\u", "batch_", "(_", "BATCH", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess_", "._", "run_", "(_", "optimizer_", ",_", "feed", "\\u", "dict_", "=_", "{_", "x_", ":_", "batch", "\\u", "xs_", ",_", "y_", ":_", "batch", "\\u", "ys_", ",_", "p", "\\u", "retain", "\\u", "input_", ":_", "RET", "AIN", "\\u", "INPUT_", ",_", "p", "\\u", "retain", "\\u", "hidden_", ":_", "RET", "AIN", "\\u", "HIDDEN", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avg", "\\u", "cost_", "+=_", "sess_", "._", "run_", "(_", "cost_", ",_", "feed", "\\u", "dict_", "=_", "{_", "x_", ":_", "batch", "\\u", "xs_", ",_", "y_", ":_", "batch", "\\u", "ys_", ",_", "p", "\\u", "retain", "\\u", "input_", ":_", "RET", "AIN", "\\u", "INPUT_", ",_", "p", "\\u", "retain", "\\u", "hidden_", ":_", "RET", "AIN", "\\u", "HIDDEN", "_", "}_", ")_", "/_", "num", "\\u", "batches_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "avg", "\\u", "cost_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "the", " ", "accu", "raci", "es", " ", "on", " ", "train", "ing", " ", "and", " ", "validation", " ", "sets_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "\\u", "accuracy_", "=_", "sess_", "._", "run_", "(_", "accuracy_", ",_", "feed", "\\u", "dict_", "=_", "{_", "x_", ":_", "datasets_", "._", "train", "\\u", "set_", "._", "inputs_", "(_", ")_", ",_", "y_", ":_", "datasets_", "._", "train", "\\u", "set_", "._", "targets_", "(_", ")_", ",_", "p", "\\u", "retain", "\\u", "input_", ":_", "1_", ",_", "p", "\\u", "retain", "\\u", "hidden_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "accu", "raci", "es_", "._", "append_", "(_", "train", "\\u", "accuracy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validation", "\\u", "accuracy_", "=_", "sess_", "._", "run_", "(_", "accuracy_", ",_", "feed", "\\u", "dict_", "=_", "{_", "x_", ":_", "datasets_", "._", "validation", "\\u", "set_", "._", "inputs_", "(_", ")_", ",_", "y_", ":_", "datasets_", "._", "validation", "\\u", "set_", "._", "targets_", "(_", ")_", ",_", "p", "\\u", "retain", "\\u", "input_", ":_", "1_", ",_", "p", "\\u", "retain", "\\u", "hidden_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validation", "\\u", "accu", "raci", "es_", "._", "append_", "(_", "validation", "\\u", "accuracy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "epoch", " ", "%", " ", "100", " ", "==", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Epoch", ":", " ", "{}", " ", "\\\\", "t", " ", "Train", " ", "accu", "rac", "y", ":", " ", "{}", " ", "\\\\", "t", " ", "Validat", "ion", " ", "accu", "rac", "y", ":", " ", "{}\"_", "._", "format_", "(_", "epoch_", ",_", "train", "\\u", "accuracy_", ",_", "validation", "\\u", "accuracy_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "heapq_", "._", "nla", "rge", "st_", "(_", "3_", ",_", "np_", "._", "array_", "(_", "validation", "\\u", "accu", "raci", "es_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
soimort/you-get/src/you_get/extractors/yixia.py
[ { "content": "def yixia_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):\n \"\"\"wrapper\"\"\"\n hostname = urlparse(url).hostname\n if 'miaopai.com' in hostname: #Miaopai\n yixia_download_by_scid = yixia_miaopai_download_by_scid\n site_info = \"Yixia Miaopai\"\n \n if re.match(r'http://www.miaopai.com/show/channel/\\w+', url): #PC\n scid = match1(url, r'http://www.miaopai.com/show/channel/(.+)\\.htm')\n elif re.match(r'http://www.miaopai.com/show/\\w+', url): #PC\n scid = match1(url, r'http://www.miaopai.com/show/(.+)\\.htm')\n elif re.match(r'http://m.miaopai.com/show/channel/\\w+', url): #Mobile\n scid = match1(url, r'http://m.miaopai.com/show/channel/(.+)\\.htm')\n \n elif 'xiaokaxiu.com' in hostname: #Xiaokaxiu\n yixia_download_by_scid = yixia_xiaokaxiu_download_by_scid\n site_info = \"Yixia Xiaokaxiu\"\n \n if re.match(r'http://v.xiaokaxiu.com/v/.+\\.html', url): #PC\n scid = match1(url, r'http://v.xiaokaxiu.com/v/(.+)\\.html')\n elif re.match(r'http://m.xiaokaxiu.com/m/.+\\.html', url): #Mobile\n scid = match1(url, r'http://m.xiaokaxiu.com/m/(.+)\\.html')\n\n else:\n pass\n \n yixia_download_by_scid(scid, output_dir, merge, info_only)", "metadata": "root.yixia_download", "header": "['module', '___EOS___']", "index": 46 } ]
[ { "span": "site_info ", "start_line": 51, "start_column": 8, "end_line": 51, "end_column": 17 }, { "span": "site_info ", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 17 } ]
[]
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_", "yi", "xia", "\\u", "download_", "(_", "url_", ",_", "output", "\\u", "dir_", "=_", "'.'_", ",_", "merge_", "=_", "True_", ",_", "info", "\\u", "only_", "=_", "False_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "wrapp", "er", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "urlparse_", "(_", "url_", ")_", "._", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "mia", "opa", "i", ".", "com", "'_", "in_", "hostname_", ":_", "#", "Mi", "ao", "pai", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yi", "xia", "\\u", "download", "\\u", "by", "\\u", "sci", "d_", "=_", "yi", "xia", "\\u", "mia", "opa", "i", "\\u", "download", "\\u", "by", "\\u", "sci", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site", "\\u", "info_", "=_", "\"", "Yi", "xia", " ", "Mi", "ao", "pai", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'", "http", "://", "www", ".", "mia", "opa", "i", ".", "com", "/", "show", "/", "channel", "/\\\\", "w", "+'_", ",_", "url_", ")_", ":_", "#", "PC_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "d_", "=_", "match", "1_", "(_", "url_", ",_", "r", "'", "http", "://", "www", ".", "mia", "opa", "i", ".", "com", "/", "show", "/", "channel", "/(.", "+)\\\\", ".", "ht", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'", "http", "://", "www", ".", "mia", "opa", "i", ".", "com", "/", "show", "/\\\\", "w", "+'_", ",_", "url_", ")_", ":_", "#", "PC_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "d_", "=_", "match", "1_", "(_", "url_", ",_", "r", "'", "http", "://", "www", ".", "mia", "opa", "i", ".", "com", "/", "show", "/(.", "+)\\\\", ".", "ht", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'", "http", "://", "m", ".", "mia", "opa", "i", ".", "com", "/", "show", "/", "channel", "/\\\\", "w", "+'_", ",_", "url_", ")_", ":_", "#", "Mob", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "d_", "=_", "match", "1_", "(_", "url_", ",_", "r", "'", "http", "://", "m", ".", "mia", "opa", "i", ".", "com", "/", "show", "/", "channel", "/(.", "+)\\\\", ".", "ht", "m", "'_", ")_", "\\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_", "'", "xia", "oka", "xi", "u", ".", "com", "'_", "in_", "hostname_", ":_", "#", "Xia", "oka", "xi", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yi", "xia", "\\u", "download", "\\u", "by", "\\u", "sci", "d_", "=_", "yi", "xia", "\\u", "xia", "oka", "xi", "u\\u", "download", "\\u", "by", "\\u", "sci", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "site", "\\u", "info_", "=_", "\"", "Yi", "xia", " ", "Xia", "oka", "xi", "u", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'", "http", "://", "v", ".", "xia", "oka", "xi", "u", ".", "com", "/", "v", "/.", "+\\\\.", "html", "'_", ",_", "url_", ")_", ":_", "#", "PC_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "d_", "=_", "match", "1_", "(_", "url_", ",_", "r", "'", "http", "://", "v", ".", "xia", "oka", "xi", "u", ".", "com", "/", "v", "/(.", "+)\\\\", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "re_", "._", "match_", "(_", "r", "'", "http", "://", "m", ".", "xia", "oka", "xi", "u", ".", "com", "/", "m", "/.", "+\\\\.", "html", "'_", ",_", "url_", ")_", ":_", "#", "Mob", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sci", "d_", "=_", "match", "1_", "(_", "url_", ",_", "r", "'", "http", "://", "m", ".", "xia", "oka", "xi", "u", ".", "com", "/", "m", "/(.", "+)\\\\", ".", "html", "'_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yi", "xia", "\\u", "download", "\\u", "by", "\\u", "sci", "d_", "(_", "sci", "d_", ",_", "output", "\\u", "dir_", ",_", "merge_", ",_", "info", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
SheffieldML/GPy/GPy/likelihoods/gamma.py
[ { "content": "# Copyright (c) 2012 - 2014, GPy authors (see AUTHORS.txt).\n# Licensed under the BSD 3-clause license (see LICENSE.txt)\n\n\nimport numpy as np\nfrom scipy import stats,special\nimport scipy as sp\nfrom ..core.parameterization import Param\nfrom . import link_functions\nfrom .likelihood import Likelihood\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Gamma(Likelihood):\n \"\"\"\n Gamma likelihood\n\n .. math::\n p(y_{i}|\\\\lambda(f_{i})) = \\\\frac{\\\\beta^{\\\\alpha_{i}}}{\\\\Gamma(\\\\alpha_{i})}y_{i}^{\\\\alpha_{i}-1}e^{-\\\\beta y_{i}}\\\\\\\\\n \\\\alpha_{i} = \\\\beta y_{i}\n\n \"\"\"\n\n\n\n\n", "metadata": "root.Gamma", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self,gp_link=None,beta=1.):\n if gp_link is None:\n gp_link = link_functions.Log()\n super(Gamma, self).__init__(gp_link, 'Gamma')\n\n self.beta = Param('beta', beta)\n self.link_parameter(self.beta)\n self.beta.fix()#TODO: gradients!", "metadata": "root.Gamma.__init__", "header": "['class', 'Gamma', '(', 'Likelihood', ')', ':', '___EOS___']", "index": 20 }, { "content": " def pdf_link(self, link_f, y, Y_metadata=None):\n \"\"\"\n Likelihood function given link(f)\n\n .. math::\n p(y_{i}|\\\\lambda(f_{i})) = \\\\frac{\\\\beta^{\\\\alpha_{i}}}{\\\\Gamma(\\\\alpha_{i})}y_{i}^{\\\\alpha_{i}-1}e^{-\\\\beta y_{i}}\\\\\\\\\n \\\\alpha_{i} = \\\\beta y_{i}\n\n :param link_f: latent variables link(f)\n :type link_f: Nx1 array\n :param y: data\n :type y: Nx1 array\n :param Y_metadata: Y_metadata which is not used in poisson distribution\n :returns: likelihood evaluated for this point\n :rtype: float\n \"\"\"\n assert np.atleast_1d(link_f).shape == np.atleast_1d(y).shape\n #return stats.gamma.pdf(obs,a = self.gp_link.transf(gp)/self.variance,scale=self.variance)\n alpha = link_f*self.beta\n objective = (y**(alpha - 1.) * np.exp(-self.beta*y) * self.beta**alpha)/ special.gamma(alpha)\n return np.exp(np.sum(np.log(objective)))", "metadata": "root.Gamma.pdf_link", "header": "['class', 'Gamma', '(', 'Likelihood', ')', ':', '___EOS___']", "index": 29 }, { "content": " def logpdf_link(self, link_f, y, Y_metadata=None):\n \"\"\"\n Log Likelihood Function given link(f)\n\n .. math::\n \\\\ln p(y_{i}|\\lambda(f_{i})) = \\\\alpha_{i}\\\\log \\\\beta - \\\\log \\\\Gamma(\\\\alpha_{i}) + (\\\\alpha_{i} - 1)\\\\log y_{i} - \\\\beta y_{i}\\\\\\\\\n \\\\alpha_{i} = \\\\beta y_{i}\n\n :param link_f: latent variables (link(f))\n :type link_f: Nx1 array\n :param y: data\n :type y: Nx1 array\n :param Y_metadata: Y_metadata which is not used in poisson distribution\n :returns: likelihood evaluated for this point\n :rtype: float\n\n \"\"\"\n #alpha = self.gp_link.transf(gp)*self.beta\n #return (1. - alpha)*np.log(obs) + self.beta*obs - alpha * np.log(self.beta) + np.log(special.gamma(alpha))\n alpha = link_f*self.beta\n log_objective = alpha*np.log(self.beta) - np.log(special.gamma(alpha)) + (alpha - 1)*np.log(y) - self.beta*y\n return log_objective", "metadata": "root.Gamma.logpdf_link", "header": "['class', 'Gamma', '(', 'Likelihood', ')', ':', '___EOS___']", "index": 51 }, { "content": " def dlogpdf_dlink(self, link_f, y, Y_metadata=None):\n \"\"\"\n Gradient of the log likelihood function at y, given link(f) w.r.t link(f)\n\n .. math::\n \\\\frac{d \\\\ln p(y_{i}|\\\\lambda(f_{i}))}{d\\\\lambda(f)} = \\\\beta (\\\\log \\\\beta y_{i}) - \\\\Psi(\\\\alpha_{i})\\\\beta\\\\\\\\\n \\\\alpha_{i} = \\\\beta y_{i}\n\n :param link_f: latent variables (f)\n :type link_f: Nx1 array\n :param y: data\n :type y: Nx1 array\n :param Y_metadata: Y_metadata which is not used in gamma distribution\n :returns: gradient of likelihood evaluated at points\n :rtype: Nx1 array\n\n \"\"\"\n grad = self.beta*np.log(self.beta*y) - special.psi(self.beta*link_f)*self.beta\n #old\n #return -self.gp_link.dtransf_df(gp)*self.beta*np.log(obs) + special.psi(self.gp_link.transf(gp)*self.beta) * self.gp_link.dtransf_df(gp)*self.beta\n return grad", "metadata": "root.Gamma.dlogpdf_dlink", "header": "['class', 'Gamma', '(', 'Likelihood', ')', ':', '___EOS___']", "index": 74 }, { "content": " def d2logpdf_dlink2(self, link_f, y, Y_metadata=None):\n \"\"\"\n Hessian at y, given link(f), w.r.t link(f)\n i.e. second derivative logpdf at y given link(f_i) and link(f_j) w.r.t link(f_i) and link(f_j)\n The hessian will be 0 unless i == j\n\n .. math::\n \\\\frac{d^{2} \\\\ln p(y_{i}|\\lambda(f_{i}))}{d^{2}\\\\lambda(f)} = -\\\\beta^{2}\\\\frac{d\\\\Psi(\\\\alpha_{i})}{d\\\\alpha_{i}}\\\\\\\\\n \\\\alpha_{i} = \\\\beta y_{i}\n\n :param link_f: latent variables link(f)\n :type link_f: Nx1 array\n :param y: data\n :type y: Nx1 array\n :param Y_metadata: Y_metadata which is not used in gamma distribution\n :returns: Diagonal of hessian matrix (second derivative of likelihood evaluated at points f)\n :rtype: Nx1 array\n\n .. Note::\n Will return diagonal of hessian, since every where else it is 0, as the likelihood factorizes over cases\n (the distribution for y_i depends only on link(f_i) not on link(f_(j!=i))\n \"\"\"\n hess = -special.polygamma(1, self.beta*link_f)*(self.beta**2)\n #old\n #return -self.gp_link.d2transf_df2(gp)*self.beta*np.log(obs) + special.polygamma(1,self.gp_link.transf(gp)*self.beta)*(self.gp_link.dtransf_df(gp)*self.beta)**2 + special.psi(self.gp_link.transf(gp)*self.beta)*self.gp_link.d2transf_df2(gp)*self.beta\n return hess", "metadata": "root.Gamma.d2logpdf_dlink2", "header": "['class', 'Gamma', '(', 'Likelihood', ')', ':', '___EOS___']", "index": 96 }, { "content": " def d3logpdf_dlink3(self, link_f, y, Y_metadata=None):\n \"\"\"\n Third order derivative log-likelihood function at y given link(f) w.r.t link(f)\n\n .. math::\n \\\\frac{d^{3} \\\\ln p(y_{i}|\\lambda(f_{i}))}{d^{3}\\\\lambda(f)} = -\\\\beta^{3}\\\\frac{d^{2}\\\\Psi(\\\\alpha_{i})}{d\\\\alpha_{i}}\\\\\\\\\n \\\\alpha_{i} = \\\\beta y_{i}\n\n :param link_f: latent variables link(f)\n :type link_f: Nx1 array\n :param y: data\n :type y: Nx1 array\n :param Y_metadata: Y_metadata which is not used in gamma distribution\n :returns: third derivative of likelihood evaluated at points f\n :rtype: Nx1 array\n \"\"\"\n d3lik_dlink3 = -special.polygamma(2, self.beta*link_f)*(self.beta**3)\n return d3lik_dlink3", "metadata": "root.Gamma.d3logpdf_dlink3", "header": "['class', 'Gamma', '(', 'Likelihood', ')', ':', '___EOS___']", "index": 123 } ]
[ { "span": "from scipy import stats,special", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 31 }, { "span": "import scipy as sp", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", " ", "-", " ", "2014", ",", " ", "GP", "y", " ", "author", "s", " ", "(", "see", " ", "AUTHOR", "S", ".", "txt", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "BS", "D", " ", "3", "-", "clause", " ", "license", " ", "(", "see", " ", "LICENSE", ".", "txt", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "import_", "stats_", ",_", "special_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "as_", "sp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "core_", "._", "parameter", "ization_", "import_", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "link", "\\u", "functions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "likelihood_", "import_", "Likelihood", "_", "\\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_", "Gamma", "_", "(_", "Likelihood", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gamma", " ", "likelihood", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "p", "(", "y", "\\u{", "i", "}|", "\\\\\\\\", "lambda", "(", "f", "\\u{", "i", "}))", " ", "=", " ", "\\\\\\\\", "frac", "{\\\\", "\\\\", "beta", "^", "{\\\\", "\\\\", "alpha", "\\u{", "i", "}}}", "{\\\\", "\\\\", "Gamma", "(\\\\\\\\", "alpha", "\\u{", "i", "})", "}", "y", "\\u{", "i", "}", "^", "{\\\\", "\\\\", "alpha", "\\u{", "i", "}-", "1", "}", "e", "^", "{-", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}}\\", "\\\\\\\\\\\\\\\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "alpha", "\\u{", "i", "}", " ", "=", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "_", "(_", "Likelihood", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "gp", "\\u", "link_", "=_", "None_", ",_", "beta_", "=_", "1._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "gp", "\\u", "link_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gp", "\\u", "link_", "=_", "link", "\\u", "functions_", "._", "Log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Gamma", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "gp", "\\u", "link_", ",_", "'", "Gamma", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "beta_", "=_", "Param_", "(_", "'", "beta", "'_", ",_", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "link", "\\u", "parameter_", "(_", "self_", "._", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "beta_", "._", "fix_", "(_", ")_", "#", "TOD", "O", ":", " ", "gradi", "ents", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "_", "(_", "Likelihood", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pdf", "\\u", "link_", "(_", "self_", ",_", "link", "\\u", "f_", ",_", "y_", ",_", "Y", "\\u", "metadata_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Likelihood", " ", "function", " ", "give", "n", " ", "link", "(", "f", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "p", "(", "y", "\\u{", "i", "}|", "\\\\\\\\", "lambda", "(", "f", "\\u{", "i", "}))", " ", "=", " ", "\\\\\\\\", "frac", "{\\\\", "\\\\", "beta", "^", "{\\\\", "\\\\", "alpha", "\\u{", "i", "}}}", "{\\\\", "\\\\", "Gamma", "(\\\\\\\\", "alpha", "\\u{", "i", "})", "}", "y", "\\u{", "i", "}", "^", "{\\\\", "\\\\", "alpha", "\\u{", "i", "}-", "1", "}", "e", "^", "{-", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}}\\", "\\\\\\\\\\\\\\\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "alpha", "\\u{", "i", "}", " ", "=", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "link", "\\u", "f", ":", " ", "latent", " ", "variab", "les", " ", "link", "(", "f", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "link", "\\u", "f", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "y", ":", " ", "data", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "y", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Y", "\\u", "metadata", ":", " ", "Y", "\\u", "metadata", " ", "whi", "ch", " ", "is", " ", "not", " ", "used", " ", "in", " ", "poisson", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "likelihood", " ", "evaluate", "d", " ", "for", " ", "this", " ", "point", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "np_", "._", "atl", "east", "\\u", "1d_", "(_", "link", "\\u", "f_", ")_", "._", "shape_", "==_", "np_", "._", "atl", "east", "\\u", "1d_", "(_", "y_", ")_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "return", " ", "stats", ".", "gamma", ".", "pdf", "(", "obs", ",", "a", " ", "=", " ", "self", ".", "gp", "\\u", "link", ".", "transf", "(", "gp", ")/", "self", ".", "varian", "ce", ",", "scale", "=", "self", ".", "varian", "ce", ")_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "link", "\\u", "f_", "*_", "self_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objective_", "=_", "(_", "y_", "**_", "(_", "alpha_", "-_", "1._", ")_", "*_", "np_", "._", "exp_", "(_", "-_", "self_", "._", "beta_", "*_", "y_", ")_", "*_", "self_", "._", "beta_", "**_", "alpha_", ")_", "/_", "special_", "._", "gamma_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "np_", "._", "exp_", "(_", "np_", "._", "sum_", "(_", "np_", "._", "log_", "(_", "objective_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "_", "(_", "Likelihood", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logp", "df", "\\u", "link_", "(_", "self_", ",_", "link", "\\u", "f_", ",_", "y_", ",_", "Y", "\\u", "metadata_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Log", " ", "Likelihood", " ", "Function", " ", "give", "n", " ", "link", "(", "f", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "ln", " ", "p", "(", "y", "\\u{", "i", "}|", "\\\\", "lambda", "(", "f", "\\u{", "i", "}))", " ", "=", " ", "\\\\\\\\", "alpha", "\\u{", "i", "}\\\\", "\\\\", "log", " ", "\\\\\\\\", "beta", " ", "-", " ", "\\\\\\\\", "log", " ", "\\\\\\\\", "Gamma", "(\\\\\\\\", "alpha", "\\u{", "i", "})", " ", "+", " ", "(\\\\\\\\", "alpha", "\\u{", "i", "}", " ", "-", " ", "1", ")\\\\\\\\", "log", " ", "y", "\\u{", "i", "}", " ", "-", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}\\\\", "\\\\\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "alpha", "\\u{", "i", "}", " ", "=", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "link", "\\u", "f", ":", " ", "latent", " ", "variab", "les", " ", "(", "link", "(", "f", "))\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "link", "\\u", "f", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "y", ":", " ", "data", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "y", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Y", "\\u", "metadata", ":", " ", "Y", "\\u", "metadata", " ", "whi", "ch", " ", "is", " ", "not", " ", "used", " ", "in", " ", "poisson", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "likelihood", " ", "evaluate", "d", " ", "for", " ", "this", " ", "point", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "float", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "alpha", " ", "=", " ", "self", ".", "gp", "\\u", "link", ".", "transf", "(", "gp", ")*", "self", ".", "beta_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "(", "1", ".", " ", "-", " ", "alpha", ")*", "np", ".", "log", "(", "obs", ")", " ", "+", " ", "self", ".", "beta", "*", "obs", " ", "-", " ", "alpha", " ", "*", " ", "np", ".", "log", "(", "self", ".", "beta", ")", " ", "+", " ", "np", ".", "log", "(", "special", ".", "gamma", "(", "alpha", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "link", "\\u", "f_", "*_", "self_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "objective_", "=_", "alpha_", "*_", "np_", "._", "log_", "(_", "self_", "._", "beta_", ")_", "-_", "np_", "._", "log_", "(_", "special_", "._", "gamma_", "(_", "alpha_", ")_", ")_", "+_", "(_", "alpha_", "-_", "1_", ")_", "*_", "np_", "._", "log_", "(_", "y_", ")_", "-_", "self_", "._", "beta_", "*_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "log", "\\u", "objective_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "_", "(_", "Likelihood", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dlo", "gpd", "f", "\\u", "dli", "nk_", "(_", "self_", ",_", "link", "\\u", "f_", ",_", "y_", ",_", "Y", "\\u", "metadata_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Grad", "ient", " ", "of", " ", "the", " ", "log", " ", "likelihood", " ", "function", " ", "at", " ", "y", ",", " ", "give", "n", " ", "link", "(", "f", ")", " ", "w", ".", "r", ".", "t", " ", "link", "(", "f", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "frac", "{", "d", " ", "\\\\\\\\", "ln", " ", "p", "(", "y", "\\u{", "i", "}|", "\\\\\\\\", "lambda", "(", "f", "\\u{", "i", "}))", "}{", "d", "\\\\\\\\", "lambda", "(", "f", ")}", " ", "=", " ", "\\\\\\\\", "beta", " ", "(\\\\\\\\", "log", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "})", " ", "-", " ", "\\\\\\\\", "Psi", "(\\\\\\\\", "alpha", "\\u{", "i", "})\\\\", "\\\\", "beta", "\\\\\\\\\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "alpha", "\\u{", "i", "}", " ", "=", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "link", "\\u", "f", ":", " ", "latent", " ", "variab", "les", " ", "(", "f", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "link", "\\u", "f", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "y", ":", " ", "data", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "y", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Y", "\\u", "metadata", ":", " ", "Y", "\\u", "metadata", " ", "whi", "ch", " ", "is", " ", "not", " ", "used", " ", "in", " ", "gamma", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "gradi", "ent", " ", "of", " ", "likelihood", " ", "evaluate", "d", " ", "at", " ", "points", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grad_", "=_", "self_", "._", "beta_", "*_", "np_", "._", "log_", "(_", "self_", "._", "beta_", "*_", "y_", ")_", "-_", "special_", "._", "psi_", "(_", "self_", "._", "beta_", "*_", "link", "\\u", "f_", ")_", "*_", "self_", "._", "beta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "old_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "-", "self", ".", "gp", "\\u", "link", ".", "dtr", "ans", "f", "\\u", "df", "(", "gp", ")*", "self", ".", "beta", "*", "np", ".", "log", "(", "obs", ")", " ", "+", " ", "special", ".", "psi", "(", "self", ".", "gp", "\\u", "link", ".", "transf", "(", "gp", ")*", "self", ".", "beta", ")", " ", "*", " ", "self", ".", "gp", "\\u", "link", ".", "dtr", "ans", "f", "\\u", "df", "(", "gp", ")*", "self", ".", "beta_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "grad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "_", "(_", "Likelihood", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "d2", "logp", "df", "\\u", "dli", "nk", "2_", "(_", "self_", ",_", "link", "\\u", "f_", ",_", "y_", ",_", "Y", "\\u", "metadata_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hes", "sia", "n", " ", "at", " ", "y", ",", " ", "give", "n", " ", "link", "(", "f", "),", " ", "w", ".", "r", ".", "t", " ", "link", "(", "f", ")", "\\", "10", ";", " ", " ", " ", " ", "i", ".", "e", ".", " ", "second", " ", "deriv", "ative", " ", "logp", "df", " ", "at", " ", "y", " ", "give", "n", " ", "link", "(", "f", "\\u", "i", ")", " ", "and", " ", "link", "(", "f", "\\u", "j", ")", " ", " ", "w", ".", "r", ".", "t", " ", "link", "(", "f", "\\u", "i", ")", " ", "and", " ", "link", "(", "f", "\\u", "j", ")", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "hessian", " ", "will", " ", "be", " ", "0", " ", "unl", "ess", " ", "i", " ", "==", " ", "j", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "frac", "{", "d", "^", "{", "2", "}", " ", "\\\\\\\\", "ln", " ", "p", "(", "y", "\\u{", "i", "}|", "\\\\", "lambda", "(", "f", "\\u{", "i", "}))", "}{", "d", "^", "{", "2", "}\\\\", "\\\\", "lambda", "(", "f", ")}", " ", "=", " ", "-\\\\\\\\", "beta", "^", "{", "2", "}\\\\", "\\\\", "frac", "{", "d", "\\\\\\\\", "Psi", "(\\\\\\\\", "alpha", "\\u{", "i", "})", "}{", "d", "\\\\\\\\", "alpha", "\\u{", "i", "}}\\", "\\\\\\\\\\\\\\\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "alpha", "\\u{", "i", "}", " ", "=", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "link", "\\u", "f", ":", " ", "latent", " ", "variab", "les", " ", "link", "(", "f", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "link", "\\u", "f", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "y", ":", " ", "data", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "y", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Y", "\\u", "metadata", ":", " ", "Y", "\\u", "metadata", " ", "whi", "ch", " ", "is", " ", "not", " ", "used", " ", "in", " ", "gamma", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "Diag", "onal", " ", "of", " ", "hessian", " ", "matrix", " ", "(", "second", " ", "deriv", "ative", " ", "of", " ", "likelihood", " ", "evaluate", "d", " ", "at", " ", "points", " ", "f", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "Not", "e", "::", "\\", "10", ";", " ", " ", " ", " ", "Wil", "l", " ", "return", " ", "diagonal", " ", "of", " ", "hessian", ",", " ", "sinc", "e", " ", "every", " ", "where", " ", "else", " ", "it", " ", "is", " ", "0", ",", " ", "as", " ", "the", " ", "likelihood", " ", "factori", "zes", " ", "over", " ", "case", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "the", " ", "distribu", "tion", " ", "for", " ", "y", "\\u", "i", " ", "depend", "s", " ", "only", " ", "on", " ", "link", "(", "f", "\\u", "i", ")", " ", "not", " ", "on", " ", "link", "(", "f", "\\u(", "j", "!=", "i", "))\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hess", "_", "=_", "-_", "special_", "._", "poly", "gamma_", "(_", "1_", ",_", "self_", "._", "beta_", "*_", "link", "\\u", "f_", ")_", "*_", "(_", "self_", "._", "beta_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "old_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "-", "self", ".", "gp", "\\u", "link", ".", "d2", "transf", "\\u", "df", "2", "(", "gp", ")*", "self", ".", "beta", "*", "np", ".", "log", "(", "obs", ")", " ", "+", " ", "special", ".", "poly", "gamma", "(", "1", ",", "self", ".", "gp", "\\u", "link", ".", "transf", "(", "gp", ")*", "self", ".", "beta", ")*", "(", "self", ".", "gp", "\\u", "link", ".", "dtr", "ans", "f", "\\u", "df", "(", "gp", ")*", "self", ".", "beta", ")**", "2", " ", "+", " ", "special", ".", "psi", "(", "self", ".", "gp", "\\u", "link", ".", "transf", "(", "gp", ")*", "self", ".", "beta", ")*", "self", ".", "gp", "\\u", "link", ".", "d2", "transf", "\\u", "df", "2", "(", "gp", ")*", "self", ".", "beta_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "hess", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gamma", "_", "(_", "Likelihood", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "d3", "logp", "df", "\\u", "dli", "nk", "3_", "(_", "self_", ",_", "link", "\\u", "f_", ",_", "y_", ",_", "Y", "\\u", "metadata_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "rd", " ", "order", " ", "deriv", "ative", " ", "log", "-", "likelihood", " ", "function", " ", "at", " ", "y", " ", "give", "n", " ", "link", "(", "f", ")", " ", "w", ".", "r", ".", "t", " ", "link", "(", "f", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "frac", "{", "d", "^", "{", "3", "}", " ", "\\\\\\\\", "ln", " ", "p", "(", "y", "\\u{", "i", "}|", "\\\\", "lambda", "(", "f", "\\u{", "i", "}))", "}{", "d", "^", "{", "3", "}\\\\", "\\\\", "lambda", "(", "f", ")}", " ", "=", " ", "-\\\\\\\\", "beta", "^", "{", "3", "}\\\\", "\\\\", "frac", "{", "d", "^", "{", "2", "}\\\\", "\\\\", "Psi", "(\\\\\\\\", "alpha", "\\u{", "i", "})", "}{", "d", "\\\\\\\\", "alpha", "\\u{", "i", "}}\\", "\\\\\\\\\\\\\\\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "alpha", "\\u{", "i", "}", " ", "=", " ", "\\\\\\\\", "beta", " ", "y", "\\u{", "i", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "link", "\\u", "f", ":", " ", "latent", " ", "variab", "les", " ", "link", "(", "f", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "link", "\\u", "f", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "y", ":", " ", "data", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "y", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "Y", "\\u", "metadata", ":", " ", "Y", "\\u", "metadata", " ", "whi", "ch", " ", "is", " ", "not", " ", "used", " ", "in", " ", "gamma", " ", "distribu", "tion", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "third", " ", "deriv", "ative", " ", "of", " ", "likelihood", " ", "evaluate", "d", " ", "at", " ", "points", " ", "f", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "Nx", "1", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d3", "lik", "\\u", "dli", "nk", "3_", "=_", "-_", "special_", "._", "poly", "gamma_", "(_", "2_", ",_", "self_", "._", "beta_", "*_", "link", "\\u", "f_", ")_", "*_", "(_", "self_", "._", "beta_", "**_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d3", "lik", "\\u", "dli", "nk", "3_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Incomplete ordering
circuits/circuits/circuits/web/headers.py
[ { "content": "class HeaderElement(object):\n\n \"\"\"An element (with parameters) from an HTTP header's element list.\"\"\"\n\n\n\n\n\n\n\n parse = staticmethod(parse)\n", "metadata": "root.HeaderElement", "header": "['module', '___EOS___']", "index": 51 }, { "content": " def __init__(self, value, params=None):\n self.value = value\n if params is None:\n params = {}\n self.params = params", "metadata": "root.HeaderElement.__init__", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 55 }, { "content": " def __eq__(self, other):\n return self.value == other.value", "metadata": "root.HeaderElement.__eq__", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": " def __lt__(self, other):\n return self.value < other.value", "metadata": "root.HeaderElement.__lt__", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def __str__(self):\n p = [\";%s=%s\" % (k, v) for k, v in iteritems(self.params)]\n return \"%s%s\" % (self.value, \"\".join(p))", "metadata": "root.HeaderElement.__str__", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def __bytes__(self):\n return b(self.__str__())", "metadata": "root.HeaderElement.__bytes__", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def __unicode__(self):\n return u(self.__str__())", "metadata": "root.HeaderElement.__unicode__", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 74 }, { "content": " def parse(elementstr):\n \"\"\"Transform 'token;key=val' to ('token', {'key': 'val'}).\"\"\"\n # Split the element into a value and parameters. The 'value' may\n # be of the form, \"token=token\", but we don't split that here.\n atoms = [x.strip() for x in elementstr.split(\";\") if x.strip()]\n if not atoms:\n initial_value = ''\n else:\n initial_value = atoms.pop(0).strip()\n params = {}\n for atom in atoms:\n atom = [x.strip() for x in atom.split(\"=\", 1) if x.strip()]\n key = atom.pop(0)\n if atom:\n val = atom[0]\n else:\n val = \"\"\n params[key] = val\n return initial_value, params", "metadata": "root.HeaderElement.parse", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " @classmethod\n def from_str(cls, elementstr):\n \"\"\"Construct an instance from a string of the form 'token;key=val'.\"\"\"\n ival, params = cls.parse(elementstr)\n return cls(ival, params)", "metadata": "root.HeaderElement.from_str", "header": "['class', 'HeaderElement', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": "class AcceptElement(HeaderElement):\n\n \"\"\"An element (with parameters) from an Accept* header's element list.\n\n AcceptElement objects are comparable; the more-preferred object will be\n \"less than\" the less-preferred object. They are also therefore sortable;\n if you sort a list of AcceptElement objects, they will be listed in\n priority order; the most preferred value will be first. Yes, it should\n have been the other way around, but it's too late to fix now.\n \"\"\"\n\n\n qvalue = property(qvalue, doc=\"The qvalue, or priority, of this value.\")\n\n", "metadata": "root.AcceptElement", "header": "['module', '___EOS___']", "index": 105 }, { "content": " @classmethod\n def from_str(cls, elementstr):\n qvalue = None\n # The first \"q\" parameter (if any) separates the initial\n # media-range parameter(s) (if any) from the accept-params.\n atoms = q_separator.split(elementstr, 1)\n media_range = atoms.pop(0).strip()\n if atoms:\n # The qvalue for an Accept header can have extensions. The other\n # headers cannot, but it's easier to parse them as if they did.\n qvalue = HeaderElement.from_str(atoms[0].strip())\n\n media_type, params = cls.parse(media_range)\n if qvalue is not None:\n params[\"q\"] = qvalue\n return cls(media_type, params)", "metadata": "root.AcceptElement.from_str", "header": "['class', 'AcceptElement', '(', 'HeaderElement', ')', ':', '___EOS___']", "index": 116 }, { "content": " def qvalue(self):\n val = self.params.get(\"q\", \"1\")\n if isinstance(val, HeaderElement):\n val = val.value\n return float(val)", "metadata": "root.AcceptElement.qvalue", "header": "['class', 'AcceptElement', '(', 'HeaderElement', ')', ':', '___EOS___']", "index": 133 }, { "content": " def __eq__(self, other):\n return self.qvalue == other.qvalue", "metadata": "root.AcceptElement.__eq__", "header": "['class', 'AcceptElement', '(', 'HeaderElement', ')', ':', '___EOS___']", "index": 140 }, { "content": " def __lt__(self, other):\n if self.qvalue == other.qvalue:\n return str(self) < str(other)\n else:\n return self.qvalue < other.qvalue", "metadata": "root.AcceptElement.__lt__", "header": "['class', 'AcceptElement', '(', 'HeaderElement', ')', ':', '___EOS___']", "index": 143 } ]
[ { "span": "class HeaderElement(object):", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 28 }, { "span": "class AcceptElement(HeaderElement):", "start_line": 105, "start_column": 0, "end_line": 105, "end_column": 35 } ]
[ { "span": "def __lt__(self, other):", "start_line": 64, "start_column": 4, "end_line": 64, "end_column": 28 }, { "span": "def __lt__(self, other):", "start_line": 143, "start_column": 4, "end_line": 143, "end_column": 28 } ]
1
false
[ "[CLS]_", "Incomp", "lete", "_", "ordering_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "element", " ", "(", "with", " ", "parameter", "s", ")", " ", "from", " ", "an", " ", "HTTP", " ", "header", "'", "s", " ", "element", " ", "list", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parse_", "=_", "staticmethod_", "(_", "parse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "value_", ",_", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "params_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "params_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "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 ", " _", "return_", "self_", "._", "value_", "==_", "other_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "value_", "<_", "other_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\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 ", " _", "p_", "=_", "[_", "\";", "%", "s", "=", "%", "s", "\"_", "%_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "iteritems_", "(_", "self_", "._", "params_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "self_", "._", "value_", ",_", "\"\"_", "._", "join_", "(_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "bytes", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "b_", "(_", "self_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "u_", "(_", "self_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "element", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Transform", " ", "'", "token", ";", "key", "=", "val", "'", " ", "to", " ", "('", "token", "',", " ", "{", "'", "key", "':", " ", "'", "val", "'})", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Split", " ", "the", " ", "element", " ", "int", "o", " ", "a", " ", "value", " ", "and", " ", "parameter", "s", ".", " ", "The", " ", "'", "value", "'", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "of", " ", "the", " ", "form", ",", " ", "\"", "token", "=", "token", "\",", " ", "but", " ", "we", " ", "don", "'", "t", " ", "split", " ", "tha", "t", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "atoms_", "=_", "[_", "x_", "._", "strip_", "(_", ")_", "for_", "x_", "in_", "element", "str_", "._", "split_", "(_", "\";\"_", ")_", "if_", "x_", "._", "strip_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "atoms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "atoms_", "._", "pop_", "(_", "0_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "atom_", "in_", "atoms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atom_", "=_", "[_", "x_", "._", "strip_", "(_", ")_", "for_", "x_", "in_", "atom_", "._", "split_", "(_", "\"=\"_", ",_", "1_", ")_", "if_", "x_", "._", "strip_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "atom_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "atom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "atom_", "[_", "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 ", " _", "val_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "[_", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initial", "\\u", "value_", ",_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Head", "er", "Element_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "str_", "(_", "cls_", ",_", "element", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", " ", "an", " ", "instance", " ", "from", " ", "a", " ", "string", " ", "of", " ", "the", " ", "form", " ", "'", "token", ";", "key", "=", "val", "'.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ival", "_", ",_", "params_", "=_", "cls_", "._", "parse_", "(_", "element", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "ival", "_", ",_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Accept", "Element_", "(_", "Head", "er", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "element", " ", "(", "with", " ", "parameter", "s", ")", " ", "from", " ", "an", " ", "Accept", "*", " ", "header", "'", "s", " ", "element", " ", "list", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Accept", "Element", " ", "object", "s", " ", "are", " ", "compara", "ble", ";", " ", "the", " ", "more", "-", "prefer", "red", " ", "object", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "\"", "less", " ", "than", "\"", " ", "the", " ", "less", "-", "prefer", "red", " ", "object", ".", " ", "The", "y", " ", "are", " ", "als", "o", " ", "there", "fore", " ", "sortable", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "you", " ", "sort", " ", "a", " ", "list", " ", "of", " ", "Accept", "Element", " ", "object", "s", ",", " ", "the", "y", " ", "will", " ", "be", " ", "liste", "d", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "priorit", "y", " ", "order", ";", " ", "the", " ", "most", " ", "prefer", "red", " ", "value", " ", "will", " ", "be", " ", "first", ".", " ", "Ye", "s", ",", " ", "it", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "bee", "n", " ", "the", " ", "other", " ", "way", " ", "aro", "und", ",", " ", "but", " ", "it", "'", "s", " ", "too", " ", "late", " ", "to", " ", "fix", " ", "now", ".", "\\", "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\\uDEDENT\\u\\u\\u_", "qva", "lue_", "=_", "property_", "(_", "qva", "lue_", ",_", "doc_", "=_", "\"", "The", " ", "qva", "lue", ",", " ", "or", " ", "priorit", "y", ",", " ", "of", " ", "this", " ", "value", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Accept", "Element_", "(_", "Head", "er", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "str_", "(_", "cls_", ",_", "element", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qva", "lue_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "\"", "q", "\"", " ", "parameter", " ", "(", "if", " ", "any", ")", " ", "separate", "s", " ", "the", " ", "initial_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "media", "-", "range", " ", "parameter", "(", "s", ")", " ", "(", "if", " ", "any", ")", " ", "from", " ", "the", " ", "accept", "-", "params", "._", "\\u\\u\\uNL\\u\\u\\u_", "atoms_", "=_", "q", "\\u", "separator_", "._", "split_", "(_", "element", "str_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media", "\\u", "range_", "=_", "atoms_", "._", "pop_", "(_", "0_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "atoms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "qva", "lue", " ", "for", " ", "an", " ", "Accept", " ", "header", " ", "can", " ", "have", " ", "extensi", "ons", ".", " ", "The", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "header", "s", " ", "cann", "ot", ",", " ", "but", " ", "it", "'", "s", " ", "easi", "er", " ", "to", " ", "parse", " ", "them", " ", "as", " ", "if", " ", "the", "y", " ", "did", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qva", "lue_", "=_", "Head", "er", "Element_", "._", "from", "\\u", "str_", "(_", "atoms_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "media", "\\u", "type_", ",_", "params_", "=_", "cls_", "._", "parse_", "(_", "media", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qva", "lue_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "\"", "q", "\"_", "]_", "=_", "qva", "lue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "media", "\\u", "type_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Accept", "Element_", "(_", "Head", "er", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "qva", "lue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "self_", "._", "params_", "._", "get_", "(_", "\"", "q", "\"_", ",_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "val_", ",_", "Head", "er", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "val_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "float_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Accept", "Element_", "(_", "Head", "er", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "qva", "lue_", "==_", "other_", "._", "qva", "lue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Accept", "Element_", "(_", "Head", "er", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "qva", "lue_", "==_", "other_", "._", "qva", "lue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", ")_", "<_", "str_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "qva", "lue_", "<_", "other_", "._", "qva", "lue_", "\\u\\u\\uNEWLIN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, 2, 2 ]
Unused import
django-bmf/django-bmf/tests/document/tests.py
[ { "content": "#!/usr/bin/python\n# ex:set fileencoding=utf-8:\n# flake8: noqa\n\nfrom __future__ import unicode_literals\n\nfrom django.test import LiveServerTestCase\nfrom django.core.urlresolvers import reverse\nfrom django.contrib.contenttypes.models import ContentType\n\nfrom djangobmf.models import Report\nfrom djangobmf.models import Document\nfrom djangobmf.utils.testcases import BaseTestCase\n\n\n\n# def test_history_files(self):\n# \"\"\"\n# \"\"\"\n\n# self.model = get_model_from_cfg(\"PROJECT\")\n# self.autotest_ajax_post(\n# 'create',\n# kwargs={'key': 'default'},\n# data={\n# 'customer': 1,\n# 'name': \"Testproject\",\n# 'employee': 1,\n# },\n# )\n\n# model = get_model_from_cfg(\"PROJECT\")\n\n# obj = model.objects.order_by('pk').last()\n# ct = ContentType.objects.get_for_model(model)\n\n# r = self.client.get(reverse('djangobmf:document-add', None, None, {'pk': obj.pk, 'ct': ct.pk}))\n# self.assertEqual(r.status_code, 302)\n\n# r = self.client.post(reverse('djangobmf:document-add', None, None, {'pk': obj.pk, 'ct': ct.pk}), {})\n# self.assertEqual(r.status_code, 302)\n\n# file = open('README.rst', 'rb')\n# r = self.client.post(reverse('djangobmf:file_add', None, None, {'pk': obj.pk, 'ct': ct.pk}), {\n# 'file': file,\n# })\n# self.assertEqual(r.status_code, 302)\n# file.close()\n \n# # now, we should have one file connected to our object\n# query = Document.objects.filter(content_type=ct, content_id=obj.pk)\n# self.assertEqual(int(query.count()), 1)\n# # cleanup\n# for obj in query:\n# obj.file.delete()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CoreTests(BaseTestCase):\n pass", "metadata": "root.CoreTests", "header": "['module', '___EOS___']", "index": 15 } ]
[ { "span": "from django.test import LiveServerTestCase", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 42 }, { "span": "from django.core.urlresolvers import reverse", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 44 }, { "span": "from django.contrib.contenttypes.models import ContentType", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 58 }, { "span": "from djangobmf.models import Report", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 35 }, { "span": "from djangobmf.models import Document", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", ":", "set", " ", "file", "encoding", "=", "utf", "-", "8", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flake", "8", ":", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Live", "Server", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "models_", "import_", "Conten", "t", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "models_", "import_", "Report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "models_", "import_", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "utils_", "._", "testcases", "_", "import_", "Base", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "histo", "ry", "\\u", "files", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "model", " ", "=", " ", "get", "\\u", "model", "\\u", "from", "\\u", "cfg", "(\"", "PROJECT", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "autotest", "\\u", "aja", "x", "\\u", "post", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "create", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "kwarg", "s", "={", "'", "key", "':", " ", "'", "default", "'}", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "data", "={", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "customer", "':", " ", "1", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "name", "':", " ", "\"", "Test", "project", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "employ", "ee", "':", " ", "1", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "},", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "model", " ", "=", " ", "get", "\\u", "model", "\\u", "from", "\\u", "cfg", "(\"", "PROJECT", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "obj", " ", "=", " ", "model", ".", "object", "s", ".", "order", "\\u", "by", "('", "pk", "')", ".", "last", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "ct", " ", "=", " ", "Conten", "t", "Type", ".", "object", "s", ".", "get", "\\u", "for", "\\u", "model", "(", "model", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "r", " ", "=", " ", "self", ".", "client", ".", "get", "(", "reverse", "('", "django", "bm", "f", ":", "document", "-", "add", "',", " ", "Non", "e", ",", " ", "Non", "e", ",", " ", "{", "'", "pk", "':", " ", "obj", ".", "pk", ",", " ", "'", "ct", "':", " ", "ct", ".", "pk", "}))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "r", ".", "status", "\\u", "code", ",", " ", "302", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "r", " ", "=", " ", "self", ".", "client", ".", "post", "(", "reverse", "('", "django", "bm", "f", ":", "document", "-", "add", "',", " ", "Non", "e", ",", " ", "Non", "e", ",", " ", "{", "'", "pk", "':", " ", "obj", ".", "pk", ",", " ", "'", "ct", "':", " ", "ct", ".", "pk", "})", ",", " ", "{})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "r", ".", "status", "\\u", "code", ",", " ", "302", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "file", " ", "=", " ", "open", "('", "READ", "ME", ".", "rst", "',", " ", "'", "rb", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "r", " ", "=", " ", "self", ".", "client", ".", "post", "(", "reverse", "('", "django", "bm", "f", ":", "file", "\\u", "add", "',", " ", "Non", "e", ",", " ", "Non", "e", ",", " ", "{", "'", "pk", "':", " ", "obj", ".", "pk", ",", " ", "'", "ct", "':", " ", "ct", ".", "pk", "})", ",", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "file", "':", " ", "file", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "})", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "r", ".", "status", "\\u", "code", ",", " ", "302", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "file", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "#", " ", "now", ",", " ", "we", " ", "shou", "ld", " ", "have", " ", "one", " ", "file", " ", "connect", "ed", " ", "to", " ", "our", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "query", " ", "=", " ", "Document", ".", "object", "s", ".", "filter", "(", "content", "\\u", "type", "=", "ct", ",", " ", "content", "\\u", "id", "=", "obj", ".", "pk", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "int", "(", "query", ".", "count", "())", ",", " ", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "#", " ", "cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "for", " ", "obj", " ", "in", " ", "query", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "obj", ".", "file", ".", "delete", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Core", "Tests_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
OpenMDAO/OpenMDAO/openmdao/core/test/test_component.py
[ { "content": " def test_add_params(self):\n self.comp.add_param(\"x\", 0.0)\n self.comp.add_param(\"y\", 0.0)\n self.comp.add_param(\"z\", shape=(1, ))\n self.comp.add_param(\"t\", shape=2)\n self.comp.add_param(\"u\", shape=1)\n\n # This should no longer raise an error\n self.comp.add_param(\"w\")\n\n prob = Problem()\n self.comp._init_sys_data('', prob._probdata)\n params, unknowns = self.comp._setup_variables()\n\n self.assertEqual([\"x\", \"y\", \"z\", \"t\", \"u\", 'w'], list(params.keys()))\n\n self.assertEqual(params[\"x\"], {'shape': 1, 'pathname': 'x', 'val': 0.0, 'size': 1})\n self.assertEqual(params[\"y\"], {'shape': 1, 'pathname': 'y', 'val': 0.0, 'size': 1})\n np.testing.assert_array_equal(params[\"z\"][\"val\"], np.zeros((1,)))\n np.testing.assert_array_equal(params[\"t\"][\"val\"], np.zeros((2,)))\n self.assertEqual(params[\"u\"], {'shape': 1, 'pathname': 'u', 'val': 0.0, 'size': 1})\n\n prob = Problem()\n root = prob.root = Group()\n root.add('comp', self.comp)\n\n with self.assertRaises(RuntimeError) as cm:\n prob.setup(check=False)\n\n self.assertTrue(\"Unconnected param 'comp.w' is missing a shape or default value.\" in str(cm.exception))", "metadata": "root.TestComponent.test_add_params", "header": "['class', 'TestComponent', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 138 }, { "content": " def test_add_var_pbo_check(self):\n p = Problem(root=Group())\n root = p.root\n root.add('C1', MyComp())\n root.add('C2', MyComp2())\n\n s = cStringIO()\n p.setup(out_stream=s)\n\n content = s.getvalue()\n self.assertTrue(\"The following variables are not differentiable but were \"\n \"not labeled by the user as pass_by_obj:\\n\"\n \"C1.x_int: type int\\n\"\n \"C2.x_list: type list\" in content)", "metadata": "root.TestComponent.test_add_var_pbo_check", "header": "['class', 'TestComponent', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 262 } ]
[ { "span": "self.assertTrue(\"Unconnected param 'comp.w' is missing a shape or default value.\" in str(cm.exception))", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 111 }, { "span": "self.assertTrue(\"The following variables are not differentiable but were \"\n \"not labeled by the user as pass_by_obj:\\n\"\n \"C1.x_int: type int\\n\"\n \"C2.x_list: type list\" in content)", "start_line": 272, "start_column": 8, "end_line": 275, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Component_", "(_", "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", "add", "\\u", "params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comp_", "._", "add", "\\u", "param_", "(_", "\"", "x", "\"_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "._", "add", "\\u", "param_", "(_", "\"", "y", "\"_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "._", "add", "\\u", "param_", "(_", "\"", "z", "\"_", ",_", "shape_", "=_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "._", "add", "\\u", "param_", "(_", "\"", "t", "\"_", ",_", "shape_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "._", "add", "\\u", "param_", "(_", "\"", "u", "\"_", ",_", "shape_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "no", " ", "long", "er", " ", "raise", " ", "an", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "comp_", "._", "add", "\\u", "param_", "(_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "=_", "Problem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "._", "\\u", "init", "\\u", "sys", "\\u", "data_", "(_", "''_", ",_", "prob_", "._", "\\u", "prob", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", ",_", "unknown", "s_", "=_", "self_", "._", "comp_", "._", "\\u", "setup", "\\u", "variables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "\"", "x", "\"_", ",_", "\"", "y", "\"_", ",_", "\"", "z", "\"_", ",_", "\"", "t", "\"_", ",_", "\"", "u", "\"_", ",_", "'", "w", "'_", "]_", ",_", "list_", "(_", "params_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "params_", "[_", "\"", "x", "\"_", "]_", ",_", "{_", "'", "shape", "'_", ":_", "1_", ",_", "'", "path", "name", "'_", ":_", "'", "x", "'_", ",_", "'", "val", "'_", ":_", "0.0_", ",_", "'", "size", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "params_", "[_", "\"", "y", "\"_", "]_", ",_", "{_", "'", "shape", "'_", ":_", "1_", ",_", "'", "path", "name", "'_", ":_", "'", "y", "'_", ",_", "'", "val", "'_", ":_", "0.0_", ",_", "'", "size", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "params_", "[_", "\"", "z", "\"_", "]_", "[_", "\"", "val", "\"_", "]_", ",_", "np_", "._", "zeros_", "(_", "(_", "1_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "params_", "[_", "\"", "t", "\"_", "]_", "[_", "\"", "val", "\"_", "]_", ",_", "np_", "._", "zeros_", "(_", "(_", "2_", ",_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "params_", "[_", "\"", "u", "\"_", "]_", ",_", "{_", "'", "shape", "'_", ":_", "1_", ",_", "'", "path", "name", "'_", ":_", "'", "u", "'_", ",_", "'", "val", "'_", ":_", "0.0_", ",_", "'", "size", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "=_", "Problem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "prob_", "._", "root_", "=_", "Group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "add_", "(_", "'", "comp", "'_", ",_", "self_", "._", "comp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prob_", "._", "setup_", "(_", "check_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Unco", "nnect", "ed", " ", "param", " ", "'", "comp", ".", "w", "'", " ", "is", " ", "missi", "ng", " ", "a", " ", "shape", " ", "or", " ", "default", " ", "value", ".\"_", "in_", "str_", "(_", "cm_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Component_", "(_", "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", "add", "\\u", "var", "\\u", "pbo", "\\u", "check_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Problem_", "(_", "root_", "=_", "Group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "p_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "add_", "(_", "'", "C1", "'_", ",_", "My", "Comp_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "add_", "(_", "'", "C2", "'_", ",_", "My", "Comp", "2_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "c", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "setup_", "(_", "out", "\\u", "stream_", "=_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "s_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "The", " ", "follow", "ing", " ", "variab", "les", " ", "are", " ", "not", " ", "different", "iable", " ", "but", " ", "wer", "e", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "not", " ", "label", "ed", " ", "by", " ", "the", " ", "user", " ", "as", " ", "pass", "\\u", "by", "\\u", "obj", ":\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "C1", ".", "x", "\\u", "int", ":", " ", "type", " ", "int", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "C2", ".", "x", "\\u", "list", ":", " ", "type", " ", "list", "\"_", "in_", "content_", ")_", "\\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,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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Missing call to `__init__` during object initialization
Microsoft/ivy/src/ivy/ivy_ast.py
[ { "content": " def __init__(self,*args):\n self.args = args", "metadata": "root.AST.__init__", "header": "['class', 'AST', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": "class Symbol(AST):", "metadata": "root.Symbol", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def __init__(self,rep,sort):\n assert isinstance(rep,str)\n self.rep = rep\n self.sort = sort", "metadata": "root.Symbol.__init__", "header": "['class', 'Symbol', '(', 'AST', ')', ':', '___EOS___']", "index": 25 }, { "content": "class Formula(AST):\n \"\"\"\n Base class for formulas.\n \"\"\"", "metadata": "root.Formula", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def __init__(self,*args):\n self.args = list(args) # make args mutable", "metadata": "root.Formula.__init__", "header": "['class', 'Formula', '(', 'AST', ')', ':', '___EOS___']", "index": 44 }, { "content": "class Not(Formula):\n \"\"\"\n Negation of a formula.\n \"\"\"", "metadata": "root.Not", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def __init__(self,*args):\n assert len(args) == 1\n self.args = args", "metadata": "root.Not.__init__", "header": "['class', 'Not', '(', 'Formula', ')', ':', '___EOS___']", "index": 69 }, { "content": "class Let(Formula):\n \"\"\"\n Formula of the form let p(X,...,Z) <-> fmla[X,...,Z], ... in fmla\n \"\"\"", "metadata": "root.Let", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def __init__(self,*args):\n assert len(args) >= 1\n self.args = args", "metadata": "root.Let.__init__", "header": "['class', 'Let', '(', 'Formula', ')', ':', '___EOS___']", "index": 81 }, { "content": "class Definition(Formula):\n \"\"\"\n Formula of the form p(X,...,Z) <-> fmla[X,...,Z]\n \"\"\"", "metadata": "root.Definition", "header": "['module', '___EOS___']", "index": 95 }, { "content": " def __init__(self,*args):\n assert len(args) == 2\n self.args = args", "metadata": "root.Definition.__init__", "header": "['class', 'Definition', '(', 'Formula', ')', ':', '___EOS___']", "index": 99 }, { "content": "class Implies(Formula):\n \"\"\"\n Implication of formulas\n \"\"\"", "metadata": "root.Implies", "header": "['module', '___EOS___']", "index": 111 }, { "content": " def __init__(self,*args):\n assert len(args) == 2\n self.args = args", "metadata": "root.Implies.__init__", "header": "['class', 'Implies', '(', 'Formula', ')', ':', '___EOS___']", "index": 115 }, { "content": "class Iff(Formula):\n \"\"\"\n Implication of formulas\n \"\"\"", "metadata": "root.Iff", "header": "['module', '___EOS___']", "index": 121 }, { "content": " def __init__(self,*args):\n assert len(args) == 2\n self.args = args", "metadata": "root.Iff.__init__", "header": "['class', 'Iff', '(', 'Formula', ')', ':', '___EOS___']", "index": 125 }, { "content": "class Ite(AST):\n \"\"\"\n If-the-else expression. \n \"\"\"", "metadata": "root.Ite", "header": "['module', '___EOS___']", "index": 131 }, { "content": " def __init__(self,*args):\n assert len(args) == 3\n self.args = args", "metadata": "root.Ite.__init__", "header": "['class', 'Ite', '(', 'AST', ')', ':', '___EOS___']", "index": 135 }, { "content": "class Quantifier(Formula):", "metadata": "root.Quantifier", "header": "['module', '___EOS___']", "index": 141 }, { "content": " def __init__(self, bounds, body):\n self.bounds = bounds\n self.args = [body]", "metadata": "root.Quantifier.__init__", "header": "['class', 'Quantifier', '(', 'Formula', ')', ':', '___EOS___']", "index": 142 }, { "content": "class Atom(Formula):\n \"\"\"\n A n-ary relation symbol applied to n terms\n \"\"\"\n # following for backward compat", "metadata": "root.Atom", "header": "['module', '___EOS___']", "index": 152 }, { "content": " def __init__(self, relsym, *terms):\n self.rep = relsym\n self.args = flatten(terms)", "metadata": "root.Atom.__init__", "header": "['class', 'Atom', '(', 'Formula', ')', ':', '___EOS___']", "index": 156 }, { "content": "class Old(Term):", "metadata": "root.Old", "header": "['module', '___EOS___']", "index": 196 }, { "content": " def __init__(self, term):\n self.args = [term]", "metadata": "root.Old.__init__", "header": "['class', 'Old', '(', 'Term', ')', ':', '___EOS___']", "index": 197 }, { "content": "class App(Term):", "metadata": "root.App", "header": "['module', '___EOS___']", "index": 202 }, { "content": " def __init__(self, funsym, *terms):\n self.rep = funsym\n self.args = flatten(terms)", "metadata": "root.App.__init__", "header": "['class', 'App', '(', 'Term', ')', ':', '___EOS___']", "index": 203 }, { "content": "class Variable(Term):", "metadata": "root.Variable", "header": "['module', '___EOS___']", "index": 229 }, { "content": " def __init__(self, rep, sort):\n assert isinstance(rep,str)\n# assert isinstance(sort,Sort)\n self.rep = rep\n self.args = []\n self.sort = sort", "metadata": "root.Variable.__init__", "header": "['class', 'Variable', '(', 'Term', ')', ':', '___EOS___']", "index": 230 }, { "content": "class Literal(AST):\n \"\"\"\n Either a positive or negative atomic formula. Literals are not\n formulas! Use Not(Atom(...)) to get a formula.\n \"\"\"", "metadata": "root.Literal", "header": "['module', '___EOS___']", "index": 253 }, { "content": " def __init__(self, polarity, atom):\n# assert isinstance(atom,Atom) or isinstance(atom,And) and len(atom.args) == 0\n self.polarity = polarity\n self.atom = atom", "metadata": "root.Literal.__init__", "header": "['class', 'Literal', '(', 'AST', ')', ':', '___EOS___']", "index": 258 }, { "content": "class EnumeratedSort(Sort):", "metadata": "root.EnumeratedSort", "header": "['module', '___EOS___']", "index": 303 }, { "content": " def __init__(self,extension):\n self.extension = extension\n self.dom = []", "metadata": "root.EnumeratedSort.__init__", "header": "['class', 'EnumeratedSort', '(', 'Sort', ')', ':', '___EOS___']", "index": 304 }, { "content": "class ConstantSort(Sort):", "metadata": "root.ConstantSort", "header": "['module', '___EOS___']", "index": 314 }, { "content": " def __init__(self,rep,prover_sort = None):\n self.rep,self.prover_sort = rep,prover_sort\n self.rng = self\n self.dom = []", "metadata": "root.ConstantSort.__init__", "header": "['class', 'ConstantSort', '(', 'Sort', ')', ':', '___EOS___']", "index": 315 }, { "content": "class FunctionSort(Sort):", "metadata": "root.FunctionSort", "header": "['module', '___EOS___']", "index": 332 }, { "content": " def __init__(self,dom,rng):\n self.dom,self.rng = dom,rng", "metadata": "root.FunctionSort.__init__", "header": "['class', 'FunctionSort', '(', 'Sort', ')', ':', '___EOS___']", "index": 333 }, { "content": "class RelationSort(Sort):", "metadata": "root.RelationSort", "header": "['module', '___EOS___']", "index": 342 }, { "content": " def __init__(self,dom):\n self.dom = dom", "metadata": "root.RelationSort.__init__", "header": "['class', 'RelationSort', '(', 'Sort', ')', ':', '___EOS___']", "index": 343 }, { "content": "class Decl(AST):", "metadata": "root.Decl", "header": "['module', '___EOS___']", "index": 360 }, { "content": " def __init__(self,*args):\n self.args = args", "metadata": "root.Decl.__init__", "header": "['class', 'Decl', '(', 'AST', ')', ':', '___EOS___']", "index": 361 }, { "content": "class Instantiation(AST):", "metadata": "root.Instantiation", "header": "['module', '___EOS___']", "index": 409 }, { "content": " def __init__(self,*args):\n self.args = args", "metadata": "root.Instantiation.__init__", "header": "['class', 'Instantiation', '(', 'AST', ')', ':', '___EOS___']", "index": 410 }, { "content": "class TypeDef(Definition):", "metadata": "root.TypeDef", "header": "['module', '___EOS___']", "index": 566 }, { "content": " def __init__(self,name,sort):\n self.args = [name,sort]", "metadata": "root.TypeDef.__init__", "header": "['class', 'TypeDef', '(', 'Definition', ')', ':', '___EOS___']", "index": 567 }, { "content": "class ActionDef(Definition):", "metadata": "root.ActionDef", "header": "['module', '___EOS___']", "index": 575 }, { "content": " def __init__(self,atom,action,formals=[],returns=[]):\n # we rename the formals to avoid name capture\n self.formal_params = [s.prefix('fml:') for s in formals]\n self.formal_returns = [s.prefix('fml:') for s in returns]\n if formals or returns:\n subst = dict((x.rep,y.rep) for x,y in zip(formals+returns,self.formal_params+self.formal_returns))\n action = subst_prefix_atoms_ast(action,subst,None,None)\n self.args = [atom,action]", "metadata": "root.ActionDef.__init__", "header": "['class', 'ActionDef', '(', 'Definition', ')', ':', '___EOS___']", "index": 576 }, { "content": "class StateDef(Definition):", "metadata": "root.StateDef", "header": "['module', '___EOS___']", "index": 606 }, { "content": " def __init__(self,name,state):\n self.args = [Atom(name,[]),state]", "metadata": "root.StateDef.__init__", "header": "['class', 'StateDef', '(', 'Definition', ')', ':', '___EOS___']", "index": 607 }, { "content": "class Range(AST):", "metadata": "root.Range", "header": "['module', '___EOS___']", "index": 811 }, { "content": " def __init__(self,lo,hi):\n self.args = []\n self.lo, self.hi = lo,hi", "metadata": "root.Range.__init__", "header": "['class', 'Range', '(', 'AST', ')', ':', '___EOS___']", "index": 812 } ]
[ { "span": "class Symbol(AST):", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 18 }, { "span": "class Formula(AST):", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 19 }, { "span": "class Not(Formula):", "start_line": 65, "start_column": 0, "end_line": 65, "end_column": 19 }, { "span": "class Let(Formula):", "start_line": 77, "start_column": 0, "end_line": 77, "end_column": 19 }, { "span": "class Definition(Formula):", "start_line": 95, "start_column": 0, "end_line": 95, "end_column": 26 }, { "span": "class Implies(Formula):", "start_line": 111, "start_column": 0, "end_line": 111, "end_column": 23 }, { "span": "class Iff(Formula):", "start_line": 121, "start_column": 0, "end_line": 121, "end_column": 19 }, { "span": "class Ite(AST):", "start_line": 131, "start_column": 0, "end_line": 131, "end_column": 15 }, { "span": "class Quantifier(Formula):", "start_line": 141, "start_column": 0, "end_line": 141, "end_column": 26 }, { "span": "class Atom(Formula):", "start_line": 152, "start_column": 0, "end_line": 152, "end_column": 20 }, { "span": "class Old(Term):", "start_line": 196, "start_column": 0, "end_line": 196, "end_column": 16 }, { "span": "class App(Term):", "start_line": 202, "start_column": 0, "end_line": 202, "end_column": 16 }, { "span": "class Variable(Term):", "start_line": 229, "start_column": 0, "end_line": 229, "end_column": 21 }, { "span": "class Literal(AST):", "start_line": 253, "start_column": 0, "end_line": 253, "end_column": 19 }, { "span": "class EnumeratedSort(Sort):", "start_line": 303, "start_column": 0, "end_line": 303, "end_column": 27 }, { "span": "class ConstantSort(Sort):", "start_line": 314, "start_column": 0, "end_line": 314, "end_column": 25 }, { "span": "class FunctionSort(Sort):", "start_line": 332, "start_column": 0, "end_line": 332, "end_column": 25 }, { "span": "class RelationSort(Sort):", "start_line": 342, "start_column": 0, "end_line": 342, "end_column": 25 }, { "span": "class Decl(AST):", "start_line": 360, "start_column": 0, "end_line": 360, "end_column": 16 }, { "span": "class Instantiation(AST):", "start_line": 409, "start_column": 0, "end_line": 409, "end_column": 25 }, { "span": "class TypeDef(Definition):", "start_line": 566, "start_column": 0, "end_line": 566, "end_column": 26 }, { "span": "class ActionDef(Definition):", "start_line": 575, "start_column": 0, "end_line": 575, "end_column": 28 }, { "span": "class StateDef(Definition):", "start_line": 606, "start_column": 0, "end_line": 606, "end_column": 27 }, { "span": "class Range(AST):", "start_line": 811, "start_column": 0, "end_line": 811, "end_column": 17 } ]
[ { "span": "def __init__(self,*args):", "start_line": 16, "start_column": 4, "end_line": 16, "end_column": 29 }, { "span": "def __init__(self,rep,sort):", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 32 }, { "span": "def __init__(self,*args):", "start_line": 44, "start_column": 4, "end_line": 44, "end_column": 29 }, { "span": "def __init__(self,*args):", "start_line": 69, "start_column": 4, "end_line": 69, "end_column": 29 }, { "span": "def __init__(self,*args):", "start_line": 81, "start_column": 4, "end_line": 81, "end_column": 29 }, { "span": "def __init__(self,*args):", "start_line": 99, "start_column": 4, "end_line": 99, "end_column": 29 }, { "span": "def __init__(self,*args):", "start_line": 115, "start_column": 4, "end_line": 115, "end_column": 29 }, { "span": "def __init__(self,*args):", "start_line": 125, "start_column": 4, "end_line": 125, "end_column": 29 }, { "span": "def __init__(self,*args):", "start_line": 135, "start_column": 4, "end_line": 135, "end_column": 29 }, { "span": "def __init__(self, bounds, body):", "start_line": 142, "start_column": 4, "end_line": 142, "end_column": 37 }, { "span": "def __init__(self, relsym, *terms):", "start_line": 156, "start_column": 4, "end_line": 156, "end_column": 39 }, { "span": "def __init__(self, term):", "start_line": 197, "start_column": 4, "end_line": 197, "end_column": 29 }, { "span": "def __init__(self, funsym, *terms):", "start_line": 203, "start_column": 4, "end_line": 203, "end_column": 39 }, { "span": "def __init__(self, rep, sort):", "start_line": 230, "start_column": 4, "end_line": 230, "end_column": 34 }, { "span": "def __init__(self, polarity, atom):", "start_line": 258, "start_column": 4, "end_line": 258, "end_column": 39 }, { "span": "def __init__(self,extension):", "start_line": 304, "start_column": 4, "end_line": 304, "end_column": 33 }, { "span": "def __init__(self,rep,prover_sort = None):", "start_line": 315, "start_column": 4, "end_line": 315, "end_column": 46 }, { "span": "def __init__(self,dom,rng):", "start_line": 333, "start_column": 4, "end_line": 333, "end_column": 31 }, { "span": "def __init__(self,dom):", "start_line": 343, "start_column": 4, "end_line": 343, "end_column": 27 }, { "span": "def __init__(self,*args):", "start_line": 361, "start_column": 4, "end_line": 361, "end_column": 29 }, { "span": "def __init__(self,*args):", "start_line": 410, "start_column": 4, "end_line": 410, "end_column": 29 }, { "span": "def __init__(self,name,sort):", "start_line": 567, "start_column": 4, "end_line": 567, "end_column": 33 }, { "span": "def __init__(self,atom,action,formals=[],returns=[]):", "start_line": 576, "start_column": 4, "end_line": 576, "end_column": 57 }, { "span": "def __init__(self,name,state):", "start_line": 607, "start_column": 4, "end_line": 607, "end_column": 34 }, { "span": "def __init__(self,lo,hi):", "start_line": 812, "start_column": 4, "end_line": 812, "end_column": 29 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "AST_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Symbol_", "(_", "AST_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Symbol_", "(_", "AST_", ")_", ":_", "\\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_", ",_", "rep_", ",_", "sort_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "rep_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rep_", "=_", "rep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sort_", "=_", "sort_", "\\u\\u\\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_", "Formula_", "(_", "AST_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "for", " ", "formulas", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Formula_", "(_", "AST_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "list_", "(_", "args_", ")_", "#", " ", "make", " ", "args", " ", "mutable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Nega", "tion", " ", "of", " ", "a", " ", "formula", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Not_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "args_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Let", "_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Form", "ula", " ", "of", " ", "the", " ", "form", " ", "let", " ", "p", "(", "X", ",...", ",", "Z", ")", " ", "<-", ">", " ", "fm", "la", "[", "X", ",...", ",", "Z", "],", " ", "...", " ", "in", " ", "fm", "la", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Let", "_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "args_", ")_", ">=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Definition_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Form", "ula", " ", "of", " ", "the", " ", "form", " ", "p", "(", "X", ",...", ",", "Z", ")", " ", "<-", ">", " ", "fm", "la", "[", "X", ",...", ",", "Z", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Definition_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "args_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Impl", "ies_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Impl", "ication", " ", "of", " ", "formulas", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Impl", "ies_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "args_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "If", "f_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Impl", "ication", " ", "of", " ", "formulas", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "If", "f_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "args_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "It", "e_", "(_", "AST_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "If", "-", "the", "-", "else", " ", "express", "ion", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "It", "e_", "(_", "AST_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "args_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Quanti", "fier", "_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quanti", "fier", "_", "(_", "Formula_", ")_", ":_", "\\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_", ",_", "bounds_", ",_", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bounds_", "=_", "bounds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "[_", "body_", "]_", "\\u\\u\\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_", "Atom_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "n", "-", "ary", " ", "relation", " ", "symbol", " ", "applied", " ", "to", " ", "n", " ", "term", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "follow", "ing", " ", "for", " ", "back", "ward", " ", "compat_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Atom_", "(_", "Formula_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "rel", "sym_", ",_", "*_", "terms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rep_", "=_", "rel", "sym_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "flatten_", "(_", "terms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Old", "_", "(_", "Term_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Old", "_", "(_", "Term_", ")_", ":_", "\\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_", ",_", "term_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "[_", "term_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "App_", "(_", "Term_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App_", "(_", "Term_", ")_", ":_", "\\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_", ",_", "fun", "sym_", ",_", "*_", "terms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rep_", "=_", "fun", "sym_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "flatten_", "(_", "terms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Variable_", "(_", "Term_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Variable_", "(_", "Term_", ")_", ":_", "\\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_", ",_", "rep_", ",_", "sort_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "rep_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "assert", " ", "isin", "stance", "(", "sort", ",", "Sort", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "rep_", "=_", "rep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sort_", "=_", "sort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Literal_", "(_", "AST_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ei", "ther", " ", "a", " ", "posit", "ive", " ", "or", " ", "negati", "ve", " ", "atomi", "c", " ", "formula", ".", " ", "Lite", "ral", "s", " ", "are", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "formulas", "!", " ", "Us", "e", " ", "Not", "(", "Atom", "(...)", ")", " ", "to", " ", "get", " ", "a", " ", "formula", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Literal_", "(_", "AST_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "polarity", "_", ",_", "atom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "assert", " ", "isin", "stance", "(", "atom", ",", "Atom", ")", " ", "or", " ", "isin", "stance", "(", "atom", ",", "And", ")", " ", "and", " ", "len", "(", "atom", ".", "args", ")", " ", "==", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "polarity", "_", "=_", "polarity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "atom_", "=_", "atom_", "\\u\\u\\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_", "Enumerate", "d", "Sort_", "(_", "Sort_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enumerate", "d", "Sort_", "(_", "Sort_", ")_", ":_", "\\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_", ",_", "extension_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "extension_", "=_", "extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dom_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Const", "ant", "Sort_", "(_", "Sort_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Const", "ant", "Sort_", "(_", "Sort_", ")_", ":_", "\\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_", ",_", "rep_", ",_", "prove", "r", "\\u", "sort_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rep_", ",_", "self_", "._", "prove", "r", "\\u", "sort_", "=_", "rep_", ",_", "prove", "r", "\\u", "sort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rng_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dom_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Function", "Sort_", "(_", "Sort_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Sort_", "(_", "Sort_", ")_", ":_", "\\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_", ",_", "dom_", ",_", "rng_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dom_", ",_", "self_", "._", "rng_", "=_", "dom_", ",_", "rng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Relation", "Sort_", "(_", "Sort_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Relation", "Sort_", "(_", "Sort_", ")_", ":_", "\\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_", ",_", "dom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dom_", "=_", "dom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Decl", "_", "(_", "AST_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decl", "_", "(_", "AST_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Instant", "iation", "_", "(_", "AST_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Instant", "iation", "_", "(_", "AST_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Type", "Def_", "(_", "Definition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "Def_", "(_", "Definition_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "sort_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "[_", "name_", ",_", "sort_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Action", "Def_", "(_", "Definition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Action", "Def_", "(_", "Definition_", ")_", ":_", "\\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_", ",_", "atom_", ",_", "action_", ",_", "formal", "s_", "=_", "[_", "]_", ",_", "returns_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "rename", " ", "the", " ", "formal", "s", " ", "to", " ", "avoid", " ", "name", " ", "capture_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "formal", "\\u", "params_", "=_", "[_", "s_", "._", "prefix_", "(_", "'", "fm", "l", ":'_", ")_", "for_", "s_", "in_", "formal", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "formal", "\\u", "returns_", "=_", "[_", "s_", "._", "prefix_", "(_", "'", "fm", "l", ":'_", ")_", "for_", "s_", "in_", "returns_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formal", "s_", "or_", "returns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subst_", "=_", "dict_", "(_", "(_", "x_", "._", "rep_", ",_", "y_", "._", "rep_", ")_", "for_", "x_", ",_", "y_", "in_", "zip_", "(_", "formal", "s_", "+_", "returns_", ",_", "self_", "._", "formal", "\\u", "params_", "+_", "self_", "._", "formal", "\\u", "returns_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "subst", "\\u", "prefix", "\\u", "atom", "s", "\\u", "ast_", "(_", "action_", ",_", "subst_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "args_", "=_", "[_", "atom_", ",_", "action_", "]_", "\\u\\u\\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_", "State", "Def_", "(_", "Definition_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Def_", "(_", "Definition_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "[_", "Atom_", "(_", "name_", ",_", "[_", "]_", ")_", ",_", "state_", "]_", "\\u\\u\\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_", "Range_", "(_", "AST_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Range_", "(_", "AST_", ")_", ":_", "\\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_", ",_", "lo_", ",_", "hi_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lo_", ",_", "self_", "._", "hi_", "=_", "lo_", ",_", "hi_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 3,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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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
azoft-dev-team/imagrium/env/Lib/test/zxjdbc/zxtest.py
[ { "content": " def setUp(self):\n zxCoreTestCase.setUp(self)\n\n c = self.cursor()\n\n try:\n c.execute(\"drop table zxtesting\")\n self.db.commit()\n except:\n self.db.rollback()\n\n try:\n c.execute(\"create table zxtesting (id int not null, name varchar(32), state varchar(32), primary key (id))\")\n self.db.commit()\n c.execute(\"insert into zxtesting (id, name, state) values (1, 'test0', 'il')\")\n c.execute(\"insert into zxtesting (id, name, state) values (2, 'test1', 'wi')\")\n c.execute(\"insert into zxtesting (id, name, state) values (3, 'test2', 'tx')\")\n c.execute(\"insert into zxtesting (id, name, state) values (4, 'test3', 'co')\")\n c.execute(\"insert into zxtesting (id, name, state) values (5, 'test4', 'il')\")\n c.execute(\"insert into zxtesting (id, name, state) values (6, 'test5', 'ca')\")\n c.execute(\"insert into zxtesting (id, name, state) values (7, 'test6', 'wi')\")\n self.db.commit()\n finally:\n c.close()", "metadata": "root.zxJDBCTestCase.setUp", "header": "['class', 'zxJDBCTestCase', '(', 'zxCoreTestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def tearDown(self):\n\n c = self.cursor()\n try:\n try:\n c.execute(\"drop table zxtesting\")\n except:\n self.db.rollback()\n finally:\n c.close()\n\n zxCoreTestCase.tearDown(self)", "metadata": "root.zxJDBCTestCase.tearDown", "header": "['class', 'zxJDBCTestCase', '(', 'zxCoreTestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def _test_precision(self, (tabname, sql), diff, values, attr):\n\n try:\n c = self.cursor()\n try:\n c.execute(\"drop table %s\" % (tabname))\n self.db.commit()\n except:\n self.db.rollback()\n finally:\n c.close()\n\n try:\n c = self.cursor()\n c.execute(sql)\n c.execute(\"insert into %s (a, b) values (?, ?)\" % (tabname), map(lambda x: (0, x), values))\n c.execute(\"select a, b from %s\" % (tabname))\n f = c.fetchall()\n assert len(values) == len(f), \"mismatched result set length\"\n for i in range(0, len(f)):\n v = values[i]\n if attr: v = getattr(v, attr)()\n msg = \"expected [%0.10f], got [%0.10f] for index [%d] of [%d]\" % (v, f[i][1], (i+1), len(f))\n assert diff(f[i][1], values[i]) < 0.01, msg\n self.db.commit()\n finally:\n c.close()\n try:\n c = self.cursor()\n try:\n c.execute(\"drop table %s\" % (tabname))\n self.db.commit()\n except:\n self.db.rollback()\n finally:\n c.close()", "metadata": "root.zxAPITestCase._test_precision", "header": "['class', 'zxAPITestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 558 }, { "content": " def testRowid(self):\n \"\"\"testing the autoincrement facilities of the different handlers\"\"\"\n assert self.has_table(\"autoincrementtable\"), \"no autoincrement table\"\n\n c = self.cursor()\n assert c.lastrowid == None, \"expected initial lastrowid to be None\"\n\n try:\n\n tabname, sql = self.table(\"autoincrementtable\")\n c.execute(sql)\n\n c.execute(\"insert into %s (b) values (?)\" % (tabname), [(0,)])\n assert c.lastrowid is not None, \"lastrowid is None\"\n\n try:\n for idx in range(c.lastrowid + 1, c.lastrowid + 25):\n c.execute(\"insert into %s (b) values (?)\" % (tabname), [(idx,)])\n assert c.lastrowid is not None, \"lastrowid is None\"\n self.assertEquals(idx, c.lastrowid)\n except:\n self.db.rollback()\n\n finally:\n if self.has_table(\"post_autoincrementtable\"):\n try:\n sequence, sql = self.table(\"post_autoincrementtable\")\n c.execute(sql)\n self.db.commit()\n except:\n self.db.rollback()\n\n try:\n c.execute(\"drop table %s\" % (tabname))\n self.db.commit()\n except:\n self.db.rollback()\n\n self.db.commit()\n c.close()", "metadata": "root.zxAPITestCase.testRowid", "header": "['class', 'zxAPITestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 875 }, { "content": " def testDBPipe(self):\n \"\"\"testing the DB pipe\"\"\"\n from com.ziclix.python.sql.pipe import Pipe\n from com.ziclix.python.sql.pipe.db import DBSource, DBSink\n\n try:\n src = self.connect()\n dst = self.connect()\n\n c = self.cursor()\n c.execute(\"create table zxtestingbcp (id int not null, name varchar(20), state varchar(2), primary key (id))\")\n self.db.commit()\n\n c.execute(\"select count(*) from zxtesting\")\n one = c.fetchone()[0]\n c.close()\n\n dbSource = DBSource(src, c.datahandler.__class__, \"zxtesting\", None, None, None)\n dbSink = DBSink(dst, c.datahandler.__class__, \"zxtestingbcp\", None, None, 1)\n\n cnt = Pipe().pipe(dbSource, dbSink) - 1 # ignore the header row\n\n c = self.cursor()\n c.execute(\"select count(*) from zxtestingbcp\")\n two = c.fetchone()[0]\n c.execute(\"delete from zxtestingbcp\")\n self.db.commit()\n c.close()\n\n assert one == two, \"expected [%d] rows in destination, got [%d] (sql)\" % (one, two)\n assert one == cnt, \"expected [%d] rows in destination, got [%d] (bcp)\" % (one, cnt)\n\n # this tests the internal assert in BCP. we need to handle the case where we exclude\n # all the rows queried (based on the fact no columns exist) but rows were fetched\n # also make sure (eg, Oracle) that the column name case is ignored\n dbSource = DBSource(src, c.datahandler.__class__, \"zxtesting\", None, [\"id\"], None)\n dbSink = DBSink(dst, c.datahandler.__class__, \"zxtestingbcp\", [\"id\"], None, 1)\n\n self.assertRaises(zxJDBC.Error, Pipe().pipe, dbSource, dbSink)\n\n params = [(4,)]\n\n dbSource = DBSource(src, c.datahandler.__class__, \"zxtesting\", \"id > ?\", None, params)\n dbSink = DBSink(dst, c.datahandler.__class__, \"zxtestingbcp\", None, None, 1)\n\n cnt = Pipe().pipe(dbSource, dbSink) - 1 # ignore the header row\n\n c = self.cursor()\n c.execute(\"select count(*) from zxtesting where id > ?\", params)\n one = c.fetchone()[0]\n c.execute(\"select count(*) from zxtestingbcp\")\n two = c.fetchone()[0]\n c.close()\n assert one == two, \"expected [%d] rows in destination, got [%d] (sql)\" % (one, two)\n assert one == cnt, \"expected [%d] rows in destination, got [%d] (bcp)\" % (one, cnt)\n\n finally:\n try:\n c = self.cursor()\n try:\n c.execute(\"drop table zxtestingbcp\")\n self.db.commit()\n except:\n self.db.rollback()\n finally:\n c.close()\n\n try:\n src.close()\n except:\n src = None\n try:\n dst.close()\n except:\n dst = None", "metadata": "root.BCPTestCase.testDBPipe", "header": "['class', 'BCPTestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 1093 }, { "content": " def testBCP(self):\n \"\"\"testing bcp parameters and functionality\"\"\"\n from com.ziclix.python.sql.util import BCP\n\n import dbexts\n\n try:\n src = self.connect()\n dst = self.connect()\n\n c = self.cursor()\n c.execute(\"create table zxtestingbcp (id int not null, name varchar(20), state varchar(2), primary key (id))\")\n self.db.commit()\n\n c.execute(\"select count(*) from zxtesting\")\n one = c.fetchone()[0]\n c.close()\n\n b = BCP(src, dst)\n if hasattr(self, \"datahandler\"):\n b.sourceDataHandler = self.datahandler\n b.destinationDataHandler = self.datahandler\n cnt = b.bcp(\"zxtesting\", toTable=\"zxtestingbcp\")\n\n c = self.cursor()\n c.execute(\"select count(*) from zxtestingbcp\")\n two = c.fetchone()[0]\n c.execute(\"delete from zxtestingbcp\")\n self.db.commit()\n c.close()\n\n assert one == two, \"expected [%d] rows in destination, got [%d] (sql)\" % (one, two)\n assert one == cnt, \"expected [%d] rows in destination, got [%d] (bcp)\" % (one, cnt)\n\n # this tests the internal assert in BCP. we need to handle the case where we exclude\n # all the rows queried (based on the fact no columns exist) but rows were fetched\n # also make sure (eg, Oracle) that the column name case is ignored\n self.assertRaises(zxJDBC.Error, b.bcp, \"zxtesting\", toTable=\"zxtestingbcp\", include=[\"id\"], exclude=[\"id\"])\n\n params = [(4,)]\n cnt = b.bcp(\"zxtesting\", \"id > ?\", params, toTable=\"zxtestingbcp\")\n\n c = self.cursor()\n c.execute(\"select count(*) from zxtesting where id > ?\", params)\n one = c.fetchone()[0]\n c.execute(\"select count(*) from zxtestingbcp\")\n two = c.fetchone()[0]\n c.close()\n assert one == two, \"expected [%d] rows in destination, got [%d] (sql)\" % (one, two)\n assert one == cnt, \"expected [%d] rows in destination, got [%d] (bcp)\" % (one, cnt)\n\n finally:\n try:\n c = self.cursor()\n try:\n c.execute(\"drop table zxtestingbcp\")\n self.db.commit()\n except:\n self.db.rollback()\n finally:\n c.close()\n\n try:\n src.close()\n except:\n src = None\n try:\n dst.close()\n except:\n dst = None", "metadata": "root.BCPTestCase.testBCP", "header": "['class', 'BCPTestCase', '(', 'zxJDBCTestCase', ')', ':', '___EOS___']", "index": 1169 } ]
[ { "span": "except:", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 15 }, { "span": "except:", "start_line": 65, "start_column": 12, "end_line": 65, "end_column": 19 }, { "span": "except:", "start_line": 565, "start_column": 12, "end_line": 565, "end_column": 19 }, { "span": "except:", "start_line": 590, "start_column": 16, "end_line": 590, "end_column": 23 }, { "span": "except:", "start_line": 895, "start_column": 12, "end_line": 895, "end_column": 19 }, { "span": "except:", "start_line": 904, "start_column": 16, "end_line": 904, "end_column": 23 }, { "span": "except:", "start_line": 910, "start_column": 12, "end_line": 910, "end_column": 19 }, { "span": "except:", "start_line": 1155, "start_column": 16, "end_line": 1155, "end_column": 23 }, { "span": "except:", "start_line": 1162, "start_column": 12, "end_line": 1162, "end_column": 19 }, { "span": "except:", "start_line": 1166, "start_column": 12, "end_line": 1166, "end_column": 19 }, { "span": "except:", "start_line": 1226, "start_column": 16, "end_line": 1226, "end_column": 23 }, { "span": "except:", "start_line": 1233, "start_column": 12, "end_line": 1233, "end_column": 19 }, { "span": "except:", "start_line": 1237, "start_column": 12, "end_line": 1237, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "zx", "JD", "BC", "Test", "Case_", "(_", "zx", "Core", "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 ", " _", "zx", "Core", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\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 ", " _", "c_", "._", "execute_", "(_", "\"", "drop", " ", "table", " ", "zx", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\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 ", " _", "c_", "._", "execute_", "(_", "\"", "create", " ", "table", " ", "zx", "testi", "ng", " ", "(", "id", " ", "int", " ", "not", " ", "null", ",", " ", "name", " ", "var", "char", "(", "32", "),", " ", "state", " ", "var", "char", "(", "32", "),", " ", "primary", " ", "key", " ", "(", "id", "))\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(", "1", ",", " ", "'", "test0", "',", " ", "'", "il", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(", "2", ",", " ", "'", "test", "1", "',", " ", "'", "wi", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(", "3", ",", " ", "'", "test", "2", "',", " ", "'", "tx", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(", "4", ",", " ", "'", "test", "3", "',", " ", "'", "co", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(", "5", ",", " ", "'", "test", "4", "',", " ", "'", "il", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(", "6", ",", " ", "'", "test", "5", "',", " ", "'", "ca", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "zx", "testi", "ng", " ", "(", "id", ",", " ", "name", ",", " ", "state", ")", " ", "values", " ", "(", "7", ",", " ", "'", "test", "6", "',", " ", "'", "wi", "')\"_", ")_", "\\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 ", " _", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "zx", "JD", "BC", "Test", "Case_", "(_", "zx", "Core", "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_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "(_", "\"", "drop", " ", "table", " ", "zx", "testi", "ng", "\"_", ")_", "\\u\\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_", "._", "db_", "._", "rollback_", "(_", ")_", "\\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_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zx", "Core", "Test", "Case_", "._", "tear", "Down_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[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_", "def_", "\\u", "test\\u", "precision_", "(_", "self_", ",_", "(_", "tab", "name_", ",_", "sql_", ")_", ",_", "diff_", ",_", "values_", ",_", "attr_", ")_", ":_", "\\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 ", " _", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\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_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\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_", "._", "close_", "(_", ")_", "\\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 ", " _", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "%", "s", " ", "(", "a", ",", " ", "b", ")", " ", "values", " ", "(?", ",", " ", "?)\"_", "%_", "(_", "tab", "name_", ")_", ",_", "map_", "(_", "lambda_", "x_", ":_", "(_", "0_", ",_", "x_", ")_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "a", ",", " ", "b", " ", "from", " ", "%", "s", "\"_", "%_", "(_", "tab", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "c_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "values_", ")_", "==_", "len_", "(_", "f_", ")_", ",_", "\"", "mismatche", "d", " ", "result", " ", "set", " ", "length", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "f_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "values_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attr_", ":_", "v_", "=_", "getattr_", "(_", "v_", ",_", "attr_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"", "expected", " ", "[", "%", "0.10", "f", "],", " ", "got", " ", "[", "%", "0.10", "f", "]", " ", "for", " ", "index", " ", "[", "%", "d", "]", " ", "of", " ", "[", "%", "d", "]\"_", "%_", "(_", "v_", ",_", "f_", "[_", "i_", "]_", "[_", "1_", "]_", ",_", "(_", "i_", "+_", "1_", ")_", ",_", "len_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "diff_", "(_", "f_", "[_", "i_", "]_", "[_", "1_", "]_", ",_", "values_", "[_", "i_", "]_", ")_", "<_", "0.01_", ",_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " _", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "(_", "\"", "drop", " ", "table", " ", "%", "s", "\"_", "%_", "(_", "tab", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\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_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[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", "Row", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "testi", "ng", " ", "the", " ", "autoi", "ncr", "ement", " ", "facilit", "ies", " ", "of", " ", "the", " ", "different", " ", "handler", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "has", "\\u", "table_", "(_", "\"", "autoi", "ncr", "ement", "table", "\"_", ")_", ",_", "\"", "no", " ", "autoi", "ncr", "ement", " ", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "._", "lastr", "owi", "d_", "==_", "None_", ",_", "\"", "expected", " ", "initial", " ", "lastr", "owi", "d", " ", "to", " ", "be", " ", "Non", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab", "name_", ",_", "sql_", "=_", "self_", "._", "table_", "(_", "\"", "autoi", "ncr", "ement", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "%", "s", " ", "(", "b", ")", " ", "values", " ", "(?", ")\"_", "%_", "(_", "tab", "name_", ")_", ",_", "[_", "(_", "0_", ",_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "._", "lastr", "owi", "d_", "is_", "not_", "None_", ",_", "\"", "lastr", "owi", "d", " ", "is", " ", "Non", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "idx_", "in_", "range_", "(_", "c_", "._", "lastr", "owi", "d_", "+_", "1_", ",_", "c_", "._", "lastr", "owi", "d_", "+_", "25_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "c_", "._", "execute_", "(_", "\"", "insert", " ", "int", "o", " ", "%", "s", " ", "(", "b", ")", " ", "values", " ", "(?", ")\"_", "%_", "(_", "tab", "name_", ")_", ",_", "[_", "(_", "idx_", ",_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "._", "lastr", "owi", "d_", "is_", "not_", "None_", ",_", "\"", "lastr", "owi", "d", " ", "is", " ", "Non", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "idx_", ",_", "c_", "._", "lastr", "owi", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "table_", "(_", "\"", "post", "\\u", "autoi", "ncr", "ement", "table", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sequence_", ",_", "sql_", "=_", "self_", "._", "table_", "(_", "\"", "post", "\\u", "autoi", "ncr", "ement", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "execute_", "(_", "\"", "drop", " ", "table", " ", "%", "s", "\"_", "%_", "(_", "tab", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "DB", "Pipe_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "testi", "ng", " ", "the", " ", "DB", " ", "pipe", "\"\"\"_", "\\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_", ",_", "DB", "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_", "dst_", "=_", "self_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "create", " ", "table", " ", "zx", "testi", "ng", "bc", "p", " ", "(", "id", " ", "int", " ", "not", " ", "null", ",", " ", "name", " ", "var", "char", "(", "20", "),", " ", "state", " ", "var", "char", "(", "2", "),", " ", "primary", " ", "key", " ", "(", "id", "))\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "one_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "db", "Sink_", "=_", "DB", "Sink_", "(_", "dst_", ",_", "c_", "._", "data", "handler_", "._", "\\u\\u", "class\\u\\u_", ",_", "\"", "zx", "testi", "ng", "bc", "p", "\"_", ",_", "None_", ",_", "None_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "Pipe_", "(_", ")_", "._", "pipe_", "(_", "db", "Source_", ",_", "db", "Sink_", ")_", "-_", "1_", "#", " ", "ignore", " ", "the", " ", "header", " ", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "two_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "delete", " ", "from", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "one_", "==_", "two_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "sql", ")\"_", "%_", "(_", "one_", ",_", "two_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "one_", "==_", "cnt_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "bc", "p", ")\"_", "%_", "(_", "one_", ",_", "cnt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "tests", " ", "the", " ", "internal", " ", "assert", " ", "in", " ", "BC", "P", ".", " ", " ", "we", " ", "need", " ", "to", " ", "handle", " ", "the", " ", "case", " ", "where", " ", "we", " ", "exclude_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "the", " ", "rows", " ", "queried", " ", "(", "based", " ", "on", " ", "the", " ", "fact", " ", "no", " ", "column", "s", " ", "exist", ")", " ", "but", " ", "rows", " ", "wer", "e", " ", "fetched", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "als", "o", " ", "make", " ", "sure", " ", "(", "eg", ",", " ", "Ora", "cle", ")", " ", "tha", "t", " ", "the", " ", "column", " ", "name", " ", "case", " ", "is", " ", "ignored_", "\\u\\u\\uNL\\u\\u\\u_", "db", "Source_", "=_", "DB", "Source_", "(_", "src_", ",_", "c_", "._", "data", "handler_", "._", "\\u\\u", "class\\u\\u_", ",_", "\"", "zx", "testi", "ng", "\"_", ",_", "None_", ",_", "[_", "\"", "id", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Sink_", "=_", "DB", "Sink_", "(_", "dst_", ",_", "c_", "._", "data", "handler_", "._", "\\u\\u", "class\\u\\u_", ",_", "\"", "zx", "testi", "ng", "bc", "p", "\"_", ",_", "[_", "\"", "id", "\"_", "]_", ",_", "None_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "zx", "JD", "BC_", "._", "Error_", ",_", "Pipe_", "(_", ")_", "._", "pipe_", ",_", "db", "Source_", ",_", "db", "Sink_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "[_", "(_", "4_", ",_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "Source_", "=_", "DB", "Source_", "(_", "src_", ",_", "c_", "._", "data", "handler_", "._", "\\u\\u", "class\\u\\u_", ",_", "\"", "zx", "testi", "ng", "\"_", ",_", "\"", "id", " ", ">", " ", "?\"_", ",_", "None_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Sink_", "=_", "DB", "Sink_", "(_", "dst_", ",_", "c_", "._", "data", "handler_", "._", "\\u\\u", "class\\u\\u_", ",_", "\"", "zx", "testi", "ng", "bc", "p", "\"_", ",_", "None_", ",_", "None_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cnt_", "=_", "Pipe_", "(_", ")_", "._", "pipe_", "(_", "db", "Source_", ",_", "db", "Sink_", ")_", "-_", "1_", "#", " ", "ignore", " ", "the", " ", "header", " ", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", " ", "where", " ", "id", " ", ">", " ", "?\"_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "one_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "two_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "one_", "==_", "two_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "sql", ")\"_", "%_", "(_", "one_", ",_", "two_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "one_", "==_", "cnt_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "bc", "p", ")\"_", "%_", "(_", "one_", ",_", "cnt_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "(_", "\"", "drop", " ", "table", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\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_", "._", "close_", "(_", ")_", "\\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 ", " _", "src_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst_", "=_", "None_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "BC", "P_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "testi", "ng", " ", "bc", "p", " ", "parameter", "s", " ", "and", " ", "functional", "it", "y", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com_", "._", "zi", "cli", "x_", "._", "python_", "._", "sql_", "._", "util_", "import_", "BC", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "dbe", "xt", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "self_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "self_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "create", " ", "table", " ", "zx", "testi", "ng", "bc", "p", " ", "(", "id", " ", "int", " ", "not", " ", "null", ",", " ", "name", " ", "var", "char", "(", "20", "),", " ", "state", " ", "var", "char", "(", "2", "),", " ", "primary", " ", "key", " ", "(", "id", "))\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "one_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "BC", "P_", "(_", "src_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "data", "handler", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "source", "Data", "Handler_", "=_", "self_", "._", "data", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "destinat", "ion", "Data", "Handler_", "=_", "self_", "._", "data", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cnt_", "=_", "b_", "._", "bc", "p_", "(_", "\"", "zx", "testi", "ng", "\"_", ",_", "to", "Table_", "=_", "\"", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "two_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "delete", " ", "from", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "one_", "==_", "two_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "sql", ")\"_", "%_", "(_", "one_", ",_", "two_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "one_", "==_", "cnt_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "bc", "p", ")\"_", "%_", "(_", "one_", ",_", "cnt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "tests", " ", "the", " ", "internal", " ", "assert", " ", "in", " ", "BC", "P", ".", " ", " ", "we", " ", "need", " ", "to", " ", "handle", " ", "the", " ", "case", " ", "where", " ", "we", " ", "exclude_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "the", " ", "rows", " ", "queried", " ", "(", "based", " ", "on", " ", "the", " ", "fact", " ", "no", " ", "column", "s", " ", "exist", ")", " ", "but", " ", "rows", " ", "wer", "e", " ", "fetched", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "als", "o", " ", "make", " ", "sure", " ", "(", "eg", ",", " ", "Ora", "cle", ")", " ", "tha", "t", " ", "the", " ", "column", " ", "name", " ", "case", " ", "is", " ", "ignored_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "zx", "JD", "BC_", "._", "Error_", ",_", "b_", "._", "bc", "p_", ",_", "\"", "zx", "testi", "ng", "\"_", ",_", "to", "Table_", "=_", "\"", "zx", "testi", "ng", "bc", "p", "\"_", ",_", "include_", "=_", "[_", "\"", "id", "\"_", "]_", ",_", "exclude_", "=_", "[_", "\"", "id", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "[_", "(_", "4_", ",_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cnt_", "=_", "b_", "._", "bc", "p_", "(_", "\"", "zx", "testi", "ng", "\"_", ",_", "\"", "id", " ", ">", " ", "?\"_", ",_", "params_", ",_", "to", "Table_", "=_", "\"", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "self_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", " ", "where", " ", "id", " ", ">", " ", "?\"_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "one_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "\"", "select", " ", "count", "(*", ")", " ", "from", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "two_", "=_", "c_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "one_", "==_", "two_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "sql", ")\"_", "%_", "(_", "one_", ",_", "two_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "one_", "==_", "cnt_", ",_", "\"", "expected", " ", "[", "%", "d", "]", " ", "rows", " ", "in", " ", "destinat", "ion", ",", " ", "got", " ", "[", "%", "d", "]", " ", "(", "bc", "p", ")\"_", "%_", "(_", "one_", ",_", "cnt_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "(_", "\"", "drop", " ", "table", " ", "zx", "testi", "ng", "bc", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "db_", "._", "rollback_", "(_", ")_", "\\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_", "._", "close_", "(_", ")_", "\\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 ", " _", "src_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst_", "=_", "None_" ]
[ 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, 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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, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
First argument to super() is not enclosing class
dimagi/commcare-hq/corehq/apps/domain/views.py
[ { "content": " @method_decorator(domain_admin_required)\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.BaseAdminProjectSettingsView.dispatch", "header": "['class', 'BaseAdminProjectSettingsView', '(', 'BaseProjectSettingsView', ')', ':', '___EOS___']", "index": 321 }, { "content": " @method_decorator(domain_admin_required)\n @use_select2\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.EditBasicProjectInfoView.dispatch", "header": "['class', 'EditBasicProjectInfoView', '(', 'BaseEditProjectInfoView', ')', ':', '___EOS___']", "index": 357 }, { "content": " @method_decorator(login_and_domain_required)\n @use_bootstrap3\n def dispatch(self, *args, **kwargs):\n return super(LoginAndDomainMixin, self).dispatch(*args, **kwargs)", "metadata": "root.EditMyProjectSettingsView.dispatch", "header": "['class', 'EditMyProjectSettingsView', '(', 'BaseProjectSettingsView', ')', ':', '___EOS___']", "index": 454 }, { "content": " @method_decorator(domain_admin_required)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.EditPrivacySecurityView.dispatch", "header": "['class', 'EditPrivacySecurityView', '(', 'BaseAdminProjectSettingsView', ')', ':', '___EOS___']", "index": 1361 }, { "content": " @method_decorator(domain_admin_required)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.ExchangeSnapshotsView.dispatch", "header": "['class', 'ExchangeSnapshotsView', '(', 'BaseAdminProjectSettingsView', ')', ':', '___EOS___']", "index": 1729 }, { "content": " @method_decorator(domain_admin_required)\n @use_bootstrap3\n @use_jquery_ui\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.CreateNewExchangeSnapshotView.dispatch", "header": "['class', 'CreateNewExchangeSnapshotView', '(', 'BaseAdminProjectSettingsView', ')', ':', '___EOS___']", "index": 1749 }, { "content": " @method_decorator(domain_admin_required)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.ManageProjectMediaView.dispatch", "header": "['class', 'ManageProjectMediaView', '(', 'BaseAdminProjectSettingsView', ')', ':', '___EOS___']", "index": 2038 }, { "content": " @method_decorator(domain_admin_required)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.DomainForwardingOptionsView.dispatch", "header": "['class', 'DomainForwardingOptionsView', '(', 'BaseAdminProjectSettingsView', ',', 'RepeaterMixin', ')', ':', '___EOS___']", "index": 2272 }, { "content": " @method_decorator(domain_admin_required)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.AddRepeaterView.dispatch", "header": "['class', 'AddRepeaterView', '(', 'BaseAdminProjectSettingsView', ',', 'RepeaterMixin', ')', ':', '___EOS___']", "index": 2299 }, { "content": " @method_decorator(login_and_domain_required)\n @method_decorator(require_superuser)\n @use_bootstrap3\n @use_jquery_ui\n @use_jquery_ui_multiselect\n def dispatch(self, request, *args, **kwargs):\n return super(BaseInternalDomainSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.EditInternalDomainInfoView.dispatch", "header": "['class', 'EditInternalDomainInfoView', '(', 'BaseInternalDomainSettingsView', ')', ':', '___EOS___']", "index": 2413 }, { "content": " @method_decorator(login_and_domain_required)\n @method_decorator(require_superuser)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseInternalDomainSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.EditInternalCalculationsView.dispatch", "header": "['class', 'EditInternalCalculationsView', '(', 'BaseInternalDomainSettingsView', ')', ':', '___EOS___']", "index": 2512 }, { "content": " @method_decorator(domain_admin_required)\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(BaseProjectSettingsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.FeaturePreviewsView.dispatch", "header": "['class', 'FeaturePreviewsView', '(', 'BaseAdminProjectSettingsView', ')', ':', '___EOS___']", "index": 2671 } ]
[ { "span": "super(BaseProjectSettingsView, self).", "start_line": 323, "start_column": 15, "end_line": 323, "end_column": 51 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 361, "start_column": 15, "end_line": 361, "end_column": 51 }, { "span": "super(LoginAndDomainMixin, self).", "start_line": 457, "start_column": 15, "end_line": 457, "end_column": 47 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 1364, "start_column": 15, "end_line": 1364, "end_column": 51 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 1732, "start_column": 15, "end_line": 1732, "end_column": 51 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 1753, "start_column": 15, "end_line": 1753, "end_column": 51 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 2041, "start_column": 15, "end_line": 2041, "end_column": 51 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 2275, "start_column": 15, "end_line": 2275, "end_column": 51 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 2302, "start_column": 15, "end_line": 2302, "end_column": 51 }, { "span": "super(BaseInternalDomainSettingsView, self).", "start_line": 2419, "start_column": 15, "end_line": 2419, "end_column": 58 }, { "span": "super(BaseInternalDomainSettingsView, self).", "start_line": 2516, "start_column": 15, "end_line": 2516, "end_column": 58 }, { "span": "super(BaseProjectSettingsView, self).", "start_line": 2674, "start_column": 15, "end_line": 2674, "end_column": 51 } ]
[]
1
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", "(_", "Base", "Project", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Edit", "Basic", "Project", "Info", "View_", "(_", "Base", "Edit", "Project", "Info", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "select", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Edit", "My", "Project", "Sett", "ings", "View_", "(_", "Base", "Project", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "login", "\\u", "and", "\\u", "domain", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Logi", "n", "And", "Doma", "in", "Mixin_", ",_", "self_", ")_", "._", "dispatch_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Edit", "Priva", "cy", "Secur", "it", "y", "View_", "(_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exc", "hange", "Snapshot", "s", "View_", "(_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "New", "Exc", "hange", "Snapshot", "View_", "(_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "jq", "uer", "y", "\\u", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Manage", "Project", "Media", "View_", "(_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Doma", "in", "Forward", "ing", "Optio", "ns", "View_", "(_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", ",_", "Repeat", "er", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Repeat", "er", "View_", "(_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", ",_", "Repeat", "er", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Edit", "Intern", "al", "Doma", "in", "Info", "View_", "(_", "Base", "Intern", "al", "Doma", "in", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "login", "\\u", "and", "\\u", "domain", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "require", "\\u", "superuser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "jq", "uer", "y", "\\u", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "jq", "uer", "y", "\\u", "ui", "\\u", "multis", "elect", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Intern", "al", "Doma", "in", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Edit", "Intern", "al", "Calculat", "ion", "s", "View_", "(_", "Base", "Intern", "al", "Doma", "in", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "login", "\\u", "and", "\\u", "domain", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "require", "\\u", "superuser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Intern", "al", "Doma", "in", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Feature", "Preview", "s", "View_", "(_", "Base", "Admi", "n", "Project", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Base", "Project", "Sett", "ings", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4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ano-Lights/models/lm_gru.py
[ { "content": " def __init__(self, data, hp):\n super(LM_gru, self).__init__(self.__class__.__name__, data, hp)\n \n self.n_h = 256\n self.dropout = 0.5\n\n self.params = Parameters()\n self.hiddenstates = Parameters()\n n_tokens = self.data['n_tokens']\n n_h = self.n_h\n scale = hp.init_scale\n gates = 3\n\n with self.hiddenstates:\n b1_h = shared_zeros((self.hp.batch_size, n_h))\n b2_h = shared_zeros((self.hp.batch_size, n_h))\n\n if hp.load_model and os.path.isfile(self.filename):\n self.params.load(self.filename)\n else:\n with self.params:\n W_emb = shared_normal((n_tokens, n_h), scale=scale)\n \n W1 = shared_normal((n_h, n_h*gates), scale=scale*1.5)\n V1 = shared_normal((n_h, n_h*gates), scale=scale*1.5)\n b1 = shared_zeros((n_h*gates))\n \n W2 = shared_normal((n_h, n_h*gates), scale=scale*1.5)\n V2 = shared_normal((n_h, n_h*gates), scale=scale*1.5)\n b2 = shared_zeros((n_h*gates,))\n\n \n def lstm(X, h, c, W, U, b):\n g_on = T.dot(X,W) + T.dot(h,U) + b\n i_on = T.nnet.sigmoid(g_on[:,:n_h])\n f_on = T.nnet.sigmoid(g_on[:,n_h:2*n_h])\n o_on = T.nnet.sigmoid(g_on[:,2*n_h:3*n_h])\n c = f_on * c + i_on * T.tanh(g_on[:,3*n_h:])\n h = o_on * T.tanh(c)\n return h, c\n\n def gru(X, h, W, U, b):\n z_t = T.nnet.sigmoid(T.dot(X,W[:,:n_h]) + T.dot(h,U[:,:n_h]) + b[:n_h])\n r_t = T.nnet.sigmoid(T.dot(X,W[:,n_h:2*n_h]) + T.dot(h,U[:,n_h:2*n_h]) + b[n_h:2*n_h])\n h_t = T.tanh(T.dot(X,W[:,2*n_h:3*n_h]) + r_t * T.dot(h,U[:,2*n_h:3*n_h]) + b[2*n_h:3*n_h])\n return (1 - z_t) * h + z_t * h_t\n\n def sgru(X, h, W, U, b):\n z_t = T.tanh(T.dot(X,W[:,:n_h]) + T.dot(h,U[:,:n_h]) + b[:n_h])\n h_t = T.tanh(T.dot(X,W[:,1*n_h:2*n_h]) + T.dot(h,U[:,1*n_h:2*n_h]) + b[1*n_h:2*n_h])\n return z_t * h_t\n\n def model(x, p, p_dropout):\n input_size = x.shape[1]\n\n h0 = p.W_emb[x] # (seq_len, batch_size, emb_size)\n h0 = dropout(h0, p_dropout)\n\n cost, h1, h2 = [0., b1_h, b2_h]\n \n for t in xrange(0, self.hp.seq_size):\n if t >= self.hp.warmup_size:\n pyx = softmax(T.dot(dropout(h2, p_dropout), T.transpose(p.W_emb)))\n cost += T.sum(T.nnet.categorical_crossentropy(pyx, theano_one_hot(x[t], n_tokens)))\n\n h1 = gru(h0[t], h1, p.W1, p.V1, p.b1)\n h2 = gru(dropout(h1, p_dropout), h2, p.W2, p.V2, p.b2)\n\n h_updates = [(b1_h, h1), (b2_h, h2)]\n\n return cost, h_updates\n \n cost, h_updates = model(self.X, self.params, self.dropout)\n te_cost, te_h_updates = model(self.X, self.params, 0.)\n\n self.compile(cost, te_cost, h_updates, te_h_updates)", "metadata": "root.LM_gru.__init__", "header": "['class', 'LM_gru', '(', 'ModelLMBase', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "W_emb ", "start_line": 35, "start_column": 16, "end_line": 35, "end_column": 21 }, { "span": "W1 ", "start_line": 37, "start_column": 16, "end_line": 37, "end_column": 18 }, { "span": "V1 ", "start_line": 38, "start_column": 16, "end_line": 38, "end_column": 18 }, { "span": "b1 ", "start_line": 39, "start_column": 16, "end_line": 39, "end_column": 18 }, { "span": "W2 ", "start_line": 41, "start_column": 16, "end_line": 41, "end_column": 18 }, { "span": "V2 ", "start_line": 42, "start_column": 16, "end_line": 42, "end_column": 18 }, { "span": "b2 ", "start_line": 43, "start_column": 16, "end_line": 43, "end_column": 18 }, { "span": "lstm(", "start_line": 46, "start_column": 12, "end_line": 46, "end_column": 16 }, { "span": "sgru(", "start_line": 61, "start_column": 12, "end_line": 61, "end_column": 16 }, { "span": "input_size ", "start_line": 67, "start_column": 12, "end_line": 67, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "LM", "\\u", "gru", "_", "(_", "Model", "LM", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "data_", ",_", "hp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "LM", "\\u", "gru", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "data_", ",_", "hp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "n", "\\u", "h_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dropout_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "params_", "=_", "Parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hidden", "states_", "=_", "Parameters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "tokens_", "=_", "self_", "._", "data_", "[_", "'", "n", "\\u", "token", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "h_", "=_", "self_", "._", "n", "\\u", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "hp_", "._", "init", "\\u", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gates", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "hidden", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b1", "\\u", "h_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "hp_", "._", "batch", "\\u", "size_", ",_", "n", "\\u", "h_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2", "\\u", "h_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "hp_", "._", "batch", "\\u", "size_", ",_", "n", "\\u", "h_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hp_", "._", "load", "\\u", "model_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "self_", "._", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "._", "load_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "W", "\\u", "emb_", "=_", "shared", "\\u", "normal_", "(_", "(_", "n", "\\u", "tokens_", ",_", "n", "\\u", "h_", ")_", ",_", "scale_", "=_", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "W1", "_", "=_", "shared", "\\u", "normal_", "(_", "(_", "n", "\\u", "h_", ",_", "n", "\\u", "h_", "*_", "gates", "_", ")_", ",_", "scale_", "=_", "scale_", "*_", "1.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V1_", "=_", "shared", "\\u", "normal_", "(_", "(_", "n", "\\u", "h_", ",_", "n", "\\u", "h_", "*_", "gates", "_", ")_", ",_", "scale_", "=_", "scale_", "*_", "1.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "n", "\\u", "h_", "*_", "gates", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "W2", "_", "=_", "shared", "\\u", "normal_", "(_", "(_", "n", "\\u", "h_", ",_", "n", "\\u", "h_", "*_", "gates", "_", ")_", ",_", "scale_", "=_", "scale_", "*_", "1.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "V2_", "=_", "shared", "\\u", "normal_", "(_", "(_", "n", "\\u", "h_", ",_", "n", "\\u", "h_", "*_", "gates", "_", ")_", ",_", "scale_", "=_", "scale_", "*_", "1.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "n", "\\u", "h_", "*_", "gates", "_", ",_", ")_", ")_", "\\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_", "def_", "lstm", "_", "(_", "X_", ",_", "h_", ",_", "c_", ",_", "W_", ",_", "U_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g", "\\u", "on_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "W_", ")_", "+_", "T_", "._", "dot_", "(_", "h_", ",_", "U_", ")_", "+_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "on_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "g", "\\u", "on_", "[_", ":_", ",_", ":_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "on_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "g", "\\u", "on_", "[_", ":_", ",_", "n", "\\u", "h_", ":_", "2_", "*_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "on_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "g", "\\u", "on_", "[_", ":_", ",_", "2_", "*_", "n", "\\u", "h_", ":_", "3_", "*_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "f", "\\u", "on_", "*_", "c_", "+_", "i", "\\u", "on_", "*_", "T_", "._", "tanh_", "(_", "g", "\\u", "on_", "[_", ":_", ",_", "3_", "*_", "n", "\\u", "h_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "o", "\\u", "on_", "*_", "T_", "._", "tanh_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "h_", ",_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gru", "_", "(_", "X_", ",_", "h_", ",_", "W_", ",_", "U_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "T_", "._", "dot_", "(_", "X_", ",_", "W_", "[_", ":_", ",_", ":_", "n", "\\u", "h_", "]_", ")_", "+_", "T_", "._", "dot_", "(_", "h_", ",_", "U_", "[_", ":_", ",_", ":_", "n", "\\u", "h_", "]_", ")_", "+_", "b_", "[_", ":_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "T_", "._", "dot_", "(_", "X_", ",_", "W_", "[_", ":_", ",_", "n", "\\u", "h_", ":_", "2_", "*_", "n", "\\u", "h_", "]_", ")_", "+_", "T_", "._", "dot_", "(_", "h_", ",_", "U_", "[_", ":_", ",_", "n", "\\u", "h_", ":_", "2_", "*_", "n", "\\u", "h_", "]_", ")_", "+_", "b_", "[_", "n", "\\u", "h_", ":_", "2_", "*_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "t_", "=_", "T_", "._", "tanh_", "(_", "T_", "._", "dot_", "(_", "X_", ",_", "W_", "[_", ":_", ",_", "2_", "*_", "n", "\\u", "h_", ":_", "3_", "*_", "n", "\\u", "h_", "]_", ")_", "+_", "r", "\\u", "t_", "*_", "T_", "._", "dot_", "(_", "h_", ",_", "U_", "[_", ":_", ",_", "2_", "*_", "n", "\\u", "h_", ":_", "3_", "*_", "n", "\\u", "h_", "]_", ")_", "+_", "b_", "[_", "2_", "*_", "n", "\\u", "h_", ":_", "3_", "*_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "1_", "-_", "z", "\\u", "t_", ")_", "*_", "h_", "+_", "z", "\\u", "t_", "*_", "h", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sgr", "u_", "(_", "X_", ",_", "h_", ",_", "W_", ",_", "U_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z", "\\u", "t_", "=_", "T_", "._", "tanh_", "(_", "T_", "._", "dot_", "(_", "X_", ",_", "W_", "[_", ":_", ",_", ":_", "n", "\\u", "h_", "]_", ")_", "+_", "T_", "._", "dot_", "(_", "h_", ",_", "U_", "[_", ":_", ",_", ":_", "n", "\\u", "h_", "]_", ")_", "+_", "b_", "[_", ":_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "t_", "=_", "T_", "._", "tanh_", "(_", "T_", "._", "dot_", "(_", "X_", ",_", "W_", "[_", ":_", ",_", "1_", "*_", "n", "\\u", "h_", ":_", "2_", "*_", "n", "\\u", "h_", "]_", ")_", "+_", "T_", "._", "dot_", "(_", "h_", ",_", "U_", "[_", ":_", ",_", "1_", "*_", "n", "\\u", "h_", ":_", "2_", "*_", "n", "\\u", "h_", "]_", ")_", "+_", "b_", "[_", "1_", "*_", "n", "\\u", "h_", ":_", "2_", "*_", "n", "\\u", "h_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "z", "\\u", "t_", "*_", "h", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "model_", "(_", "x_", ",_", "p_", ",_", "p", "\\u", "dropout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "size_", "=_", "x_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h0_", "=_", "p_", "._", "W", "\\u", "emb_", "[_", "x_", "]_", "#", " ", "(", "seq", "\\u", "len", ",", " ", "batch", "\\u", "size", ",", " ", "emb", "\\u", "size", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h0_", "=_", "dropout_", "(_", "h0_", ",_", "p", "\\u", "dropout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cost_", ",_", "h1_", ",_", "h2_", "=_", "[_", "0._", ",_", "b1", "\\u", "h_", ",_", "b2", "\\u", "h_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "xrange_", "(_", "0_", ",_", "self_", "._", "hp_", "._", "seq", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", ">=_", "self_", "._", "hp_", "._", "warmup", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pyx", "_", "=_", "softmax_", "(_", "T_", "._", "dot_", "(_", "dropout_", "(_", "h2_", ",_", "p", "\\u", "dropout_", ")_", ",_", "T_", "._", "transpose_", "(_", "p_", "._", "W", "\\u", "emb_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost_", "+=_", "T_", "._", "sum_", "(_", "T_", "._", "nnet", "_", "._", "categor", "ical", "\\u", "crossentropy", "_", "(_", "pyx", "_", ",_", "theano", "\\u", "one", "\\u", "hot_", "(_", "x_", "[_", "t_", "]_", ",_", "n", "\\u", "tokens_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h1_", "=_", "gru", "_", "(_", "h0_", "[_", "t_", "]_", ",_", "h1_", ",_", "p_", "._", "W1", "_", ",_", "p_", "._", "V1_", ",_", "p_", "._", "b1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h2_", "=_", "gru", "_", "(_", "dropout_", "(_", "h1_", ",_", "p", "\\u", "dropout_", ")_", ",_", "h2_", ",_", "p_", "._", "W2", "_", ",_", "p_", "._", "V2_", ",_", "p_", "._", "b2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h", "\\u", "updates_", "=_", "[_", "(_", "b1", "\\u", "h_", ",_", "h1_", ")_", ",_", "(_", "b2", "\\u", "h_", ",_", "h2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "cost_", ",_", "h", "\\u", "updates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cost_", ",_", "h", "\\u", "updates_", "=_", "model_", "(_", "self_", "._", "X_", ",_", "self_", "._", "params_", ",_", "self_", "._", "dropout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "te", "\\u", "cost_", ",_", "te", "\\u", "h", "\\u", "updates_", "=_", "model_", "(_", "self_", "._", "X_", ",_", "self_", "._", "params_", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "compile_", "(_", "cost_", ",_", "te", "\\u", "cost_", ",_", "h", "\\u", "updates_", ",_", "te", "\\u", "h", "\\u", "updates_", ")_" ]
[ 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, 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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 ]
Unused import
keithmoss/Hodor/hodor/retries.py
[ { "content": "# Copyright 2012 by Jeff Laughlin Consulting LLC\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\nimport sys\nimport json\nimport multiprocessing\nfrom time import sleep\nfrom hodor.exceptions import *\nfrom apiclient.errors import HttpError\nfrom socket import error as socket_error\nfrom hodor.cli import Context\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def gme_exc_handler(tries_remaining, exception, delay, args):\n \"\"\"GME exception handler; retries 403 errors (access token expired) and prints a warning to stderr.\n\n tries_remaining: The number of tries remaining.\n exception: The exception instance which was raised.\n delay: The length of time we're sleeping for.\n args: A tuple of the arguments passed to the calling function.\n \"\"\"\n\n # By convention Hodor always passes Context as the\n # first argument to anything that utilises retries.\n ctx = args[0]\n\n # Refresh expired access tokens\n if isinstance(exception, HttpError):\n if exception.resp.status == 401:\n print \"Token Expired, Reauthenticating...\"\n\n if not isinstance(ctx, Context):\n raise Exception(\"Error: Could not find Context object. Calling method must pass Context as the first argument.\")\n\n ctx.refresh_services()\n\n # Files uploads return a 204 No Content \"error\" that needs to be handled farther up.\n elif exception.resp.status == 204:\n raise NoContent()\n\n # Allow these fatal errors to bubble up - there's nowt we can do about them here.\n elif exception.resp.status in [403, 500, 503, 410]:\n content = json.loads(exception.content)\n if content['error']['errors'][0]['reason'] == 'queryTooExpensive':\n raise QueryTooExpensive(\"Query too expensive '%s'\" % (content['error']['message']))\n elif content['error']['errors'][0]['reason'] == 'backendError':\n # raise BackendError(\"GME backend error '%s'\" % (content['error']['message']))\n\n # content['error']['message'] == \"Service is unavailable. Retry.\"\n # HTTP 503 or 410\n\n # content['error']['message'] == \"Deadline exceeded.\"\n # HTTP 410\n\n print content\n if content['error']['message'] == \"Deadline exceeded.\":\n raise BackendError(\"GME backend error '%s'\" % (content['error']['message']))\n else:\n pass\n elif content['error']['errors'][0]['reason'] == 'tableTooLarge':\n raise TableTooLarge(\"Table too large '%s'\" % (content['error']['message']))\n elif content['error']['errors'][0]['reason'] == 'internalError':\n raise InternalServerError(\"%s\" % (content['error']['message']))\n elif content['error']['errors'][0]['reason'] == 'rateLimitExceeded':\n pass # Retry 403 Rate Limit Exceeded (for uploads only)\n\n # Retry non-fatal errors like \"server didn't respond in time\", GME's random \"internal server error\", or rate limit exceeded errors\n elif exception.resp.status not in [410, 429, 500]:\n raise exception\n\n if isinstance(ctx, Context):\n ctx.log(\"%s, %d tries remaining, sleeping for %s seconds\" % (exception, tries_remaining, delay))\n else:\n if getattr(exception, 'content', None) is not None:\n content = json.loads(exception.content)\n message = content['error']['message'] + \" \" + content['error']['errors'][0]['reason']\n print >> sys.stderr, \"Caught '%s' (%s), %d tries remaining, sleeping for %s seconds\" % (message, exception.resp.status, tries_remaining, round(delay, 2))\n else:\n raise exception", "metadata": "root.gme_exc_handler", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def example_exc_handler(tries_remaining, exception, delay):\n \"\"\"Example exception handler; prints a warning to stderr.\n\n tries_remaining: The number of tries remaining.\n exception: The exception instance which was raised.\n \"\"\"\n print >> sys.stderr, \"Caught '%s', %d tries remaining, sleeping for %s seconds\" % (exception, tries_remaining, delay)", "metadata": "root.example_exc_handler", "header": "['module', '___EOS___']", "index": 97 }, { "content": "def retries(max_tries, delay=1, backoff=1.1, exceptions=(Exception, HttpError, socket_error), hook=gme_exc_handler):\n \"\"\"Function decorator implementing retrying logic.\n\n delay: Sleep this many seconds * backoff * try number after failure\n backoff: Multiply delay by this factor after each failure\n exceptions: A tuple of exception classes; default (Exception,)\n hook: A function with the signature myhook(tries_remaining, exception);\n default None\n\n The decorator will call the function up to max_tries times if it raises\n an exception.\n\n By default it catches instances of the Exception class and subclasses.\n This will recover after all but the most fatal errors. You may specify a\n custom tuple of exception classes with the 'exceptions' argument; the\n function will only be retried if it raises one of the specified\n exceptions.\n\n Additionally you may specify a hook function which will be called prior\n to retrying with the number of remaining tries and the exception instance;\n see given example. This is primarily intended to give the opportunity to\n log the failure. Hook is not called after failure if no retries remain.\n \"\"\"\n def dec(func):\n def f2(*args, **kwargs):\n mydelay = delay\n tries = range(max_tries)\n tries.reverse()\n for tries_remaining in tries:\n try:\n return func(*args, **kwargs)\n except exceptions as e:\n if tries_remaining > 0:\n if hook is not None:\n hook(tries_remaining, e, mydelay, args)\n sleep(mydelay)\n mydelay = mydelay * backoff\n else:\n raise e\n else:\n break\n return f2\n return dec", "metadata": "root.retries", "header": "['module', '___EOS___']", "index": 106 } ]
[ { "span": "import multiprocessing", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "by", " ", "Je", "ff", " ", "Lau", "gh", "lin", " ", "Consult", "ing", " ", "LLC", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hod", "or_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "apiclient_", "._", "errors_", "import_", "Http", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "error_", "as_", "socket", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hod", "or_", "._", "cli_", "import_", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "gm", "e\\u", "exc", "\\u", "handler_", "(_", "trie", "s", "\\u", "remaining_", ",_", "exception_", ",_", "delay_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "GM", "E", " ", "exception", " ", "handler", ";", " ", "retrie", "s", " ", "403", " ", "error", "s", " ", "(", "access", " ", "token", " ", "expir", "ed", ")", " ", "and", " ", "print", "s", " ", "a", " ", "warn", "ing", " ", "to", " ", "std", "err", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "trie", "s", "\\u", "rema", "inin", "g", ":", " ", "The", " ", "number", " ", "of", " ", "trie", "s", " ", "rema", "inin", "g", ".", "\\", "10", ";", " ", " ", " ", " ", "exception", ":", " ", "The", " ", "exception", " ", "instance", " ", "whi", "ch", " ", "was", " ", "raise", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "dela", "y", ":", " ", "The", " ", "length", " ", "of", " ", "time", " ", "we", "'", "re", " ", "sleep", "ing", " ", "for", ".", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "A", " ", "tuple", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "pass", "ed", " ", "to", " ", "the", " ", "calling", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "convention", " ", "Ho", "dor", " ", "alw", "ay", "s", " ", "pass", "es", " ", "Context", " ", "as", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "argu", "ment", " ", "to", " ", "anyt", "hing", " ", "tha", "t", " ", "utilis", "es", " ", "retrie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Refr", "esh", " ", "expir", "ed", " ", "access", " ", "tokens_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "exception_", ",_", "Http", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exception_", "._", "resp_", "._", "status_", "==_", "401_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Token", " ", "Expire", "d", ",", " ", "Rea", "uth", "entica", "ting", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "ctx_", ",_", "Context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Error", ":", " ", "Cou", "ld", " ", "not", " ", "find", " ", "Context", " ", "object", ".", " ", "Call", "ing", " ", "method", " ", "must", " ", "pass", " ", "Context", " ", "as", " ", "the", " ", "first", " ", "argu", "ment", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "refre", "sh", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Files", " ", "uploads", " ", "return", " ", "a", " ", "204", " ", "No", " ", "Conten", "t", " ", "\"", "error", "\"", " ", "tha", "t", " ", "need", "s", " ", "to", " ", "be", " ", "handle", "d", " ", "far", "ther", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "exception_", "._", "resp_", "._", "status_", "==_", "204_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Content_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "these", " ", "fat", "al", " ", "error", "s", " ", "to", " ", "bubble", " ", "up", " ", "-", " ", "there", "'", "s", " ", "now", "t", " ", "we", " ", "can", " ", "do", " ", "abo", "ut", " ", "them", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "exception_", "._", "resp_", "._", "status_", "in_", "[_", "403_", ",_", "500_", ",_", "503_", ",_", "410", "_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "json_", "._", "loads_", "(_", "exception_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "error", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "reason", "'_", "]_", "==_", "'", "query", "Too", "Expe", "nsi", "ve", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Query", "Too", "Expe", "nsi", "ve_", "(_", "\"", "Query", " ", "too", " ", "expen", "sive", " ", "'%", "s", "'\"_", "%_", "(_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "message", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "error", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "reason", "'_", "]_", "==_", "'", "back", "end", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "raise", " ", "Back", "end", "Error", "(\"", "GM", "E", " ", "back", "end", " ", "error", " ", "'%", "s", "'\"", " ", "%", " ", "(", "content", "['", "error", "']", "['", "message", "'])", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "content", "['", "error", "']", "['", "message", "']", " ", "==", " ", "\"", "Service", " ", "is", " ", "unava", "ilab", "le", ".", " ", "Retr", "y", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HTTP", " ", "503", " ", "or", " ", "410", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "content", "['", "error", "']", "['", "message", "']", " ", "==", " ", "\"", "Dead", "line", " ", "exceed", "ed", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HTTP", " ", "410", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "message", "'_", "]_", "==_", "\"", "Dead", "line", " ", "exceed", "ed", ".\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Back", "end", "Error_", "(_", "\"", "GM", "E", " ", "back", "end", " ", "error", " ", "'%", "s", "'\"_", "%_", "(_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "message", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "error", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "reason", "'_", "]_", "==_", "'", "table", "Too", "Large", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Table", "Too", "Large", "_", "(_", "\"", "Table", " ", "too", " ", "large", " ", "'%", "s", "'\"_", "%_", "(_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "message", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "error", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "reason", "'_", "]_", "==_", "'", "internal", "Error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Intern", "al", "Server", "Error_", "(_", "\"%", "s", "\"_", "%_", "(_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "message", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "error", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "reason", "'_", "]_", "==_", "'", "rate", "Limit", "Exce", "eded", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "Retr", "y", " ", "403", " ", "Rat", "e", " ", "Limit", " ", "Exce", "eded", " ", "(", "for", " ", "uploads", " ", "only", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Retr", "y", " ", "non", "-", "fat", "al", " ", "error", "s", " ", "like", " ", "\"", "server", " ", "did", "n", "'", "t", " ", "respond", " ", "in", " ", "time", "\",", " ", "GM", "E", "'", "s", " ", "random", " ", "\"", "internal", " ", "server", " ", "error", "\",", " ", "or", " ", "rate", " ", "limit", " ", "exceed", "ed", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "exception_", "._", "resp_", "._", "status_", "not_", "in_", "[_", "410", "_", ",_", "429", "_", ",_", "500_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "ctx_", ",_", "Context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "log_", "(_", "\"%", "s", ",", " ", "%", "d", " ", "trie", "s", " ", "rema", "inin", "g", ",", " ", "sleep", "ing", " ", "for", " ", "%", "s", " ", "second", "s", "\"_", "%_", "(_", "exception_", ",_", "trie", "s", "\\u", "remaining_", ",_", "delay_", ")_", ")_", "\\u\\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_", "getattr_", "(_", "exception_", ",_", "'", "content", "'_", ",_", "None_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "json_", "._", "loads_", "(_", "exception_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "message", "'_", "]_", "+_", "\"", " ", "\"_", "+_", "content_", "[_", "'", "error", "'_", "]_", "[_", "'", "error", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "reason", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Cau", "ght", " ", "'%", "s", "'", " ", "(%", "s", "),", " ", "%", "d", " ", "trie", "s", " ", "rema", "inin", "g", ",", " ", "sleep", "ing", " ", "for", " ", "%", "s", " ", "second", "s", "\"_", "%_", "(_", "message_", ",_", "exception_", "._", "resp_", "._", "status_", ",_", "trie", "s", "\\u", "remaining_", ",_", "round_", "(_", "delay_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "example", "\\u", "exc", "\\u", "handler_", "(_", "trie", "s", "\\u", "remaining_", ",_", "exception_", ",_", "delay_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Exam", "ple", " ", "exception", " ", "handler", ";", " ", "print", "s", " ", "a", " ", "warn", "ing", " ", "to", " ", "std", "err", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "trie", "s", "\\u", "rema", "inin", "g", ":", " ", "The", " ", "number", " ", "of", " ", "trie", "s", " ", "rema", "inin", "g", ".", "\\", "10", ";", " ", " ", " ", " ", "exception", ":", " ", "The", " ", "exception", " ", "instance", " ", "whi", "ch", " ", "was", " ", "raise", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Cau", "ght", " ", "'%", "s", "',", " ", "%", "d", " ", "trie", "s", " ", "rema", "inin", "g", ",", " ", "sleep", "ing", " ", "for", " ", "%", "s", " ", "second", "s", "\"_", "%_", "(_", "exception_", ",_", "trie", "s", "\\u", "remaining_", ",_", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "retries_", "(_", "max", "\\u", "tries_", ",_", "delay_", "=_", "1_", ",_", "backoff_", "=_", "1.1_", ",_", "exceptions_", "=_", "(_", "Exception_", ",_", "Http", "Error_", ",_", "socket", "\\u", "error_", ")_", ",_", "hook_", "=_", "gm", "e\\u", "exc", "\\u", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Function", " ", "decorat", "or", " ", "implement", "ing", " ", "retrying", " ", "logic", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "dela", "y", ":", " ", "Sleep", " ", "this", " ", "many", " ", "second", "s", " ", "*", " ", "backoff", " ", "*", " ", "try", " ", "number", " ", "after", " ", "fail", "ure", "\\", "10", ";", " ", " ", " ", " ", "backoff", ":", " ", "Multiply", " ", "dela", "y", " ", "by", " ", "this", " ", "factor", " ", "after", " ", "each", " ", "fail", "ure", "\\", "10", ";", " ", " ", " ", " ", "exception", "s", ":", " ", "A", " ", "tuple", " ", "of", " ", "exception", " ", "classe", "s", ";", " ", "default", " ", "(", "Except", "ion", ",)", "\\", "10", ";", " ", " ", " ", " ", "hook", ":", " ", "A", " ", "function", " ", "with", " ", "the", " ", "signa", "ture", " ", "myh", "ook", "(", "trie", "s", "\\u", "rema", "inin", "g", ",", " ", "exception", ");", "\\", "10", ";", " ", " ", "default", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "decorat", "or", " ", "will", " ", "call", " ", "the", " ", "function", " ", "up", " ", "to", " ", "max", "\\u", "trie", "s", " ", "times", " ", "if", " ", "it", " ", "raise", "s", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "exception", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "default", " ", "it", " ", "catche", "s", " ", "instance", "s", " ", "of", " ", "the", " ", "Except", "ion", " ", "class", " ", "and", " ", "subclasses", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "recover", " ", "after", " ", "all", " ", "but", " ", "the", " ", "most", " ", "fat", "al", " ", "error", "s", ".", " ", "You", " ", "may", " ", "speci", "fy", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "custom", " ", "tuple", " ", "of", " ", "exception", " ", "classe", "s", " ", "with", " ", "the", " ", "'", "exception", "s", "'", " ", "argu", "ment", ";", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "will", " ", "only", " ", "be", " ", "retrie", "d", " ", "if", " ", "it", " ", "raise", "s", " ", "one", " ", "of", " ", "the", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "exception", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Addition", "ally", " ", "you", " ", "may", " ", "speci", "fy", " ", "a", " ", "hook", " ", "function", " ", "whi", "ch", " ", "will", " ", "be", " ", "call", "ed", " ", "prior", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "retrying", " ", "with", " ", "the", " ", "number", " ", "of", " ", "rema", "inin", "g", " ", "trie", "s", " ", "and", " ", "the", " ", "exception", " ", "instance", ";", "\\", "10", ";", " ", " ", " ", " ", "see", " ", "give", "n", " ", "example", ".", " ", "Thi", "s", " ", "is", " ", "prima", "ri", "ly", " ", "inten", "ded", " ", "to", " ", "give", " ", "the", " ", "opportunit", "y", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "log", " ", "the", " ", "fail", "ure", ".", " ", "Hook", " ", "is", " ", "not", " ", "call", "ed", " ", "after", " ", "fail", "ure", " ", "if", " ", "no", " ", "retrie", "s", " ", "rema", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dec_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "f2_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myd", "ela", "y_", "=_", "delay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tries_", "=_", "range_", "(_", "max", "\\u", "tries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tries_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "trie", "s", "\\u", "remaining_", "in_", "tries_", ":_", "\\u\\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_", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exceptions_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "trie", "s", "\\u", "remaining_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "hook_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "hook_", "(_", "trie", "s", "\\u", "remaining_", ",_", "e_", ",_", "myd", "ela", "y_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sleep_", "(_", "myd", "ela", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myd", "ela", "y_", "=_", "myd", "ela", "y_", "*_", "backoff_", "\\u\\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_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "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_", "return_", "f2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dec_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
stripe/monospace-django/monospace/views.py
[ { "content": "import datetime\n\nfrom django.db import IntegrityError\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import render_to_response, redirect\nfrom django.template import RequestContext\nimport stripe\n\nfrom monospace.forms import *\nfrom monospace.models import *\nimport monospace.settings as settings\n\nstripe.api_key = settings.STRIPE_SECRET\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def soon():\n soon = datetime.date.today() + datetime.timedelta(days=30)\n return {'month': soon.month, 'year': soon.year}", "metadata": "root.soon", "header": "['module', '___EOS___']", "index": 14 }, { "content": "def home(request):\n uid = request.session.get('user')\n if uid is None:\n return render_to_response('home.html')\n else:\n return render_to_response('user.html', {'user': User.objects.get(pk=uid)})", "metadata": "root.home", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def sign_in(request):\n user = None\n if request.method == 'POST':\n form = SignInForm(request.POST)\n if form.is_valid():\n results = User.objects.filter(email=form.cleaned_data['email'])\n if len(results) == 1:\n if results[0].check_password(form.cleaned_data['password']):\n request.session['user'] = results[0].pk\n return HttpResponseRedirect('/')\n else:\n form.addError('Incorrect email address or password')\n else:\n form.addError('Incorrect email address or password')\n else:\n form = SignInForm()\n \n print form.non_field_errors()\n\n return render_to_response(\n 'sign_in.html',\n {\n 'form': form,\n 'user': user\n },\n context_instance=RequestContext(request)\n )", "metadata": "root.sign_in", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def sign_out(request):\n del request.session['user']\n return HttpResponseRedirect('/')", "metadata": "root.sign_out", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def register(request):\n user = None\n if request.method == 'POST':\n form = UserForm(request.POST)\n if form.is_valid():\n\n customer = stripe.Customer.create(\n description = form.cleaned_data['email'],\n card = form.cleaned_data['stripe_token'],\n plan = 'basic'\n )\n\n user = User(\n name = form.cleaned_data['name'],\n email = form.cleaned_data['email'],\n last_4_digits = form.cleaned_data['last_4_digits'],\n stripe_id = customer.id\n )\n user.set_password(form.cleaned_data['password1'])\n\n try:\n user.save()\n except IntegrityError:\n form.addError(user.email + ' is already a member')\n else:\n request.session['user'] = user.pk\n return HttpResponseRedirect('/')\n\n else:\n form = UserForm()\n\n return render_to_response(\n 'register.html',\n {\n 'form': form,\n 'months': range(1, 13),\n 'publishable': settings.STRIPE_PUBLISHABLE,\n 'soon': soon(),\n 'user': user,\n 'years': range(2011, 2036),\n },\n context_instance=RequestContext(request)\n )", "metadata": "root.register", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def edit(request):\n uid = request.session.get('user')\n if uid is None:\n return HttpResponseRedirect('/')\n user = User.objects.get(pk=uid)\n if request.method == 'POST':\n form = CardForm(request.POST)\n if form.is_valid():\n\n customer = stripe.Customer.retrieve(user.stripe_id)\n customer.card = form.cleaned_data['stripe_token']\n customer.save()\n\n user.last_4_digits = form.cleaned_data['last_4_digits']\n user.stripe_id = customer.id\n user.save()\n\n return HttpResponseRedirect('/')\n\n else:\n form = CardForm()\n\n return render_to_response(\n 'edit.html',\n {\n 'form': form,\n 'publishable': settings.STRIPE_PUBLISHABLE,\n 'soon': soon(),\n 'months': range(1, 13),\n 'years': range(2011, 2036)\n },\n context_instance=RequestContext(request)\n )", "metadata": "root.edit", "header": "['module', '___EOS___']", "index": 101 } ]
[ { "span": "from django.shortcuts import render_to_response, redirect", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 57 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "Int", "egr", "it", "y", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", ",_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stripe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "monospace", "_", "._", "forms_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "monospace", "_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "monospace", "_", "._", "settings_", "as_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stripe_", "._", "api", "\\u", "key_", "=_", "settings_", "._", "STRIP", "E", "\\u", "SECRET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "soo", "n_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "soo", "n_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "month", "'_", ":_", "soo", "n_", "._", "month_", ",_", "'", "year", "'_", ":_", "soo", "n_", "._", "year_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "home_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uid_", "=_", "request_", "._", "session_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uid_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "home", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "user", ".", "html", "'_", ",_", "{_", "'", "user", "'_", ":_", "User_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "uid_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign", "\\u", "in_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Sign", "In", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "User_", "._", "objects_", "._", "filter_", "(_", "email_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "email", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "results_", "[_", "0_", "]_", "._", "check", "\\u", "password_", "(_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "session_", "[_", "'", "user", "'_", "]_", "=_", "results_", "[_", "0_", "]_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\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_", "._", "add", "Error_", "(_", "'", "Inco", "rrect", " ", "email", " ", "address", " ", "or", " ", "password", "'_", ")_", "\\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 ", " _", "form_", "._", "add", "Error_", "(_", "'", "Inco", "rrect", " ", "email", " ", "address", " ", "or", " ", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Sign", "In", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "form_", "._", "non", "\\u", "field", "\\u", "errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sign", "\\u", "in", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "user_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", "\\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_", "sign", "\\u", "out_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "request_", "._", "session_", "[_", "'", "user", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "register_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "User", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "customer_", "=_", "stripe_", "._", "Customer_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "card_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "strip", "e\\u", "token", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plan_", "=_", "'", "basic", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "User_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "email", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "4", "\\u", "digits_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "last", "\\u", "4", "\\u", "digit", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip", "e\\u", "id_", "=_", "customer_", "._", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "set\\u", "password_", "(_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "password", "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 ", " _", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Int", "egr", "it", "y", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "._", "add", "Error_", "(_", "user_", "._", "email_", "+_", "'", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "member", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "session_", "[_", "'", "user", "'_", "]_", "=_", "user_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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 ", " _", "form_", "=_", "User", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "register", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "month", "s", "'_", ":_", "range_", "(_", "1_", ",_", "13_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sha", "ble", "'_", ":_", "settings_", "._", "STRIP", "E", "\\u", "PUBLISH", "ABLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "soo", "n", "'_", ":_", "soo", "n_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "s", "'_", ":_", "range_", "(_", "2011_", ",_", "203", "6_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", "\\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_", "edit_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uid_", "=_", "request_", "._", "session_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uid_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Card", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "customer_", "=_", "stripe_", "._", "Customer_", "._", "retrieve_", "(_", "user_", "._", "strip", "e\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "customer_", "._", "card_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "strip", "e\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "customer_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "._", "last", "\\u", "4", "\\u", "digits_", "=_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "last", "\\u", "4", "\\u", "digit", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "strip", "e\\u", "id_", "=_", "customer_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Card", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "edit", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "'_", ":_", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "publi", "sha", "ble", "'_", ":_", "settings_", "._", "STRIP", "E", "\\u", "PUBLISH", "ABLE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "soo", "n", "'_", ":_", "soo", "n_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "month", "s", "'_", ":_", "range_", "(_", "1_", ",_", "13_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "s", "'_", ":_", "range_", "(_", "2011_", ",_", "203", "6_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
shuge/Qt-Python-Binding-Examples/layout/layout_in_grid.py
[ { "content": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\"\"\"\nlay out in Gird demo\n\nTested environment:\n Mac OS X 10.6.8\n\"\"\"\nimport sys\n\ntry:\n from PySide import QtCore\n from PySide import QtGui\nexcept ImportError:\n from PyQt4 import QtCore\n from PyQt4 import QtGui\n\n\n\n\nif __name__ == \"__main__\":\n app = QtGui.QApplication(sys.argv)\n\n demo = Demo()\n demo.show_and_raise()\n\n sys.exit(app.exec_())\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Demo(QtGui.QWidget):\n", "metadata": "root.Demo", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self):\n super(Demo, self).__init__()\n\n x, y, w, h = 500, 200, 300, 400\n self.setGeometry(x, y, w, h)\n\n title = QtGui.QLabel('Title')\n author = QtGui.QLabel('Author')\n review = QtGui.QLabel('Review')\n\n titleEdit = QtGui.QLineEdit()\n authorEdit = QtGui.QLineEdit()\n reviewEdit = QtGui.QTextEdit()\n\n grid = QtGui.QGridLayout()\n grid.setSpacing(10)\n\n grid.addWidget(title, 1, 0)\n grid.addWidget(titleEdit, 1, 1)\n\n grid.addWidget(author, 2, 0)\n grid.addWidget(authorEdit, 2, 1)\n\n grid.addWidget(review, 3, 0)\n grid.addWidget(reviewEdit, 3, 1, 5, 1)\n \n self.setLayout(grid)", "metadata": "root.Demo.__init__", "header": "['class', 'Demo', '(', 'QtGui', '.', 'QWidget', ')', ':', '___EOS___']", "index": 19 }, { "content": " def show_and_raise(self):\n self.show()\n self.raise_()", "metadata": "root.Demo.show_and_raise", "header": "['class', 'Demo', '(', 'QtGui', '.', 'QWidget', ')', ':', '___EOS___']", "index": 47 } ]
[ { "span": "from PySide import QtCore", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 29 }, { "span": "from PyQt4 import QtCore", "start_line": 14, "start_column": 4, "end_line": 14, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "*-", " ", "codi", "ng", ":", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "lay", " ", "out", " ", "in", " ", "Gir", "d", " ", "demo", "\\", "10", ";", "\\", "10", ";", "Test", "ed", " ", "environ", "ment", ":", "\\", "10", ";", " ", " ", " ", " ", "Mac", " ", "OS", " ", "X", " ", "10.", "6.8", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "Side_", "import_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Side_", "import_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "Qt4_", "import_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "import_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "demo_", "=_", "Demo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "demo_", "._", "show", "\\u", "and", "\\u", "raise_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exit_", "(_", "app_", "._", "exec\\u_", "(_", ")_", ")_", "\\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_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QW", "idge", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QW", "idge", "t_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Demo", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "=_", "500_", ",_", "200_", ",_", "300_", ",_", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Geometry_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "Qt", "Gui_", "._", "QL", "abel_", "(_", "'", "Tit", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "author_", "=_", "Qt", "Gui_", "._", "QL", "abel_", "(_", "'", "Author", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "review_", "=_", "Qt", "Gui_", "._", "QL", "abel_", "(_", "'", "Review", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title", "Edit_", "=_", "Qt", "Gui_", "._", "QL", "ine", "Edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "author", "Edit_", "=_", "Qt", "Gui_", "._", "QL", "ine", "Edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "review", "Edit_", "=_", "Qt", "Gui_", "._", "QT", "ext", "Edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grid_", "=_", "Qt", "Gui_", "._", "QG", "rid", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "._", "set", "Spacing_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grid_", "._", "add", "Widget_", "(_", "title_", ",_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "._", "add", "Widget_", "(_", "title", "Edit_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grid_", "._", "add", "Widget_", "(_", "author_", ",_", "2_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "._", "add", "Widget_", "(_", "author", "Edit_", ",_", "2_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "grid_", "._", "add", "Widget_", "(_", "review_", ",_", "3_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "._", "add", "Widget_", "(_", "review", "Edit_", ",_", "3_", ",_", "1_", ",_", "5_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set", "Layout_", "(_", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QW", "idge", "t_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ImageEngine/gaffer/python/GafferSceneUI/PruneUI.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport Gaffer\nimport GafferUI\n\nimport GafferScene\nimport GafferSceneUI\n\nGaffer.Metadata.registerNodeDescription(\n\nGafferScene.Prune,\n\n\"\"\"A node for removing whole branches from the scene hierarchy.\"\"\",\n\n\"filter\",\n\"\"\"The branches to prune. The specified locations and all locations below them will be removed from the scene.\"\"\",\n\n\"adjustBounds\",\n\"\"\"Computes new tightened bounding boxes taking into account the removed locations. This can be an expensive operation - turn on with care.\"\"\",\n\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import GafferUI", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 15 }, { "span": "import GafferSceneUI", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", ",", " ", "Image", " ", "Engine", " ", "Desig", "n", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Joh", "n", " ", "Had", "don", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "any", " ", "other", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Ga", "ffer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Ga", "ffer", "Scene_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Scen", "e", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "_", "._", "Metadata_", "._", "register", "Node", "Description_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "ffer", "Scene_", "._", "Pru", "ne_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "A", " ", "node", " ", "for", " ", "remo", "ving", " ", "whole", " ", "branch", "es", " ", "from", " ", "the", " ", "scen", "e", " ", "hier", "arch", "y", ".\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "filter", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "The", " ", "branch", "es", " ", "to", " ", "prune", ".", " ", "The", " ", "specified", " ", "location", "s", " ", "and", " ", "all", " ", "location", "s", " ", "belo", "w", " ", "them", " ", "will", " ", "be", " ", "remove", "d", " ", "from", " ", "the", " ", "scen", "e", ".\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "adjust", "Bound", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Compute", "s", " ", "new", " ", "tig", "hte", "ned", " ", "bound", "ing", " ", "box", "es", " ", "tak", "ing", " ", "int", "o", " ", "account", " ", "the", " ", "remove", "d", " ", "location", "s", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "an", " ", "expen", "sive", " ", "operati", "on", " ", "-", " ", "turn", " ", "on", " ", "with", " ", "care", ".\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
heiskr/sagefy/server/index.py
[ { "content": "\"\"\"\nWelcome to Sagefy.\n\"\"\"\n# flake8: noqa\n\nfrom config import config\nimport framework.index as framework\nframework.update_config(config)\n\nfrom framework.database import setup_db\nsetup_db()\n\nimport routes.public\nimport routes.user\nimport routes.notice\nimport routes.topic\nimport routes.follow\nimport routes.user_sets\nimport routes.card\nimport routes.unit\nimport routes.set\nimport routes.search\nimport routes.next\n\nfrom framework.index import serve\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import routes.public", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 20 }, { "span": "import routes.user", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 18 }, { "span": "import routes.notice", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 20 }, { "span": "import routes.topic", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 19 }, { "span": "import routes.follow", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 20 }, { "span": "import routes.user_sets", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 23 }, { "span": "import routes.card", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 18 }, { "span": "import routes.unit", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 18 }, { "span": "import routes.set", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 17 }, { "span": "import routes.search", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 20 }, { "span": "import routes.next", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 18 }, { "span": "from framework.index import serve", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Wel", "come", " ", "to", " ", "Sag", "ef", "y", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "flake", "8", ":", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "config_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "framework_", "._", "index_", "as_", "framework_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "framework_", "._", "update", "\\u", "config_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "framework_", "._", "database_", "import_", "setup", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup", "\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "routes_", "._", "public_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "notice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "follow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "user", "\\u", "sets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "card_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "unit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "routes_", "._", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "framework_", "._", "index_", "import_", "serve_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1 ]
Imprecise assert
ImageEngine/gaffer/python/GafferTest/SignalsTest.py
[ { "content": "\tdef testNonScopedConnection( self ) :\n\n\t\tself.numCalls = 0\n\t\tdef f() :\n\t\t\tself.numCalls += 1\n\n\t\ts = Gaffer.Signal0()\n\t\tc = s.connect( f, scoped = False )\n\n\t\tself.assertEqual( self.numCalls, 0 )\n\t\ts()\n\t\tself.assertEqual( self.numCalls, 1 )\n\n\t\tc.block( True )\n\t\ts()\n\t\tself.assertEqual( self.numCalls, 1 )\n\t\tc.block( False )\n\t\ts()\n\t\tself.assertEqual( self.numCalls, 2 )\n\n\t\t# If we drop our reference to the slot,\n\t\t# it should still be alive because the\n\t\t# signal is referencing it (because it\n\t\t# is connected).\n\t\tw = weakref.ref( f )\n\t\tdel f\n\t\tself.assertTrue( w() is not None )\n\n\t\t# And it should still be triggered when\n\t\t# we call the signal.\n\t\ts()\n\t\tself.assertEqual( self.numCalls, 3 )\n\n\t\t# And it should finally die when the\n\t\t# signal dies.\n\t\tdel s\n\t\tself.assertTrue( w() is None )", "metadata": "root.SignalsTest.testNonScopedConnection", "header": "['class', 'SignalsTest', '(', 'GafferTest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 360 } ]
[ { "span": "self.assertTrue( w() is not None )", "start_line": 386, "start_column": 2, "end_line": 386, "end_column": 36 }, { "span": "self.assertTrue( w() is None )", "start_line": 396, "start_column": 2, "end_line": 396, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Signal", "s", "Test_", "(_", "Ga", "ffer", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Sco", "ped", "Connection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "num", "Calls", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "f_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "num", "Calls", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "Ga", "ffer", "_", "._", "Signal", "0_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "s_", "._", "connect_", "(_", "f_", ",_", "scoped", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "num", "Calls", "_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "num", "Calls", "_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "block_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "num", "Calls", "_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "block_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "num", "Calls", "_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "drop", " ", "our", " ", "reference", " ", "to", " ", "the", " ", "slot", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "shou", "ld", " ", "still", " ", "be", " ", "alive", " ", "bec", "aus", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "signal", " ", "is", " ", "referenci", "ng", " ", "it", " ", "(", "bec", "aus", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "connect", "ed", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "weakref_", "._", "ref_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "w_", "(_", ")_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "it", " ", "shou", "ld", " ", "still", " ", "be", " ", "trigger", "ed", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "call", " ", "the", " ", "signal", "._", "\\u\\u\\uNL\\u\\u\\u_", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "num", "Calls", "_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "it", " ", "shou", "ld", " ", "final", "ly", " ", "die", " ", "whe", "n", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "signal", " ", "die", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "del_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "w_", "(_", ")_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
tbarbugli/stream_framework_example/core/tests.py
[ { "content": " def setUp(self):\n TestCase.setUp(self)\n\n self.bogus_user = bogus_user = get_user_model().objects.get(\n username='bogus')\n self.bogus_user2 = bogus_user2 = get_user_model().objects.get(\n username='bogus2')\n # start by resetting the feeds\n for u in [self.bogus_user, self.bogus_user2]:\n user_feed = manager.get_user_feed(u.id)\n user_feed.delete()\n for name, feed in manager.get_feeds(u.id).items():\n feed.delete()\n\n # login the user\n rf = RequestMock()\n self.rf = rf\n self.client = Client()\n self.auth_client = Client()\n self.auth_client2 = Client()\n auth_response = self.auth_client.login(\n username='bogus', password='bogus')\n self.assertTrue(auth_response)\n auth_response = self.auth_client2.login(\n username='bogus2', password='bogus')\n self.assertTrue(auth_response)", "metadata": "root.BaseTestCase.setUp", "header": "['class', 'BaseTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def test_unpin(self):\n data = dict(\n message='my awesome pin',\n item=1,\n board_name='my favourite things',\n influencer=1,\n )\n pin_url = reverse('pin') + '?ajax=1'\n response = self.client.post(pin_url, data)\n self.assertEqual(response.status_code, 302)\n pin_response = self.auth_client.post(pin_url, data)\n self.assertEqual(pin_response.status_code, 200)\n response_data = json.loads(pin_response.content)\n self.assertTrue(response_data['pin'])\n self.assertTrue(response_data['pin']['id'])\n data['remove'] = 1\n response = self.auth_client.post(pin_url, data)\n pins = list(Pin.objects.filter(item=1, user=self.bogus_user)[:4])\n assert pins == []", "metadata": "root.PinTest.test_unpin", "header": "['class', 'PinTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_unfollow(self):\n data = dict(\n target=2,\n )\n follow_url = reverse('follow')\n response = self.client.post(follow_url, data)\n self.assertEqual(response.status_code, 302)\n follow_response = self.auth_client.post(follow_url, data)\n self.assertEqual(follow_response.status_code, 200)\n response_data = json.loads(follow_response.content)\n self.assertTrue(response_data['follow'])\n self.assertTrue(response_data['follow']['id'])\n data['remove'] = 1\n response = self.auth_client.post(follow_url, data)\n follows = list(Follow.objects.filter(\n target=2, user=self.bogus_user)[:4])\n assert follows == []", "metadata": "root.FollowTest.test_unfollow", "header": "['class', 'FollowTest', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 109 } ]
[ { "span": "bogus_user ", "start_line": 29, "start_column": 26, "end_line": 29, "end_column": 36 }, { "span": "bogus_user2 ", "start_line": 31, "start_column": 27, "end_line": 31, "end_column": 38 }, { "span": "response ", "start_line": 89, "start_column": 8, "end_line": 89, "end_column": 16 }, { "span": "response ", "start_line": 122, "start_column": 8, "end_line": 122, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Base", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bog", "us", "\\u", "user_", "=_", "bog", "us", "\\u", "user_", "=_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "'", "bog", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bog", "us", "\\u", "user2_", "=_", "bog", "us", "\\u", "user2_", "=_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "'", "bog", "us", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "start", " ", "by", " ", "reset", "ting", " ", "the", " ", "feeds_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "u_", "in_", "[_", "self_", "._", "bog", "us", "\\u", "user_", ",_", "self_", "._", "bog", "us", "\\u", "user2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "feed_", "=_", "manager_", "._", "get", "\\u", "user", "\\u", "feed_", "(_", "u_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "feed_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "feed_", "in_", "manager_", "._", "get", "\\u", "feeds_", "(_", "u_", "._", "id_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "feed_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "login", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rf_", "=_", "Request", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rf_", "=_", "rf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "=_", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "auth", "\\u", "client_", "=_", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "auth", "\\u", "client", "2_", "=_", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "response_", "=_", "self_", "._", "auth", "\\u", "client_", "._", "login_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "'", "bog", "us", "'_", ",_", "password_", "=_", "'", "bog", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "auth", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "response_", "=_", "self_", "._", "auth", "\\u", "client", "2_", "._", "login_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "'", "bog", "us", "2", "'_", ",_", "password_", "=_", "'", "bog", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "auth", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pin", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unp", "in_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'", "my", " ", "aw", "eso", "me", " ", "pin", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "board", "\\u", "name_", "=_", "'", "my", " ", "favourite", " ", "thing", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "influence", "r_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pin", "\\u", "url_", "=_", "reverse_", "(_", "'", "pin", "'_", ")_", "+_", "'?", "aja", "x", "=", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "pin", "\\u", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pin", "\\u", "response_", "=_", "self_", "._", "auth", "\\u", "client_", "._", "post_", "(_", "pin", "\\u", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pin", "\\u", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "pin", "\\u", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response", "\\u", "data_", "[_", "'", "pin", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response", "\\u", "data_", "[_", "'", "pin", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "remove", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "auth", "\\u", "client_", "._", "post_", "(_", "pin", "\\u", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pins_", "=_", "list_", "(_", "Pin_", "._", "objects_", "._", "filter_", "(_", "item_", "=_", "1_", ",_", "user_", "=_", "self_", "._", "bog", "us", "\\u", "user_", ")_", "[_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "pins_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Follow", "Test_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unfol", "low_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follow", "\\u", "url_", "=_", "reverse_", "(_", "'", "follow", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "follow", "\\u", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follow", "\\u", "response_", "=_", "self_", "._", "auth", "\\u", "client_", "._", "post_", "(_", "follow", "\\u", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "follow", "\\u", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "follow", "\\u", "response_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response", "\\u", "data_", "[_", "'", "follow", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response", "\\u", "data_", "[_", "'", "follow", "'_", "]_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "remove", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "auth", "\\u", "client_", "._", "post_", "(_", "follow", "\\u", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follow", "s_", "=_", "list_", "(_", "Follow", "_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "2_", ",_", "user_", "=_", "self_", "._", "bog", "us", "\\u", "user_", ")_", "[_", ":_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "follow", "s_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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,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Default widget to use when rendering this type of Field.\n hidden_widget = HiddenInput # Default widget to use when rendering this as \"hidden\".\n default_validators = [] # Default set of validators\n # Add an 'invalid' entry to default_error_message if you want a specific\n # field error message not raised by the field validators.\n default_error_messages = {\n 'required': _('This field is required.'),\n }\n empty_values = list(validators.EMPTY_VALUES)\n\n # Tracks each time a Field instance is created. Used to retain order.\n creation_counter = 0\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Field", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def __init__(self, required=True, widget=None, label=None, initial=None,\n help_text='', error_messages=None, show_hidden_initial=False,\n validators=[], localize=False, disabled=False, label_suffix=None):\n # required -- Boolean that specifies whether the field is required.\n # True by default.\n # widget -- A Widget class, or instance of a Widget class, that should\n # be used for this Field when displaying it. Each Field has a\n # default Widget that it'll use if you don't specify this. In\n # most cases, the default widget is TextInput.\n # label -- A verbose name for this field, for use in displaying this\n # field in a form. By default, Django will use a \"pretty\"\n # version of the form field name, if the Field is part of a\n # Form.\n # initial -- A value to use in this Field's initial display. This value\n # is *not* used as a fallback if data isn't given.\n # help_text -- An optional string to use as \"help text\" for this Field.\n # error_messages -- An optional dictionary to override the default\n # messages that the field will raise.\n # show_hidden_initial -- Boolean that specifies if it is needed to render a\n # hidden widget with initial value after widget.\n # validators -- List of additional validators to use\n # localize -- Boolean that specifies if the field should be localized.\n # disabled -- Boolean that specifies whether the field is disabled, that\n # is its widget is shown in the form but not editable.\n # label_suffix -- Suffix to be added to the label. Overrides\n # form's label_suffix.\n self.required, self.label, self.initial = required, label, initial\n self.show_hidden_initial = show_hidden_initial\n self.help_text = help_text\n self.disabled = disabled\n self.label_suffix = label_suffix\n widget = widget or self.widget\n if isinstance(widget, type):\n widget = widget()\n\n # Trigger the localization machinery if needed.\n self.localize = localize\n if self.localize:\n widget.is_localized = True\n\n # Let the widget know whether it should display as required.\n widget.is_required = self.required\n\n # Hook into self.widget_attrs() for any Field-specific HTML attributes.\n extra_attrs = self.widget_attrs(widget)\n if extra_attrs:\n widget.attrs.update(extra_attrs)\n\n self.widget = widget\n\n # Increase the creation counter, and save our local copy.\n self.creation_counter = Field.creation_counter\n Field.creation_counter += 1\n\n messages = {}\n for c in reversed(self.__class__.__mro__):\n messages.update(getattr(c, 'default_error_messages', {}))\n messages.update(error_messages or {})\n self.error_messages = messages\n\n self.validators = list(itertools.chain(self.default_validators, validators))\n\n super(Field, self).__init__()", "metadata": "root.Field.__init__", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": " def prepare_value(self, value):\n return value", "metadata": "root.Field.prepare_value", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": " def to_python(self, value):\n return value", "metadata": "root.Field.to_python", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def validate(self, value):\n if value in self.empty_values and self.required:\n raise ValidationError(self.error_messages['required'], code='required')", "metadata": "root.Field.validate", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 132 }, { "content": " def run_validators(self, value):\n if value in self.empty_values:\n return\n errors = []\n for v in self.validators:\n try:\n v(value)\n except ValidationError as e:\n if hasattr(e, 'code') and e.code in self.error_messages:\n e.message = self.error_messages[e.code]\n errors.extend(e.error_list)\n if errors:\n raise ValidationError(errors)", "metadata": "root.Field.run_validators", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def clean(self, value):\n \"\"\"\n Validates the given value and returns its \"cleaned\" value as an\n appropriate Python object.\n\n Raises ValidationError for any errors.\n \"\"\"\n value = self.to_python(value)\n self.validate(value)\n self.run_validators(value)\n return value", "metadata": "root.Field.clean", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 150 }, { "content": " def bound_data(self, data, initial):\n \"\"\"\n Return the value that should be shown for this field on render of a\n bound form, given the submitted POST data for the field and the initial\n data, if any.\n\n For most fields, this will simply be data; FileFields need to handle it\n a bit differently.\n \"\"\"\n if self.disabled:\n return initial\n return data", "metadata": "root.Field.bound_data", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def widget_attrs(self, widget):\n \"\"\"\n Given a Widget instance (*not* a Widget class), returns a dictionary of\n any HTML attributes that should be added to the Widget, based on this\n Field.\n \"\"\"\n return {}", "metadata": "root.Field.widget_attrs", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " def has_changed(self, initial, data):\n \"\"\"\n Return True if data differs from initial.\n \"\"\"\n try:\n data = self.to_python(data)\n if hasattr(self, '_coerce'):\n return self._coerce(data) != self._coerce(initial)\n except ValidationError:\n return True\n # For purposes of seeing whether something has changed, None is\n # the same as an empty string, if the data or initial value we get\n # is None, replace it with ''.\n initial_value = initial if initial is not None else ''\n data_value = data if data is not None else ''\n return initial_value != data_value", "metadata": "root.Field.has_changed", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 183 }, { "content": " def get_bound_field(self, form, field_name):\n \"\"\"\n Return a BoundField instance that will be used when accessing the form\n field in a template.\n \"\"\"\n return BoundField(form, self, field_name)", "metadata": "root.Field.get_bound_field", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " def __deepcopy__(self, memo):\n result = copy.copy(self)\n memo[id(self)] = result\n result.widget = copy.deepcopy(self.widget, memo)\n result.validators = self.validators[:]\n return result", "metadata": "root.Field.__deepcopy__", "header": "['class', 'Field', '(', 'object', ')', ':', '___EOS___']", "index": 207 }, { "content": "class CharField(Field):\n\n", "metadata": "root.CharField", "header": "['module', '___EOS___']", "index": 215 }, { "content": " def __init__(self, max_length=None, min_length=None, strip=True, *args, **kwargs):\n self.max_length = max_length\n self.min_length = min_length\n self.strip = strip\n super(CharField, self).__init__(*args, **kwargs)\n if min_length is not None:\n self.validators.append(validators.MinLengthValidator(int(min_length)))\n if max_length is not None:\n self.validators.append(validators.MaxLengthValidator(int(max_length)))", "metadata": "root.CharField.__init__", "header": "['class', 'CharField', '(', 'Field', ')', ':', '___EOS___']", "index": 216 }, { "content": " def to_python(self, value):\n \"Returns a Unicode object.\"\n if value in self.empty_values:\n return ''\n value = force_text(value)\n if self.strip:\n value = value.strip()\n return value", "metadata": "root.CharField.to_python", "header": "['class', 'CharField', '(', 'Field', ')', ':', '___EOS___']", "index": 226 }, { "content": " def widget_attrs(self, widget):\n attrs = super(CharField, self).widget_attrs(widget)\n if self.max_length is not None:\n # The HTML attribute is maxlength, not max_length.\n attrs['maxlength'] = str(self.max_length)\n if self.min_length is not None:\n # The HTML attribute is minlength, not min_length.\n attrs['minlength'] = str(self.min_length)\n return attrs", "metadata": "root.CharField.widget_attrs", "header": "['class', 'CharField', '(', 'Field', ')', ':', '___EOS___']", "index": 235 }, { "content": "class IntegerField(Field):\n widget = NumberInput\n default_error_messages = {\n 'invalid': _('Enter a whole number.'),\n }\n re_decimal = re.compile(r'\\.0*\\s*$')\n\n\n", "metadata": "root.IntegerField", "header": "['module', '___EOS___']", "index": 246 }, { "content": " def __init__(self, max_value=None, min_value=None, *args, **kwargs):\n self.max_value, self.min_value = max_value, min_value\n if kwargs.get('localize') and self.widget == NumberInput:\n # Localized number input is not well supported on most browsers\n kwargs.setdefault('widget', super(IntegerField, self).widget)\n super(IntegerField, self).__init__(*args, **kwargs)\n\n if max_value is not None:\n self.validators.append(validators.MaxValueValidator(max_value))\n if min_value is not None:\n self.validators.append(validators.MinValueValidator(min_value))", "metadata": "root.IntegerField.__init__", "header": "['class', 'IntegerField', '(', 'Field', ')', ':', '___EOS___']", "index": 253 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that int() can be called on the input. Returns the result\n of int(). Returns None for empty values.\n \"\"\"\n value = super(IntegerField, self).to_python(value)\n if value in self.empty_values:\n return None\n if self.localize:\n value = formats.sanitize_separators(value)\n # Strip trailing decimal and zeros.\n try:\n value = int(self.re_decimal.sub('', str(value)))\n except (ValueError, TypeError):\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.IntegerField.to_python", "header": "['class', 'IntegerField', '(', 'Field', ')', ':', '___EOS___']", "index": 265 }, { "content": " def widget_attrs(self, widget):\n attrs = super(IntegerField, self).widget_attrs(widget)\n if isinstance(widget, NumberInput):\n if self.min_value is not None:\n attrs['min'] = self.min_value\n if self.max_value is not None:\n attrs['max'] = self.max_value\n return attrs", "metadata": "root.IntegerField.widget_attrs", "header": "['class', 'IntegerField', '(', 'Field', ')', ':', '___EOS___']", "index": 282 }, { "content": "class FloatField(IntegerField):\n default_error_messages = {\n 'invalid': _('Enter a number.'),\n }\n\n\n", "metadata": "root.FloatField", "header": "['module', '___EOS___']", "index": 292 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that float() can be called on the input. Returns the result\n of float(). Returns None for empty values.\n \"\"\"\n value = super(IntegerField, self).to_python(value)\n if value in self.empty_values:\n return None\n if self.localize:\n value = formats.sanitize_separators(value)\n try:\n value = float(value)\n except (ValueError, TypeError):\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.FloatField.to_python", "header": "['class', 'FloatField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 297 }, { "content": " def validate(self, value):\n super(FloatField, self).validate(value)\n\n # Check for NaN (which is the only thing not equal to itself) and +/- infinity\n if value != value or value in (Decimal('Inf'), Decimal('-Inf')):\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n\n return value", "metadata": "root.FloatField.validate", "header": "['class', 'FloatField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 313 }, { "content": " def widget_attrs(self, widget):\n attrs = super(FloatField, self).widget_attrs(widget)\n if isinstance(widget, NumberInput) and 'step' not in widget.attrs:\n attrs.setdefault('step', 'any')\n return attrs", "metadata": "root.FloatField.widget_attrs", "header": "['class', 'FloatField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 322 }, { "content": "class DecimalField(IntegerField):\n default_error_messages = {\n 'invalid': _('Enter a number.'),\n }\n\n\n\n", "metadata": "root.DecimalField", "header": "['module', '___EOS___']", "index": 329 }, { "content": " def __init__(self, max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs):\n self.max_digits, self.decimal_places = max_digits, decimal_places\n super(DecimalField, self).__init__(max_value, min_value, *args, **kwargs)\n self.validators.append(validators.DecimalValidator(max_digits, decimal_places))", "metadata": "root.DecimalField.__init__", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 334 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input is a decimal number. Returns a Decimal\n instance. Returns None for empty values. Ensures that there are no more\n than max_digits in the number, and no more than decimal_places digits\n after the decimal point.\n \"\"\"\n if value in self.empty_values:\n return None\n if self.localize:\n value = formats.sanitize_separators(value)\n value = smart_text(value).strip()\n try:\n value = Decimal(value)\n except DecimalException:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.DecimalField.to_python", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 339 }, { "content": " def validate(self, value):\n super(DecimalField, self).validate(value)\n if value in self.empty_values:\n return\n # Check for NaN, Inf and -Inf values. We can't compare directly for NaN,\n # since it is never equal to itself. However, NaN is the only value that\n # isn't equal to itself, so we can use this to identify NaN\n if value != value or value == Decimal(\"Inf\") or value == Decimal(\"-Inf\"):\n raise ValidationError(self.error_messages['invalid'], code='invalid')", "metadata": "root.DecimalField.validate", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 357 }, { "content": " def widget_attrs(self, widget):\n attrs = super(DecimalField, self).widget_attrs(widget)\n if isinstance(widget, NumberInput) and 'step' not in widget.attrs:\n if self.decimal_places is not None:\n # Use exponential notation for small values since they might\n # be parsed as 0 otherwise. ref #20765\n step = str(Decimal('1') / 10 ** self.decimal_places).lower()\n else:\n step = 'any'\n attrs.setdefault('step', step)\n return attrs", "metadata": "root.DecimalField.widget_attrs", "header": "['class', 'DecimalField', '(', 'IntegerField', ')', ':', '___EOS___']", "index": 367 }, { "content": "class BaseTemporalField(Field):\n\n\n", "metadata": "root.BaseTemporalField", "header": "['module', '___EOS___']", "index": 380 }, { "content": " def __init__(self, input_formats=None, *args, **kwargs):\n super(BaseTemporalField, self).__init__(*args, **kwargs)\n if input_formats is not None:\n self.input_formats = input_formats", "metadata": "root.BaseTemporalField.__init__", "header": "['class', 'BaseTemporalField', '(', 'Field', ')', ':', '___EOS___']", "index": 382 }, { "content": " def to_python(self, value):\n # Try to coerce the value to unicode.\n unicode_value = force_text(value, strings_only=True)\n if isinstance(unicode_value, six.text_type):\n value = unicode_value.strip()\n # If unicode, try to strptime against each input format.\n if isinstance(value, six.text_type):\n for format in self.input_formats:\n try:\n return self.strptime(value, format)\n except (ValueError, TypeError):\n continue\n raise ValidationError(self.error_messages['invalid'], code='invalid')", "metadata": "root.BaseTemporalField.to_python", "header": "['class', 'BaseTemporalField', '(', 'Field', ')', ':', '___EOS___']", "index": 387 }, { "content": " def strptime(self, value, format):\n raise NotImplementedError('Subclasses must define this method.')", "metadata": "root.BaseTemporalField.strptime", "header": "['class', 'BaseTemporalField', '(', 'Field', ')', ':', '___EOS___']", "index": 401 }, { "content": "class DateField(BaseTemporalField):\n widget = DateInput\n input_formats = formats.get_format_lazy('DATE_INPUT_FORMATS')\n default_error_messages = {\n 'invalid': _('Enter a valid date.'),\n }\n\n", "metadata": "root.DateField", "header": "['module', '___EOS___']", "index": 405 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input can be converted to a date. Returns a Python\n datetime.date object.\n \"\"\"\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.datetime):\n return value.date()\n if isinstance(value, datetime.date):\n return value\n return super(DateField, self).to_python(value)", "metadata": "root.DateField.to_python", "header": "['class', 'DateField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 412 }, { "content": " def strptime(self, value, format):\n return datetime.datetime.strptime(force_str(value), format).date()", "metadata": "root.DateField.strptime", "header": "['class', 'DateField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 425 }, { "content": "class TimeField(BaseTemporalField):\n widget = TimeInput\n input_formats = formats.get_format_lazy('TIME_INPUT_FORMATS')\n default_error_messages = {\n 'invalid': _('Enter a valid time.')\n }\n\n", "metadata": "root.TimeField", "header": "['module', '___EOS___']", "index": 429 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input can be converted to a time. Returns a Python\n datetime.time object.\n \"\"\"\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.time):\n return value\n return super(TimeField, self).to_python(value)", "metadata": "root.TimeField.to_python", "header": "['class', 'TimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 436 }, { "content": " def strptime(self, value, format):\n return datetime.datetime.strptime(force_str(value), format).time()", "metadata": "root.TimeField.strptime", "header": "['class', 'TimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 447 }, { "content": "class DateTimeField(BaseTemporalField):\n widget = DateTimeInput\n input_formats = formats.get_format_lazy('DATETIME_INPUT_FORMATS')\n default_error_messages = {\n 'invalid': _('Enter a valid date/time.'),\n }\n\n\n", "metadata": "root.DateTimeField", "header": "['module', '___EOS___']", "index": 451 }, { "content": " def prepare_value(self, value):\n if isinstance(value, datetime.datetime):\n value = to_current_timezone(value)\n return value", "metadata": "root.DateTimeField.prepare_value", "header": "['class', 'DateTimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 458 }, { "content": " def to_python(self, value):\n \"\"\"\n Validates that the input can be converted to a datetime. Returns a\n Python datetime.datetime object.\n \"\"\"\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.datetime):\n return from_current_timezone(value)\n if isinstance(value, datetime.date):\n result = datetime.datetime(value.year, value.month, value.day)\n return from_current_timezone(result)\n result = super(DateTimeField, self).to_python(value)\n return from_current_timezone(result)", "metadata": "root.DateTimeField.to_python", "header": "['class', 'DateTimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 463 }, { "content": " def strptime(self, value, format):\n return datetime.datetime.strptime(force_str(value), format)", "metadata": "root.DateTimeField.strptime", "header": "['class', 'DateTimeField', '(', 'BaseTemporalField', ')', ':', '___EOS___']", "index": 478 }, { "content": "class DurationField(Field):\n default_error_messages = {\n 'invalid': _('Enter a valid duration.'),\n }\n\n", "metadata": "root.DurationField", "header": "['module', '___EOS___']", "index": 482 }, { "content": " def prepare_value(self, value):\n if isinstance(value, datetime.timedelta):\n return duration_string(value)\n return value", "metadata": "root.DurationField.prepare_value", "header": "['class', 'DurationField', '(', 'Field', ')', ':', '___EOS___']", "index": 487 }, { "content": " def to_python(self, value):\n if value in self.empty_values:\n return None\n if isinstance(value, datetime.timedelta):\n return value\n value = parse_duration(force_text(value))\n if value is None:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.DurationField.to_python", "header": "['class', 'DurationField', '(', 'Field', ')', ':', '___EOS___']", "index": 492 }, { "content": "class RegexField(CharField):\n\n\n\n regex = property(_get_regex, _set_regex)", "metadata": "root.RegexField", "header": "['module', '___EOS___']", "index": 503 }, { "content": " def __init__(self, regex, max_length=None, min_length=None, error_message=None, *args, **kwargs):\n \"\"\"\n regex can be either a string or a compiled regular expression object.\n error_message is an optional error message to use, if\n 'Enter a valid value' is too generic for you.\n \"\"\"\n kwargs.setdefault('strip', False)\n super(RegexField, self).__init__(max_length, min_length, *args, **kwargs)\n self._set_regex(regex)", "metadata": "root.RegexField.__init__", "header": "['class', 'RegexField', '(', 'CharField', ')', ':', '___EOS___']", "index": 504 }, { "content": " def _get_regex(self):\n return self._regex", "metadata": "root.RegexField._get_regex", "header": "['class', 'RegexField', '(', 'CharField', ')', ':', '___EOS___']", "index": 514 }, { "content": " def _set_regex(self, regex):\n if isinstance(regex, six.string_types):\n regex = re.compile(regex, re.UNICODE)\n self._regex = regex\n if hasattr(self, '_regex_validator') and self._regex_validator in self.validators:\n self.validators.remove(self._regex_validator)\n self._regex_validator = validators.RegexValidator(regex=regex)\n self.validators.append(self._regex_validator)", "metadata": "root.RegexField._set_regex", "header": "['class', 'RegexField', '(', 'CharField', ')', ':', '___EOS___']", "index": 517 }, { "content": "class EmailField(CharField):\n widget = EmailInput\n default_validators = [validators.validate_email]\n", "metadata": "root.EmailField", "header": "['module', '___EOS___']", "index": 529 }, { "content": " def clean(self, value):\n value = self.to_python(value).strip()\n return super(EmailField, self).clean(value)", "metadata": "root.EmailField.clean", "header": "['class', 'EmailField', '(', 'CharField', ')', ':', '___EOS___']", "index": 533 }, { "content": "class FileField(Field):\n widget = ClearableFileInput\n default_error_messages = {\n 'invalid': _(\"No file was submitted. Check the encoding type on the form.\"),\n 'missing': _(\"No file was submitted.\"),\n 'empty': _(\"The submitted file is empty.\"),\n 'max_length': ungettext_lazy(\n 'Ensure this filename has at most %(max)d character (it has %(length)d).',\n 'Ensure this filename has at most %(max)d characters (it has %(length)d).',\n 'max'),\n 'contradiction': _('Please either submit a file or check the clear checkbox, not both.')\n }\n\n\n\n\n", "metadata": "root.FileField", "header": "['module', '___EOS___']", "index": 538 }, { "content": " def __init__(self, *args, **kwargs):\n self.max_length = kwargs.pop('max_length', None)\n self.allow_empty_file = kwargs.pop('allow_empty_file', False)\n super(FileField, self).__init__(*args, **kwargs)", "metadata": "root.FileField.__init__", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 551 }, { "content": " def to_python(self, data):\n if data in self.empty_values:\n return None\n\n # UploadedFile objects should have name and size attributes.\n try:\n file_name = data.name\n file_size = data.size\n except AttributeError:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n\n if self.max_length is not None and len(file_name) > self.max_length:\n params = {'max': self.max_length, 'length': len(file_name)}\n raise ValidationError(self.error_messages['max_length'], code='max_length', params=params)\n if not file_name:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n if not self.allow_empty_file and not file_size:\n raise ValidationError(self.error_messages['empty'], code='empty')\n\n return data", "metadata": "root.FileField.to_python", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 556 }, { "content": " def clean(self, data, initial=None):\n # If the widget got contradictory inputs, we raise a validation error\n if data is FILE_INPUT_CONTRADICTION:\n raise ValidationError(self.error_messages['contradiction'], code='contradiction')\n # False means the field value should be cleared; further validation is\n # not needed.\n if data is False:\n if not self.required:\n return False\n # If the field is required, clearing is not possible (the widget\n # shouldn't return False data in that case anyway). False is not\n # in self.empty_value; if a False value makes it this far\n # it should be validated from here on out as None (so it will be\n # caught by the required check).\n data = None\n if not data and initial:\n return initial\n return super(FileField, self).clean(data)", "metadata": "root.FileField.clean", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 577 }, { "content": " def bound_data(self, data, initial):\n if data in (None, FILE_INPUT_CONTRADICTION):\n return initial\n return data", "metadata": "root.FileField.bound_data", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 596 }, { "content": " def has_changed(self, initial, data):\n if data is None:\n return False\n return True", "metadata": "root.FileField.has_changed", "header": "['class', 'FileField', '(', 'Field', ')', ':', '___EOS___']", "index": 601 }, { "content": "class ImageField(FileField):\n default_error_messages = {\n 'invalid_image': _(\n \"Upload a valid image. The file you uploaded was either not an \"\n \"image or a corrupted image.\"\n ),\n }\n", "metadata": "root.ImageField", "header": "['module', '___EOS___']", "index": 607 }, { "content": " def to_python(self, data):\n \"\"\"\n Checks that the file-upload field data contains a valid image (GIF, JPG,\n PNG, possibly others -- whatever the Python Imaging Library supports).\n \"\"\"\n f = super(ImageField, self).to_python(data)\n if f is None:\n return None\n\n from PIL import Image\n\n # We need to get a file object for Pillow. We might have a path or we might\n # have to read the data into memory.\n if hasattr(data, 'temporary_file_path'):\n file = data.temporary_file_path()\n else:\n if hasattr(data, 'read'):\n file = BytesIO(data.read())\n else:\n file = BytesIO(data['content'])\n\n try:\n # load() could spot a truncated JPEG, but it loads the entire\n # image in memory, which is a DoS vector. See #3848 and #18520.\n image = Image.open(file)\n # verify() must be called immediately after the constructor.\n image.verify()\n\n # Annotating so subclasses can reuse it for their own validation\n f.image = image\n # Pillow doesn't detect the MIME type of all formats. In those\n # cases, content_type will be None.\n f.content_type = Image.MIME.get(image.format)\n except Exception:\n # Pillow doesn't recognize it as an image.\n six.reraise(ValidationError, ValidationError(\n self.error_messages['invalid_image'],\n code='invalid_image',\n ), sys.exc_info()[2])\n if hasattr(f, 'seek') and callable(f.seek):\n f.seek(0)\n return f", "metadata": "root.ImageField.to_python", "header": "['class', 'ImageField', '(', 'FileField', ')', ':', '___EOS___']", "index": 615 }, { "content": "class URLField(CharField):\n widget = URLInput\n default_error_messages = {\n 'invalid': _('Enter a valid URL.'),\n }\n default_validators = [validators.URLValidator()]\n\n", "metadata": "root.URLField", "header": "['module', '___EOS___']", "index": 659 }, { "content": " def to_python(self, value):\n\n def split_url(url):\n \"\"\"\n Returns a list of url parts via ``urlparse.urlsplit`` (or raises a\n ``ValidationError`` exception for certain).\n \"\"\"\n try:\n return list(urlsplit(url))\n except ValueError:\n # urlparse.urlsplit can raise a ValueError with some\n # misformatted URLs.\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n\n value = super(URLField, self).to_python(value)\n if value:\n url_fields = split_url(value)\n if not url_fields[0]:\n # If no URL scheme given, assume http://\n url_fields[0] = 'http'\n if not url_fields[1]:\n # Assume that if no domain is provided, that the path segment\n # contains the domain.\n url_fields[1] = url_fields[2]\n url_fields[2] = ''\n # Rebuild the url_fields list, since the domain segment may now\n # contain the path too.\n url_fields = split_url(urlunsplit(url_fields))\n value = urlunsplit(url_fields)\n return value", "metadata": "root.URLField.to_python", "header": "['class', 'URLField', '(', 'CharField', ')', ':', '___EOS___']", "index": 666 }, { "content": " def clean(self, value):\n value = self.to_python(value).strip()\n return super(URLField, self).clean(value)", "metadata": "root.URLField.clean", "header": "['class', 'URLField', '(', 'CharField', ')', ':', '___EOS___']", "index": 697 }, { "content": "class BooleanField(Field):\n widget = CheckboxInput\n\n\n", "metadata": "root.BooleanField", "header": "['module', '___EOS___']", "index": 702 }, { "content": " def to_python(self, value):\n \"\"\"Returns a Python boolean object.\"\"\"\n # Explicitly check for the string 'False', which is what a hidden field\n # will submit for False. Also check for '0', since this is what\n # RadioSelect will provide. Because bool(\"True\") == bool('1') == True,\n # we don't need to handle that explicitly.\n if isinstance(value, six.string_types) and value.lower() in ('false', '0'):\n value = False\n else:\n value = bool(value)\n return super(BooleanField, self).to_python(value)", "metadata": "root.BooleanField.to_python", "header": "['class', 'BooleanField', '(', 'Field', ')', ':', '___EOS___']", "index": 705 }, { "content": " def validate(self, value):\n if not value and self.required:\n raise ValidationError(self.error_messages['required'], code='required')", "metadata": "root.BooleanField.validate", "header": "['class', 'BooleanField', '(', 'Field', ')', ':', '___EOS___']", "index": 717 }, { "content": " def has_changed(self, initial, data):\n # Sometimes data or initial may be a string equivalent of a boolean\n # so we should run it through to_python first to get a boolean value\n return self.to_python(initial) != self.to_python(data)", "metadata": "root.BooleanField.has_changed", "header": "['class', 'BooleanField', '(', 'Field', ')', ':', '___EOS___']", "index": 721 }, { "content": "class NullBooleanField(BooleanField):\n \"\"\"\n A field whose valid values are None, True and False. Invalid values are\n cleaned to None.\n \"\"\"\n widget = NullBooleanSelect\n\n", "metadata": "root.NullBooleanField", "header": "['module', '___EOS___']", "index": 727 }, { "content": " def to_python(self, value):\n \"\"\"\n Explicitly checks for the string 'True' and 'False', which is what a\n hidden field will submit for True and False, for 'true' and 'false',\n which are likely to be returned by JavaScript serializations of forms,\n and for '1' and '0', which is what a RadioField will submit. Unlike\n the Booleanfield we need to explicitly check for True, because we are\n not using the bool() function\n \"\"\"\n if value in (True, 'True', 'true', '1'):\n return True\n elif value in (False, 'False', 'false', '0'):\n return False\n else:\n return None", "metadata": "root.NullBooleanField.to_python", "header": "['class', 'NullBooleanField', '(', 'BooleanField', ')', ':', '___EOS___']", "index": 734 }, { "content": " def validate(self, value):\n pass", "metadata": "root.NullBooleanField.validate", "header": "['class', 'NullBooleanField', '(', 'BooleanField', ')', ':', '___EOS___']", "index": 750 }, { "content": "class ChoiceField(Field):\n widget = Select\n default_error_messages = {\n 'invalid_choice': _('Select a valid choice. %(value)s is not one of the available choices.'),\n }\n\n\n\n\n\n choices = property(_get_choices, _set_choices)\n\n\n", "metadata": "root.ChoiceField", "header": "['module', '___EOS___']", "index": 763 }, { "content": " def __init__(self, choices=(), required=True, widget=None, label=None,\n initial=None, help_text='', *args, **kwargs):\n super(ChoiceField, self).__init__(\n required=required, widget=widget, label=label, initial=initial,\n help_text=help_text, *args, **kwargs\n )\n self.choices = choices", "metadata": "root.ChoiceField.__init__", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 769 }, { "content": " def __deepcopy__(self, memo):\n result = super(ChoiceField, self).__deepcopy__(memo)\n result._choices = copy.deepcopy(self._choices, memo)\n return result", "metadata": "root.ChoiceField.__deepcopy__", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 777 }, { "content": " def _get_choices(self):\n return self._choices", "metadata": "root.ChoiceField._get_choices", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 782 }, { "content": " def _set_choices(self, value):\n # Setting choices also sets the choices on the widget.\n # choices can be any iterable, but we call list() on it because\n # it will be consumed more than once.\n if callable(value):\n value = CallableChoiceIterator(value)\n else:\n value = list(value)\n\n self._choices = self.widget.choices = value", "metadata": "root.ChoiceField._set_choices", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 785 }, { "content": " def to_python(self, value):\n \"Returns a Unicode object.\"\n if value in self.empty_values:\n return ''\n return smart_text(value)", "metadata": "root.ChoiceField.to_python", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 798 }, { "content": " def validate(self, value):\n \"\"\"\n Validates that the input is in self.choices.\n \"\"\"\n super(ChoiceField, self).validate(value)\n if value and not self.valid_value(value):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': value},\n )", "metadata": "root.ChoiceField.validate", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 804 }, { "content": " def valid_value(self, value):\n \"Check to see if the provided value is a valid choice\"\n text_value = force_text(value)\n for k, v in self.choices:\n if isinstance(v, (list, tuple)):\n # This is an optgroup, so look inside the group for options\n for k2, v2 in v:\n if value == k2 or text_value == force_text(k2):\n return True\n else:\n if value == k or text_value == force_text(k):\n return True\n return False", "metadata": "root.ChoiceField.valid_value", "header": "['class', 'ChoiceField', '(', 'Field', ')', ':', '___EOS___']", "index": 816 }, { "content": "class TypedChoiceField(ChoiceField):\n\n", "metadata": "root.TypedChoiceField", "header": "['module', '___EOS___']", "index": 831 }, { "content": " def __init__(self, *args, **kwargs):\n self.coerce = kwargs.pop('coerce', lambda val: val)\n self.empty_value = kwargs.pop('empty_value', '')\n super(TypedChoiceField, self).__init__(*args, **kwargs)", "metadata": "root.TypedChoiceField.__init__", "header": "['class', 'TypedChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 832 }, { "content": " def _coerce(self, value):\n \"\"\"\n Validate that the value can be coerced to the right type (if not empty).\n \"\"\"\n if value == self.empty_value or value in self.empty_values:\n return self.empty_value\n try:\n value = self.coerce(value)\n except (ValueError, TypeError, ValidationError):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': value},\n )\n return value", "metadata": "root.TypedChoiceField._coerce", "header": "['class', 'TypedChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 837 }, { "content": " def clean(self, value):\n value = super(TypedChoiceField, self).clean(value)\n return self._coerce(value)", "metadata": "root.TypedChoiceField.clean", "header": "['class', 'TypedChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 853 }, { "content": "class MultipleChoiceField(ChoiceField):\n hidden_widget = MultipleHiddenInput\n widget = SelectMultiple\n default_error_messages = {\n 'invalid_choice': _('Select a valid choice. %(value)s is not one of the available choices.'),\n 'invalid_list': _('Enter a list of values.'),\n }\n\n\n", "metadata": "root.MultipleChoiceField", "header": "['module', '___EOS___']", "index": 858 }, { "content": " def to_python(self, value):\n if not value:\n return []\n elif not isinstance(value, (list, tuple)):\n raise ValidationError(self.error_messages['invalid_list'], code='invalid_list')\n return [smart_text(val) for val in value]", "metadata": "root.MultipleChoiceField.to_python", "header": "['class', 'MultipleChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 866 }, { "content": " def validate(self, value):\n \"\"\"\n Validates that the input is a list or tuple.\n \"\"\"\n if self.required and not value:\n raise ValidationError(self.error_messages['required'], code='required')\n # Validate that each value in the value list is in self.choices.\n for val in value:\n if not self.valid_value(val):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': val},\n )", "metadata": "root.MultipleChoiceField.validate", "header": "['class', 'MultipleChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 873 }, { "content": " def has_changed(self, initial, data):\n if initial is None:\n initial = []\n if data is None:\n data = []\n if len(initial) != len(data):\n return True\n initial_set = set(force_text(value) for value in initial)\n data_set = set(force_text(value) for value in data)\n return data_set != initial_set", "metadata": "root.MultipleChoiceField.has_changed", "header": "['class', 'MultipleChoiceField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 888 }, { "content": "class TypedMultipleChoiceField(MultipleChoiceField):\n\n\n", "metadata": "root.TypedMultipleChoiceField", "header": "['module', '___EOS___']", "index": 900 }, { "content": " def __init__(self, *args, **kwargs):\n self.coerce = kwargs.pop('coerce', lambda val: val)\n self.empty_value = kwargs.pop('empty_value', [])\n super(TypedMultipleChoiceField, self).__init__(*args, **kwargs)", "metadata": "root.TypedMultipleChoiceField.__init__", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 901 }, { "content": " def _coerce(self, value):\n \"\"\"\n Validates that the values are in self.choices and can be coerced to the\n right type.\n \"\"\"\n if value == self.empty_value or value in self.empty_values:\n return self.empty_value\n new_value = []\n for choice in value:\n try:\n new_value.append(self.coerce(choice))\n except (ValueError, TypeError, ValidationError):\n raise ValidationError(\n self.error_messages['invalid_choice'],\n code='invalid_choice',\n params={'value': choice},\n )\n return new_value", "metadata": "root.TypedMultipleChoiceField._coerce", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 906 }, { "content": " def clean(self, value):\n value = super(TypedMultipleChoiceField, self).clean(value)\n return self._coerce(value)", "metadata": "root.TypedMultipleChoiceField.clean", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 925 }, { "content": " def validate(self, value):\n if value != self.empty_value:\n super(TypedMultipleChoiceField, self).validate(value)\n elif self.required:\n raise ValidationError(self.error_messages['required'], code='required')", "metadata": "root.TypedMultipleChoiceField.validate", "header": "['class', 'TypedMultipleChoiceField', '(', 'MultipleChoiceField', ')', ':', '___EOS___']", "index": 929 }, { "content": "class ComboField(Field):\n \"\"\"\n A Field whose clean() method calls multiple Field clean() methods.\n \"\"\"\n", "metadata": "root.ComboField", "header": "['module', '___EOS___']", "index": 936 }, { "content": " def __init__(self, fields=(), *args, **kwargs):\n super(ComboField, self).__init__(*args, **kwargs)\n # Set 'required' to False on the individual fields, because the\n # required validation will be handled by ComboField, not by those\n # individual fields.\n for f in fields:\n f.required = False\n self.fields = fields", "metadata": "root.ComboField.__init__", "header": "['class', 'ComboField', '(', 'Field', ')', ':', '___EOS___']", "index": 940 }, { "content": " def clean(self, value):\n \"\"\"\n Validates the given value against all of self.fields, which is a\n list of Field instances.\n \"\"\"\n super(ComboField, self).clean(value)\n for field in self.fields:\n value = field.clean(value)\n return value", "metadata": "root.ComboField.clean", "header": "['class', 'ComboField', '(', 'Field', ')', ':', '___EOS___']", "index": 949 }, { "content": "class MultiValueField(Field):\n \"\"\"\n A Field that aggregates the logic of multiple Fields.\n\n Its clean() method takes a \"decompressed\" list of values, which are then\n cleaned into a single value according to self.fields. Each value in\n this list is cleaned by the corresponding field -- the first value is\n cleaned by the first field, the second value is cleaned by the second\n field, etc. Once all fields are cleaned, the list of clean values is\n \"compressed\" into a single value.\n\n Subclasses should not have to implement clean(). Instead, they must\n implement compress(), which takes a list of valid values and returns a\n \"compressed\" version of those values -- a single value.\n\n You'll probably want to use this with MultiWidget.\n \"\"\"\n default_error_messages = {\n 'invalid': _('Enter a list of values.'),\n 'incomplete': _('Enter a complete value.'),\n }\n\n\n\n\n\n", "metadata": "root.MultiValueField", "header": "['module', '___EOS___']", "index": 960 }, { "content": " def __init__(self, fields=(), *args, **kwargs):\n self.require_all_fields = kwargs.pop('require_all_fields', True)\n super(MultiValueField, self).__init__(*args, **kwargs)\n for f in fields:\n f.error_messages.setdefault('incomplete',\n self.error_messages['incomplete'])\n if self.require_all_fields:\n # Set 'required' to False on the individual fields, because the\n # required validation will be handled by MultiValueField, not\n # by those individual fields.\n f.required = False\n self.fields = fields", "metadata": "root.MultiValueField.__init__", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 982 }, { "content": " def __deepcopy__(self, memo):\n result = super(MultiValueField, self).__deepcopy__(memo)\n result.fields = tuple(x.__deepcopy__(memo) for x in self.fields)\n return result", "metadata": "root.MultiValueField.__deepcopy__", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 995 }, { "content": " def validate(self, value):\n pass", "metadata": "root.MultiValueField.validate", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1000 }, { "content": " def clean(self, value):\n \"\"\"\n Validates every value in the given list. A value is validated against\n the corresponding Field in self.fields.\n\n For example, if this MultiValueField was instantiated with\n fields=(DateField(), TimeField()), clean() would call\n DateField.clean(value[0]) and TimeField.clean(value[1]).\n \"\"\"\n clean_data = []\n errors = []\n if not value or isinstance(value, (list, tuple)):\n if not value or not [v for v in value if v not in self.empty_values]:\n if self.required:\n raise ValidationError(self.error_messages['required'], code='required')\n else:\n return self.compress([])\n else:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n for i, field in enumerate(self.fields):\n try:\n field_value = value[i]\n except IndexError:\n field_value = None\n if field_value in self.empty_values:\n if self.require_all_fields:\n # Raise a 'required' error if the MultiValueField is\n # required and any field is empty.\n if self.required:\n raise ValidationError(self.error_messages['required'], code='required')\n elif field.required:\n # Otherwise, add an 'incomplete' error to the list of\n # collected errors and skip field cleaning, if a required\n # field is empty.\n if field.error_messages['incomplete'] not in errors:\n errors.append(field.error_messages['incomplete'])\n continue\n try:\n clean_data.append(field.clean(field_value))\n except ValidationError as e:\n # Collect all validation errors in a single list, which we'll\n # raise at the end of clean(), rather than raising a single\n # exception for the first error we encounter. Skip duplicates.\n errors.extend(m for m in e.error_list if m not in errors)\n if errors:\n raise ValidationError(errors)\n\n out = self.compress(clean_data)\n self.validate(out)\n self.run_validators(out)\n return out", "metadata": "root.MultiValueField.clean", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1003 }, { "content": " def compress(self, data_list):\n \"\"\"\n Returns a single value for the given list of values. The values can be\n assumed to be valid.\n\n For example, if this MultiValueField was instantiated with\n fields=(DateField(), TimeField()), this might return a datetime\n object created by combining the date and time in data_list.\n \"\"\"\n raise NotImplementedError('Subclasses must implement this method.')", "metadata": "root.MultiValueField.compress", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1055 }, { "content": " def has_changed(self, initial, data):\n if initial is None:\n initial = ['' for x in range(0, len(data))]\n else:\n if not isinstance(initial, list):\n initial = self.widget.decompress(initial)\n for field, initial, data in zip(self.fields, initial, data):\n try:\n initial = field.to_python(initial)\n except ValidationError:\n return True\n if field.has_changed(initial, data):\n return True\n return False", "metadata": "root.MultiValueField.has_changed", "header": "['class', 'MultiValueField', '(', 'Field', ')', ':', '___EOS___']", "index": 1066 }, { "content": "class FilePathField(ChoiceField):", "metadata": "root.FilePathField", "header": "['module', '___EOS___']", "index": 1082 }, { "content": " def __init__(self, path, match=None, recursive=False, allow_files=True,\n allow_folders=False, required=True, widget=None, label=None,\n initial=None, help_text='', *args, **kwargs):\n self.path, self.match, self.recursive = path, match, recursive\n self.allow_files, self.allow_folders = allow_files, allow_folders\n super(FilePathField, self).__init__(\n choices=(), required=required, widget=widget, label=label,\n initial=initial, help_text=help_text, *args, **kwargs\n )\n\n if self.required:\n self.choices = []\n else:\n self.choices = [(\"\", \"---------\")]\n\n if self.match is not None:\n self.match_re = re.compile(self.match)\n\n if recursive:\n for root, dirs, files in sorted(os.walk(self.path)):\n if self.allow_files:\n for f in files:\n if self.match is None or self.match_re.search(f):\n f = os.path.join(root, f)\n self.choices.append((f, f.replace(path, \"\", 1)))\n if self.allow_folders:\n for f in dirs:\n if f == '__pycache__':\n continue\n if self.match is None or self.match_re.search(f):\n f = os.path.join(root, f)\n self.choices.append((f, f.replace(path, \"\", 1)))\n else:\n try:\n for f in sorted(os.listdir(self.path)):\n if f == '__pycache__':\n continue\n full_file = os.path.join(self.path, f)\n if (((self.allow_files and os.path.isfile(full_file)) or\n (self.allow_folders and os.path.isdir(full_file))) and\n (self.match is None or self.match_re.search(f))):\n self.choices.append((full_file, f))\n except OSError:\n pass\n\n self.widget.choices = self.choices", "metadata": "root.FilePathField.__init__", "header": "['class', 'FilePathField', '(', 'ChoiceField', ')', ':', '___EOS___']", "index": 1083 }, { "content": "class SplitDateTimeField(MultiValueField):\n widget = SplitDateTimeWidget\n hidden_widget = SplitHiddenDateTimeWidget\n default_error_messages = {\n 'invalid_date': _('Enter a valid date.'),\n 'invalid_time': _('Enter a valid time.'),\n }\n\n", "metadata": "root.SplitDateTimeField", "header": "['module', '___EOS___']", "index": 1131 }, { "content": " def __init__(self, input_date_formats=None, input_time_formats=None, *args, **kwargs):\n errors = self.default_error_messages.copy()\n if 'error_messages' in kwargs:\n errors.update(kwargs['error_messages'])\n localize = kwargs.get('localize', False)\n fields = (\n DateField(input_formats=input_date_formats,\n error_messages={'invalid': errors['invalid_date']},\n localize=localize),\n TimeField(input_formats=input_time_formats,\n error_messages={'invalid': errors['invalid_time']},\n localize=localize),\n )\n super(SplitDateTimeField, self).__init__(fields, *args, **kwargs)", "metadata": "root.SplitDateTimeField.__init__", "header": "['class', 'SplitDateTimeField', '(', 'MultiValueField', ')', ':', '___EOS___']", "index": 1139 }, { "content": " def compress(self, data_list):\n if data_list:\n # Raise a validation error if time or date is empty\n # (possible if SplitDateTimeField has required=False).\n if data_list[0] in self.empty_values:\n raise ValidationError(self.error_messages['invalid_date'], code='invalid_date')\n if data_list[1] in self.empty_values:\n raise ValidationError(self.error_messages['invalid_time'], code='invalid_time')\n result = datetime.datetime.combine(*data_list)\n return from_current_timezone(result)\n return None", "metadata": "root.SplitDateTimeField.compress", "header": "['class', 'SplitDateTimeField', '(', 'MultiValueField', ')', ':', '___EOS___']", "index": 1154 }, { "content": "class GenericIPAddressField(CharField):\n", "metadata": "root.GenericIPAddressField", "header": "['module', '___EOS___']", "index": 1167 }, { "content": " def __init__(self, protocol='both', unpack_ipv4=False, *args, **kwargs):\n self.unpack_ipv4 = unpack_ipv4\n self.default_validators = validators.ip_address_validators(protocol, unpack_ipv4)[0]\n super(GenericIPAddressField, self).__init__(*args, **kwargs)", "metadata": "root.GenericIPAddressField.__init__", "header": "['class', 'GenericIPAddressField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1168 }, { "content": " def to_python(self, value):\n if value in self.empty_values:\n return ''\n value = value.strip()\n if value and ':' in value:\n return clean_ipv6_address(value, self.unpack_ipv4)\n return value", "metadata": "root.GenericIPAddressField.to_python", "header": "['class', 'GenericIPAddressField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1173 }, { "content": "class SlugField(CharField):\n default_validators = [validators.validate_slug]\n", "metadata": "root.SlugField", "header": "['module', '___EOS___']", "index": 1182 }, { "content": " def __init__(self, *args, **kwargs):\n self.allow_unicode = kwargs.pop('allow_unicode', False)\n if self.allow_unicode:\n self.default_validators = [validators.validate_unicode_slug]\n super(SlugField, self).__init__(*args, **kwargs)", "metadata": "root.SlugField.__init__", "header": "['class', 'SlugField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1185 }, { "content": "class UUIDField(CharField):\n default_error_messages = {\n 'invalid': _('Enter a valid UUID.'),\n }\n\n", "metadata": "root.UUIDField", "header": "['module', '___EOS___']", "index": 1192 }, { "content": " def prepare_value(self, value):\n if isinstance(value, uuid.UUID):\n return value.hex\n return value", "metadata": "root.UUIDField.prepare_value", "header": "['class', 'UUIDField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1197 }, { "content": " def to_python(self, value):\n value = super(UUIDField, self).to_python(value)\n if value in self.empty_values:\n return None\n if not isinstance(value, uuid.UUID):\n try:\n value = uuid.UUID(value)\n except ValueError:\n raise ValidationError(self.error_messages['invalid'], code='invalid')\n return value", "metadata": "root.UUIDField.to_python", "header": "['class', 'UUIDField', '(', 'CharField', ')', ':', '___EOS___']", "index": 1202 } ]
[ { "span": "self.widget_attrs(widget)", "start_line": 106, "start_column": 22, "end_line": 106, "end_column": 47 } ]
[ { "span": "def widget_attrs(self, widget):", "start_line": 175, "start_column": 4, "end_line": 175, "end_column": 35 }, { "span": "def widget_attrs(self, widget):", "start_line": 235, "start_column": 4, "end_line": 235, "end_column": 35 }, { "span": "def widget_attrs(self, widget):", "start_line": 282, "start_column": 4, "end_line": 282, "end_column": 35 }, { "span": "def widget_attrs(self, widget):", "start_line": 322, "start_column": 4, "end_line": 322, "end_column": 35 }, { "span": "def widget_attrs(self, widget):", "start_line": 367, "start_column": 4, "end_line": 367, "end_column": 35 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Text", "Input_", "#", " ", "Default", " ", "widget", " ", "to", " ", "use", " ", "whe", "n", " ", "render", "ing", " ", "this", " ", "type", " ", "of", " ", "Field", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "widget_", "=_", "Hi", "dde", "n", "Input_", "#", " ", "Default", " ", "widget", " ", "to", " ", "use", " ", "whe", "n", " ", "render", "ing", " ", "this", " ", "as", " ", "\"", "hidden", "\".", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "validators_", "=_", "[_", "]_", "#", " ", "Default", " ", "set", " ", "of", " ", "validators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "an", " ", "'", "invalid", "'", " ", "entry", " ", "to", " ", "default", "\\u", "error", "\\u", "message", " ", "if", " ", "you", " ", "want", " ", "a", " ", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", " ", "error", " ", "message", " ", "not", " ", "raise", "d", " ", "by", " ", "the", " ", "field", " ", "validator", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d", "'_", ":_", "\\u_", "(_", "'", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty", "\\u", "values_", "=_", "list_", "(_", "validators_", "._", "EMP", "TY", "\\u", "VALUES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Track", "s", " ", "each", " ", "time", " ", "a", " ", "Field", " ", "instance", " ", "is", " ", "created", ".", " ", "Us", "ed", " ", "to", " ", "retain", " ", "order", "._", "\\u\\u\\uNL\\u\\u\\u_", "creati", "on", "\\u", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "required_", "=_", "True_", ",_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "initial_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "''_", ",_", "error", "\\u", "messages_", "=_", "None_", ",_", "show", "\\u", "hidden", "\\u", "initial_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validators_", "=_", "[_", "]_", ",_", "localize_", "=_", "False_", ",_", "disabled_", "=_", "False_", ",_", "label", "\\u", "suffix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "require", "d", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "whe", "ther", " ", "the", " ", "field", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "Tru", "e", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "widget", " ", "--", " ", "A", " ", "Wid", "get", " ", "class", ",", " ", "or", " ", "instance", " ", "of", " ", "a", " ", "Wid", "get", " ", "class", ",", " ", "tha", "t", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "be", " ", "used", " ", "for", " ", "this", " ", "Field", " ", "whe", "n", " ", "display", "ing", " ", "it", ".", " ", "Ea", "ch", " ", "Field", " ", "has", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "default", " ", "Wid", "get", " ", "tha", "t", " ", "it", "'", "ll", " ", "use", " ", "if", " ", "you", " ", "don", "'", "t", " ", "speci", "fy", " ", "this", ".", " ", "In_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "most", " ", "case", "s", ",", " ", "the", " ", "default", " ", "widget", " ", "is", " ", "Text", "Inp", "ut", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "label", " ", "--", " ", "A", " ", "verbo", "se", " ", "name", " ", "for", " ", "this", " ", "field", ",", " ", "for", " ", "use", " ", "in", " ", "display", "ing", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "field", " ", "in", " ", "a", " ", "form", ".", " ", "By", " ", "default", ",", " ", "Dj", "ang", "o", " ", "will", " ", "use", " ", "a", " ", "\"", "pretty", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "version", " ", "of", " ", "the", " ", "form", " ", "field", " ", "name", ",", " ", "if", " ", "the", " ", "Field", " ", "is", " ", "part", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Form", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "initial", " ", "--", " ", "A", " ", "value", " ", "to", " ", "use", " ", "in", " ", "this", " ", "Field", "'", "s", " ", "initial", " ", "display", ".", " ", "Thi", "s", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "is", " ", "*", "not", "*", " ", "used", " ", "as", " ", "a", " ", "fall", "back", " ", "if", " ", "data", " ", "isn", "'", "t", " ", "give", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", "\\u", "text", " ", "--", " ", "An", " ", "option", "al", " ", "string", " ", "to", " ", "use", " ", "as", " ", "\"", "help", " ", "text", "\"", " ", "for", " ", "this", " ", "Field", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", "\\u", "message", "s", " ", "--", " ", "An", " ", "option", "al", " ", "dictionar", "y", " ", "to", " ", "override", " ", "the", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", "s", " ", "tha", "t", " ", "the", " ", "field", " ", "will", " ", "raise", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "show", "\\u", "hidden", "\\u", "initial", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "if", " ", "it", " ", "is", " ", "need", "ed", " ", "to", " ", "render", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "hidden", " ", "widget", " ", "with", " ", "initial", " ", "value", " ", "after", " ", "widget", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validator", "s", " ", "--", " ", "List", " ", "of", " ", "addition", "al", " ", "validator", "s", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "localiz", "e", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "if", " ", "the", " ", "field", " ", "shou", "ld", " ", "be", " ", "localized", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disable", "d", " ", "--", " ", "Boo", "lean", " ", "tha", "t", " ", "speci", "fie", "s", " ", "whe", "ther", " ", "the", " ", "field", " ", "is", " ", "disable", "d", ",", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "is", " ", "its", " ", "widget", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "form", " ", "but", " ", "not", " ", "edita", "ble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "label", "\\u", "suff", "ix", " ", "--", " ", "Su", "ffi", "x", " ", "to", " ", "be", " ", "adde", "d", " ", "to", " ", "the", " ", "label", ".", " ", "Override", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "form", "'", "s", " ", "label", "\\u", "suff", "ix", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "required_", ",_", "self_", "._", "label_", ",_", "self_", "._", "initial_", "=_", "required_", ",_", "label_", ",_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "\\u", "hidden", "\\u", "initial_", "=_", "show", "\\u", "hidden", "\\u", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "help", "\\u", "text_", "=_", "help", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "disabled_", "=_", "disabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "suffix_", "=_", "label", "\\u", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "widget_", "or_", "self_", "._", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Trigger", " ", "the", " ", "localization", " ", "machine", "ry", " ", "if", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "localize_", "=_", "localize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "is", "\\u", "localized", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Let", " ", "the", " ", "widget", " ", "know", " ", "whe", "ther", " ", "it", " ", "shou", "ld", " ", "display", " ", "as", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "widget_", "._", "is", "\\u", "required_", "=_", "self_", "._", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hook", " ", "int", "o", " ", "self", ".", "widget", "\\u", "attr", "s", "()", " ", "for", " ", "any", " ", "Field", "-", "specific", " ", "HTM", "L", " ", "attribute", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "attrs_", "=_", "self_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extra", "\\u", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "attrs_", "._", "update_", "(_", "extra", "\\u", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "widget_", "=_", "widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increase", " ", "the", " ", "creati", "on", " ", "counter", ",", " ", "and", " ", "save", " ", "our", " ", "local", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "creati", "on", "\\u", "counter_", "=_", "Field_", "._", "creati", "on", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Field_", "._", "creati", "on", "\\u", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "reversed_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "mro", "\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "messages_", "._", "update_", "(_", "getattr_", "(_", "c_", ",_", "'", "default", "\\u", "error", "\\u", "message", "s", "'_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "messages_", "._", "update_", "(_", "error", "\\u", "messages_", "or_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "=_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "validators_", "=_", "list_", "(_", "itertools_", "._", "chain_", "(_", "self_", "._", "default", "\\u", "validators_", ",_", "validators_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", "and_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "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_", "run", "\\u", "validators_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "self_", "._", "validators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "e_", ",_", "'", "code", "'_", ")_", "and_", "e_", "._", "code_", "in_", "self_", "._", "error", "\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "e_", "._", "message_", "=_", "self_", "._", "error", "\\u", "messages_", "[_", "e_", "._", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "errors_", "._", "extend_", "(_", "e_", "._", "error", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "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_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "the", " ", "give", "n", " ", "value", " ", "and", " ", "return", "s", " ", "its", " ", "\"", "clean", "ed", "\"", " ", "value", " ", "as", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "appropr", "iate", " ", "Pyth", "on", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Validat", "ion", "Error", " ", "for", " ", "any", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "validators_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bound", "\\u", "data_", "(_", "self_", ",_", "data_", ",_", "initial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "value", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "shown", " ", "for", " ", "this", " ", "field", " ", "on", " ", "render", " ", "of", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "bound", " ", "form", ",", " ", "give", "n", " ", "the", " ", "submitted", " ", "POST", " ", "data", " ", "for", " ", "the", " ", "field", " ", "and", " ", "the", " ", "initial", "\\", "10", ";", " ", " ", " ", " ", "data", ",", " ", "if", " ", "any", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "most", " ", "fields", ",", " ", "this", " ", "will", " ", "simp", "ly", " ", "be", " ", "data", ";", " ", "File", "Field", "s", " ", "need", " ", "to", " ", "handle", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "bit", " ", "different", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "disabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "Wid", "get", " ", "instance", " ", "(*", "not", "*", " ", "a", " ", "Wid", "get", " ", "class", "),", " ", "return", "s", " ", "a", " ", "dictionar", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "HTM", "L", " ", "attribute", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "adde", "d", " ", "to", " ", "the", " ", "Wid", "get", ",", " ", "based", " ", "on", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "Field", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "Tru", "e", " ", "if", " ", "data", " ", "differs", " ", "from", " ", "initial", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "coerce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "coerce", "_", "(_", "data_", ")_", "!=_", "self_", "._", "\\u", "coerce", "_", "(_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "purpose", "s", " ", "of", " ", "see", "ing", " ", "whe", "ther", " ", "somet", "hing", " ", "has", " ", "change", "d", ",", " ", "Non", "e", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "same", " ", "as", " ", "an", " ", "empty", " ", "string", ",", " ", "if", " ", "the", " ", "data", " ", "or", " ", "initial", " ", "value", " ", "we", " ", "get_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "Non", "e", ",", " ", "replace", " ", "it", " ", "with", " ", "''", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "initial", "\\u", "value_", "=_", "initial_", "if_", "initial_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "value_", "=_", "data_", "if_", "data_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "initial", "\\u", "value_", "!=_", "data\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "bound", "\\u", "field_", "(_", "self_", ",_", "form_", ",_", "field", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "Bound", "Field", " ", "instance", " ", "tha", "t", " ", "will", " ", "be", " ", "used", " ", "whe", "n", " ", "accessi", "ng", " ", "the", " ", "form", "\\", "10", ";", " ", " ", " ", " ", "field", " ", "in", " ", "a", " ", "template", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Bound", "Field_", "(_", "form_", ",_", "self_", ",_", "field", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "copy_", "._", "copy_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memo_", "[_", "id_", "(_", "self_", ")_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "widget_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "widget_", ",_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "validators_", "=_", "self_", "._", "validators_", "[_", ":_", "]_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\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_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "max", "\\u", "length_", "=_", "None_", ",_", "min", "\\u", "length_", "=_", "None_", ",_", "strip_", "=_", "True_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "length_", "=_", "max", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "min", "\\u", "length_", "=_", "min", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "strip_", "=_", "strip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Char", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "min", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Min", "Length", "Validator_", "(_", "int_", "(_", "min", "\\u", "length_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "max", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Max", "Length", "Validator_", "(_", "int_", "(_", "max", "\\u", "length_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", "s", " ", "a", " ", "Unic", "ode", " ", "object", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "value_", "=_", "force", "\\u", "text_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "strip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Char", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Char", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "HTM", "L", " ", "attribute", " ", "is", " ", "maxlength", ",", " ", "not", " ", "max", "\\u", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "maxlength", "'_", "]_", "=_", "str_", "(_", "self_", "._", "max", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "min", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "HTM", "L", " ", "attribute", " ", "is", " ", "minlen", "gth", ",", " ", "not", " ", "min", "\\u", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "minlen", "gth", "'_", "]_", "=_", "str_", "(_", "self_", "._", "min", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Number", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "whole", " ", "number", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "re", "\\u", "decimal_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\.", "0", "*\\\\", "s", "*$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "max", "\\u", "value_", "=_", "None_", ",_", "min", "\\u", "value_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "value_", ",_", "self_", "._", "min", "\\u", "value_", "=_", "max", "\\u", "value_", ",_", "min", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kwargs_", "._", "get_", "(_", "'", "localiz", "e", "'_", ")_", "and_", "self_", "._", "widget_", "==_", "Number", "Input_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Locali", "zed", " ", "number", " ", "input", " ", "is", " ", "not", " ", "well", " ", "support", "ed", " ", "on", " ", "most", " ", "browsers", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "setdefault_", "(_", "'", "widget", "'_", ",_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "max", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Max", "Value", "Validator_", "(_", "max", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "min", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Min", "Value", "Validator_", "(_", "min", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "int", "()", " ", "can", " ", "be", " ", "call", "ed", " ", "on", " ", "the", " ", "input", ".", " ", "Return", "s", " ", "the", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "int", "()", ".", " ", "Return", "s", " ", "Non", "e", " ", "for", " ", "empty", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "formats_", "._", "sanitize", "\\u", "separators_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Strip", " ", "trail", "ing", " ", "decima", "l", " ", "and", " ", "zero", "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 ", " _", "value_", "=_", "int_", "(_", "self_", "._", "re", "\\u", "decimal_", "._", "sub_", "(_", "''_", ",_", "str_", "(_", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Integer", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "Number", "Input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "min", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "min", "'_", "]_", "=_", "self_", "._", "min", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "max", "'_", "]_", "=_", "self_", "._", "max", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "number", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "float", "()", " ", "can", " ", "be", " ", "call", "ed", " ", "on", " ", "the", " ", "input", ".", " ", "Return", "s", " ", "the", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "float", "()", ".", " ", "Return", "s", " ", "Non", "e", " ", "for", " ", "empty", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "super_", "(_", "Integer", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "formats_", "._", "sanitize", "\\u", "separators_", "(_", "value_", ")_", "\\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_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Float", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "Na", "N", " ", "(", "whi", "ch", " ", "is", " ", "the", " ", "only", " ", "thing", " ", "not", " ", "equal", " ", "to", " ", "its", "elf", ")", " ", "and", " ", "+/-", " ", "infinity", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "!=_", "value_", "or_", "value_", "in_", "(_", "Decimal_", "(_", "'", "Inf", "'_", ")_", ",_", "Decimal_", "(_", "'-", "Inf", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Float", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Float", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "Number", "Input_", ")_", "and_", "'", "step", "'_", "not_", "in_", "widget_", "._", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "._", "setdefault_", "(_", "'", "step", "'_", ",_", "'", "any", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "number", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "max", "\\u", "value_", "=_", "None_", ",_", "min", "\\u", "value_", "=_", "None_", ",_", "max", "\\u", "digits_", "=_", "None_", ",_", "decima", "l\\u", "places_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "digits_", ",_", "self_", "._", "decima", "l\\u", "places_", "=_", "max", "\\u", "digits_", ",_", "decima", "l\\u", "places_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Deci", "mal", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "max", "\\u", "value_", ",_", "min", "\\u", "value_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validators_", "._", "append_", "(_", "validators_", "._", "Deci", "mal", "Validator_", "(_", "max", "\\u", "digits_", ",_", "decima", "l\\u", "places_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "is", " ", "a", " ", "decima", "l", " ", "number", ".", " ", "Return", "s", " ", "a", " ", "Deci", "mal", "\\", "10", ";", " ", " ", " ", " ", "instance", ".", " ", "Return", "s", " ", "Non", "e", " ", "for", " ", "empty", " ", "values", ".", " ", "Ensur", "es", " ", "tha", "t", " ", "there", " ", "are", " ", "no", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "than", " ", "max", "\\u", "digit", "s", " ", "in", " ", "the", " ", "number", ",", " ", "and", " ", "no", " ", "more", " ", "than", " ", "decima", "l\\u", "place", "s", " ", "digit", "s", "\\", "10", ";", " ", " ", " ", " ", "after", " ", "the", " ", "decima", "l", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "self_", "._", "localize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "formats_", "._", "sanitize", "\\u", "separators_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "smart", "\\u", "text_", "(_", "value_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Decimal_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Deci", "mal", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Deci", "mal", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "Na", "N", ",", " ", "Inf", " ", "and", " ", "-", "Inf", " ", "values", ".", " ", "We", " ", "can", "'", "t", " ", "compare", " ", "direct", "ly", " ", "for", " ", "Na", "N", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "it", " ", "is", " ", "neve", "r", " ", "equal", " ", "to", " ", "its", "elf", ".", " ", "Ho", "we", "ver", ",", " ", "Na", "N", " ", "is", " ", "the", " ", "only", " ", "value", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "isn", "'", "t", " ", "equal", " ", "to", " ", "its", "elf", ",", " ", "so", " ", "we", " ", "can", " ", "use", " ", "this", " ", "to", " ", "identify", " ", "Na", "N_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "!=_", "value_", "or_", "value_", "==_", "Decimal_", "(_", "\"", "Inf", "\"_", ")_", "or_", "value_", "==_", "Decimal_", "(_", "\"-", "Inf", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Field_", "(_", "Integer", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "widget", "\\u", "attrs_", "(_", "self_", ",_", "widget_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "super_", "(_", "Deci", "mal", "Field_", ",_", "self_", ")_", "._", "widget", "\\u", "attrs_", "(_", "widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "widget_", ",_", "Number", "Input_", ")_", "and_", "'", "step", "'_", "not_", "in_", "widget_", "._", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "decima", "l\\u", "places_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "exponential", " ", "notation", " ", "for", " ", "small", " ", "values", " ", "sinc", "e", " ", "the", "y", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "parsed", " ", "as", " ", "0", " ", "other", "wis", "e", ".", " ", "ref", " ", "#", "207", "65_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step_", "=_", "str_", "(_", "Decimal_", "(_", "'", "1", "'_", ")_", "/_", "10_", "**_", "self_", "._", "decima", "l\\u", "places_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step_", "=_", "'", "any", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attrs_", "._", "setdefault_", "(_", "'", "step", "'_", ",_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\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_", ",_", "input", "\\u", "formats_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Base", "Tempora", "l", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "formats_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input", "\\u", "formats_", "=_", "input", "\\u", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "coerce", " ", "the", " ", "value", " ", "to", " ", "unicode", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode", "\\u", "value_", "=_", "force", "\\u", "text_", "(_", "value_", ",_", "string", "s", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "unicode", "\\u", "value_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "unicode", "\\u", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "unicode", ",", " ", "try", " ", "to", " ", "strp", "time", " ", "against", " ", "each", " ", "input", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "format_", "in_", "self_", "._", "input", "\\u", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "strptime_", "(_", "value_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "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_", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Tempora", "l", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Subc", "lasse", "s", " ", "must", " ", "defin", "e", " ", "this", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Date", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Date", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "formats_", "=_", "formats_", "._", "get", "\\u", "format\\u", "lazy_", "(_", "'", "DAT", "E", "\\u", "INPUT", "\\u", "FORMAT", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "date", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "Date", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "can", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "date", ".", " ", "Return", "s", " ", "a", " ", "Pyth", "on", "\\", "10", ";", " ", " ", " ", " ", "datetime", ".", "date", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Date", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Date", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "force", "\\u", "str_", "(_", "value_", ")_", ",_", "format_", ")_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Time", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "formats_", "=_", "formats_", "._", "get", "\\u", "format\\u", "lazy_", "(_", "'", "TIME", "\\u", "INPUT", "\\u", "FORMAT", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "time", ".'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "can", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "time", ".", " ", "Return", "s", " ", "a", " ", "Pyth", "on", "\\", "10", ";", " ", " ", " ", " ", "datetime", ".", "time", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Time", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "force", "\\u", "str_", "(_", "value_", ")_", ",_", "format_", ")_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Date", "Time", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "formats_", "=_", "formats_", "._", "get", "\\u", "format\\u", "lazy_", "(_", "'", "DATETIME", "\\u", "INPUT", "\\u", "FORMAT", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "date", "/", "time", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "to", "\\u", "current", "\\u", "timezone_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "can", " ", "be", " ", "convert", "ed", " ", "to", " ", "a", " ", "datetime", ".", " ", "Return", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "Pyth", "on", " ", "datetime", ".", "datetime", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "datetime_", "._", "datetime_", "(_", "value_", "._", "year_", ",_", "value_", "._", "month_", ",_", "value_", "._", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "super_", "(_", "Date", "Time", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Date", "Time", "Field_", "(_", "Base", "Tempora", "l", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strptime_", "(_", "self_", ",_", "value_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "force", "\\u", "str_", "(_", "value_", ")_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Dur", "ation", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "duration", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "Dur", "ation", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "timedelta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "duration", "\\u", "string_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dur", "ation", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "timedelta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "parse", "\\u", "duration_", "(_", "force", "\\u", "text_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "regex_", "=_", "property_", "(_", "\\u", "get", "\\u", "regex_", ",_", "\\u", "set\\u", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "regex_", ",_", "max", "\\u", "length_", "=_", "None_", ",_", "min", "\\u", "length_", "=_", "None_", ",_", "error", "\\u", "message_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "regex", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "string", " ", "or", " ", "a", " ", "compile", "d", " ", "regular", " ", "express", "ion", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "error", "\\u", "message", " ", "is", " ", "an", " ", "option", "al", " ", "error", " ", "message", " ", "to", " ", "use", ",", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "'", "Enter", " ", "a", " ", "valid", " ", "value", "'", " ", "is", " ", "too", " ", "gener", "ic", " ", "for", " ", "you", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "setdefault_", "(_", "'", "strip", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Rege", "x", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "max", "\\u", "length_", ",_", "min", "\\u", "length_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "regex_", "(_", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "regex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rege", "x", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "regex_", "(_", "self_", ",_", "regex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "regex_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "regex_", "=_", "re_", "._", "compile_", "(_", "regex_", ",_", "re_", "._", "UNICODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "regex_", "=_", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "regex", "\\u", "validator", "'_", ")_", "and_", "self_", "._", "\\u", "regex", "\\u", "validator_", "in_", "self_", "._", "validators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validators_", "._", "remove_", "(_", "self_", "._", "\\u", "regex", "\\u", "validator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "regex", "\\u", "validator_", "=_", "validators_", "._", "Rege", "x", "Validator_", "(_", "regex_", "=_", "regex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validators_", "._", "append_", "(_", "self_", "._", "\\u", "regex", "\\u", "validator_", ")_", "\\u\\u\\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_", "Ema", "il", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Ema", "il", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "validat", "e\\u", "email_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ema", "il", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Ema", "il", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "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_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Clear", "able", "File", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "\"", "No", " ", "file", " ", "was", " ", "submitted", ".", " ", "Check", " ", "the", " ", "encoding", " ", "type", " ", "on", " ", "the", " ", "form", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "missi", "ng", "'_", ":_", "\\u_", "(_", "\"", "No", " ", "file", " ", "was", " ", "submitted", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "'_", ":_", "\\u_", "(_", "\"", "The", " ", "submitted", " ", "file", " ", "is", " ", "empty", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "length", "'_", ":_", "unge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ensur", "e", " ", "this", " ", "filename", " ", "has", " ", "at", " ", "most", " ", "%", "(", "max", ")", "d", " ", "character", " ", "(", "it", " ", "has", " ", "%", "(", "length", ")", "d", ").'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ensur", "e", " ", "this", " ", "filename", " ", "has", " ", "at", " ", "most", " ", "%", "(", "max", ")", "d", " ", "character", "s", " ", "(", "it", " ", "has", " ", "%", "(", "length", ")", "d", ").'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contra", "diction", "'_", ":_", "\\u_", "(_", "'", "Ple", "ase", " ", "eit", "her", " ", "submit", " ", "a", " ", "file", " ", "or", " ", "check", " ", "the", " ", "clear", " ", "checkb", "ox", ",", " ", "not", " ", "bot", "h", ".'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "length_", "=_", "kwargs_", "._", "pop_", "(_", "'", "max", "\\u", "length", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "allow", "\\u", "empty", "\\u", "file_", "=_", "kwargs_", "._", "pop_", "(_", "'", "allow", "\\u", "empty", "\\u", "file", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "File", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "#", " ", "Upload", "ed", "File", " ", "object", "s", " ", "shou", "ld", " ", "have", " ", "name", " ", "and", " ", "size", " ", "attribute", "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 ", " _", "file", "\\u", "name_", "=_", "data_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "size_", "=_", "data_", "._", "size_", "\\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_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "length_", "is_", "not_", "None_", "and_", "len_", "(_", "file", "\\u", "name_", ")_", ">_", "self_", "._", "max", "\\u", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "'", "max", "'_", ":_", "self_", "._", "max", "\\u", "length_", ",_", "'", "length", "'_", ":_", "len_", "(_", "file", "\\u", "name_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "max", "\\u", "length", "'_", "]_", ",_", "code_", "=_", "'", "max", "\\u", "length", "'_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "allow", "\\u", "empty", "\\u", "file_", "and_", "not_", "file", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "empty", "'_", "]_", ",_", "code_", "=_", "'", "empty", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "data_", ",_", "initial_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "widget", " ", "got", " ", "contra", "dict", "ory", " ", "inputs", ",", " ", "we", " ", "raise", " ", "a", " ", "validation", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "is_", "FILE", "\\u", "INPUT", "\\u", "CONTR", "AD", "ICT", "ION_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "contra", "diction", "'_", "]_", ",_", "code_", "=_", "'", "contra", "diction", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fal", "se", " ", "means", " ", "the", " ", "field", " ", "value", " ", "shou", "ld", " ", "be", " ", "clear", "ed", ";", " ", "fur", "ther", " ", "validation", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "field", " ", "is", " ", "require", "d", ",", " ", "clear", "ing", " ", "is", " ", "not", " ", "possib", "le", " ", "(", "the", " ", "widget_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", "n", "'", "t", " ", "return", " ", "Fal", "se", " ", "data", " ", "in", " ", "tha", "t", " ", "case", " ", "anyway", ").", " ", "Fal", "se", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "self", ".", "empty", "\\u", "value", ";", " ", "if", " ", "a", " ", "Fal", "se", " ", "value", " ", "make", "s", " ", "it", " ", "this", " ", "far_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "shou", "ld", " ", "be", " ", "validat", "ed", " ", "from", " ", "here", " ", "on", " ", "out", " ", "as", " ", "Non", "e", " ", "(", "so", " ", "it", " ", "will", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cau", "ght", " ", "by", " ", "the", " ", "require", "d", " ", "check", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "data_", "and_", "initial_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "File", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bound", "\\u", "data_", "(_", "self_", ",_", "data_", ",_", "initial_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "in_", "(_", "None_", ",_", "FILE", "\\u", "INPUT", "\\u", "CONTR", "AD", "ICT", "ION_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "initial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Image", "Field_", "(_", "File", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "image", "'_", ":_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Upload", " ", "a", " ", "valid", " ", "image", ".", " ", "The", " ", "file", " ", "you", " ", "uploade", "d", " ", "was", " ", "eit", "her", " ", "not", " ", "an", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", " ", "or", " ", "a", " ", "corrupted", " ", "image", ".\"_", "\\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_", "Image", "Field_", "(_", "File", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "tha", "t", " ", "the", " ", "file", "-", "upload", " ", "field", " ", "data", " ", "contain", "s", " ", "a", " ", "valid", " ", "image", " ", "(", "GIF", ",", " ", "JP", "G", ",", "\\", "10", ";", " ", " ", " ", " ", "PNG", ",", " ", "possib", "ly", " ", "other", "s", " ", "--", " ", "what", "ever", " ", "the", " ", "Pyth", "on", " ", "Imagin", "g", " ", "Libr", "ary", " ", "support", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "super_", "(_", "Image", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "get", " ", "a", " ", "file", " ", "object", " ", "for", " ", "Pil", "low", ".", " ", "We", " ", "mig", "ht", " ", "have", " ", "a", " ", "path", " ", "or", " ", "we", " ", "mig", "ht_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "to", " ", "read", " ", "the", " ", "data", " ", "int", "o", " ", "memory", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "data_", ",_", "'", "temporar", "y", "\\u", "file", "\\u", "path", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "data_", "._", "temporar", "y", "\\u", "file", "\\u", "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 ", " _", "if_", "hasattr_", "(_", "data_", ",_", "'", "read", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "Byte", "s", "IO_", "(_", "data_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "=_", "Byte", "s", "IO_", "(_", "data_", "[_", "'", "content", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", "()", " ", "coul", "d", " ", "spot", " ", "a", " ", "truncat", "ed", " ", "JP", "EG", ",", " ", "but", " ", "it", " ", "load", "s", " ", "the", " ", "entire", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "image", " ", "in", " ", "memory", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "Do", "S", " ", "vector", ".", " ", "See", " ", "#", "384", "8", " ", "and", " ", "#", "185", "20._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "Image_", "._", "open_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "verify", "()", " ", "must", " ", "be", " ", "call", "ed", " ", "immediate", "ly", " ", "after", " ", "the", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "image_", "._", "verify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Annot", "ati", "ng", " ", "so", " ", "subclasses", " ", "can", " ", "reus", "e", " ", "it", " ", "for", " ", "thei", "r", " ", "own", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "image_", "=_", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pil", "low", " ", "doe", "sn", "'", "t", " ", "detect", " ", "the", " ", "MIME", " ", "type", " ", "of", " ", "all", " ", "formats", ".", " ", "In", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", "s", ",", " ", "content", "\\u", "type", " ", "will", " ", "be", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "content", "\\u", "type_", "=_", "Image_", "._", "MIME", "_", "._", "get_", "(_", "image_", "._", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pil", "low", " ", "doe", "sn", "'", "t", " ", "recognize", " ", "it", " ", "as", " ", "an", " ", "image", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "six_", "._", "reraise", "_", "(_", "Validat", "ion", "Error_", ",_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "image", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "image", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", ",_", "'", "seek", "'_", ")_", "and_", "callable_", "(_", "f_", "._", "seek_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "seek_", "(_", "0_", ")_", "\\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_", "URL", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "URL", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "URL", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "URL", "Validator_", "(_", ")_", "]_", "\\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_", "URL", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "split", "\\u", "url_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "of", " ", "url", " ", "part", "s", " ", "via", " ", "``", "urlpa", "rse", ".", "urls", "plit", "``", " ", "(", "or", " ", "raise", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "``", "Validat", "ion", "Error", "``", " ", "exception", " ", "for", " ", "cert", "ain", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "urlsplit_", "(_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "urlpa", "rse", ".", "urls", "plit", " ", "can", " ", "raise", " ", "a", " ", "Value", "Error", " ", "with", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mis", "format", "ted", " ", "URL", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "super_", "(_", "URL", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "fields_", "=_", "split", "\\u", "url_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url", "\\u", "fields_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "URL", " ", "sche", "me", " ", "give", "n", ",", " ", "assume", " ", "http", "://", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "fields_", "[_", "0_", "]_", "=_", "'", "http", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "url", "\\u", "fields_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "tha", "t", " ", "if", " ", "no", " ", "domain", " ", "is", " ", "provided", ",", " ", "tha", "t", " ", "the", " ", "path", " ", "segment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "s", " ", "the", " ", "domain", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "\\u", "fields_", "[_", "1_", "]_", "=_", "url", "\\u", "fields_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "fields_", "[_", "2_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reb", "uild", " ", "the", " ", "url", "\\u", "fields", " ", "list", ",", " ", "sinc", "e", " ", "the", " ", "domain", " ", "segment", " ", "may", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "the", " ", "path", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "fields_", "=_", "split", "\\u", "url_", "(_", "urlu", "nsp", "lit_", "(_", "url", "\\u", "fields_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "urlu", "nsp", "lit_", "(_", "url", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "URL", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "URL", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "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_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Checkb", "ox", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "Pyth", "on", " ", "boolean", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Exp", "licit", "ly", " ", "check", " ", "for", " ", "the", " ", "string", " ", "'", "Fal", "se", "',", " ", "whi", "ch", " ", "is", " ", "what", " ", "a", " ", "hidden", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "submit", " ", "for", " ", "Fal", "se", ".", " ", "Al", "so", " ", "check", " ", "for", " ", "'", "0", "',", " ", "sinc", "e", " ", "this", " ", "is", " ", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Radio", "Select", " ", "will", " ", "provide", ".", " ", "Be", "caus", "e", " ", "bool", "(\"", "Tru", "e", "\")", " ", "==", " ", "bool", "('", "1", "')", " ", "==", " ", "Tru", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "need", " ", "to", " ", "handle", " ", "tha", "t", " ", "explicit", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "six_", "._", "string", "\\u", "types_", ")_", "and_", "value_", "._", "lower_", "(_", ")_", "in_", "(_", "'", "fal", "se", "'_", ",_", "'", "0", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "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 ", " _", "value_", "=_", "bool_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Boo", "lean", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", "and_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boo", "lean", "Field_", "(_", "Field_", ")_", ":_", "\\u\\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", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", "times", " ", "data", " ", "or", " ", "initial", " ", "may", " ", "be", " ", "a", " ", "string", " ", "equivalent", " ", "of", " ", "a", " ", "boolean_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "shou", "ld", " ", "run", " ", "it", " ", "through", " ", "to", "\\u", "python", " ", "first", " ", "to", " ", "get", " ", "a", " ", "boolean", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "to", "\\u", "python_", "(_", "initial_", ")_", "!=_", "self_", "._", "to", "\\u", "python_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Null", "Boo", "lean", "Field_", "(_", "Boo", "lean", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "field", " ", "who", "se", " ", "valid", " ", "values", " ", "are", " ", "Non", "e", ",", " ", "Tru", "e", " ", "and", " ", "Fal", "se", ".", " ", "Inva", "lid", " ", "values", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "clean", "ed", " ", "to", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "Null", "Boo", "lean", "Select_", "\\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_", "Null", "Boo", "lean", "Field_", "(_", "Boo", "lean", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Exp", "licit", "ly", " ", "checks", " ", "for", " ", "the", " ", "string", " ", "'", "Tru", "e", "'", " ", "and", " ", "'", "Fal", "se", "',", " ", "whi", "ch", " ", "is", " ", "what", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "hidden", " ", "field", " ", "will", " ", "submit", " ", "for", " ", "Tru", "e", " ", "and", " ", "Fal", "se", ",", " ", "for", " ", "'", "true", "'", " ", "and", " ", "'", "fal", "se", "',", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "are", " ", "like", "ly", " ", "to", " ", "be", " ", "return", "ed", " ", "by", " ", "Ja", "va", "Script", " ", "serializ", "ation", "s", " ", "of", " ", "forms", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "for", " ", "'", "1", "'", " ", "and", " ", "'", "0", "',", " ", "whi", "ch", " ", "is", " ", "what", " ", "a", " ", "Radio", "Field", " ", "will", " ", "submit", ".", " ", "Unli", "ke", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Boo", "lean", "field", " ", "we", " ", "need", " ", "to", " ", "explicit", "ly", " ", "check", " ", "for", " ", "Tru", "e", ",", " ", "bec", "aus", "e", " ", "we", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "usi", "ng", " ", "the", " ", "bool", "()", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "(_", "True_", ",_", "'", "Tru", "e", "'_", ",_", "'", "true", "'_", ",_", "'", "1", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "in_", "(_", "False_", ",_", "'", "Fal", "se", "'_", ",_", "'", "fal", "se", "'_", ",_", "'", "0", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Null", "Boo", "lean", "Field_", "(_", "Boo", "lean", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "choice", "'_", ":_", "\\u_", "(_", "'", "Select", " ", "a", " ", "valid", " ", "choice", ".", " ", "%", "(", "value", ")", "s", " ", "is", " ", "not", " ", "one", " ", "of", " ", "the", " ", "avail", "able", " ", "choice", "s", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "choices_", "=_", "property_", "(_", "\\u", "get", "\\u", "choices_", ",_", "\\u", "set\\u", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "choices_", "=_", "(_", ")_", ",_", "required_", "=_", "True_", ",_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "None_", ",_", "help", "\\u", "text_", "=_", "''_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "required_", ",_", "widget_", "=_", "widget_", ",_", "label_", "=_", "label_", ",_", "initial_", "=_", "initial_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "help", "\\u", "text_", ",_", "*_", "args_", ",_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "choices_", "=_", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "\\u", "choices_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "\\u", "choices_", ",_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "choices_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "choices_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sett", "ing", " ", "choice", "s", " ", "als", "o", " ", "sets", " ", "the", " ", "choice", "s", " ", "on", " ", "the", " ", "widget", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "choice", "s", " ", "can", " ", "be", " ", "any", " ", "iterable", ",", " ", "but", " ", "we", " ", "call", " ", "list", "()", " ", "on", " ", "it", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "will", " ", "be", " ", "consume", "d", " ", "more", " ", "than", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callable_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Call", "able", "Choi", "ce", "Iterator_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "list_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "choices_", "=_", "self_", "._", "widget_", "._", "choices_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", "s", " ", "a", " ", "Unic", "ode", " ", "object", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "smart", "\\u", "text_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "is", " ", "in", " ", "self", ".", "choice", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "and_", "not_", "self_", "._", "valid", "\\u", "value_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "value_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Choi", "ce", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "valid", "\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "provided", " ", "value", " ", "is", " ", "a", " ", "valid", " ", "choice", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "value_", "=_", "force", "\\u", "text_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "v_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "an", " ", "opt", "group", ",", " ", "so", " ", "look", " ", "insi", "de", " ", "the", " ", "group", " ", "for", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k2_", ",_", "v2_", "in_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "value_", "==_", "k2_", "or_", "text", "\\u", "value_", "==_", "force", "\\u", "text_", "(_", "k2_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "k_", "or_", "text", "\\u", "value_", "==_", "force", "\\u", "text_", "(_", "k_", ")_", ":_", "\\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_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\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_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "coerce", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "coerce", "'_", ",_", "lambda_", "val_", ":_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "empty", "\\u", "value_", "=_", "kwargs_", "._", "pop_", "(_", "'", "empty", "\\u", "value", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Type", "d", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "coerce", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", " ", "tha", "t", " ", "the", " ", "value", " ", "can", " ", "be", " ", "coerce", "d", " ", "to", " ", "the", " ", "right", " ", "type", " ", "(", "if", " ", "not", " ", "empty", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "self_", "._", "empty", "\\u", "value_", "or_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "empty", "\\u", "value_", "\\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_", "=_", "self_", "._", "coerce", "_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ",_", "Validat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "value_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "super_", "(_", "Type", "d", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "coerce", "_", "(_", "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_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hidden", "\\u", "widget_", "=_", "Multipl", "e", "Hi", "dde", "n", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "Select", "Multiple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "choice", "'_", ":_", "\\u_", "(_", "'", "Select", " ", "a", " ", "valid", " ", "choice", ".", " ", "%", "(", "value", ")", "s", " ", "is", " ", "not", " ", "one", " ", "of", " ", "the", " ", "avail", "able", " ", "choice", "s", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "list", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "list", " ", "of", " ", "values", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "value_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "list", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "smart", "\\u", "text_", "(_", "val_", ")_", "for_", "val_", "in_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "input", " ", "is", " ", "a", " ", "list", " ", "or", " ", "tuple", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "required_", "and_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validate", " ", "tha", "t", " ", "each", " ", "value", " ", "in", " ", "the", " ", "value", " ", "list", " ", "is", " ", "in", " ", "self", ".", "choice", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "val_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "valid", "\\u", "value_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "val_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\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_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "initial_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "initial_", ")_", "!=_", "len_", "(_", "data_", ")_", ":_", "\\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_", "initial", "\\u", "set_", "=_", "set_", "(_", "force", "\\u", "text_", "(_", "value_", ")_", "for_", "value_", "in_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "set_", "=_", "set_", "(_", "force", "\\u", "text_", "(_", "value_", ")_", "for_", "value_", "in_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data\\u", "set_", "!=_", "initial", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\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_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "coerce", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "coerce", "'_", ",_", "lambda_", "val_", ":_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "empty", "\\u", "value_", "=_", "kwargs_", "._", "pop_", "(_", "'", "empty", "\\u", "value", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "coerce", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "tha", "t", " ", "the", " ", "values", " ", "are", " ", "in", " ", "self", ".", "choice", "s", " ", "and", " ", "can", " ", "be", " ", "coerce", "d", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "right", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "self_", "._", "empty", "\\u", "value_", "or_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "empty", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "choice_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "value_", "._", "append_", "(_", "self_", "._", "coerce", "_", "(_", "choice_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ",_", "Validat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "choice", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "invalid", "\\u", "choice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "value", "'_", ":_", "choice_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "super_", "(_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "coerce", "_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", "(_", "Multipl", "e", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "!=_", "self_", "._", "empty", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Type", "d", "Multipl", "e", "Choi", "ce", "Field_", ",_", "self_", ")_", "._", "validate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "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_", "class_", "Comb", "o", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Field", " ", "who", "se", " ", "clean", "()", " ", "method", " ", "calls", " ", "multiple", " ", "Field", " ", "clean", "()", " ", "method", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Comb", "o", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fields_", "=_", "(_", ")_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Comb", "o", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "'", "require", "d", "'", " ", "to", " ", "Fal", "se", " ", "on", " ", "the", " ", "individual", " ", "fields", ",", " ", "bec", "aus", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "validation", " ", "will", " ", "be", " ", "handle", "d", " ", "by", " ", "Comb", "o", "Field", ",", " ", "not", " ", "by", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "individual", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "=_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Comb", "o", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "the", " ", "give", "n", " ", "value", " ", "against", " ", "all", " ", "of", " ", "self", ".", "fields", ",", " ", "whi", "ch", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "Field", " ", "instance", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Comb", "o", "Field_", ",_", "self_", ")_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "self_", "._", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "field_", "._", "clean_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Field", " ", "tha", "t", " ", "aggregates", " ", "the", " ", "logic", " ", "of", " ", "multiple", " ", "Field", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", "s", " ", "clean", "()", " ", "method", " ", "take", "s", " ", "a", " ", "\"", "decompress", "ed", "\"", " ", "list", " ", "of", " ", "values", ",", " ", "whi", "ch", " ", "are", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "clean", "ed", " ", "int", "o", " ", "a", " ", "single", " ", "value", " ", "according", " ", "to", " ", "self", ".", "fields", ".", " ", "Ea", "ch", " ", "value", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "list", " ", "is", " ", "clean", "ed", " ", "by", " ", "the", " ", "correspond", "ing", " ", "field", " ", "--", " ", "the", " ", "first", " ", "value", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "clean", "ed", " ", "by", " ", "the", " ", "first", " ", "field", ",", " ", "the", " ", "second", " ", "value", " ", "is", " ", "clean", "ed", " ", "by", " ", "the", " ", "second", "\\", "10", ";", " ", " ", " ", " ", "field", ",", " ", "etc", ".", " ", "On", "ce", " ", "all", " ", "fields", " ", "are", " ", "clean", "ed", ",", " ", "the", " ", "list", " ", "of", " ", "clean", " ", "values", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "\"", "compress", "ed", "\"", " ", "int", "o", " ", "a", " ", "single", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Subc", "lasse", "s", " ", "shou", "ld", " ", "not", " ", "have", " ", "to", " ", "implement", " ", "clean", "()", ".", " ", "Ins", "tea", "d", ",", " ", "the", "y", " ", "must", "\\", "10", ";", " ", " ", " ", " ", "implement", " ", "compress", "()", ",", " ", "whi", "ch", " ", "take", "s", " ", "a", " ", "list", " ", "of", " ", "valid", " ", "values", " ", "and", " ", "return", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "\"", "compress", "ed", "\"", " ", "version", " ", "of", " ", "tho", "se", " ", "values", " ", "--", " ", "a", " ", "single", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", "'", "ll", " ", "probab", "ly", " ", "want", " ", "to", " ", "use", " ", "this", " ", "with", " ", "Multi", "Wid", "get", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "list", " ", "of", " ", "values", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "incomplete", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "complete", " ", "value", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fields_", "=_", "(_", ")_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "require", "\\u", "all", "\\u", "fields_", "=_", "kwargs_", "._", "pop_", "(_", "'", "require", "\\u", "all", "\\u", "fields", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Multi", "Value", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "error", "\\u", "messages_", "._", "setdefault_", "(_", "'", "incomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "incomplete", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "require", "\\u", "all", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "'", "require", "d", "'", " ", "to", " ", "Fal", "se", " ", "on", " ", "the", " ", "individual", " ", "fields", ",", " ", "bec", "aus", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "validation", " ", "will", " ", "be", " ", "handle", "d", " ", "by", " ", "Multi", "Value", "Field", ",", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "tho", "se", " ", "individual", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "=_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Multi", "Value", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "fields_", "=_", "tuple_", "(_", "x_", "._", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "memo_", ")_", "for_", "x_", "in_", "self_", "._", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Validate", "s", " ", "every", " ", "value", " ", "in", " ", "the", " ", "give", "n", " ", "list", ".", " ", "A", " ", "value", " ", "is", " ", "validat", "ed", " ", "against", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "correspond", "ing", " ", "Field", " ", "in", " ", "self", ".", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "if", " ", "this", " ", "Multi", "Value", "Field", " ", "was", " ", "instantiate", "d", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "fields", "=(", "Date", "Field", "()", ",", " ", "Time", "Field", "())", ",", " ", "clean", "()", " ", "wou", "ld", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "Date", "Field", ".", "clean", "(", "value", "[", "0", "])", " ", "and", " ", "Time", "Field", ".", "clean", "(", "value", "[", "1", "])", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", "or_", "isinstance_", "(_", "value_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", "or_", "not_", "[_", "v_", "for_", "v_", "in_", "value_", "if_", "v_", "not_", "in_", "self_", "._", "empty", "\\u", "values_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "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_", "self_", "._", "compress_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "field_", "in_", "enumerate_", "(_", "self_", "._", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "value_", "=_", "value_", "[_", "i_", "]_", "\\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 ", " _", "field", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "field", "\\u", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "require", "\\u", "all", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rai", "se", " ", "a", " ", "'", "require", "d", "'", " ", "error", " ", "if", " ", "the", " ", "Multi", "Value", "Field", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "d", " ", "and", " ", "any", " ", "field", " ", "is", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "require", "d", "'_", "]_", ",_", "code_", "=_", "'", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "add", " ", "an", " ", "'", "incomplete", "'", " ", "error", " ", "to", " ", "the", " ", "list", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collected", " ", "error", "s", " ", "and", " ", "skip", " ", "field", " ", "clean", "ing", ",", " ", "if", " ", "a", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", " ", "is", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "field_", "._", "error", "\\u", "messages_", "[_", "'", "incomplete", "'_", "]_", "not_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "errors_", "._", "append_", "(_", "field_", "._", "error", "\\u", "messages_", "[_", "'", "incomplete", "'_", "]_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "\\u", "data_", "._", "append_", "(_", "field_", "._", "clean_", "(_", "field", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Collect", " ", "all", " ", "validation", " ", "error", "s", " ", "in", " ", "a", " ", "single", " ", "list", ",", " ", "whi", "ch", " ", "we", "'", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raise", " ", "at", " ", "the", " ", "end", " ", "of", " ", "clean", "()", ",", " ", "rat", "her", " ", "than", " ", "rais", "ing", " ", "a", " ", "single_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", " ", "for", " ", "the", " ", "first", " ", "error", " ", "we", " ", "encounter", ".", " ", "Ski", "p", " ", "duplicat", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "extend_", "(_", "m_", "for_", "m_", "in_", "e_", "._", "error", "\\u", "list_", "if_", "m_", "not_", "in_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "self_", "._", "compress_", "(_", "clean", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "validate_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "validators_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compress_", "(_", "self_", ",_", "data\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "single", " ", "value", " ", "for", " ", "the", " ", "give", "n", " ", "list", " ", "of", " ", "values", ".", " ", "The", " ", "values", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "assume", "d", " ", "to", " ", "be", " ", "valid", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "if", " ", "this", " ", "Multi", "Value", "Field", " ", "was", " ", "instantiate", "d", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "fields", "=(", "Date", "Field", "()", ",", " ", "Time", "Field", "())", ",", " ", "this", " ", "mig", "ht", " ", "return", " ", "a", " ", "datetime", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "created", " ", "by", " ", "combin", "ing", " ", "the", " ", "date", " ", "and", " ", "time", " ", "in", " ", "data\\u", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Subc", "lasse", "s", " ", "must", " ", "implement", " ", "this", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Value", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "changed_", "(_", "self_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "initial_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "[_", "''_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "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 ", " _", "if_", "not_", "isinstance_", "(_", "initial_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "self_", "._", "widget_", "._", "decompress_", "(_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "field_", ",_", "initial_", ",_", "data_", "in_", "zip_", "(_", "self_", "._", "fields_", ",_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "field_", "._", "to", "\\u", "python_", "(_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "field_", "._", "has", "\\u", "changed_", "(_", "initial_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "File", "Path", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "File", "Path", "Field_", "(_", "Choi", "ce", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "path_", ",_", "match_", "=_", "None_", ",_", "recursive_", "=_", "False_", ",_", "allow", "\\u", "files_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "folders_", "=_", "False_", ",_", "required_", "=_", "True_", ",_", "widget_", "=_", "None_", ",_", "label_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "None_", ",_", "help", "\\u", "text_", "=_", "''_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", ",_", "self_", "._", "match_", ",_", "self_", "._", "recursive_", "=_", "path_", ",_", "match_", ",_", "recursive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "allow", "\\u", "files_", ",_", "self_", "._", "allow", "\\u", "folders_", "=_", "allow", "\\u", "files_", ",_", "allow", "\\u", "folders_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "File", "Path", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", ")_", ",_", "required_", "=_", "required_", ",_", "widget_", "=_", "widget_", ",_", "label_", "=_", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "initial_", ",_", "help", "\\u", "text_", "=_", "help", "\\u", "text_", ",_", "*_", "args_", ",_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "choices_", "=_", "[_", "]_", "\\u\\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_", "._", "choices_", "=_", "[_", "(_", "\"\"_", ",_", "\"-------", "--\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "match_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "match", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "self_", "._", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "recursive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "root_", ",_", "dirs_", ",_", "files_", "in_", "sorted_", "(_", "os_", "._", "walk_", "(_", "self_", "._", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "allow", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "choices_", "._", "append_", "(_", "(_", "f_", ",_", "f_", "._", "replace_", "(_", "path_", ",_", "\"\"_", ",_", "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_", "if_", "self_", "._", "allow", "\\u", "folders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "f_", "in_", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "f_", "==_", "'\\u", "\\u", "pyca", "che", "\\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_", "if_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "choices_", "._", "append_", "(_", "(_", "f_", ",_", "f_", "._", "replace_", "(_", "path_", ",_", "\"\"_", ",_", "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_", "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 ", " _", "for_", "f_", "in_", "sorted_", "(_", "os_", "._", "listdir_", "(_", "self_", "._", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "f_", "==_", "'\\u", "\\u", "pyca", "che", "\\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_", "full", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "path_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "(_", "self_", "._", "allow", "\\u", "files_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "full", "\\u", "file_", ")_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "allow", "\\u", "folders_", "and_", "os_", "._", "path_", "._", "isdir_", "(_", "full", "\\u", "file_", ")_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "match_", "is_", "None_", "or_", "self_", "._", "match", "\\u", "re_", "._", "search_", "(_", "f_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "choices_", "._", "append_", "(_", "(_", "full", "\\u", "file_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\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_", "self_", "._", "widget_", "._", "choices_", "=_", "self_", "._", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Split", "Date", "Time", "Field_", "(_", "Multi", "Value", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "=_", "Split", "Date", "Time", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hidden", "\\u", "widget_", "=_", "Split", "Hi", "dde", "n", "Date", "Time", "Widget_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "date", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "date", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "\\u", "time", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "time", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "Split", "Date", "Time", "Field_", "(_", "Multi", "Value", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "input", "\\u", "date", "\\u", "formats_", "=_", "None_", ",_", "input", "\\u", "time", "\\u", "formats_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "self_", "._", "default", "\\u", "error", "\\u", "messages_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "error", "\\u", "message", "s", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "update_", "(_", "kwargs_", "[_", "'", "error", "\\u", "message", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "localize_", "=_", "kwargs_", "._", "get_", "(_", "'", "localiz", "e", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Field_", "(_", "input", "\\u", "formats_", "=_", "input", "\\u", "date", "\\u", "formats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "messages_", "=_", "{_", "'", "invalid", "'_", ":_", "errors_", "[_", "'", "invalid", "\\u", "date", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "localize_", "=_", "localize_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Time", "Field_", "(_", "input", "\\u", "formats_", "=_", "input", "\\u", "time", "\\u", "formats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "messages_", "=_", "{_", "'", "invalid", "'_", ":_", "errors_", "[_", "'", "invalid", "\\u", "time", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "localize_", "=_", "localize_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Split", "Date", "Time", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "fields_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Split", "Date", "Time", "Field_", "(_", "Multi", "Value", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compress_", "(_", "self_", ",_", "data\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rai", "se", " ", "a", " ", "validation", " ", "error", " ", "if", " ", "time", " ", "or", " ", "date", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "possib", "le", " ", "if", " ", "Split", "Date", "Time", "Field", " ", "has", " ", "require", "d", "=", "Fal", "se", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data\\u", "list_", "[_", "0_", "]_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "date", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "\\u", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data\\u", "list_", "[_", "1_", "]_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "\\u", "time", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "\\u", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "datetime_", "._", "datetime_", "._", "combine_", "(_", "*_", "data\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "from", "\\u", "current", "\\u", "timezone_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Gene", "ric", "IPA", "ddress", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Gene", "ric", "IPA", "ddress", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "protocol_", "=_", "'", "bot", "h", "'_", ",_", "unpack", "\\u", "ipv4_", "=_", "False_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "unpack", "\\u", "ipv4_", "=_", "unpack", "\\u", "ipv4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "validators_", "=_", "validators_", "._", "ip", "\\u", "address", "\\u", "validators_", "(_", "protocol_", ",_", "unpack", "\\u", "ipv4_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Gene", "ric", "IPA", "ddress", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gene", "ric", "IPA", "ddress", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "value_", "=_", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "and_", "':'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "clean", "\\u", "ipv", "6", "\\u", "address_", "(_", "value_", ",_", "self_", "._", "unpack", "\\u", "ipv4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sl", "ug", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "validat", "e\\u", "slug_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sl", "ug", "Field_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "allow", "\\u", "unicode_", "=_", "kwargs_", "._", "pop_", "(_", "'", "allow", "\\u", "unicode", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "allow", "\\u", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "default", "\\u", "validators_", "=_", "[_", "validators_", "._", "validat", "e\\u", "unicode", "\\u", "slug_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Sl", "ug", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "UU", "IDF", "ield_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", "'_", ":_", "\\u_", "(_", "'", "Enter", " ", "a", " ", "valid", " ", "UU", "ID", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "UU", "IDF", "ield_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "uuid_", "._", "UUID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UU", "IDF", "ield_", "(_", "Char", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "python_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "super_", "(_", "UU", "IDF", "ield_", ",_", "self_", ")_", "._", "to", "\\u", "python_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "self_", "._", "empty", "\\u", "values_", ":_", "\\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_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "uuid_", "._", "UUID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "uuid_", "._", "UUID_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "self_", "._", "error", "\\u", "messages_", "[_", "'", "invalid", "'_", "]_", ",_", "code_", "=_", "'", "invalid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
apache/libcloud/libcloud/test/dns/test_durabledns.py
[ { "content": " def test_list_record_types(self):\n record_types = self.driver.list_record_types()\n self.assertEqual(len(record_types), 10)\n self.assertTrue(RecordType.A in record_types)\n self.assertTrue(RecordType.AAAA in record_types)\n self.assertTrue(RecordType.CNAME in record_types)\n self.assertTrue(RecordType.HINFO in record_types)\n self.assertTrue(RecordType.MX in record_types)\n self.assertTrue(RecordType.NS in record_types)\n self.assertTrue(RecordType.PTR in record_types)\n self.assertTrue(RecordType.RP in record_types)\n self.assertTrue(RecordType.SRV in record_types)\n self.assertTrue(RecordType.TXT in record_types)", "metadata": "root.DurableDNSTests.test_list_record_types", "header": "['class', 'DurableDNSTests', '(', 'LibcloudTestCase', ')', ':', '___EOS___']", "index": 46 } ]
[ { "span": "self.assertTrue(RecordType.A in record_types)", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 53 }, { "span": "self.assertTrue(RecordType.AAAA in record_types)", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 56 }, { "span": "self.assertTrue(RecordType.CNAME in record_types)", "start_line": 51, "start_column": 8, "end_line": 51, "end_column": 57 }, { "span": "self.assertTrue(RecordType.HINFO in record_types)", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 57 }, { "span": "self.assertTrue(RecordType.MX in record_types)", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 54 }, { "span": "self.assertTrue(RecordType.NS in record_types)", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 54 }, { "span": "self.assertTrue(RecordType.PTR in record_types)", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 55 }, { "span": "self.assertTrue(RecordType.RP in record_types)", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 54 }, { "span": "self.assertTrue(RecordType.SRV in record_types)", "start_line": 57, "start_column": 8, "end_line": 57, "end_column": 55 }, { "span": "self.assertTrue(RecordType.TXT in record_types)", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 55 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Dur", "able", "DNS", "Tests_", "(_", "Lib", "cloud", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "record", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "\\u", "types_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "record", "\\u", "types_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "record", "\\u", "types_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "A_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "AAAA", "_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "CNA", "ME_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "HI", "NF", "O_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "MX", "_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "NS_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "PTR", "_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "RP", "_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "SRV", "_", "in_", "record", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Record", "Type_", "._", "TXT", "_", "in_", "record", "\\u", "types_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
rizar/attention-lvcsr/libs/Theano/theano/tensor/nnet/abstract_conv.py
[ { "content": " def perform(self, node, inp, out_):\n img, kern = inp\n img = numpy.asarray(img)\n kern = numpy.asarray(kern)\n o, = out_\n mode = self.border_mode\n\n if not ((isinstance(mode, tuple) and min(mode) >= 0) or\n mode in ('valid', 'full', 'half')):\n raise ValueError(\n 'invalid border_mode {}, which must be either '\n '\"valid\", \"full\", \"half\", an integer or a pair of'\n ' integers'.format(mode))\n\n if mode == \"full\":\n mode = (kern.shape[2] - 1, kern.shape[3] - 1)\n elif mode == \"half\":\n mode = (kern.shape[2] // 2, kern.shape[3] // 2)\n if isinstance(mode, tuple):\n pad_h, pad_w = map(int, mode)\n mode = \"valid\"\n new_img = numpy.zeros((img.shape[0], img.shape[1],\n img.shape[2] + 2 * pad_h,\n img.shape[3] + 2 * pad_w), dtype=img.dtype)\n new_img[:, :, pad_h:img.shape[2] + pad_h, pad_w:img.shape[3] + pad_w] = img\n img = new_img\n if not self.filter_flip:\n kern = kern[:, :, ::-1, ::-1]\n conv_out = self.conv2d(img, kern, mode=\"valid\")\n conv_out = conv_out[:, :, ::self.subsample[0], ::self.subsample[1]]\n\n o[0] = node.outputs[0].type.filter(conv_out)", "metadata": "root.AbstractConv2d.perform", "header": "['class', 'AbstractConv2d', '(', 'BaseAbstractConv2d', ')', ':', '___EOS___']", "index": 502 }, { "content": " def perform(self, node, inp, out_):\n img, topgrad, shape = inp\n img = numpy.asarray(img)\n topgrad = numpy.asarray(topgrad)\n\n o, = out_\n\n mode = self.border_mode\n if not ((isinstance(mode, tuple) and min(mode) >= 0) or\n mode in ('valid', 'full', 'half')):\n raise ValueError(\n 'invalid border_mode {}, which must be either '\n '\"valid\", \"full\", \"half\", an integer or a pair of'\n ' integers'.format(mode))\n\n if mode == \"full\":\n mode = (shape[0] - 1, shape[1] - 1)\n elif mode == \"half\":\n mode = (shape[0] // 2, shape[1] // 2)\n if isinstance(mode, tuple):\n pad_h, pad_w = map(int, mode)\n mode = \"valid\"\n new_img = numpy.zeros((img.shape[0], img.shape[1],\n img.shape[2] + 2 * pad_h,\n img.shape[3] + 2 * pad_w), dtype=img.dtype)\n new_img[:, :, pad_h:img.shape[2] + pad_h, pad_w:img.shape[3] + pad_w] = img\n img = new_img\n\n if self.subsample[0] > 1 or self.subsample[1] > 1:\n new_shape = (topgrad.shape[0], topgrad.shape[1],\n img.shape[2] - shape[0] + 1,\n img.shape[3] - shape[1] + 1)\n new_topgrad = numpy.zeros((new_shape), dtype=topgrad.dtype)\n new_topgrad[:, :, ::self.subsample[0], ::self.subsample[1]] = topgrad\n topgrad = new_topgrad\n\n topgrad = topgrad.transpose(1, 0, 2, 3)[:, :, ::-1, ::-1]\n img = img.transpose(1, 0, 2, 3)\n kern = self.conv2d(img, topgrad, mode=\"valid\")\n if self.filter_flip:\n kern = kern.transpose(1, 0, 2, 3)[:, :, ::-1, ::-1]\n else:\n kern = kern.transpose(1, 0, 2, 3)\n o[0] = node.outputs[0].type.filter(kern)", "metadata": "root.AbstractConv2d_gradWeights.perform", "header": "['class', 'AbstractConv2d_gradWeights', '(', 'BaseAbstractConv2d', ')', ':', '___EOS___']", "index": 628 } ]
[ { "span": "mode ", "start_line": 522, "start_column": 12, "end_line": 522, "end_column": 16 }, { "span": "mode ", "start_line": 649, "start_column": 12, "end_line": 649, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Abstract", "Conv", "2d_", "(_", "Base", "Abstract", "Conv", "2d_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform_", "(_", "self_", ",_", "node_", ",_", "inp_", ",_", "out", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", ",_", "kern", "_", "=_", "inp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "numpy_", "._", "asarray_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kern", "_", "=_", "numpy_", "._", "asarray_", "(_", "kern", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", ",_", "=_", "out", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "self_", "._", "border", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "(_", "isinstance_", "(_", "mode_", ",_", "tuple_", ")_", "and_", "min_", "(_", "mode_", ")_", ">=_", "0_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "in_", "(_", "'", "valid", "'_", ",_", "'", "full", "'_", ",_", "'", "half", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", " ", "border", "\\u", "mode", " ", "{}", ",", " ", "whi", "ch", " ", "must", " ", "be", " ", "eit", "her", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "valid", "\",", " ", "\"", "full", "\",", " ", "\"", "half", "\",", " ", "an", " ", "integ", "er", " ", "or", " ", "a", " ", "pair", " ", "of", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "integ", "ers", "'_", "._", "format_", "(_", "mode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode_", "==_", "\"", "full", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "(_", "kern", "_", "._", "shape_", "[_", "2_", "]_", "-_", "1_", ",_", "kern", "_", "._", "shape_", "[_", "3_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "\"", "half", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "(_", "kern", "_", "._", "shape_", "[_", "2_", "]_", "//_", "2_", ",_", "kern", "_", "._", "shape_", "[_", "3_", "]_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "mode_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pad", "\\u", "h_", ",_", "pad", "\\u", "w_", "=_", "map_", "(_", "int_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "valid", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "img_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "img_", "._", "shape_", "[_", "0_", "]_", ",_", "img_", "._", "shape_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "img_", "._", "shape_", "[_", "2_", "]_", "+_", "2_", "*_", "pad", "\\u", "h_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "img_", "._", "shape_", "[_", "3_", "]_", "+_", "2_", "*_", "pad", "\\u", "w_", ")_", ",_", "dtype_", "=_", "img_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "img_", "[_", ":_", ",_", ":_", ",_", "pad", "\\u", "h_", ":_", "img_", "._", "shape_", "[_", "2_", "]_", "+_", "pad", "\\u", "h_", ",_", "pad", "\\u", "w_", ":_", "img_", "._", "shape_", "[_", "3_", "]_", "+_", "pad", "\\u", "w_", "]_", "=_", "img_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "new", "\\u", "img_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "filter", "\\u", "flip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kern", "_", "=_", "kern", "_", "[_", ":_", ",_", ":_", ",_", ":_", ":_", "-_", "1_", ",_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conv", "\\u", "out_", "=_", "self_", "._", "conv2d_", "(_", "img_", ",_", "kern", "_", ",_", "mode_", "=_", "\"", "valid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "\\u", "out_", "=_", "conv", "\\u", "out_", "[_", ":_", ",_", ":_", ",_", ":_", ":_", "self_", "._", "subsample", "_", "[_", "0_", "]_", ",_", ":_", ":_", "self_", "._", "subsample", "_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "o_", "[_", "0_", "]_", "=_", "node_", "._", "outputs_", "[_", "0_", "]_", "._", "type_", "._", "filter_", "(_", "conv", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Abstract", "Conv", "2d", "\\u", "grad", "Weights_", "(_", "Base", "Abstract", "Conv", "2d_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "perform_", "(_", "self_", ",_", "node_", ",_", "inp_", ",_", "out", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", ",_", "top", "grad_", ",_", "shape_", "=_", "inp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "numpy_", "._", "asarray_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "grad_", "=_", "numpy_", "._", "asarray_", "(_", "top", "grad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "o_", ",_", "=_", "out", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "self_", "._", "border", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "(_", "isinstance_", "(_", "mode_", ",_", "tuple_", ")_", "and_", "min_", "(_", "mode_", ")_", ">=_", "0_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "in_", "(_", "'", "valid", "'_", ",_", "'", "full", "'_", ",_", "'", "half", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", " ", "border", "\\u", "mode", " ", "{}", ",", " ", "whi", "ch", " ", "must", " ", "be", " ", "eit", "her", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "valid", "\",", " ", "\"", "full", "\",", " ", "\"", "half", "\",", " ", "an", " ", "integ", "er", " ", "or", " ", "a", " ", "pair", " ", "of", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "integ", "ers", "'_", "._", "format_", "(_", "mode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode_", "==_", "\"", "full", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "(_", "shape_", "[_", "0_", "]_", "-_", "1_", ",_", "shape_", "[_", "1_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "\"", "half", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "(_", "shape_", "[_", "0_", "]_", "//_", "2_", ",_", "shape_", "[_", "1_", "]_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "mode_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pad", "\\u", "h_", ",_", "pad", "\\u", "w_", "=_", "map_", "(_", "int_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "valid", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "img_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "img_", "._", "shape_", "[_", "0_", "]_", ",_", "img_", "._", "shape_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "img_", "._", "shape_", "[_", "2_", "]_", "+_", "2_", "*_", "pad", "\\u", "h_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "img_", "._", "shape_", "[_", "3_", "]_", "+_", "2_", "*_", "pad", "\\u", "w_", ")_", ",_", "dtype_", "=_", "img_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "img_", "[_", ":_", ",_", ":_", ",_", "pad", "\\u", "h_", ":_", "img_", "._", "shape_", "[_", "2_", "]_", "+_", "pad", "\\u", "h_", ",_", "pad", "\\u", "w_", ":_", "img_", "._", "shape_", "[_", "3_", "]_", "+_", "pad", "\\u", "w_", "]_", "=_", "img_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "new", "\\u", "img_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "subsample", "_", "[_", "0_", "]_", ">_", "1_", "or_", "self_", "._", "subsample", "_", "[_", "1_", "]_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "shape_", "=_", "(_", "top", "grad_", "._", "shape_", "[_", "0_", "]_", ",_", "top", "grad_", "._", "shape_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "img_", "._", "shape_", "[_", "2_", "]_", "-_", "shape_", "[_", "0_", "]_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "img_", "._", "shape_", "[_", "3_", "]_", "-_", "shape_", "[_", "1_", "]_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "top", "grad_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "new", "\\u", "shape_", ")_", ",_", "dtype_", "=_", "top", "grad_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "top", "grad_", "[_", ":_", ",_", ":_", ",_", ":_", ":_", "self_", "._", "subsample", "_", "[_", "0_", "]_", ",_", ":_", ":_", "self_", "._", "subsample", "_", "[_", "1_", "]_", "]_", "=_", "top", "grad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "grad_", "=_", "new", "\\u", "top", "grad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "top", "grad_", "=_", "top", "grad_", "._", "transpose_", "(_", "1_", ",_", "0_", ",_", "2_", ",_", "3_", ")_", "[_", ":_", ",_", ":_", ",_", ":_", ":_", "-_", "1_", ",_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "img_", "._", "transpose_", "(_", "1_", ",_", "0_", ",_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kern", "_", "=_", "self_", "._", "conv2d_", "(_", "img_", ",_", "top", "grad_", ",_", "mode_", "=_", "\"", "valid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "filter", "\\u", "flip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kern", "_", "=_", "kern", "_", "._", "transpose_", "(_", "1_", ",_", "0_", ",_", "2_", ",_", "3_", ")_", "[_", ":_", ",_", ":_", ",_", ":_", ":_", "-_", "1_", ",_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kern", "_", "=_", "kern", "_", "._", "transpose_", "(_", "1_", ",_", "0_", ",_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\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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 ]
Unused import
google/grr/grr/tools/console.py
[ { "content": "#!/usr/bin/env python\n\"\"\"This is the GRR Console.\n\nWe can schedule a new flow for a specific client.\n\"\"\"\n\n\n# pylint: disable=unused-import\n# Import things that are useful from the console.\nimport collections\nimport csv\nimport datetime\nimport getpass\nimport os\nimport re\nimport sys\nimport time\n\n\n# pylint: disable=unused-import,g-bad-import-order\nfrom grr.lib import server_plugins\n# pylint: enable=g-bad-import-order\n\nimport logging\n\nfrom grr.endtoend_tests import base\nfrom grr.lib import access_control\nfrom grr.lib import aff4\nfrom grr.lib import artifact\nfrom grr.lib import artifact_utils\nfrom grr.lib import config_lib\nfrom grr.lib import console_utils\nfrom grr.lib import data_store\nfrom grr.lib import export_utils\nfrom grr.lib import flags\nfrom grr.lib import flow\nfrom grr.lib import flow_runner\nfrom grr.lib import flow_utils\nfrom grr.lib import hunts\nfrom grr.lib import ipshell\nfrom grr.lib import maintenance_utils\nfrom grr.lib import startup\nfrom grr.lib import type_info\nfrom grr.lib import utils\nfrom grr.lib import worker\n\nfrom grr.lib.aff4_objects import aff4_grr\nfrom grr.lib.aff4_objects import reports\nfrom grr.lib.aff4_objects import security\n\n# All the functions in this lib we want in local namespace.\n# pylint: disable=wildcard-import\nfrom grr.lib.console_utils import *\n# pylint: enable=wildcard-import\n\nfrom grr.lib.flows import console\nfrom grr.lib.flows.console import debugging\nfrom grr.lib.flows.general import memory\n# pylint: enable=unused-import\n\nfrom grr.tools import end_to_end_tests\n\n\nflags.DEFINE_string(\"client\", None,\n \"Initialise the console with this client id \"\n \"(e.g. C.1234345).\")\n\nflags.DEFINE_string(\"reason\", None,\n \"Create a default token with this access reason \")\n\nflags.DEFINE_string(\"code_to_execute\", None,\n \"If present, no console is started but the code given in \"\n \"the flag is run instead (comparable to the -c option of \"\n \"IPython).\")\n\nflags.DEFINE_string(\"command_file\", None,\n \"If present, no console is started but the code given in \"\n \"command file is supplied as input instead.\")\n\nflags.DEFINE_bool(\"exit_on_complete\", True,\n \"If set to False and command_file or code_to_execute is \"\n \"set we keep the console alive after the code completes.\")\n\n\n\n\n\n\nif __name__ == \"__main__\":\n flags.StartMain(main)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def Lister(arg):\n for x in arg:\n print x", "metadata": "root.Lister", "header": "['module', '___EOS___']", "index": 84 }, { "content": "def main(unused_argv):\n \"\"\"Main.\"\"\"\n banner = (\"\\nWelcome to the GRR console\\n\")\n\n config_lib.CONFIG.AddContext(\"Commandline Context\")\n config_lib.CONFIG.AddContext(\n \"Console Context\",\n \"Context applied when running the console binary.\")\n startup.Init()\n\n # To make the console easier to use, we make a default token which will be\n # used in StartFlow operations.\n data_store.default_token = access_control.ACLToken(username=getpass.getuser(),\n reason=flags.FLAGS.reason)\n\n locals_vars = {\n \"__name__\": \"GRR Console\",\n \"l\": Lister,\n \"o\": aff4.FACTORY.Open,\n\n # Bring some symbols from other modules into the console's\n # namespace.\n \"StartFlowAndWait\": flow_utils.StartFlowAndWait,\n \"StartFlowAndWorker\": debugging.StartFlowAndWorker,\n \"RunEndToEndTests\": end_to_end_tests.RunEndToEndTests,\n }\n\n locals_vars.update(globals()) # add global variables to console\n if flags.FLAGS.client is not None:\n locals_vars[\"client\"], locals_vars[\"token\"] = console_utils.OpenClient(\n client_id=flags.FLAGS.client)\n\n if flags.FLAGS.code_to_execute:\n logging.info(\"Running code from flag: %s\", flags.FLAGS.code_to_execute)\n exec(flags.FLAGS.code_to_execute) # pylint: disable=exec-used\n elif flags.FLAGS.command_file:\n logging.info(\"Running code from file: %s\", flags.FLAGS.command_file)\n execfile(flags.FLAGS.command_file)\n\n if (flags.FLAGS.exit_on_complete and\n (flags.FLAGS.code_to_execute or flags.FLAGS.command_file)):\n return\n\n else: # We want the normal shell.\n locals_vars.update(globals()) # add global variables to console\n ipshell.IPShell(argv=[], user_ns=locals_vars, banner=banner)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 89 } ]
[ { "span": "import collections", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 18 }, { "span": "import csv", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 10 }, { "span": "import datetime", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 15 }, { "span": "import os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 9 }, { "span": "import re", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 9 }, { "span": "import sys", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 }, { "span": "import time", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 11 }, { "span": "from grr.lib import server_plugins", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 34 }, { "span": "from grr.endtoend_tests import base", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 35 }, { "span": "from grr.lib import artifact", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 28 }, { "span": "from grr.lib import artifact_utils", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 34 }, { "span": "from grr.lib import export_utils", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 32 }, { "span": "from grr.lib import flow", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 24 }, { "span": "from grr.lib import flow_runner", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 31 }, { "span": "from grr.lib import hunts", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 25 }, { "span": "from grr.lib import maintenance_utils", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 37 }, { "span": "from grr.lib import type_info", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 29 }, { "span": "from grr.lib import utils", "start_line": 43, "start_column": 0, "end_line": 43, "end_column": 25 }, { "span": "from grr.lib import worker", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 26 }, { "span": "from grr.lib.aff4_objects import aff4_grr", "start_line": 46, "start_column": 0, "end_line": 46, "end_column": 41 }, { "span": "from grr.lib.aff4_objects import reports", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 40 }, { "span": "from grr.lib.aff4_objects import security", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 41 }, { "span": "from grr.lib.flows import console", "start_line": 55, "start_column": 0, "end_line": 55, "end_column": 33 }, { "span": "from grr.lib.flows.general import memory", "start_line": 57, "start_column": 0, "end_line": 57, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "is", " ", "the", " ", "GR", "R", " ", "Cons", "ole", ".", "\\", "10", ";", "\\", "10", ";", "We", " ", "can", " ", "schedule", " ", "a", " ", "new", " ", "flow", " ", "for", " ", "a", " ", "specific", " ", "client", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "import_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "thing", "s", " ", "tha", "t", " ", "are", " ", "usef", "ul", " ", "from", " ", "the", " ", "console", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "import", ",", "g", "-", "bad", "-", "import", "-", "order_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "server", "\\u", "plugins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "enable", "=", "g", "-", "bad", "-", "import", "-", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "endt", "oe", "nd", "\\u", "tests_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "access", "\\u", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "aff4", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "artifact_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "artifact", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "config", "\\u", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "console", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "data\\u", "store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "export", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "flow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "flow", "\\u", "runner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "flow", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "hunt", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "ips", "hell", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "maintenance", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "startup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "type", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "worker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "aff4", "\\u", "objects_", "import_", "aff4", "\\u", "grr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "aff4", "\\u", "objects_", "import_", "reports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "aff4", "\\u", "objects_", "import_", "security_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "the", " ", "function", "s", " ", "in", " ", "this", " ", "lib", " ", "we", " ", "want", " ", "in", " ", "local", " ", "namespace", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "wild", "card", "-", "import_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "console", "\\u", "utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "enable", "=", "wild", "card", "-", "import_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "flows_", "import_", "console_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "flows_", "._", "console_", "import_", "debugg", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "flows_", "._", "general_", "import_", "memory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "enable", "=", "unu", "sed", "-", "import_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "tools_", "import_", "end", "\\u", "to", "\\u", "end", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "\"", "client", "\"_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Initialise", " ", "the", " ", "console", " ", "with", " ", "this", " ", "client", " ", "id", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "e", ".", "g", ".", " ", "C", ".12", "343", "4", "5", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "\"", "reason", "\"_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Creat", "e", " ", "a", " ", "default", " ", "token", " ", "with", " ", "this", " ", "access", " ", "reason", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "\"", "code", "\\u", "to", "\\u", "execute", "\"_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "If", " ", "presen", "t", ",", " ", "no", " ", "console", " ", "is", " ", "start", "ed", " ", "but", " ", "the", " ", "code", " ", "give", "n", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "the", " ", "flag", " ", "is", " ", "run", " ", "inst", "ead", " ", "(", "compara", "ble", " ", "to", " ", "the", " ", "-", "c", " ", "option", " ", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "IP", "yth", "on", ").\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "\"", "command", "\\u", "file", "\"_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "If", " ", "presen", "t", ",", " ", "no", " ", "console", " ", "is", " ", "start", "ed", " ", "but", " ", "the", " ", "code", " ", "give", "n", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "command", " ", "file", " ", "is", " ", "supplie", "d", " ", "as", " ", "input", " ", "inst", "ead", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "bool_", "(_", "\"", "exit", "\\u", "on", "\\u", "complete", "\"_", ",_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "If", " ", "set", " ", "to", " ", "Fal", "se", " ", "and", " ", "command", "\\u", "file", " ", "or", " ", "code", "\\u", "to", "\\u", "execute", " ", "is", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "set", " ", "we", " ", "keep", " ", "the", " ", "console", " ", "alive", " ", "after", " ", "the", " ", "code", " ", "complete", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "flags_", "._", "Start", "Main_", "(_", "main_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Liste", "r_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "arg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "unu", "sed", "\\u", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Main", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "banner_", "=_", "(_", "\"\\\\", "n", "Wel", "come", " ", "to", " ", "the", " ", "GR", "R", " ", "console", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "lib_", "._", "CONFIG_", "._", "Add", "Context_", "(_", "\"", "Command", "line", " ", "Context", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "lib_", "._", "CONFIG_", "._", "Add", "Context_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cons", "ole", " ", "Context", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Context", " ", "applied", " ", "whe", "n", " ", "runn", "ing", " ", "the", " ", "console", " ", "binar", "y", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "startup_", "._", "Init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "make", " ", "the", " ", "console", " ", "easi", "er", " ", "to", " ", "use", ",", " ", "we", " ", "make", " ", "a", " ", "default", " ", "token", " ", "whi", "ch", " ", "will", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "in", " ", "Start", "Flow", " ", "operati", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "store_", "._", "default", "\\u", "token_", "=_", "access", "\\u", "control_", "._", "ACL", "Token_", "(_", "username_", "=_", "getpass_", "._", "getuser", "_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "flags_", "._", "FLAGS_", "._", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locals", "\\u", "vars_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u\\u", "name", "\\u\\u\"_", ":_", "\"", "GR", "R", " ", "Cons", "ole", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "l", "\"_", ":_", "Liste", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "o", "\"_", ":_", "aff4", "_", "._", "FACTORY", "_", "._", "Open_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bri", "ng", " ", "some", " ", "symbols", " ", "from", " ", "other", " ", "module", "s", " ", "int", "o", " ", "the", " ", "console", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Start", "Flow", "And", "Wait", "\"_", ":_", "flow", "\\u", "utils_", "._", "Start", "Flow", "And", "Wait_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Start", "Flow", "And", "Worke", "r", "\"_", ":_", "debugg", "ing_", "._", "Start", "Flow", "And", "Worker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Run", "End", "To", "End", "Test", "s", "\"_", ":_", "end", "\\u", "to", "\\u", "end", "\\u", "tests_", "._", "Run", "End", "To", "End", "Tests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locals", "\\u", "vars_", "._", "update_", "(_", "globals_", "(_", ")_", ")_", "#", " ", "add", " ", "global", " ", "variab", "les", " ", "to", " ", "console_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "flags_", "._", "FLAGS_", "._", "client_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locals", "\\u", "vars_", "[_", "\"", "client", "\"_", "]_", ",_", "locals", "\\u", "vars_", "[_", "\"", "token", "\"_", "]_", "=_", "console", "\\u", "utils_", "._", "Open", "Client_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "id_", "=_", "flags_", "._", "FLAGS_", "._", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flags_", "._", "FLAGS_", "._", "code", "\\u", "to", "\\u", "execute_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Run", "ning", " ", "code", " ", "from", " ", "flag", ":", " ", "%", "s", "\"_", ",_", "flags_", "._", "FLAGS_", "._", "code", "\\u", "to", "\\u", "execute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "flags_", "._", "FLAGS_", "._", "code", "\\u", "to", "\\u", "execute_", ")_", "#", " ", "pylint", ":", " ", "disable", "=", "exec", "-", "used_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "flags_", "._", "FLAGS_", "._", "command", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Run", "ning", " ", "code", " ", "from", " ", "file", ":", " ", "%", "s", "\"_", ",_", "flags_", "._", "FLAGS_", "._", "command", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "execfile", "_", "(_", "flags_", "._", "FLAGS_", "._", "command", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "flags_", "._", "FLAGS_", "._", "exit", "\\u", "on", "\\u", "complete_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "flags_", "._", "FLAGS_", "._", "code", "\\u", "to", "\\u", "execute_", "or_", "flags_", "._", "FLAGS_", "._", "command", "\\u", "file_", ")_", ")_", ":_", "\\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_", "else_", ":_", "#", " ", "We", " ", "want", " ", "the", " ", "normal", " ", "shell", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locals", "\\u", "vars_", "._", "update_", "(_", "globals_", "(_", ")_", ")_", "#", " ", "add", " ", "global", " ", "variab", "les", " ", "to", " ", "console_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ips", "hell", "_", "._", "IPS", "hell", "_", "(_", "argv_", "=_", "[_", "]_", ",_", "user", "\\u", "ns_", "=_", "locals", "\\u", "vars_", ",_", "banner_", "=_", "banner_", ")_", "\\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, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 0, 1, 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/ipython-py3k/IPython/zmq/tests/test_session.py
[ { "content": " def test_args(self):\n \"\"\"initialization arguments for Session\"\"\"\n s = self.session\n self.assertTrue(s.pack is ss.default_packer)\n self.assertTrue(s.unpack is ss.default_unpacker)\n self.assertEquals(s.username, os.environ.get('USER', 'username'))\n \n s = ss.Session()\n self.assertEquals(s.username, os.environ.get('USER', 'username'))\n \n self.assertRaises(TypeError, ss.Session, pack='hi')\n self.assertRaises(TypeError, ss.Session, unpack='hi')\n u = str(uuid.uuid4())\n s = ss.Session(username='carrot', session=u)\n self.assertEquals(s.session, u)\n self.assertEquals(s.username, 'carrot')", "metadata": "root.TestSession.test_args", "header": "['class', 'TestSession', '(', 'SessionTestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_tracking(self):\n \"\"\"test tracking messages\"\"\"\n a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR)\n s = self.session\n stream = ZMQStream(a)\n msg = s.send(a, 'hello', track=False)\n self.assertTrue(msg['tracker'] is None)\n msg = s.send(a, 'hello', track=True)\n self.assertTrue(isinstance(msg['tracker'], zmq.MessageTracker))\n M = zmq.Message(b'hi there', track=True)\n msg = s.send(a, 'hello', buffers=[M], track=True)\n t = msg['tracker']\n self.assertTrue(isinstance(t, zmq.MessageTracker))\n self.assertRaises(zmq.NotDone, t.wait, .1)\n del M\n t.wait(1) # this will raise", "metadata": "root.TestSession.test_tracking", "header": "['class', 'TestSession', '(', 'SessionTestCase', ')', ':', '___EOS___']", "index": 60 }, { "content": " def test_unique_msg_ids(self):\n \"\"\"test that messages receive unique ids\"\"\"\n ids = set()\n for i in range(2**12):\n h = self.session.msg_header('test')\n msg_id = h['msg_id']\n self.assertTrue(msg_id not in ids)\n ids.add(msg_id)", "metadata": "root.TestSession.test_unique_msg_ids", "header": "['class', 'TestSession', '(', 'SessionTestCase', ')', ':', '___EOS___']", "index": 96 } ]
[ { "span": "self.assertTrue(s.pack is ss.default_packer)", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 52 }, { "span": "self.assertTrue(s.unpack is ss.default_unpacker)", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 56 }, { "span": "self.assertTrue(msg['tracker'] is None)", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 47 }, { "span": "self.assertTrue(msg_id not in ids)", "start_line": 102, "start_column": 12, "end_line": 102, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Session_", "(_", "Sess", "ion", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "initialization", " ", "argu", "ment", "s", " ", "for", " ", "Sess", "ion", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "self_", "._", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "s_", "._", "pack_", "is_", "ss_", "._", "default", "\\u", "packer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "s_", "._", "unpack_", "is_", "ss_", "._", "default", "\\u", "unpack", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "s_", "._", "username_", ",_", "os_", "._", "environ_", "._", "get_", "(_", "'", "USER", "'_", ",_", "'", "user", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "ss_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "s_", "._", "username_", ",_", "os_", "._", "environ_", "._", "get_", "(_", "'", "USER", "'_", ",_", "'", "user", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "ss_", "._", "Session_", ",_", "pack_", "=_", "'", "hi", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "ss_", "._", "Session_", ",_", "unpack_", "=_", "'", "hi", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "ss_", "._", "Session_", "(_", "username_", "=_", "'", "carr", "ot", "'_", ",_", "session_", "=_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "s_", "._", "session_", ",_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "s_", "._", "username_", ",_", "'", "carr", "ot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Session_", "(_", "Sess", "ion", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tracking_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "test", " ", "track", "ing", " ", "message", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", ",_", "b_", "=_", "self_", "._", "create", "\\u", "bound", "\\u", "pair_", "(_", "zmq_", "._", "PAIR", "_", ",_", "zmq_", "._", "PAIR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "self_", "._", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "=_", "ZM", "QS", "tream_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "s_", "._", "send_", "(_", "a_", ",_", "'", "hell", "o", "'_", ",_", "track_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "msg_", "[_", "'", "track", "er", "'_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "s_", "._", "send_", "(_", "a_", ",_", "'", "hell", "o", "'_", ",_", "track_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "msg_", "[_", "'", "track", "er", "'_", "]_", ",_", "zmq_", "._", "Messag", "e", "Tracker_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "zmq_", "._", "Message_", "(_", "b", "'", "hi", " ", "there", "'_", ",_", "track_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "s_", "._", "send_", "(_", "a_", ",_", "'", "hell", "o", "'_", ",_", "buffers_", "=_", "[_", "M_", "]_", ",_", "track_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "msg_", "[_", "'", "track", "er", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", ",_", "zmq_", "._", "Messag", "e", "Tracker_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "zmq_", "._", "Not", "Done_", ",_", "t_", "._", "wait_", ",_", ".1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "wait_", "(_", "1_", ")_", "#", " ", "this", " ", "will", " ", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Session_", "(_", "Sess", "ion", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unique", "\\u", "msg", "\\u", "ids_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "test", " ", "tha", "t", " ", "message", "s", " ", "receive", " ", "unique", " ", "ids", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "2_", "**_", "12_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "self_", "._", "session_", "._", "msg", "\\u", "header_", "(_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "id_", "=_", "h_", "[_", "'", "msg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "msg", "\\u", "id_", "not_", "in_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "._", "add_", "(_", "msg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
edgewall/trac/doc/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2008-2014 Edgewall Software\n# Copyright (C) 2008 Noah Kantrowitz <[email protected]>\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n# you should have received as part of this distribution. The terms\n# are also available at http://trac.edgewall.com/license.html.\n#\n# This software consists of voluntary contributions made by many\n# individuals. For the exact contribution history, see the revision\n# history and logs, available at http://trac.edgewall.org/.\n\n# Trac documentation build configuration file, created by\n# sphinx-quickstart on Wed May 14 09:05:13 2008.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# The contents of this file are pickled, so don't put values in the\n# namespace that aren't pickleable (module imports are okay, they're\n# removed automatically).\n#\n# All configuration values have a default value; values that are\n# commented out serve to show the default value.\n\nimport os\nimport sys\nfrom datetime import datetime\n\nfrom trac.util import get_pkginfo\n\npkg_info = get_pkginfo(sys.modules['trac'])\n\n# General substitutions.\nproject = 'Trac'\ncopyright = '%s, Edgewall Software' % datetime.now().year\nurl = pkg_info['home_page']\n\n# The default replacements for |version| and |release|, also used in various\n# other places throughout the built documents.\n#\n# The short X.Y version.\nversion = pkg_info['version'].split('dev')[0]\n# The full version, including alpha/beta/rc tags.\nrelease = pkg_info['version']\n\n# Devel or Release mode for the documentation (if devel, include TODOs,\n# can also be used in conditionals: .. ifconfig :: devel)\ndevel = 'dev' in pkg_info['version']\n\n# If your extensions are in another directory, add it here. If the\n# directory is relative to the documentation root, use os.path.abspath\n# to make it absolute, like shown here.\n# sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))\n\n# General configuration\n# ---------------------\n\n# Add any Sphinx extension module names here, as strings.\n# They can be extensions coming with Sphinx (named 'sphinx.ext.*')\n# or your custom ones.\n\nextensions = []\n\n# -- Autodoc\n\nextensions.append('sphinx.ext.autodoc')\n\nautoclass_content = 'both'\nautodoc_member_order = 'bysource'\n\n# -- Conditional content (see setup() below)\nextensions.append('sphinx.ext.ifconfig')\n\n# -- Link to other Sphinx documentations\nextensions.append('sphinx.ext.intersphinx')\n\nintersphinx_mapping = {'python': ('http://docs.python.org/2.7', None)}\n\n# -- Keep track of :todo: items\nextensions.append('sphinx.ext.todo')\n\ntodo_include_todos = devel\n\n# -- PDF support via http://code.google.com/p/rst2pdf/\ntry:\n import rst2pdf\n extensions.append('rst2pdf.pdfbuilder')\nexcept ImportError:\n pass\n\n\n# Add any paths that contain templates here, relative to this directory.\n#templates_path = ['utils/templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\ntoday_fmt = '%B %d, %Y'\n\n# List of documents that shouldn't be included in the build.\nunused_docs = []\n\n# List of directories, relative to source directories, that shouldn't be searched\n# for source files.\nexclude_patterns = [\n]\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 = 'trac'\n\n# The default role is a reference to some Python object\ndefault_role = 'py:obj'\n\n\n# Options for HTML output\n# -----------------------\n\n# The style sheet to use for HTML and HTML Help pages. A file of that name\n# must exist either in Sphinx' static/ path, or in one of the custom paths\n# given in html_static_path.\nhtml_style = 'tracsphinx.css'\n\nhtml_theme = 'sphinxdoc'\n\nhtml_theme_options = {\n# 'linkcolor': '#B00',\n# 'visitedlinkcolor': '#B00',\n}\n\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# The name of an image file (within the static path) to place at the top of\n# the sidebar.\nhtml_logo = 'images/trac_logo.png'\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 = ['utils/']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\nhtml_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\nhtml_use_modindex = True\n\n# If true, the reST sources are included in the HTML build as _sources/<name>.\n#html_copy_source = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# If nonempty, this is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = ''\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'Tracdoc'\n\n\nmodindex_common_prefix = ['trac.', 'tracopt.']\n\n\n# Options for LaTeX output\n# ------------------------\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, document class [howto/manual]).\nlatex_documents = [\n ('index', 'Trac.tex', 'Trac API Documentation', 'The Trac Team', '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\n\n\n# Options for PDF output\n# ----------------------\n# (initially copied from\n# http://rst2pdf.googlecode.com/svn/tags/0.16/doc/manual.txt)\n\n# Grouping the document tree into PDF files. List of tuples\n# (source start file, target name, title, author, options).\n#\n# If there is more than one author, separate them with \\\\.\n# For example: r'Guido van Rossum\\\\Fred L. Drake, Jr., editor'\n#\n# The options element is a dictionary that lets you override\n# this config per-document.\n# For example,\n# ('index', u'MyProject', u'My Project', u'Author Name',\n# dict(pdf_compressed = True))\n# would mean that specific document would be compressed\n# regardless of the global pdf_compressed setting.\n\npdf_documents = [\n ('index', 'trac_dev', project, u'The Trac Team'),\n]\n\n# A comma-separated list of custom stylesheets (latest has higher precedence)\npdf_stylesheets = [\n 'sphinx',\n 'a4',\n 'trac',\n os.path.join(os.path.dirname(__file__), 'utils', 'trac_dev_pdf.style')\n]\n\n# Create a compressed PDF\n# Use True/False or 1/0\n# Example: compressed=True\npdf_compressed = True\n\n# A colon-separated list of folders to search for fonts. Example:\n# pdf_font_path = ['/usr/share/fonts', '/usr/share/texmf-dist/fonts/']\n\n# Language to be used for hyphenation support\npdf_language = \"en_US\"\n\n# Mode for literal blocks wider than the frame. Can be\n# overflow, shrink or truncate\npdf_fit_mode = \"shrink\"\n\n# Section level that forces a break page.\n# For example: 1 means top-level sections start in a new page\n# 0 means disabled\npdf_break_level = 1\n\n# When a section starts in a new page, force it to be 'even', 'odd',\n# or just use 'any'\n#pdf_breakside = 'any'\n\n# Insert footnotes where they are defined instead of\n# at the end.\n#pdf_inline_footnotes = True\n\n# verbosity level. 0 1 or 2\n#pdf_verbosity = 0\n\n# If false, no index is generated.\npdf_use_index = True\n\n# If false, no modindex is generated.\npdf_use_modindex = True\n\n# If false, no coverpage is generated.\n#pdf_use_coverpage = True\n\n# Name of the cover page template to use\n#pdf_cover_template = 'sphinxcover.tmpl'\n\n# Documents to append as an appendix to all manuals.\n#pdf_appendices = []\n\n# Enable experimental feature to split table cells. Use it\n# if you get \"DelayedTable too big\" errors\n#pdf_splittables = False\n\n# Set the default DPI for images\n#pdf_default_dpi = 72\n\n# Enable rst2pdf extension modules (default is only vectorpdf)\n# you need vectorpdf if you want to use sphinx's graphviz support\n#pdf_extensions = ['vectorpdf']\n\n# Page template name for \"regular\" pages\n#pdf_page_template = 'cutePage'\n\n# Show Table Of Contents at the beginning?\n#pdf_use_toc = True\n\n# How many levels deep should the table of contents be?\npdf_toc_depth = 9999\n\n# Add section number to section references\npdf_use_numbered_links = False\n\n# Background images fitting mode\npdf_fit_background_mode = 'scale'\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setup(app):\n # adding role for linking to InterTrac targets on t.e.o\n from docutils import nodes\n from docutils.parsers.rst import roles\n\n def teo_role(name, rawtext, text, lineno, inliner, options={}, content=[]):\n # special case ticket references\n if text[0] == '#':\n ref = url + '/ticket/' + text[1:]\n else:\n ref = url + '/intertrac/' + text\n roles.set_classes(options)\n node = nodes.reference(rawtext, text, refuri=ref, **options)\n return [node], []\n roles.register_canonical_role('teo', teo_role)\n\n def extensionpoints_role(name, rawtext, text, lineno, inliner, options={},\n content=[]):\n ref = url + '/wiki/TracDev/PluginDevelopment/ExtensionPoints/' + text\n roles.set_classes(options)\n node = nodes.reference(rawtext, text + \" extension point\",\n refuri=ref, **options)\n return [node], []\n roles.register_canonical_role('extensionpoints', extensionpoints_role)\n\n # ifconfig variables\n app.add_config_value('devel', '', True)", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 338 } ]
[ { "span": "import rst2pdf", "start_line": 88, "start_column": 4, "end_line": 88, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2008", "-", "2014", " ", "Ed", "ge", "wall", " ", "Sof", "twa", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2008", " ", "No", "ah", " ", "Kan", "tro", "wit", "z", " ", "<", "noa", "h", "@", "coder", "ange", "r", ".", "net", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "software", " ", "is", " ", "license", "d", " ", "as", " ", "descri", "bed", " ", "in", " ", "the", " ", "file", " ", "COPY", "ING", ",", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "as", " ", "part", " ", "of", " ", "this", " ", "distribu", "tion", ".", " ", "The", " ", "terms_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "als", "o", " ", "avail", "able", " ", "at", " ", "http", "://", "trac", ".", "edge", "wall", ".", "com", "/", "license", ".", "html", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "software", " ", "consi", "sts", " ", "of", " ", "volu", "nta", "ry", " ", "contributions", " ", "made", " ", "by", " ", "many_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "individual", "s", ".", " ", "For", " ", "the", " ", "exact", " ", "contribution", " ", "histo", "ry", ",", " ", "see", " ", "the", " ", "revision_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "histo", "ry", " ", "and", " ", "logs", ",", " ", "avail", "able", " ", "at", " ", "http", "://", "trac", ".", "edge", "wall", ".", "org", "/.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Trac", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "We", "d", " ", "Ma", "y", " ", "14", " ", "09", ":", "05", ":", "13", " ", "2008", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "content", "s", " ", "of", " ", "this", " ", "file", " ", "are", " ", "pickled", ",", " ", "so", " ", "don", "'", "t", " ", "put", " ", "values", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "pickle", "able", " ", "(", "module", " ", "import", "s", " ", "are", " ", "oka", "y", ",", " ", "the", "y", "'", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", "d", " ", "automati", "call", "y", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", " ", "value", ";", " ", "values", " ", "tha", "t", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commente", "d", " ", "out", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "trac", "_", "._", "util_", "import_", "get", "\\u", "pkg", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pkg", "\\u", "info_", "=_", "get", "\\u", "pkg", "info_", "(_", "sys_", "._", "modules_", "[_", "'", "trac", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "substitution", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "'", "Trac", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "'%", "s", ",", " ", "Ed", "ge", "wall", " ", "Sof", "twa", "re", "'_", "%_", "datetime_", "._", "now_", "(_", ")_", "._", "year_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "pkg", "\\u", "info_", "[_", "'", "home", "\\u", "page", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "replace", "ment", "s", " ", "for", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "pkg", "\\u", "info_", "[_", "'", "version", "'_", "]_", "._", "split_", "(_", "'", "dev", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "pkg", "\\u", "info_", "[_", "'", "version", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dev", "el", " ", "or", " ", "Release", " ", "mode", " ", "for", " ", "the", " ", "documentation", " ", "(", "if", " ", "deve", "l", ",", " ", "include", " ", "TOD", "Os", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "als", "o", " ", "be", " ", "used", " ", "in", " ", "conditional", "s", ":", " ", "..", " ", "ifconfig", " ", "::", " ", "deve", "l", ")_", "\\u\\u\\uNL\\u\\u\\u_", "deve", "l_", "=_", "'", "dev", "'_", "in_", "pkg", "\\u", "info_", "[_", "'", "version", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "extensi", "ons", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",", " ", "add", " ", "it", " ", "here", ".", " ", "If", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abspath_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "dir", "name", "(", "os", ".", "path", ".", "dir", "name", "(\\u", "\\u", "file", "\\u\\u)", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "y", " ", "can", " ", "be", " ", "extensi", "ons", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Auto", "doc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "._", "append_", "(_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "autocl", "ass", "\\u", "content_", "=_", "'", "bot", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "autod", "oc", "\\u", "member", "\\u", "order_", "=_", "'", "bys", "ource", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Cond", "itional", " ", "content", " ", "(", "see", " ", "setup", "()", " ", "belo", "w", ")_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "._", "append_", "(_", "'", "sphinx", ".", "ext", ".", "ifconfig", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Link", " ", "to", " ", "other", " ", "Sph", "inx", " ", "documentation", "s_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "._", "append_", "(_", "'", "sphinx", ".", "ext", ".", "intersphinx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "intersphinx", "\\u", "mapping_", "=_", "{_", "'", "python", "'_", ":_", "(_", "'", "http", "://", "docs", ".", "python", ".", "org", "/", "2.7", "'_", ",_", "None_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Keep", " ", "track", " ", "of", " ", ":", "todo", ":", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "._", "append_", "(_", "'", "sphinx", ".", "ext", ".", "todo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "todo", "\\u", "include", "\\u", "todos_", "=_", "deve", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "PD", "F", " ", "support", " ", "via", " ", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "rst", "2p", "df", "/_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "rst", "2p", "df_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "._", "append_", "(_", "'", "rst", "2p", "df", ".", "pdf", "builde", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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", " ", "=", " ", "['", "util", "s", "/", "template", "s", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "toda", "y", "\\u", "fmt_", "=_", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "document", "s", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "include", "d", " ", "in", " ", "the", " ", "build", "._", "\\u\\u\\uNL\\u\\u\\u_", "unu", "sed", "\\u", "docs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "director", "ies", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "ies", ",", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "searche", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\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_", "=_", "'", "trac", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "role", " ", "is", " ", "a", " ", "reference", " ", "to", " ", "some", " ", "Pyth", "on", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "role_", "=_", "'", "py", ":", "obj", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "style", " ", "sheet", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", "A", " ", "file", " ", "of", " ", "tha", "t", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "must", " ", "exist", " ", "eit", "her", " ", "in", " ", "Sph", "inx", "'", " ", "static", "/", " ", "path", ",", " ", "or", " ", "in", " ", "one", " ", "of", " ", "the", " ", "custom", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", "n", " ", "in", " ", "html", "\\u", "static", "\\u", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "style_", "=_", "'", "trac", "sphinx", ".", "css", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "sphinx", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "them", "e\\u", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "link", "color", "':", " ", "'#", "B0", "0", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "visit", "edl", "ink", "color", "':", " ", "'#", "B0", "0", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "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_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "logo_", "=_", "'", "images", "/", "trac", "\\u", "logo", ".", "png", "'_", "\\u\\u\\uNEWLINE\\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_", "=_", "[_", "'", "util", "s", "/'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt_", "=_", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "use", "\\u", "modi", "ndex_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "include", "d", " ", "in", " ", "the", " ", "HTM", "L", " ", "build", " ", "as", " ", "\\u", "source", "s", "/", "<", "name", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "copy", "\\u", "source", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "none", "mpty", ",", " ", "this", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "Trac", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "modi", "nde", "x", "\\u", "common", "\\u", "prefix_", "=_", "[_", "'", "trac", ".'_", ",_", "'", "trac", "opt", ".'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "'", " ", "or", " ", "'", "a4", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "pape", "r", "\\u", "size", " ", "=", " ", "'", "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", "'_", ",_", "'", "Trac", ".", "tex", "'_", ",_", "'", "Trac", " ", "API", " ", "Document", "ation", "'_", ",_", "'", "The", " ", "Trac", " ", "Tea", "m", "'_", ",_", "'", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "ns", " ", "for", " ", "PD", "F", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "initially", " ", "copie", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "rst", "2p", "df", ".", "googlec", "ode", ".", "com", "/", "svn", "/", "tags", "/", "0.16", "/", "doc", "/", "manu", "al", ".", "txt", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "PD", "F", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "options", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "more", " ", "than", " ", "one", " ", "author", ",", " ", "separate", " ", "them", " ", "with", " ", "\\\\\\\\.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "example", ":", " ", "r", "'", "Guid", "o", " ", "van", " ", "Ros", "sum", "\\\\\\\\", "Fre", "d", " ", "L", ".", " ", "Dra", "ke", ",", " ", "J", "r", ".,", " ", "editor", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "options", " ", "element", " ", "is", " ", "a", " ", "dictionar", "y", " ", "tha", "t", " ", "lets", " ", "you", " ", "override_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "config", " ", "per", "-", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "example", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "('", "index", "',", " ", "u", "'", "My", "Project", "',", " ", "u", "'", "My", " ", "Project", "',", " ", "u", "'", "Author", " ", "Name", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dict", "(", "pdf", "\\u", "compress", "ed", " ", "=", " ", "Tru", "e", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wou", "ld", " ", "mean", " ", "tha", "t", " ", "specific", " ", "document", " ", "wou", "ld", " ", "be", " ", "compressed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rega", "rd", "less", " ", "of", " ", "the", " ", "global", " ", "pdf", "\\u", "compress", "ed", " ", "setti", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "trac", "\\u", "dev", "'_", ",_", "project_", ",_", "u", "'", "The", " ", "Trac", " ", "Tea", "m", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "comma", "-", "separate", "d", " ", "list", " ", "of", " ", "custom", " ", "stylesheet", "s", " ", "(", "late", "st", " ", "has", " ", "higher", " ", "preceden", "ce", ")_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "stylesheet", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "a4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trac", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "util", "s", "'_", ",_", "'", "trac", "\\u", "dev", "\\u", "pdf", ".", "style", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "compress", "ed", " ", "PDF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "Tru", "e", "/", "Fal", "se", " ", "or", " ", "1", "/", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", ":", " ", "compress", "ed", "=", "True_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "compressed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "colon", "-", "separate", "d", " ", "list", " ", "of", " ", "folder", "s", " ", "to", " ", "search", " ", "for", " ", "font", "s", ".", " ", "Exam", "ple", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pdf", "\\u", "font", "\\u", "path", " ", "=", " ", "['", "/", "usr", "/", "share", "/", "font", "s", "',", " ", "'/", "usr", "/", "share", "/", "tex", "mf", "-", "dist", "/", "font", "s", "/'", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", "ua", "ge", " ", "to", " ", "be", " ", "used", " ", "for", " ", "hyphen", "ation", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "language_", "=_", "\"", "en", "\\u", "US", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mode", " ", "for", " ", "literal", " ", "blocks", " ", "wide", "r", " ", "than", " ", "the", " ", "frame", ".", " ", "Can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "overflow", ",", " ", "shrink", " ", "or", " ", "truncate_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "fit", "\\u", "mode_", "=_", "\"", "shrink", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sect", "ion", " ", "level", " ", "tha", "t", " ", "force", "s", " ", "a", " ", "break", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "example", ":", " ", "1", " ", "means", " ", "top", "-", "level", " ", "section", "s", " ", "start", " ", "in", " ", "a", " ", "new", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "0", " ", "means", " ", "disabled_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "break", "\\u", "level_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "a", " ", "section", " ", "starts", " ", "in", " ", "a", " ", "new", " ", "page", ",", " ", "force", " ", "it", " ", "to", " ", "be", " ", "'", "even", "',", " ", "'", "odd", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "just", " ", "use", " ", "'", "any", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "breaks", "ide", " ", "=", " ", "'", "any", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "footnote", "s", " ", "where", " ", "the", "y", " ", "are", " ", "defin", "ed", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "the", " ", "end", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "inline", "\\u", "footnote", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verbo", "sity", " ", "level", ".", " ", "0", " ", "1", " ", "or", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "verbo", "sity", " ", "=", " ", "0_", "\\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_", "pdf", "\\u", "use", "\\u", "index_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "modi", "nde", "x", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "use", "\\u", "modi", "ndex_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "cover", "page", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "use", "\\u", "cover", "page", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Name", " ", "of", " ", "the", " ", "cover", " ", "page", " ", "template", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "cover", "\\u", "template", " ", "=", " ", "'", "sphinx", "cover", ".", "tmpl", "'_", "\\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_", "#", "pdf", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "experimental", " ", "feature", " ", "to", " ", "split", " ", "table", " ", "cells", ".", " ", "Us", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "you", " ", "get", " ", "\"", "Delay", "ed", "Table", " ", "too", " ", "big", "\"", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "split", "tables", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "default", " ", "DP", "I", " ", "for", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "default", "\\u", "dp", "i", " ", "=", " ", "72_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "rst", "2p", "df", " ", "extensi", "on", " ", "module", "s", " ", "(", "default", " ", "is", " ", "only", " ", "vector", "pdf", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "need", " ", "vector", "pdf", " ", "if", " ", "you", " ", "want", " ", "to", " ", "use", " ", "sphinx", "'", "s", " ", "graphviz", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "extensi", "ons", " ", "=", " ", "['", "vector", "pdf", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Page", " ", "template", " ", "name", " ", "for", " ", "\"", "regular", "\"", " ", "pages_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "page", "\\u", "template", " ", "=", " ", "'", "cute", "Page", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", " ", "Table", " ", "Of", " ", "Conten", "ts", " ", "at", " ", "the", " ", "beginn", "ing", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "pdf", "\\u", "use", "\\u", "toc", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "many", " ", "level", "s", " ", "deep", " ", "shou", "ld", " ", "the", " ", "table", " ", "of", " ", "content", "s", " ", "be", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "toc", "\\u", "depth_", "=_", "9999_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "section", " ", "number", " ", "to", " ", "section", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "use", "\\u", "numbered", "\\u", "links_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Back", "ground", " ", "images", " ", "fitting", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "pdf", "\\u", "fit", "\\u", "background", "\\u", "mode_", "=_", "'", "scale", "'_", "\\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_", "setup_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "addin", "g", " ", "role", " ", "for", " ", "linking", " ", "to", " ", "Inter", "Trac", " ", "target", "s", " ", "on", " ", "t", ".", "e", ".", "o_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "docutils_", "import_", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "._", "parsers_", "._", "rst_", "import_", "roles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "te", "o", "\\u", "role_", "(_", "name_", ",_", "rawt", "ext_", ",_", "text_", ",_", "lineno_", ",_", "inline", "r_", ",_", "options_", "=_", "{_", "}_", ",_", "content_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "special", " ", "case", " ", "tick", "et", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "text_", "[_", "0_", "]_", "==_", "'#'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref_", "=_", "url_", "+_", "'/", "tick", "et", "/'_", "+_", "text_", "[_", "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 ", " _", "ref_", "=_", "url_", "+_", "'/", "inter", "trac", "/'_", "+_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "roles_", "._", "set\\u", "classes_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "nodes_", "._", "reference_", "(_", "rawt", "ext_", ",_", "text_", ",_", "ref", "uri_", "=_", "ref_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "node_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "roles_", "._", "register", "\\u", "canonical", "\\u", "role_", "(_", "'", "te", "o", "'_", ",_", "te", "o", "\\u", "role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "extensi", "onp", "oint", "s", "\\u", "role_", "(_", "name_", ",_", "rawt", "ext_", ",_", "text_", ",_", "lineno_", ",_", "inline", "r_", ",_", "options_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ref_", "=_", "url_", "+_", "'/", "wiki", "/", "Trac", "Dev", "/", "Plug", "in", "Dev", "elo", "pme", "nt", "/", "Ext", "ensi", "on", "Point", "s", "/'_", "+_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roles_", "._", "set\\u", "classes_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "nodes_", "._", "reference_", "(_", "rawt", "ext_", ",_", "text_", "+_", "\"", " ", "extensi", "on", " ", "point", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "uri_", "=_", "ref_", ",_", "**_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "node_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "roles_", "._", "register", "\\u", "canonical", "\\u", "role_", "(_", "'", "extensi", "onp", "oint", "s", "'_", ",_", "extensi", "onp", "oint", "s", "\\u", "role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ifconfig", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "add", "\\u", "config", "\\u", "value_", "(_", "'", "deve", "l", "'_", ",_", "''_", ",_", "True_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
wq/wq.db/tests/test_auth.py
[ { "content": " def test_auth_config_json(self):\n response = self.client.get('/config.json')\n result = json.loads(response.content.decode('utf-8'))\n self.assertTrue(\"login\" in result['pages'])", "metadata": "root.AuthTestCase.test_auth_config_json", "header": "['class', 'AuthTestCase', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_auth_login_info(self):\n response = self.client.get('/login.json')\n result = json.loads(response.content.decode('utf-8'))\n self.assertTrue(\"user\" in result)\n self.assertTrue(\"social_auth\" in result['user'])\n account = result['user']['social_auth']['accounts'][0]\n\n self.assertEqual(account['label'], \"[email protected]\")\n self.assertEqual(account['provider_label'], 'Google')", "metadata": "root.AuthTestCase.test_auth_login_info", "header": "['class', 'AuthTestCase', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 20 } ]
[ { "span": "self.assertTrue(\"login\" in result['pages'])", "start_line": 18, "start_column": 8, "end_line": 18, "end_column": 51 }, { "span": "self.assertTrue(\"user\" in result)", "start_line": 23, "start_column": 8, "end_line": 23, "end_column": 41 }, { "span": "self.assertTrue(\"social_auth\" in result['user'])", "start_line": 24, "start_column": 8, "end_line": 24, "end_column": 56 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Auth", "Test", "Case_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "auth", "\\u", "config", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "config", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "content_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "login", "\"_", "in_", "result_", "[_", "'", "page", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Auth", "Test", "Case_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "auth", "\\u", "login", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "'/", "login", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "content_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "user", "\"_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "social", "\\u", "auth", "\"_", "in_", "result_", "[_", "'", "user", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account_", "=_", "result_", "[_", "'", "user", "'_", "]_", "[_", "'", "social", "\\u", "auth", "'_", "]_", "[_", "'", "account", "s", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "account_", "[_", "'", "label", "'_", "]_", ",_", "\"", "testu", "ser", "@", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "account_", "[_", "'", "provide", "r", "\\u", "label", "'_", "]_", ",_", "'", "Goo", "gle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Unused import
bryancatanzaro/copperhead/copperhead/compiler/binarygenerator.py
[ { "content": "#\n# Copyright 2008-2012 NVIDIA Corporation\n# Copyright 2009-2010 University of California\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\nfrom __future__ import division\nimport coresyntax as S\nimport coretypes as T\nimport inspect\nimport pltools\nimport copy\nimport numpy as np\nimport parsetypes\nimport pdb\nfrom itertools import ifilter\nimport codepy.bpl\nimport codepy.cuda\nimport codepy.cgen as CG\nimport pickle\nimport os\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def prepare_compilation(M):\n from ..runtime import cuda_support\n if cuda_support:\n from ..runtime import cuda_tag\n if M.tag == cuda_tag:\n return prepare_cuda_compilation(M)\n return prepare_host_compilation(M)", "metadata": "root.prepare_compilation", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def prepare_cuda_compilation(M):\n assert(len(M.entry_points) == 1)\n procedure_name = M.entry_points[0]\n hash, (wrap_type, wrap_name), wrap_args = M.wrap_info\n wrap_decl = CG.FunctionDeclaration(CG.Value(wrap_type, wrap_name),\n [CG.Value(x, y) for x, y in wrap_args])\n host_module = codepy.bpl.BoostPythonModule(max_arity=max(10,M.arity),\n use_private_namespace=False)\n host_module.add_to_preamble([\n CG.Include(\"prelude/runtime/cunp.hpp\"),\n CG.Include(\"prelude/runtime/cuarray.hpp\"),\n CG.Line('using namespace copperhead;')])\n device_module = codepy.cuda.CudaModule(host_module)\n hash_namespace_open = CG.Line('namespace %s {' % hash)\n hash_namespace_close = CG.Line('}')\n using_declaration = CG.Line('using namespace %s;' % hash)\n host_module.add_to_preamble([hash_namespace_open, wrap_decl,\n hash_namespace_close, using_declaration])\n\n host_module.add_to_init([CG.Statement(\n \"boost::python::def(\\\"%s\\\", &%s)\" % (\n procedure_name, wrap_name))])\n\n device_module.add_to_preamble(\n [CG.Include(\"prelude/prelude.h\"),\n CG.Include(\"prelude/runtime/cunp.hpp\"),\n CG.Include(\"prelude/runtime/make_cuarray.hpp\"),\n CG.Include(\"prelude/runtime/make_sequence.hpp\"),\n CG.Include(\"prelude/runtime/tuple_utilities.hpp\"),\n CG.Line('using namespace copperhead;')])\n wrapped_cuda_code = [CG.Line(M.compiler_output)]\n device_module.add_to_module(wrapped_cuda_code)\n M.device_module = device_module\n if M.compile:\n M.current_toolchains = (M.toolchains.host_toolchain,\n M.toolchains.nvcc_toolchain)\n else:\n M.current_toolchains = (M.toolchains.null_host_toolchain,\n M.toolchains.null_nvcc_toolchain)\n M.codepy_module = device_module\n M.code = (str(host_module.generate()), str(device_module.generate()))\n M.kwargs = dict(host_kwargs=dict(cache_dir=M.code_dir),\n nvcc_kwargs=dict(cache_dir=M.code_dir),\n debug=M.verbose)\n return []", "metadata": "root.prepare_cuda_compilation", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def prepare_host_compilation(M):\n assert(len(M.entry_points) == 1)\n procedure_name = M.entry_points[0]\n hash, (wrap_type, wrap_name), wrap_args = M.wrap_info\n host_module = codepy.bpl.BoostPythonModule(max_arity=max(10,M.arity),\n use_private_namespace=False)\n host_module.add_to_preamble([CG.Include(\"prelude/prelude.h\"),\n CG.Include(\"prelude/runtime/cunp.hpp\"),\n CG.Include(\"prelude/runtime/make_cuarray.hpp\"),\n CG.Include(\"prelude/runtime/make_sequence.hpp\"),\n CG.Include(\"prelude/runtime/tuple_utilities.hpp\"),\n CG.Line('using namespace copperhead;')])\n\n host_module.add_to_init([CG.Statement(\n \"boost::python::def(\\\"%s\\\", &%s)\" % (\n procedure_name, wrap_name))])\n wrapped_code = [CG.Line(M.compiler_output),\n CG.Line('using namespace %s;' % hash)]\n host_module.add_to_module(wrapped_code)\n M.codepy_module = host_module\n if M.compile:\n M.current_toolchains = (M.toolchains.host_toolchain,)\n else:\n M.current_toolchains = (M.toolchains.null_host_toolchain,)\n M.code = (str(host_module.generate()),)\n M.kwargs = dict(cache_dir=M.code_dir,\n debug=M.verbose)\n return []", "metadata": "root.prepare_host_compilation", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def make_binary(M):\n assert(len(M.entry_points) == 1)\n procedure_name = M.entry_points[0]\n\n code = M.code\n codepy_module = M.codepy_module\n toolchains = M.current_toolchains\n kwargs = M.kwargs\n try:\n module = codepy_module.compile(*toolchains, **kwargs)\n except Exception as e:\n if isinstance(e, NotImplementedError):\n raise e\n for m in code:\n print m\n print e\n raise e\n\n name = M.input_types.keys()[0]\n input_type = M.input_types[name]\n #Unmark name\n input_name = name[1:]\n \n copperhead_info = (input_name, input_type, M.tag)\n module_dir, module_file = os.path.split(module.__file__)\n info_file = open(os.path.join(module_dir, 'cuinfo'), 'w')\n pickle.dump(copperhead_info, info_file)\n info_file.close()\n return code, getattr(module, procedure_name)", "metadata": "root.make_binary", "header": "['module', '___EOS___']", "index": 118 } ]
[ { "span": "import coresyntax as S", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 22 }, { "span": "import coretypes as T", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 21 }, { "span": "import inspect", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 14 }, { "span": "import pltools", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 14 }, { "span": "import copy", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 11 }, { "span": "import numpy as np", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 18 }, { "span": "import parsetypes", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 17 }, { "span": "import pdb", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "2008", "-", "2012", " ", "NV", "IDI", "A", " ", "Cor", "porat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "200", "9", "-", "2010", " ", "Univers", "it", "y", " ", "of", " ", "Cali", "for", "nia", "_", "\\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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cores", "yn", "tax_", "as_", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core", "types_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "plt", "ools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "parset", "ypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "ifi", "lter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "code", "py_", "._", "bp", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "code", "py_", "._", "cuda_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "code", "py_", "._", "cg", "en_", "as_", "CG", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "prepar", "e\\u", "compilation", "_", "(_", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "._", "runtime_", "import_", "cud", "a", "\\u", "support_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cud", "a", "\\u", "support_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "._", "runtime_", "import_", "cud", "a", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "M_", "._", "tag_", "==_", "cud", "a", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "prepar", "e\\u", "cud", "a", "\\u", "compilation", "_", "(_", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "prepar", "e\\u", "host", "\\u", "compilation", "_", "(_", "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_", "prepar", "e\\u", "cud", "a", "\\u", "compilation", "_", "(_", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "len_", "(_", "M_", "._", "entry", "\\u", "points_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "procedure", "\\u", "name_", "=_", "M_", "._", "entry", "\\u", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash_", ",_", "(_", "wrap", "\\u", "type_", ",_", "wrap", "\\u", "name_", ")_", ",_", "wrap", "\\u", "args_", "=_", "M_", "._", "wrap", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrap", "\\u", "decl_", "=_", "CG", "_", "._", "Function", "Declaration_", "(_", "CG", "_", "._", "Value_", "(_", "wrap", "\\u", "type_", ",_", "wrap", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "CG", "_", "._", "Value_", "(_", "x_", ",_", "y_", ")_", "for_", "x_", ",_", "y_", "in_", "wrap", "\\u", "args_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "module_", "=_", "code", "py_", "._", "bp", "l_", "._", "Boost", "Pyth", "on", "Module_", "(_", "max", "\\u", "arity_", "=_", "max_", "(_", "10_", ",_", "M_", "._", "arity_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "private", "\\u", "namespace_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "preamble_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "cu", "np", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "cua", "rray", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Line_", "(_", "'", "usi", "ng", " ", "namespace", " ", "cop", "per", "head", ";'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "module_", "=_", "code", "py_", "._", "cuda_", "._", "Cu", "da", "Module_", "(_", "host", "\\u", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "\\u", "namespace", "\\u", "open_", "=_", "CG", "_", "._", "Line_", "(_", "'", "namespace", " ", "%", "s", " ", "{'_", "%_", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "\\u", "namespace", "\\u", "close_", "=_", "CG", "_", "._", "Line_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usi", "ng", "\\u", "declaration_", "=_", "CG", "_", "._", "Line_", "(_", "'", "usi", "ng", " ", "namespace", " ", "%", "s", ";'_", "%_", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "preamble_", "(_", "[_", "hash", "\\u", "namespace", "\\u", "open_", ",_", "wrap", "\\u", "decl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "\\u", "namespace", "\\u", "close_", ",_", "usi", "ng", "\\u", "declaration_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "init_", "(_", "[_", "CG", "_", "._", "Statement_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "boost", "::", "python", "::", "def", "(\\\\\"", "%", "s", "\\\\\",", " ", "&%", "s", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "procedure", "\\u", "name_", ",_", "wrap", "\\u", "name_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "preamble_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "prel", "ude", ".", "h", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "cu", "np", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "make", "\\u", "cua", "rray", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "make", "\\u", "sequence", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "tuple", "\\u", "util", "iti", "es", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Line_", "(_", "'", "usi", "ng", " ", "namespace", " ", "cop", "per", "head", ";'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrapp", "ed", "\\u", "cud", "a", "\\u", "code_", "=_", "[_", "CG", "_", "._", "Line_", "(_", "M_", "._", "compiler", "\\u", "output_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "module_", "(_", "wrapp", "ed", "\\u", "cud", "a", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "device", "\\u", "module_", "=_", "device", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "M_", "._", "compile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "current", "\\u", "toolchain", "s_", "=_", "(_", "M_", "._", "toolchain", "s_", "._", "host", "\\u", "toolchain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "M_", "._", "toolchain", "s_", "._", "nv", "cc", "\\u", "toolchain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "current", "\\u", "toolchain", "s_", "=_", "(_", "M_", "._", "toolchain", "s_", "._", "null", "\\u", "host", "\\u", "toolchain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "M_", "._", "toolchain", "s_", "._", "null", "\\u", "nv", "cc", "\\u", "toolchain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "M_", "._", "code", "py", "\\u", "module_", "=_", "device", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "code_", "=_", "(_", "str_", "(_", "host", "\\u", "module_", "._", "generate_", "(_", ")_", ")_", ",_", "str_", "(_", "device", "\\u", "module_", "._", "generate_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "kwargs_", "=_", "dict_", "(_", "host", "\\u", "kwargs_", "=_", "dict_", "(_", "cache", "\\u", "dir_", "=_", "M_", "._", "code", "\\u", "dir_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nv", "cc", "\\u", "kwargs_", "=_", "dict_", "(_", "cache", "\\u", "dir_", "=_", "M_", "._", "code", "\\u", "dir_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "M_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "host", "\\u", "compilation", "_", "(_", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "len_", "(_", "M_", "._", "entry", "\\u", "points_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "procedure", "\\u", "name_", "=_", "M_", "._", "entry", "\\u", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash_", ",_", "(_", "wrap", "\\u", "type_", ",_", "wrap", "\\u", "name_", ")_", ",_", "wrap", "\\u", "args_", "=_", "M_", "._", "wrap", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "module_", "=_", "code", "py_", "._", "bp", "l_", "._", "Boost", "Pyth", "on", "Module_", "(_", "max", "\\u", "arity_", "=_", "max_", "(_", "10_", ",_", "M_", "._", "arity_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "private", "\\u", "namespace_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "preamble_", "(_", "[_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "prel", "ude", ".", "h", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "cu", "np", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "make", "\\u", "cua", "rray", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "make", "\\u", "sequence", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Include", "_", "(_", "\"", "prel", "ude", "/", "runt", "ime", "/", "tuple", "\\u", "util", "iti", "es", ".", "hp", "p", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Line_", "(_", "'", "usi", "ng", " ", "namespace", " ", "cop", "per", "head", ";'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "init_", "(_", "[_", "CG", "_", "._", "Statement_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "boost", "::", "python", "::", "def", "(\\\\\"", "%", "s", "\\\\\",", " ", "&%", "s", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "procedure", "\\u", "name_", ",_", "wrap", "\\u", "name_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrapp", "ed", "\\u", "code_", "=_", "[_", "CG", "_", "._", "Line_", "(_", "M_", "._", "compiler", "\\u", "output_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CG", "_", "._", "Line_", "(_", "'", "usi", "ng", " ", "namespace", " ", "%", "s", ";'_", "%_", "hash_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "module_", "._", "add", "\\u", "to", "\\u", "module_", "(_", "wrapp", "ed", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "code", "py", "\\u", "module_", "=_", "host", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "M_", "._", "compile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "current", "\\u", "toolchain", "s_", "=_", "(_", "M_", "._", "toolchain", "s_", "._", "host", "\\u", "toolchain_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "current", "\\u", "toolchain", "s_", "=_", "(_", "M_", "._", "toolchain", "s_", "._", "null", "\\u", "host", "\\u", "toolchain_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "M_", "._", "code_", "=_", "(_", "str_", "(_", "host", "\\u", "module_", "._", "generate_", "(_", ")_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "kwargs_", "=_", "dict_", "(_", "cache", "\\u", "dir_", "=_", "M_", "._", "code", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "M_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "binary_", "(_", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "len_", "(_", "M_", "._", "entry", "\\u", "points_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "procedure", "\\u", "name_", "=_", "M_", "._", "entry", "\\u", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "M_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "py", "\\u", "module_", "=_", "M_", "._", "code", "py", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "toolchain", "s_", "=_", "M_", "._", "current", "\\u", "toolchain", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "M_", "._", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "=_", "code", "py", "\\u", "module_", "._", "compile_", "(_", "*_", "toolchain", "s_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "e_", ",_", "Not", "Impl", "ement", "ed", "Error_", ")_", ":_", "\\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_", "for_", "m_", "in_", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "M_", "._", "input", "\\u", "types_", "._", "keys_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "type_", "=_", "M_", "._", "input", "\\u", "types_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Unma", "rk", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "name_", "=_", "name_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cop", "per", "head", "\\u", "info_", "=_", "(_", "input", "\\u", "name_", ",_", "input", "\\u", "type_", ",_", "M_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "dir_", ",_", "module", "\\u", "file_", "=_", "os_", "._", "path_", "._", "split_", "(_", "module_", "._", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u", "file_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "module", "\\u", "dir_", ",_", "'", "cui", "nfo", "'_", ")_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "cop", "per", "head", "\\u", "info_", ",_", "info", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "code_", ",_", "getattr_", "(_", "module_", ",_", "procedure", "\\u", "name_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
vishnubob/silhouette/src/utils.py
[ { "content": "import math\nimport re\n\n# units\nfrom pint import UnitRegistry\nunits = UnitRegistry()\n\n# my guess as to why 508 is the magic number is the motor steps and the belt TPI\n# i am guessing the belt is 2.54 TPI, and the motor can provide 200 steps\n# 2.54 * 200 = 508\nunits.define('steps = inch / 508.0 = step')\n\n# For SVG files, Silhouette Studio defines one inch as 72 points\nunits.define('dpi = inch / 72.0')\n\n\n## units\n\nDEFAULT_UNIT = \"mm\"\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def steps(val):\n val = unit(val, unit=None)\n return int(val.to(\"steps\").magnitude)", "metadata": "root.steps", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def unit(val, **kw):\n _unit = kw.get(\"unit\", DEFAULT_UNIT)\n if _unit != None:\n _unit = units.parse_expression(_unit)\n if type(val) != units.Quantity:\n if type(val) in (int, float):\n assert _unit, \"value %r of type '%r' requires a unit definition\" % (val, type(val))\n val = val * _unit\n elif type(val) in (str, unicode):\n val = units.parse_expression(val)\n else:\n raise TypeError, \"I don't know how to convert type '%s' to a unit\" % str(type(val))\n assert type(val) == units.Quantity, \"%r != %r\" % (type(val), units.Quantity)\n if _unit:\n val = val.to(_unit)\n return val", "metadata": "root.unit", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def inch2mm(inches):\n inches = unit(inches, unit=\"inch\")\n return inches.to(units.mm).magnitude", "metadata": "root.inch2mm", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def mm2inch(mm):\n mm = unit(mm, unit=\"mm\")\n return mm.to(units.inch).magnitude", "metadata": "root.mm2inch", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def circle(**kw):\n assert \"radius\" in kw, \"Need radius keyword argument\"\n defs = {\"steps\": 20, \"center_x\": \"0in\", \"center_y\": \"0in\", \"phase\": 0}\n _kw = defs.copy()\n _kw.update(kw)\n _steps = int(_kw[\"steps\"])\n radius = unit(_kw[\"radius\"])\n center_x = unit(_kw[\"center_x\"])\n center_y = unit(_kw[\"center_y\"])\n phase = float(_kw[\"phase\"])\n #\n if steps < 2:\n raise ValueError, \"3 or more steps are required\"\n radstep = (2 * math.pi) / float(_steps - 1)\n for rad in range(int(_steps)):\n x = math.cos(rad * radstep + phase) * radius + center_x\n y = math.sin(rad * radstep + phase) * radius + center_y\n yield (steps(x), steps(y))", "metadata": "root.circle", "header": "['module', '___EOS___']", "index": 48 } ]
[ { "span": "import re", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pint", "_", "import_", "Unit", "Registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "units_", "=_", "Unit", "Registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "my", " ", "guess", " ", "as", " ", "to", " ", "wh", "y", " ", "508", " ", "is", " ", "the", " ", "magic", " ", "number", " ", "is", " ", "the", " ", "motor", " ", "step", "s", " ", "and", " ", "the", " ", "bel", "t", " ", "TP", "I_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", " ", "am", " ", "guess", "ing", " ", "the", " ", "bel", "t", " ", "is", " ", "2.5", "4", " ", "TP", "I", ",", " ", "and", " ", "the", " ", "motor", " ", "can", " ", "provide", " ", "200", " ", "steps_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2.5", "4", " ", "*", " ", "200", " ", "=", " ", "508", "_", "\\u\\u\\uNL\\u\\u\\u_", "units_", "._", "define_", "(_", "'", "step", "s", " ", "=", " ", "inch", " ", "/", " ", "508", ".0", " ", "=", " ", "step", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "SV", "G", " ", "files", ",", " ", "Sil", "hou", "ette", " ", "Stud", "io", " ", "defin", "es", " ", "one", " ", "inch", " ", "as", " ", "7", "2", " ", "points_", "\\u\\u\\uNL\\u\\u\\u_", "units_", "._", "define_", "(_", "'", "dp", "i", " ", "=", " ", "inch", " ", "/", " ", "72.", "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_", "##", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "UNIT", "_", "=_", "\"", "mm", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "steps_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "unit_", "(_", "val_", ",_", "unit_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "val_", "._", "to_", "(_", "\"", "step", "s", "\"_", ")_", "._", "magnitude_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "unit_", "(_", "val_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "unit_", "=_", "kw_", "._", "get_", "(_", "\"", "unit", "\"_", ",_", "DEF", "AUL", "T", "\\u", "UNIT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "unit_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "unit_", "=_", "units_", "._", "parse", "\\u", "expression_", "(_", "\\u", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "val_", ")_", "!=_", "units_", "._", "Quantity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "val_", ")_", "in_", "(_", "int_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "\\u", "unit_", ",_", "\"", "value", " ", "%", "r", " ", "of", " ", "type", " ", "'%", "r", "'", " ", "require", "s", " ", "a", " ", "unit", " ", "definit", "ion", "\"_", "%_", "(_", "val_", ",_", "type_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "val_", "*_", "\\u", "unit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "val_", ")_", "in_", "(_", "str_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "units_", "._", "parse", "\\u", "expression_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", ",_", "\"", "I", " ", "don", "'", "t", " ", "know", " ", "how", " ", "to", " ", "convert", " ", "type", " ", "'%", "s", "'", " ", "to", " ", "a", " ", "unit", "\"_", "%_", "str_", "(_", "type_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "type_", "(_", "val_", ")_", "==_", "units_", "._", "Quantity_", ",_", "\"%", "r", " ", "!=", " ", "%", "r", "\"_", "%_", "(_", "type_", "(_", "val_", ")_", ",_", "units_", "._", "Quantity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "unit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "val_", "._", "to_", "(_", "\\u", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inch", "2m", "m_", "(_", "inches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inches_", "=_", "unit_", "(_", "inches_", ",_", "unit_", "=_", "\"", "inch", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "inches_", "._", "to_", "(_", "units_", "._", "mm_", ")_", "._", "magnitude_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mm", "2in", "ch_", "(_", "mm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mm_", "=_", "unit_", "(_", "mm_", ",_", "unit_", "=_", "\"", "mm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mm_", "._", "to_", "(_", "units_", "._", "inch_", ")_", "._", "magnitude_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "circle_", "(_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "\"", "radi", "us", "\"_", "in_", "kw_", ",_", "\"", "Ne", "ed", " ", "radi", "us", " ", "keyw", "ord", " ", "argu", "ment", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defs_", "=_", "{_", "\"", "step", "s", "\"_", ":_", "20_", ",_", "\"", "center", "\\u", "x", "\"_", ":_", "\"", "0", "in", "\"_", ",_", "\"", "center", "\\u", "y", "\"_", ":_", "\"", "0", "in", "\"_", ",_", "\"", "phase", "\"_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "kw_", "=_", "defs_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "kw_", "._", "update_", "(_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "steps_", "=_", "int_", "(_", "\\u", "kw_", "[_", "\"", "step", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "unit_", "(_", "\\u", "kw_", "[_", "\"", "radi", "us", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "\\u", "x_", "=_", "unit_", "(_", "\\u", "kw_", "[_", "\"", "center", "\\u", "x", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "\\u", "y_", "=_", "unit_", "(_", "\\u", "kw_", "[_", "\"", "center", "\\u", "y", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phase_", "=_", "float_", "(_", "\\u", "kw_", "[_", "\"", "phase", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "steps_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "\"", "3", " ", "or", " ", "more", " ", "step", "s", " ", "are", " ", "require", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rad", "step_", "=_", "(_", "2_", "*_", "math_", "._", "pi_", ")_", "/_", "float_", "(_", "\\u", "steps_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rad_", "in_", "range_", "(_", "int_", "(_", "\\u", "steps_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "math_", "._", "cos_", "(_", "rad_", "*_", "rad", "step_", "+_", "phase_", ")_", "*_", "radius_", "+_", "center", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "math_", "._", "sin_", "(_", "rad_", "*_", "rad", "step_", "+_", "phase_", ")_", "*_", "radius_", "+_", "center", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "steps_", "(_", "x_", ")_", ",_", "steps_", "(_", "y_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2 ]
Nested loops with same variable
VikParuchuri/simpsons-scripts/tasks/preprocess.py
[ { "content": " def predict(self, data, **kwargs):\n \"\"\"\n Used in the predict phase, after training. Override\n \"\"\"\n\n voice_scripts = []\n for i in xrange(0,data.shape[0]):\n script_lines = data['script'][i].split('\\n')\n voice_lines = []\n current_line = \"\"\n for (i,line) in enumerate(script_lines):\n current_line = current_line.strip()\n line = line.strip()\n if line.startswith(\"[\") and line.endswith(\"]\"):\n continue\n if line.startswith(\"-\"):\n continue\n voice_line = re.search('\\w+:',line)\n if voice_line is not None:\n if self.check_for_line_split(current_line):\n voice_lines.append(current_line)\n current_line = line\n elif (len(line)==0 or line.startswith(\"-\")) and len(current_line)>0:\n if self.check_for_line_split(current_line):\n voice_lines.append(current_line)\n current_line = \"\"\n voice_lines.append(\" \")\n elif len(current_line)>0:\n current_line+=\" \" + line\n script_text = \"\\n\".join([l for l in voice_lines if len(l)>0 and \"{\" not in l and \"=\" not in l])\n script_text = re.sub(\"\\[.+\\]\",\"\",script_text)\n voice_scripts.append(script_text.strip())\n\n data['voice_script'] = voice_scripts\n\n return data", "metadata": "root.CleanupScriptText.predict", "header": "['class', 'CleanupScriptText', '(', 'Task', ')', ':', '___EOS___']", "index": 142 } ]
[ { "span": "for (i,line) in enumerate(script_lines):", "start_line": 152, "start_column": 12, "end_line": 152, "end_column": 52 } ]
[ { "span": "for i in xrange(0,data.shape[0]):", "start_line": 148, "start_column": 8, "end_line": 148, "end_column": 41 } ]
1
true
[ "[CLS]_", "Nest", "ed_", "loops_", "with_", "same_", "variable_", "[SEP]_", "class_", "Clean", "up", "Script", "Text_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "predict_", "(_", "self_", ",_", "data_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "in", " ", "the", " ", "predi", "ct", " ", "phase", ",", " ", "after", " ", "train", "ing", ".", " ", " ", "Override", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "voice", "\\u", "scripts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "data_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script", "\\u", "lines_", "=_", "data_", "[_", "'", "script", "'_", "]_", "[_", "i_", "]_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voice", "\\u", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "line_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "i_", ",_", "line_", ")_", "in_", "enumerate_", "(_", "script", "\\u", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "line_", "=_", "current", "\\u", "line_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "line_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "._", "startswith_", "(_", "\"[\"_", ")_", "and_", "line_", "._", "endswith_", "(_", "\"]\"_", ")_", ":_", "\\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_", "line_", "._", "startswith_", "(_", "\"-\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "voice", "\\u", "line_", "=_", "re_", "._", "search_", "(_", "'\\\\", "w", "+:", "'_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "voice", "\\u", "line_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "check", "\\u", "for", "\\u", "line", "\\u", "split_", "(_", "current", "\\u", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "voice", "\\u", "lines_", "._", "append_", "(_", "current", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "line_", "=_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "len_", "(_", "line_", ")_", "==_", "0_", "or_", "line_", "._", "startswith_", "(_", "\"-\"_", ")_", ")_", "and_", "len_", "(_", "current", "\\u", "line_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "check", "\\u", "for", "\\u", "line", "\\u", "split_", "(_", "current", "\\u", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "voice", "\\u", "lines_", "._", "append_", "(_", "current", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "line_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voice", "\\u", "lines_", "._", "append_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "current", "\\u", "line_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "current", "\\u", "line_", "+=_", "\"", " ", "\"_", "+_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script", "\\u", "text_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "[_", "l_", "for_", "l_", "in_", "voice", "\\u", "lines_", "if_", "len_", "(_", "l_", ")_", ">_", "0_", "and_", "\"{\"_", "not_", "in_", "l_", "and_", "\"=\"_", "not_", "in_", "l_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "\\u", "text_", "=_", "re_", "._", "sub_", "(_", "\"\\\\", "[.", "+\\\\", "]\"_", ",_", "\"\"_", ",_", "script", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "voice", "\\u", "scripts_", "._", "append_", "(_", "script", "\\u", "text_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "[_", "'", "voice", "\\u", "script", "'_", "]_", "=_", "voice", "\\u", "scripts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "data_", "\\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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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 ]
Unused import
Hipo/drf-extra-fields/drf_extra_fields/fields.py
[ { "content": "import base64\nimport binascii\nimport imghdr\nimport uuid\nfrom django.core.exceptions import ValidationError\nfrom django.core.files.base import ContentFile\nfrom django.utils import six\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom rest_framework.fields import (\n DateField,\n DateTimeField,\n DictField,\n FloatField,\n ImageField,\n IntegerField,\n)\nfrom rest_framework.utils import html, humanize_datetime, representation\nfrom .compat import (\n DateRange,\n DateTimeTZRange,\n NumericRange,\n postgres_fields,\n)\n\n\nDEFAULT_CONTENT_TYPE = \"application/octet-stream\"\nALLOWED_IMAGE_TYPES = (\n \"jpeg\",\n \"jpg\",\n \"png\",\n \"gif\"\n)\n\nEMPTY_VALUES = (None, '', [], (), {})\n\n\n\n\n\n\n\n\n\n\n\n\n\nif postgres_fields is not None:\n # monkey patch modelserializer to map Native django Range fields to\n # drf_extra_fiels's Range fields.\n from rest_framework.serializers import ModelSerializer\n ModelSerializer.serializer_field_mapping[postgres_fields.DateTimeRangeField] = DateTimeRangeField\n ModelSerializer.serializer_field_mapping[postgres_fields.DateRangeField] = DateRangeField\n ModelSerializer.serializer_field_mapping[postgres_fields.IntegerRangeField] = IntegerRangeField\n ModelSerializer.serializer_field_mapping[postgres_fields.FloatRangeField] = FloatRangeField\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Base64ImageField(ImageField):\n \"\"\"\n A django-rest-framework field for handling image-uploads through raw post data.\n It uses base64 for en-/decoding the contents of the file.\n \"\"\"\n\n\n\n", "metadata": "root.Base64ImageField", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def __init__(self, *args, **kwargs):\n self.represent_in_base64 = kwargs.pop('represent_in_base64', False)\n super(Base64ImageField, self).__init__(*args, **kwargs)", "metadata": "root.Base64ImageField.__init__", "header": "['class', 'Base64ImageField', '(', 'ImageField', ')', ':', '___EOS___']", "index": 43 }, { "content": " def to_internal_value(self, base64_data):\n # Check if this is a base64 string\n if base64_data in EMPTY_VALUES:\n return None\n\n if isinstance(base64_data, six.string_types):\n # Strip base64 header.\n if ';base64,' in base64_data:\n header, base64_data = base64_data.split(';base64,')\n\n # Try to decode the file. Return validation error if it fails.\n try:\n decoded_file = base64.b64decode(base64_data)\n except (TypeError, binascii.Error):\n raise ValidationError(_(\"Please upload a valid image.\"))\n # Generate file name:\n file_name = str(uuid.uuid4())[:12] # 12 characters are more than enough.\n # Get the file name extension:\n file_extension = self.get_file_extension(file_name, decoded_file)\n if file_extension not in ALLOWED_IMAGE_TYPES:\n raise ValidationError(_(\"The type of the image couldn't been determined.\"))\n complete_file_name = file_name + \".\" + file_extension\n data = ContentFile(decoded_file, name=complete_file_name)\n return super(Base64ImageField, self).to_internal_value(data)\n raise ValidationError(_('This is not an base64 string'))", "metadata": "root.Base64ImageField.to_internal_value", "header": "['class', 'Base64ImageField', '(', 'ImageField', ')', ':', '___EOS___']", "index": 47 }, { "content": " def get_file_extension(self, filename, decoded_file):\n extension = imghdr.what(filename, decoded_file)\n extension = \"jpg\" if extension == \"jpeg\" else extension\n return extension", "metadata": "root.Base64ImageField.get_file_extension", "header": "['class', 'Base64ImageField', '(', 'ImageField', ')', ':', '___EOS___']", "index": 73 }, { "content": " def to_representation(self, image):\n if self.represent_in_base64:\n try:\n with open(image.path, 'rb') as f:\n return base64.b64encode(f.read()).decode()\n except Exception:\n raise IOError(\"Error encoding image file\")\n else:\n return super(ImageField, self).to_representation(image)", "metadata": "root.Base64ImageField.to_representation", "header": "['class', 'Base64ImageField', '(', 'ImageField', ')', ':', '___EOS___']", "index": 78 }, { "content": "class RangeField(DictField):\n\n range_type = None\n\n default_error_messages = {\n 'not_a_dict': _('Expected a dictionary of items but got type \"{input_type}\".'),\n 'too_much_content': _('Extra content not allowed \"{extra}\".'),\n }\n\n", "metadata": "root.RangeField", "header": "['module', '___EOS___']", "index": 89 }, { "content": " def to_internal_value(self, data):\n \"\"\"\n Range instances <- Dicts of primitive datatypes.\n \"\"\"\n if html.is_html_input(data):\n data = html.parse_html_dict(data)\n if not isinstance(data, dict):\n self.fail('not_a_dict', input_type=type(data).__name__)\n validated_dict = {}\n for key in ('lower', 'upper'):\n try:\n value = data.pop(key)\n except KeyError:\n continue\n validated_dict[six.text_type(key)] = self.child.run_validation(value)\n for key in ('bounds', 'empty'):\n try:\n value = data.pop(key)\n except KeyError:\n continue\n validated_dict[six.text_type(key)] = value\n if data:\n self.fail('too_much_content', extra=', '.join(map(str, data.keys())))\n return self.range_type(**validated_dict)", "metadata": "root.RangeField.to_internal_value", "header": "['class', 'RangeField', '(', 'DictField', ')', ':', '___EOS___']", "index": 98 }, { "content": " def to_representation(self, value):\n \"\"\"\n Range instances -> dicts of primitive datatypes.\n \"\"\"\n if value.isempty:\n return {'empty': True}\n lower = self.child.to_representation(value.lower) if value.lower is not None else None\n upper = self.child.to_representation(value.upper) if value.upper is not None else None\n return {'lower': lower,\n 'upper': upper,\n 'bounds': value._bounds}", "metadata": "root.RangeField.to_representation", "header": "['class', 'RangeField', '(', 'DictField', ')', ':', '___EOS___']", "index": 123 }, { "content": "class IntegerRangeField(RangeField):\n child = IntegerField()\n range_type = NumericRange", "metadata": "root.IntegerRangeField", "header": "['module', '___EOS___']", "index": 136 }, { "content": "class FloatRangeField(RangeField):\n child = FloatField()\n range_type = NumericRange", "metadata": "root.FloatRangeField", "header": "['module', '___EOS___']", "index": 141 }, { "content": "class DateTimeRangeField(RangeField):\n child = DateTimeField()\n range_type = DateTimeTZRange", "metadata": "root.DateTimeRangeField", "header": "['module', '___EOS___']", "index": 146 }, { "content": "class DateRangeField(RangeField):\n child = DateField()\n range_type = DateRange", "metadata": "root.DateRangeField", "header": "['module', '___EOS___']", "index": 151 } ]
[ { "span": "from rest_framework.utils import html, humanize_datetime, representation", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 72 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "binascii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "img", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "base_", "import_", "Conten", "t", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "fields_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Time", "Field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dict", "Field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Float", "Field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "Field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Integer", "Field_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "utils_", "import_", "html_", ",_", "humanize", "\\u", "datetime_", ",_", "representation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "compat_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Range_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Time", "TZ", "Range_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Numer", "ic", "Range_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "postgres", "\\u", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CONTE", "NT", "\\u", "TYPE_", "=_", "\"", "applica", "tion", "/", "oct", "et", "-", "stream", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALLOWED", "\\u", "IMA", "GE", "\\u", "TYPES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "jpeg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "jp", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "png", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gif", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EMP", "TY", "\\u", "VALUES_", "=_", "(_", "None_", ",_", "''_", ",_", "[_", "]_", ",_", "(_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "postgres", "\\u", "fields_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "monkey", " ", "patch", " ", "model", "serialize", "r", " ", "to", " ", "map", " ", "Nat", "ive", " ", "django", " ", "Range", " ", "fields", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dr", "f", "\\u", "extra", "\\u", "fie", "ls", "'", "s", " ", "Range", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "rest", "\\u", "framework_", "._", "serializers_", "import_", "Model", "Serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model", "Serializer_", "._", "serialize", "r", "\\u", "field", "\\u", "mapping_", "[_", "postgres", "\\u", "fields_", "._", "Date", "Time", "Range", "Field_", "]_", "=_", "Date", "Time", "Range", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model", "Serializer_", "._", "serialize", "r", "\\u", "field", "\\u", "mapping_", "[_", "postgres", "\\u", "fields_", "._", "Date", "Range", "Field_", "]_", "=_", "Date", "Range", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model", "Serializer_", "._", "serialize", "r", "\\u", "field", "\\u", "mapping_", "[_", "postgres", "\\u", "fields_", "._", "Integer", "Range", "Field_", "]_", "=_", "Integer", "Range", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Model", "Serializer_", "._", "serialize", "r", "\\u", "field", "\\u", "mapping_", "[_", "postgres", "\\u", "fields_", "._", "Float", "Range", "Field_", "]_", "=_", "Float", "Range", "Field_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Base", "64", "Image", "Field_", "(_", "Image", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "django", "-", "rest", "-", "frame", "work", " ", "field", " ", "for", " ", "handling", " ", "image", "-", "uploads", " ", "through", " ", "raw", " ", "post", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "use", "s", " ", "base64", " ", "for", " ", "en", "-", "/", "deco", "ding", " ", "the", " ", "content", "s", " ", "of", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "64", "Image", "Field_", "(_", "Image", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "represent", "\\u", "in", "\\u", "base64_", "=_", "kwargs_", "._", "pop_", "(_", "'", "represent", "\\u", "in", "\\u", "base64", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Base", "64", "Image", "Field_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "64", "Image", "Field_", "(_", "Image", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "internal", "\\u", "value_", "(_", "self_", ",_", "base64", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "this", " ", "is", " ", "a", " ", "base64", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "base64", "\\u", "data_", "in_", "EMP", "TY", "\\u", "VALUES_", ":_", "\\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_", "isinstance_", "(_", "base64", "\\u", "data_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Strip", " ", "base64", " ", "header", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "';", "base64", ",'_", "in_", "base64", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", ",_", "base64", "\\u", "data_", "=_", "base64", "\\u", "data_", "._", "split_", "(_", "';", "base64", ",'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "decode", " ", "the", " ", "file", ".", " ", "Return", " ", "validation", " ", "error", " ", "if", " ", "it", " ", "fail", "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 ", " _", "decode", "d\\u", "file_", "=_", "base64_", "._", "b64decode_", "(_", "base64", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "binascii_", "._", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Ple", "ase", " ", "upload", " ", "a", " ", "valid", " ", "image", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Generate", " ", "file", " ", "name", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "\\u", "name_", "=_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", "[_", ":_", "12_", "]_", "#", " ", "1", "2", " ", "character", "s", " ", "are", " ", "more", " ", "than", " ", "eno", "ugh", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "file", " ", "name", " ", "extensi", "on", ":_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "extension_", "=_", "self_", "._", "get", "\\u", "file", "\\u", "extension_", "(_", "file", "\\u", "name_", ",_", "decode", "d\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "extension_", "not_", "in_", "ALLOWED", "\\u", "IMA", "GE", "\\u", "TYPES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "The", " ", "type", " ", "of", " ", "the", " ", "image", " ", "coul", "dn", "'", "t", " ", "bee", "n", " ", "dete", "rmin", "ed", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "complete", "\\u", "file", "\\u", "name_", "=_", "file", "\\u", "name_", "+_", "\".\"_", "+_", "file", "\\u", "extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "Conten", "t", "File_", "(_", "decode", "d\\u", "file_", ",_", "name_", "=_", "complete", "\\u", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Base", "64", "Image", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "internal", "\\u", "value_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "'", "Thi", "s", " ", "is", " ", "not", " ", "an", " ", "base64", " ", "string", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "64", "Image", "Field_", "(_", "Image", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "file", "\\u", "extension_", "(_", "self_", ",_", "filename_", ",_", "decode", "d\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extension_", "=_", "img", "hdr_", "._", "what_", "(_", "filename_", ",_", "decode", "d\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extension_", "=_", "\"", "jp", "g", "\"_", "if_", "extension_", "==_", "\"", "jpeg", "\"_", "else_", "extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "64", "Image", "Field_", "(_", "Image", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "representation_", "(_", "self_", ",_", "image_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "represent", "\\u", "in", "\\u", "base64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "image_", "._", "path_", ",_", "'", "rb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "base64_", "._", "b64encode_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "._", "decode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "Error", " ", "encoding", " ", "image", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Image", "Field_", ",_", "self_", ")_", "._", "to", "\\u", "representation_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Range", "Field_", "(_", "Dict", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "error", "\\u", "messages_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "not", "\\u", "a", "\\u", "dict", "'_", ":_", "\\u_", "(_", "'", "Expect", "ed", " ", "a", " ", "dictionar", "y", " ", "of", " ", "items", " ", "but", " ", "got", " ", "type", " ", "\"{", "input", "\\u", "type", "}\"", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "too", "\\u", "muc", "h", "\\u", "content", "'_", ":_", "\\u_", "(_", "'", "Extra", " ", "content", " ", "not", " ", "allow", "ed", " ", "\"{", "extra", "}\"", ".'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "Range", "Field_", "(_", "Dict", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "to", "\\u", "internal", "\\u", "value_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Range", " ", "instance", "s", " ", "<-", " ", "Dict", "s", " ", "of", " ", "primi", "tiv", "e", " ", "datatype", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "html_", "._", "is", "\\u", "html", "\\u", "input_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "html_", "._", "parse", "\\u", "html", "\\u", "dict_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "data_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "not", "\\u", "a", "\\u", "dict", "'_", ",_", "input", "\\u", "type_", "=_", "type_", "(_", "data_", ")_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "validat", "ed", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "(_", "'", "lower", "'_", ",_", "'", "upper", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "data_", "._", "pop_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "validat", "ed", "\\u", "dict_", "[_", "six_", "._", "text", "\\u", "type_", "(_", "key_", ")_", "]_", "=_", "self_", "._", "child_", "._", "run", "\\u", "validation_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "(_", "'", "bound", "s", "'_", ",_", "'", "empty", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "data_", "._", "pop_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "validat", "ed", "\\u", "dict_", "[_", "six_", "._", "text", "\\u", "type_", "(_", "key_", ")_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "too", "\\u", "muc", "h", "\\u", "content", "'_", ",_", "extra_", "=_", "',", " ", "'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "data_", "._", "keys_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "range", "\\u", "type_", "(_", "**_", "validat", "ed", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Range", "Field_", "(_", "Dict", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "representation_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Range", " ", "instance", "s", " ", "->", " ", "dict", "s", " ", "of", " ", "primi", "tiv", "e", " ", "datatype", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "._", "ise", "mpty", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "empty", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lower_", "=_", "self_", "._", "child_", "._", "to", "\\u", "representation_", "(_", "value_", "._", "lower_", ")_", "if_", "value_", "._", "lower_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upper_", "=_", "self_", "._", "child_", "._", "to", "\\u", "representation_", "(_", "value_", "._", "upper_", ")_", "if_", "value_", "._", "upper_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "lower", "'_", ":_", "lower_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upper", "'_", ":_", "upper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bound", "s", "'_", ":_", "value_", "._", "\\u", "bounds_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Integer", "Range", "Field_", "(_", "Range", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "Integer", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "type_", "=_", "Numer", "ic", "Range_", "\\u\\u\\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_", "Float", "Range", "Field_", "(_", "Range", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "Float", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "type_", "=_", "Numer", "ic", "Range_", "\\u\\u\\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_", "Date", "Time", "Range", "Field_", "(_", "Range", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "Date", "Time", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "type_", "=_", "Date", "Time", "TZ", "Range_", "\\u\\u\\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_", "Date", "Range", "Field_", "(_", "Range", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "Date", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "type_", "=_", "Date", "Range_", "\\u\\u\\uNE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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
enthought/mayavi/mayavi/core/ui/api.py
[ { "content": "from mayavi.tools.mlab_scene_model import MlabSceneModel\nfrom mayavi.core.ui.mayavi_scene import MayaviScene, \\\n DecoratedScene\nfrom tvtk.pyface.scene_editor import SceneEditor\nfrom mayavi.core.ui.engine_view import EngineView\nfrom mayavi.core.ui.engine_rich_view import EngineRichView\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from mayavi.tools.mlab_scene_model import MlabSceneModel", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 56 }, { "span": "from mayavi.core.ui.mayavi_scene import MayaviScene, \\\n DecoratedScene", "start_line": 1, "start_column": 0, "end_line": 2, "end_column": 34 }, { "span": "from tvtk.pyface.scene_editor import SceneEditor", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 48 }, { "span": "from mayavi.core.ui.engine_view import EngineView", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 49 }, { "span": "from mayavi.core.ui.engine_rich_view import EngineRichView", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 58 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "maya", "vi_", "._", "tools_", "._", "mla", "b", "\\u", "scen", "e\\u", "model_", "import_", "Ml", "ab", "Scen", "e", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "vi_", "._", "core_", "._", "ui_", "._", "maya", "vi", "\\u", "scene_", "import_", "Maya", "vi", "Scene_", ",_", "Decorat", "ed", "Scene_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tv", "tk_", "._", "pyf", "ace_", "._", "scen", "e\\u", "editor_", "import_", "Scen", "e", "Editor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "vi_", "._", "core_", "._", "ui_", "._", "eng", "ine", "\\u", "view_", "import_", "Engine", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "vi_", "._", "core_", "._", "ui_", "._", "eng", "ine", "\\u", "rich", "\\u", "view_", "import_", "Engine", "Rich", "View_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 0, 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 ]
Unused import
Miserlou/django-knockout-modeler/knockout_modeler/templatetags/knockout.py
[ { "content": "from django import template\ntry:\n import simplejson as json\nexcept ImportError, e:\n import json\nimport datetime\nfrom knockout_modeler.ko import ko, ko_data, ko_model, ko_bindings, get_fields\n\nregister = template.Library()\n\n\n\n\n\nregister.filter(knockout)\nregister.filter(knockout_data)\nregister.filter(knockout_model)\nregister.filter(knockout_bindings)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def knockout(values):\n \"\"\"\n Knockoutify a QuerySet!\n \"\"\"\n\n if not values:\n return ''\n \n field_names = get_fields(values[0])\n return ko(values, field_names)", "metadata": "root.knockout", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def knockout_data(values, args=None):\n \"\"\"\n\n \"\"\"\n if not values:\n return ''\n\n name = None\n safe = False\n\n if args:\n arg_list = [arg.strip() for arg in args.split(',')]\n if len(arg_list) > 1:\n safe = True\n else:\n safe = False\n name = arg_list[0]\n\n field_names = get_fields(values[0])\n return ko_data(values, field_names, name, safe)", "metadata": "root.knockout_data", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def knockout_model(values):\n \"\"\"\n\n \"\"\"\n if not values:\n return ''\n\n field_names = get_fields(values[0])\n modelClass = values[0].__class__\n return ko_model(modelClass, field_names)", "metadata": "root.knockout_model", "header": "['module', '___EOS___']", "index": 42 }, { "content": "def knockout_bindings(values):\n \"\"\"\n\n \"\"\"\n if not values:\n return ''\n\n return ko_bindings(values[0])", "metadata": "root.knockout_bindings", "header": "['module', '___EOS___']", "index": 53 } ]
[ { "span": "import simplejson as json", "start_line": 2, "start_column": 4, "end_line": 2, "end_column": 29 }, { "span": "import json", "start_line": 4, "start_column": 4, "end_line": 4, "end_column": 15 }, { "span": "import datetime", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kno", "cko", "ut", "\\u", "model", "er_", "._", "ko", "_", "import_", "ko", "_", ",_", "ko", "\\u", "data_", ",_", "ko", "\\u", "model_", ",_", "ko", "\\u", "bindings_", ",_", "get", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "register_", "._", "filter_", "(_", "kno", "cko", "ut_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "filter_", "(_", "kno", "cko", "ut", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "filter_", "(_", "kno", "cko", "ut", "\\u", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "filter_", "(_", "kno", "cko", "ut", "\\u", "bindings_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "kno", "cko", "ut_", "(_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Kno", "cko", "uti", "fy", " ", "a", " ", "Query", "Set", "!", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "values_", ":_", "\\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_", "field", "\\u", "names_", "=_", "get", "\\u", "fields_", "(_", "values_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ko", "_", "(_", "values_", ",_", "field", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kno", "cko", "ut", "\\u", "data_", "(_", "values_", ",_", "args_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "values_", ":_", "\\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_", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "safe_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg", "\\u", "list_", "=_", "[_", "arg_", "._", "strip_", "(_", ")_", "for_", "arg_", "in_", "args_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "arg", "\\u", "list_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "safe_", "=_", "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 ", " _", "safe_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "arg", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "names_", "=_", "get", "\\u", "fields_", "(_", "values_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ko", "\\u", "data_", "(_", "values_", ",_", "field", "\\u", "names_", ",_", "name_", ",_", "safe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kno", "cko", "ut", "\\u", "model_", "(_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "values_", ":_", "\\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_", "field", "\\u", "names_", "=_", "get", "\\u", "fields_", "(_", "values_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Class_", "=_", "values_", "[_", "0_", "]_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ko", "\\u", "model_", "(_", "model", "Class_", ",_", "field", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kno", "cko", "ut", "\\u", "bindings_", "(_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "values_", ":_", "\\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_", "ko", "\\u", "bindings_", "(_", "values_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
lsaffre/lino/docs/tutorials/workflows_tutorial/workflows.py
[ { "content": "## Copyright 2013 Luc Saffre\n## This file is part of the Lino project.\n\nfrom lino.api import dd, rt\nfrom django.utils.translation import ugettext_lazy as _\n\n \nadd = EntryStates.add_item\nadd('10', _(\"To do\"),'todo')\nadd('20', _(\"Started\"),'started')\nadd('30', _(\"Done\"),'done')\nadd('40', _(\"Sleeping\"),'sleeping')\nadd('50', _(\"Cancelled\"),'cancelled')\n\n\n\n\n\n \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class EntryStates(dd.Workflow):\n pass", "metadata": "root.EntryStates", "header": "['module', '___EOS___']", "index": 6 }, { "content": "@dd.receiver(dd.pre_analyze)\ndef my_entry_workflow(sender=None,**kw):\n EntryStates.todo.add_transition(_(\"Reopen\"),states='done cancelled')\n EntryStates.todo.add_transition(WakeupEntry)\n EntryStates.started.add_transition(StartEntry)\n EntryStates.sleeping.add_transition(states=\"todo\")\n EntryStates.done.add_transition(FinishEntry)\n EntryStates.cancelled.add_transition(states='sleeping started',\n help_text=_(\"\"\"This is a rather verbose help text for the action \n which triggers transition from 'sleeping' or 'started' to 'cancelled'.\"\"\"),\n icon_name='cancel')", "metadata": "root.my_entry_workflow", "header": "['module', '___EOS___']", "index": 17 }, { "content": "class StartEntry(dd.ChangeStateAction):\n label = _(\"Start\")\n help_text = _(\"This action is not allowed when company, body or subject is empty.\")\n required_states = 'todo cancelled'", "metadata": "root.StartEntry", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def get_action_permission(self,ar,obj,state):\n # cannot start entries with empty company, subject or body fields\n if not obj.company or not obj.subject or not obj.body:\n return False\n return super(StartEntry,self).get_action_permission(ar,obj,state)", "metadata": "root.StartEntry.get_action_permission", "header": "['class', 'StartEntry', '(', 'dd', '.', 'ChangeStateAction', ')', ':', '___EOS___']", "index": 34 }, { "content": "class FinishEntry(StartEntry):\n icon_name='accept'\n label = _(\"Finish\")\n required_states = 'todo started'\n help_text = _(\"Inherts from StartEntry and thus is not allowed when company, body or subject is empty.\")", "metadata": "root.FinishEntry", "header": "['module', '___EOS___']", "index": 40 }, { "content": "class WakeupEntry(dd.ChangeStateAction,dd.NotifyingAction):\n label = _(\"Wake up\")\n required_states = 'sleeping'\n # in our example waking up an antry will send a notification", "metadata": "root.WakeupEntry", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def get_notify_subject(self,ar,obj):\n return _(\"Entry %s has been reactivated!\") % obj", "metadata": "root.WakeupEntry.get_notify_subject", "header": "['class', 'WakeupEntry', '(', 'dd', '.', 'ChangeStateAction', ',', 'dd', '.', 'NotifyingAction', ')', ':', '___EOS___']", "index": 50 } ]
[ { "span": "from lino.api import dd, rt", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "Copy", "right", " ", "2013", " ", "Luc", " ", "Saf", "fre", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "the", " ", "Lin", "o", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lino", "_", "._", "api_", "import_", "dd_", ",_", "rt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\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_", "add_", "=_", "Entr", "y", "States_", "._", "add", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add_", "(_", "'", "10", "'_", ",_", "\\u_", "(_", "\"", "To", " ", "do", "\"_", ")_", ",_", "'", "todo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add_", "(_", "'", "20", "'_", ",_", "\\u_", "(_", "\"", "Start", "ed", "\"_", ")_", ",_", "'", "start", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add_", "(_", "'", "30", "'_", ",_", "\\u_", "(_", "\"", "Don", "e", "\"_", ")_", ",_", "'", "don", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add_", "(_", "'", "40", "'_", ",_", "\\u_", "(_", "\"", "Sleep", "ing", "\"_", ")_", ",_", "'", "sleep", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add_", "(_", "'", "50", "'_", ",_", "\\u_", "(_", "\"", "Cancel", "led", "\"_", ")_", ",_", "'", "cancel", "led", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Entr", "y", "States_", "(_", "dd_", "._", "Workflow_", ")_", ":_", "\\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_", "@_", "dd_", "._", "receiver_", "(_", "dd_", "._", "pre", "\\u", "analyze_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "my", "\\u", "entry", "\\u", "workflow_", "(_", "sender_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Entr", "y", "States_", "._", "todo_", "._", "add", "\\u", "transition_", "(_", "\\u_", "(_", "\"", "Re", "open", "\"_", ")_", ",_", "states_", "=_", "'", "don", "e", " ", "cancel", "led", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Entr", "y", "States_", "._", "todo_", "._", "add", "\\u", "transition_", "(_", "Wake", "up", "Entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Entr", "y", "States_", "._", "started_", "._", "add", "\\u", "transition_", "(_", "Start", "Entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Entr", "y", "States_", "._", "sleep", "ing_", "._", "add", "\\u", "transition_", "(_", "states_", "=_", "\"", "todo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Entr", "y", "States_", "._", "done_", "._", "add", "\\u", "transition_", "(_", "Finish", "Entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Entr", "y", "States_", "._", "cancelled_", "._", "add", "\\u", "transition_", "(_", "states_", "=_", "'", "sleep", "ing", " ", "start", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "\\u_", "(_", "\"\"\"", "Thi", "s", " ", "is", " ", "a", " ", "rat", "her", " ", "verbo", "se", " ", "help", " ", "text", " ", "for", " ", "the", " ", "action", " ", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "trigger", "s", " ", "transiti", "on", " ", "from", " ", "'", "sleep", "ing", "'", " ", "or", " ", "'", "start", "ed", "'", " ", "to", " ", "'", "cancel", "led", "'.", "\"\"\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "icon", "\\u", "name_", "=_", "'", "cancel", "'_", ")_", "\\u\\u\\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_", "Start", "Entry_", "(_", "dd_", "._", "Change", "State", "Action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "\\u_", "(_", "\"", "Start", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Thi", "s", " ", "action", " ", "is", " ", "not", " ", "allow", "ed", " ", "whe", "n", " ", "compan", "y", ",", " ", "body", " ", "or", " ", "subject", " ", "is", " ", "empty", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "d\\u", "states_", "=_", "'", "todo", " ", "cancel", "led", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Entry_", "(_", "dd_", "._", "Change", "State", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "action", "\\u", "permission_", "(_", "self_", ",_", "ar_", ",_", "obj_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cann", "ot", " ", "start", " ", "entri", "es", " ", "with", " ", "empty", " ", "compan", "y", ",", " ", "subject", " ", "or", " ", "body", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "obj_", "._", "company_", "or_", "not_", "obj_", "._", "subject_", "or_", "not_", "obj_", "._", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Start", "Entry_", ",_", "self_", ")_", "._", "get", "\\u", "action", "\\u", "permission_", "(_", "ar_", ",_", "obj_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Finish", "Entry_", "(_", "Start", "Entry_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon", "\\u", "name_", "=_", "'", "accept", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "\\u_", "(_", "\"", "Finish", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "d\\u", "states_", "=_", "'", "todo", " ", "start", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "help", "\\u", "text_", "=_", "\\u_", "(_", "\"", "In", "her", "ts", " ", "from", " ", "Start", "Entr", "y", " ", "and", " ", "thu", "s", " ", "is", " ", "not", " ", "allow", "ed", " ", "whe", "n", " ", "compan", "y", ",", " ", "body", " ", "or", " ", "subject", " ", "is", " ", "empty", ".\"_", ")_", "\\u\\u\\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_", "Wake", "up", "Entry_", "(_", "dd_", "._", "Change", "State", "Action_", ",_", "dd_", "._", "Noti", "fy", "ing", "Action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "\\u_", "(_", "\"", "Wake", " ", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "d\\u", "states_", "=_", "'", "sleep", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "our", " ", "example", " ", "wa", "king", " ", "up", " ", "an", " ", "ant", "ry", " ", "will", " ", "send", " ", "a", " ", "notification_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Wake", "up", "Entry_", "(_", "dd_", "._", "Change", "State", "Action_", ",_", "dd_", "._", "Noti", "fy", "ing", "Action_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "notif", "y", "\\u", "subject_", "(_", "self_", ",_", "ar_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u_", "(_", "\"", "Entr", "y", " ", "%", "s", " ", "has", " ", "bee", "n", " ", "reacti", "vat", "ed", "!\"_", ")_", "%_", "obj_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
babble/babble/include/jython/Lib/test/test_dis.py
[ { "content": "def bug1333982(x=[]):\n assert 0, ([s for s in x] +\n 1)\n pass", "metadata": "root.bug1333982", "header": "['module', '___EOS___']", "index": 49 } ]
[ { "span": "pass", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "bug", "133", "398", "2_", "(_", "x_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "0_", ",_", "(_", "[_", "s_", "for_", "s_", "in_", "x_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/styles/borders.py
[ { "content": "from __future__ import absolute_import\n# Copyright (c) 2010-2015 openpyxl\n\nfrom openpyxl.compat import safe_string\nfrom openpyxl.descriptors import NoneSet, Typed, Bool, Alias\n\nfrom .colors import ColorDescriptor\nfrom .hashable import HashableObject\n\n\nBORDER_NONE = None\nBORDER_DASHDOT = 'dashDot'\nBORDER_DASHDOTDOT = 'dashDotDot'\nBORDER_DASHED = 'dashed'\nBORDER_DOTTED = 'dotted'\nBORDER_DOUBLE = 'double'\nBORDER_HAIR = 'hair'\nBORDER_MEDIUM = 'medium'\nBORDER_MEDIUMDASHDOT = 'mediumDashDot'\nBORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'\nBORDER_MEDIUMDASHED = 'mediumDashed'\nBORDER_SLANTDASHDOT = 'slantDashDot'\nBORDER_THICK = 'thick'\nBORDER_THIN = 'thin'\n\n\n\n\n\nDEFAULT_BORDER = Border()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Side(HashableObject):\n\n \"\"\"Border options for use in styles.\n Caution: if you do not specify a border_style, other attributes will\n have no effect !\"\"\"\n\n __fields__ = ('style',\n 'color')\n\n color = ColorDescriptor(allow_none=True)\n style = NoneSet(values=('dashDot','dashDotDot', 'dashed','dotted',\n 'double','hair', 'medium', 'mediumDashDot', 'mediumDashDotDot',\n 'mediumDashed', 'slantDashDot', 'thick', 'thin')\n )\n border_style = Alias('style')\n", "metadata": "root.Side", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def __init__(self, style=None, color=None, border_style=None):\n if border_style is not None:\n style = border_style\n self.style = style\n self.color = color", "metadata": "root.Side.__init__", "header": "['class', 'Side', '(', 'HashableObject', ')', ':', '___EOS___']", "index": 42 }, { "content": "class Border(HashableObject):\n \"\"\"Border positioning for use in styles.\"\"\"\n\n tagname = \"border\"\n\n __fields__ = ('left',\n 'right',\n 'top',\n 'bottom',\n 'diagonal',\n 'diagonal_direction',\n 'vertical',\n 'horizontal')\n __elements__ = ('start', 'end', 'left', 'right', 'top', 'bottom',\n 'diagonal', 'vertical', 'horizontal')\n\n # child elements\n start = Typed(expected_type=Side, allow_none=True)\n end = Typed(expected_type=Side, allow_none=True)\n left = Typed(expected_type=Side, allow_none=True)\n right = Typed(expected_type=Side, allow_none=True)\n top = Typed(expected_type=Side, allow_none=True)\n bottom = Typed(expected_type=Side)\n diagonal = Typed(expected_type=Side, allow_none=True)\n vertical = Typed(expected_type=Side, allow_none=True)\n horizontal = Typed(expected_type=Side, allow_none=True)\n # attributes\n outline = Bool()\n diagonalUp = Bool()\n diagonalDown = Bool()\n\n", "metadata": "root.Border", "header": "['module', '___EOS___']", "index": 49 }, { "content": " def __init__(self, left=Side(), right=Side(), top=Side(),\n bottom=Side(), diagonal=Side(), diagonal_direction=None,\n vertical=None, horizontal=None, diagonalUp=False, diagonalDown=False,\n outline=True, start=None, end=None):\n self.left = left\n self.right = right\n self.top = top\n self.bottom = bottom\n self.diagonal = diagonal\n self.vertical = vertical\n self.horizontal = horizontal\n self.diagonal_direction = diagonal_direction\n self.diagonalUp = diagonalUp\n self.diagonalDown = diagonalDown\n self.outline = outline\n self.start = start\n self.end = end", "metadata": "root.Border.__init__", "header": "['class', 'Border', '(', 'HashableObject', ')', ':', '___EOS___']", "index": 80 }, { "content": " def __iter__(self):\n for attr in self.__attrs__:\n value = getattr(self, attr)\n if value and attr != \"outline\":\n yield attr, value\n elif attr == \"outline\" and not value:\n yield attr, value", "metadata": "root.Border.__iter__", "header": "['class', 'Border', '(', 'HashableObject', ')', ':', '___EOS___']", "index": 98 } ]
[ { "span": "from openpyxl.compat import safe_string", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 39 } ]
[]
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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", "-", "201", "5", " ", "openp", "yx", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "compat_", "import_", "safe", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "descriptors_", "import_", "Non", "e", "Set_", ",_", "Type", "d_", ",_", "Bool_", ",_", "Alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "colors_", "import_", "Color", "Descriptor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "hashable", "_", "import_", "Hash", "able", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "BORDER", "\\u", "NONE_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "DAS", "HD", "OT", "_", "=_", "'", "dash", "Dot", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "DAS", "HD", "OT", "DOT", "_", "=_", "'", "dash", "Dot", "Dot", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "DAS", "HED", "_", "=_", "'", "dashed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "DOT", "TED_", "=_", "'", "dot", "ted", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "DOUBLE_", "=_", "'", "double", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "HA", "IR_", "=_", "'", "hair", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "MEDIUM", "_", "=_", "'", "medium", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "MEDIUM", "DAS", "HD", "OT", "_", "=_", "'", "medium", "Dash", "Dot", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "MEDIUM", "DAS", "HD", "OT", "DOT", "_", "=_", "'", "medium", "Dash", "Dot", "Dot", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "MEDIUM", "DAS", "HED", "_", "=_", "'", "medium", "Dash", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "SLA", "NT", "DAS", "HD", "OT", "_", "=_", "'", "sla", "nt", "Dash", "Dot", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "THI", "CK_", "=_", "'", "thick", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BORDER", "\\u", "THI", "N_", "=_", "'", "thin", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "BORDER", "_", "=_", "Border", "_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Side_", "(_", "Hash", "able", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Border", " ", "options", " ", "for", " ", "use", " ", "in", " ", "style", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Cau", "tion", ":", " ", "if", " ", "you", " ", "do", " ", "not", " ", "speci", "fy", " ", "a", " ", "border", "\\u", "style", ",", " ", "other", " ", "attribute", "s", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "no", " ", "effect", " ", "!\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "fields", "\\u\\u_", "=_", "(_", "'", "style", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "color", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "Color", "Descriptor_", "(_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style_", "=_", "Non", "e", "Set_", "(_", "values_", "=_", "(_", "'", "dash", "Dot", "'_", ",_", "'", "dash", "Dot", "Dot", "'_", ",_", "'", "dashed", "'_", ",_", "'", "dot", "ted", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "double", "'_", ",_", "'", "hair", "'_", ",_", "'", "medium", "'_", ",_", "'", "medium", "Dash", "Dot", "'_", ",_", "'", "medium", "Dash", "Dot", "Dot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "Dash", "ed", "'_", ",_", "'", "sla", "nt", "Dash", "Dot", "'_", ",_", "'", "thick", "'_", ",_", "'", "thin", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "border", "\\u", "style_", "=_", "Alias_", "(_", "'", "style", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Side_", "(_", "Hash", "able", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "style_", "=_", "None_", ",_", "color_", "=_", "None_", ",_", "border", "\\u", "style_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "border", "\\u", "style_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "style_", "=_", "border", "\\u", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "style_", "=_", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color_", "=_", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Border", "_", "(_", "Hash", "able", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Border", " ", "position", "ing", " ", "for", " ", "use", " ", "in", " ", "style", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tagname_", "=_", "\"", "border", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "fields", "\\u\\u_", "=_", "(_", "'", "left", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "right", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "top", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bottom", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "diagonal", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "diagonal", "\\u", "direction", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vertical", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "horizon", "tal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "element", "s\\u\\u_", "=_", "(_", "'", "start", "'_", ",_", "'", "end", "'_", ",_", "'", "left", "'_", ",_", "'", "right", "'_", ",_", "'", "top", "'_", ",_", "'", "bottom", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "diagonal", "'_", ",_", "'", "vertical", "'_", ",_", "'", "horizon", "tal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "child", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottom_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diagonal_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertical_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "horizontal_", "=_", "Type", "d_", "(_", "expected", "\\u", "type_", "=_", "Side_", ",_", "allow", "\\u", "none_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "outline_", "=_", "Bool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diagonal", "Up_", "=_", "Bool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diagonal", "Down_", "=_", "Bool_", "(_", ")_", "\\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_", "Border", "_", "(_", "Hash", "able", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "left_", "=_", "Side_", "(_", ")_", ",_", "right_", "=_", "Side_", "(_", ")_", ",_", "top_", "=_", "Side_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bottom_", "=_", "Side_", "(_", ")_", ",_", "diagonal_", "=_", "Side_", "(_", ")_", ",_", "diagonal", "\\u", "direction_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vertical_", "=_", "None_", ",_", "horizontal_", "=_", "None_", ",_", "diagonal", "Up_", "=_", "False_", ",_", "diagonal", "Down_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "outline_", "=_", "True_", ",_", "start_", "=_", "None_", ",_", "end_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "left_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "top_", "=_", "top_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bottom_", "=_", "bottom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "diagonal_", "=_", "diagonal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vertical_", "=_", "vertical_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "horizontal_", "=_", "horizontal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "diagonal", "\\u", "direction_", "=_", "diagonal", "\\u", "direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "diagonal", "Up_", "=_", "diagonal", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "diagonal", "Down_", "=_", "diagonal", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "outline_", "=_", "outline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end_", "=_", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Border", "_", "(_", "Hash", "able", "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 ", " _", "for_", "attr_", "in_", "self_", "._", "\\u\\u", "attr", "s\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "self_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "and_", "attr_", "!=_", "\"", "outline", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "attr_", ",_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "==_", "\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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
kootenpv/sky/sky/crawler_plugins.py
[ { "content": " def get_template_dict(self):\n try:\n templ_dict = self.es.get(index=self.project_name + \"-crawler-template_dict\",\n doc_type='template_dict',\n id=self.plugin_name)['_source']\n templ_dict = {self.ast.literal_eval(k): v for k, v in templ_dict.items()}\n # In acually catching the NotFoundError (for which I do not want to depend\n # on importing the elasticsearch package)\n # pylint: disable=bare-except\n except:\n templ_dict = {}\n return templ_dict", "metadata": "root.CrawlElasticSearchPluginNews.get_template_dict", "header": "['class', 'CrawlElasticSearchPluginNews', '(', 'CrawlElasticSearchPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 363 }, { "content": " def save_template_dict(self, templ_dict):\n if templ_dict:\n try:\n self.es.index(index=self.project_name + \"-crawler-template_dict\",\n doc_type='template_dict', id=self.plugin_name,\n body=json.dumps({repr(k): v for k, v in templ_dict.items()}))\n # In acually catching the NotFoundError (for which I do not want to depend\n # on importing the elasticsearch package)\n # pylint: disable=bare-except\n except:\n self.es.update(\n index=self.project_name + \"-crawler-template_dict\",\n doc_type='template_dict', id=self.plugin_name,\n body=json.dumps({\"doc\": {repr(k): v for k, v in templ_dict.items()}}))", "metadata": "root.CrawlElasticSearchPluginNews.save_template_dict", "header": "['class', 'CrawlElasticSearchPluginNews', '(', 'CrawlElasticSearchPlugin', ',', 'CrawlPluginNews', ')', ':', '___EOS___']", "index": 376 } ]
[ { "span": "except:", "start_line": 372, "start_column": 8, "end_line": 372, "end_column": 15 }, { "span": "except:", "start_line": 385, "start_column": 12, "end_line": 385, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plug", "in", "News", "_", "(_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "template", "\\u", "dict_", "(_", "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 ", " _", "templ", "\\u", "dict_", "=_", "self_", "._", "es_", "._", "get_", "(_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "template", "\\u", "dict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "'", "template", "\\u", "dict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ")_", "[_", "'\\u", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "templ", "\\u", "dict_", "=_", "{_", "self_", "._", "ast_", "._", "literal", "\\u", "eval_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "templ", "\\u", "dict_", "._", "items_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "acu", "ally", " ", "catch", "ing", " ", "the", " ", "Not", "Foun", "d", "Error", " ", "(", "for", " ", "whi", "ch", " ", "I", " ", "do", " ", "not", " ", "want", " ", "to", " ", "depend", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "import", "ing", " ", "the", " ", "elastic", "search", " ", "package", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "bare", "-", "except_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "templ", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "templ", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Crawl", "Elast", "ic", "Sear", "ch", "Plug", "in", "News", "_", "(_", "Crawl", "Elast", "ic", "Sear", "ch", "Plugin_", ",_", "Crawl", "Plug", "in", "News", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "template", "\\u", "dict_", "(_", "self_", ",_", "templ", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "templ", "\\u", "dict_", ":_", "\\u\\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_", "._", "es_", "._", "index_", "(_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "template", "\\u", "dict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "'", "template", "\\u", "dict", "'_", ",_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "json_", "._", "dumps_", "(_", "{_", "repr_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "templ", "\\u", "dict_", "._", "items_", "(_", ")_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "acu", "ally", " ", "catch", "ing", " ", "the", " ", "Not", "Foun", "d", "Error", " ", "(", "for", " ", "whi", "ch", " ", "I", " ", "do", " ", "not", " ", "want", " ", "to", " ", "depend", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "import", "ing", " ", "the", " ", "elastic", "search", " ", "package", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "bare", "-", "except_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "es_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "self_", "._", "project", "\\u", "name_", "+_", "\"-", "crawle", "r", "-", "template", "\\u", "dict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "\\u", "type_", "=_", "'", "template", "\\u", "dict", "'_", ",_", "id_", "=_", "self_", "._", "plugin", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "json_", "._", "dumps_", "(_", "{_", "\"", "doc", "\"_", ":_", "{_", "repr_", "(_", "k_", ")_", ":_", "v_", "for_", "k_", ",_", "v_", "in_", "templ", "\\u", "dict_", "._", "items_", "(_", ")_", "}_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
PythonJS/PythonJS/regtests/lang/raise.py
[ { "content": "def main():\n\ta = False\n\ttry:\n\t\traise TypeError\n\texcept TypeError:\n\t\ta = True\n\n\tTestError( a==True )\n\n\tb = False\n\ttry:\n\t\tb = True\n\texcept:\n\t\tb = False\n\n\tTestError( b==True )\n\n\tc = False\n\ttry:\n\t\traise AttributeError('name')\n\texcept AttributeError:\n\t\tc = True\n\n\tTestError( c==True )", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 4 } ]
[ { "span": "except:", "start_line": 16, "start_column": 1, "end_line": 16, "end_column": 8 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "a_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Type", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "a_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Test", "Error_", "(_", "a_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "b_", "=_", "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\t", "\t_", "b_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Test", "Error_", "(_", "b_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Attribute", "Error_", "(_", "'", "name", "'_", ")_", "\\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\t", "\t_", "c_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Test", "Error_", "(_", "c_", "==_", "True_", ")_" ]
[ 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, 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 ]
Except block handles 'BaseException'
cloudkick/libcloud/test/storage/test_cloudfiles.py
[ { "content": " def test_create_container_invalid_name(self):\n try:\n container = self.driver.create_container(container_name='invalid//name/')\n except:\n pass\n else:\n self.fail('Invalid name was provided (name contains slashes), but exception was not thrown')", "metadata": "root.CloudFilesTests.test_create_container_invalid_name", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 115 }, { "content": " def test_create_container_invalid_name(self):\n name = ''.join([ 'x' for x in range(0, 257)])\n try:\n container = self.driver.create_container(container_name=name)\n except:\n pass\n else:\n self.fail('Invalid name was provided (name is too long), but exception was not thrown')", "metadata": "root.CloudFilesTests.test_create_container_invalid_name", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 123 } ]
[ { "span": "except:", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 15 }, { "span": "except:", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "create", "\\u", "container", "\\u", "invalid", "\\u", "name_", "(_", "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 ", " _", "container_", "=_", "self_", "._", "driver_", "._", "create", "\\u", "container_", "(_", "container", "\\u", "name_", "=_", "'", "invalid", "//", "name", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Inva", "lid", " ", "name", " ", "was", " ", "provided", " ", "(", "name", " ", "contain", "s", " ", "slash", "es", "),", " ", "but", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "create", "\\u", "container", "\\u", "invalid", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "''_", "._", "join_", "(_", "[_", "'", "x", "'_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "257_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "container_", "=_", "self_", "._", "driver_", "._", "create", "\\u", "container_", "(_", "container", "\\u", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Inva", "lid", " ", "name", " ", "was", " ", "provided", " ", "(", "name", " ", "is", " ", "too", " ", "long", "),", " ", "but", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
dropbox/changes/tests/changes/api/test_project_options_index.py
[ { "content": " def test_nonsense_project(self):\n project = self.create_project()\n path_fmt = '/api/0/projects/{0}/options/'\n self.login_default_admin()\n resp = self.client.post(path_fmt.format('project-that-doesnt-exist'), data={\n 'mail.notify-author': '0',\n })\n assert resp.status_code == 404\n\n # Random UUID.\n uuid_resp = self.client.post(path_fmt.format('fc0e5c51-19c5-43f0-9e11-8c28e091e9b0'), data={\n 'mail.notify-author': '0',\n })\n assert uuid_resp.status_code == 404", "metadata": "root.ProjectOptionsTest.test_nonsense_project", "header": "['class', 'ProjectOptionsTest', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 63 } ]
[ { "span": "project ", "start_line": 64, "start_column": 8, "end_line": 64, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Project", "Optio", "ns", "Test_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nons", "ense", "\\u", "project_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "fmt_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "options", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login", "\\u", "default", "\\u", "admin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "path", "\\u", "fmt_", "._", "format_", "(_", "'", "project", "-", "tha", "t", "-", "doesnt", "-", "exist", "'_", ")_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", ".", "notif", "y", "-", "author", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Random", " ", "UU", "ID", "._", "\\u\\u\\uNL\\u\\u\\u_", "uuid", "\\u", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "path", "\\u", "fmt_", "._", "format_", "(_", "'", "fc", "0e", "5c", "5", "1", "-1", "9c", "5", "-", "4", "3f", "0", "-", "9e", "11", "-", "8c", "2", "8e", "091", "e9", "b0", "'_", ")_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", ".", "notif", "y", "-", "author", "'_", ":_", "'", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "uuid", "\\u", "resp_", "._", "status", "\\u", "code_", "==_", "404_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Nested loops with same variable
vmalloc/mongomock/mongomock/collection.py
[ { "content": " def _update(self, spec, document, upsert=False, manipulate=False,\n multi=False, check_keys=False, **kwargs):\n validate_is_mapping('spec', spec)\n validate_is_mapping('document', document)\n\n updated_existing = False\n upserted_id = None\n num_updated = 0\n for existing_document in itertools.chain(self._iter_documents(spec), [None]):\n # we need was_insert for the setOnInsert update operation\n was_insert = False\n # the sentinel document means we should do an upsert\n if existing_document is None:\n if not upsert or num_updated:\n continue\n _id = document.get('_id')\n to_insert = dict(spec, _id=_id) if _id else spec\n to_insert = self._expand_dots(to_insert)\n upserted_id = self._insert(self._discard_operators(to_insert))\n existing_document = self._documents[upserted_id]\n was_insert = True\n else:\n updated_existing = True\n num_updated += 1\n first = True\n subdocument = None\n for k, v in iteritems(document):\n if k == '$set':\n positional = False\n for key in iterkeys(v):\n if '$' in key:\n positional = True\n break\n if positional:\n subdocument = self._update_document_fields_positional(\n existing_document, v, spec, _set_updater, subdocument)\n continue\n\n self._update_document_fields(existing_document, v, _set_updater)\n elif k == '$setOnInsert':\n if not was_insert:\n continue\n positional = any('$' in key for key in iterkeys(v))\n if positional:\n # we use _set_updater\n subdocument = self._update_document_fields_positional(\n existing_document, v, spec, _set_updater, subdocument)\n else:\n self._update_document_fields(existing_document, v, _set_updater)\n\n elif k == '$unset':\n for field, value in iteritems(v):\n if self._has_key(existing_document, field):\n self._remove_key(existing_document, field)\n\n elif k == '$inc':\n positional = False\n for key in iterkeys(v):\n if '$' in key:\n positional = True\n break\n\n if positional:\n subdocument = self._update_document_fields_positional(\n existing_document, v, spec, _inc_updater, subdocument)\n continue\n self._update_document_fields(existing_document, v, _inc_updater)\n elif k == '$addToSet':\n for field, value in iteritems(v):\n nested_field_list = field.rsplit('.')\n if len(nested_field_list) == 1:\n if field not in existing_document:\n existing_document[field] = []\n # document should be a list append to it\n if isinstance(value, dict):\n if '$each' in value:\n # append the list to the field\n existing_document[field] += [\n obj for obj in list(value['$each'])\n if obj not in existing_document[field]]\n continue\n if value not in existing_document[field]:\n existing_document[field].append(value)\n continue\n # push to array in a nested attribute\n else:\n # create nested attributes if they do not exist\n subdocument = existing_document\n for field in nested_field_list[:-1]:\n if field not in subdocument:\n subdocument[field] = {}\n\n subdocument = subdocument[field]\n\n # we're pushing a list\n push_results = []\n if nested_field_list[-1] in subdocument:\n # if the list exists, then use that list\n push_results = subdocument[\n nested_field_list[-1]]\n\n if isinstance(value, dict) and '$each' in value:\n push_results += [\n obj for obj in list(value['$each'])\n if obj not in push_results]\n elif value not in push_results:\n push_results.append(value)\n\n subdocument[nested_field_list[-1]] = push_results\n elif k == '$pull':\n for field, value in iteritems(v):\n nested_field_list = field.rsplit('.')\n # nested fields includes a positional element\n # need to find that element\n if '$' in nested_field_list:\n if not subdocument:\n subdocument = self._get_subdocument(\n existing_document, spec, nested_field_list)\n\n # value should be a dictionary since we're pulling\n pull_results = []\n # and the last subdoc should be an array\n for obj in subdocument[nested_field_list[-1]]:\n if isinstance(obj, dict):\n for pull_key, pull_value in iteritems(value):\n if obj[pull_key] != pull_value:\n pull_results.append(obj)\n continue\n if obj != value:\n pull_results.append(obj)\n\n # cannot write to doc directly as it doesn't save to\n # existing_document\n subdocument[nested_field_list[-1]] = pull_results\n else:\n arr = existing_document\n for field in nested_field_list:\n if field not in arr:\n break\n arr = arr[field]\n if not isinstance(arr, list):\n continue\n\n if isinstance(value, dict):\n for idx, obj in enumerate(arr):\n if filter_applies(value, obj):\n del arr[idx]\n else:\n for idx, obj in enumerate(arr):\n if value == obj:\n del arr[idx]\n elif k == '$pullAll':\n for field, value in iteritems(v):\n nested_field_list = field.rsplit('.')\n if len(nested_field_list) == 1:\n if field in existing_document:\n arr = existing_document[field]\n existing_document[field] = [\n obj for obj in arr if obj not in value]\n continue\n else:\n subdocument = existing_document\n for nested_field in nested_field_list[:-1]:\n if nested_field not in subdocument:\n break\n subdocument = subdocument[nested_field]\n\n if nested_field_list[-1] in subdocument:\n arr = subdocument[nested_field_list[-1]]\n subdocument[nested_field_list[-1]] = [\n obj for obj in arr if obj not in value]\n elif k == '$push':\n for field, value in iteritems(v):\n nested_field_list = field.rsplit('.')\n if len(nested_field_list) == 1:\n if field not in existing_document:\n existing_document[field] = []\n # document should be a list\n # append to it\n if isinstance(value, dict):\n if '$each' in value:\n # append the list to the field\n existing_document[field] += list(value['$each'])\n continue\n existing_document[field].append(value)\n continue\n # nested fields includes a positional element\n # need to find that element\n elif '$' in nested_field_list:\n if not subdocument:\n subdocument = self._get_subdocument(\n existing_document, spec, nested_field_list)\n\n # we're pushing a list\n push_results = []\n if nested_field_list[-1] in subdocument:\n # if the list exists, then use that list\n push_results = subdocument[nested_field_list[-1]]\n\n if isinstance(value, dict):\n # check to see if we have the format\n # { '$each': [] }\n if '$each' in value:\n push_results += list(value['$each'])\n else:\n push_results.append(value)\n else:\n push_results.append(value)\n\n # cannot write to doc directly as it doesn't save to\n # existing_document\n subdocument[nested_field_list[-1]] = push_results\n # push to array in a nested attribute\n else:\n # create nested attributes if they do not exist\n subdocument = existing_document\n for field in nested_field_list[:-1]:\n if field not in subdocument:\n subdocument[field] = {}\n subdocument = subdocument[field]\n\n # we're pushing a list\n push_results = []\n if nested_field_list[-1] in subdocument:\n # if the list exists, then use that list\n push_results = subdocument[nested_field_list[-1]]\n\n if isinstance(value, dict) and '$each' in value:\n push_results += list(value['$each'])\n else:\n push_results.append(value)\n\n subdocument[nested_field_list[-1]] = push_results\n else:\n if first:\n # replace entire document\n for key in document.keys():\n if key.startswith('$'):\n # can't mix modifiers with non-modifiers in\n # update\n raise ValueError('field names cannot start with $ [{}]'.format(k))\n _id = spec.get('_id', existing_document.get('_id'))\n existing_document.clear()\n if _id:\n existing_document['_id'] = _id\n existing_document.update(self._internalize_dict(document))\n if existing_document['_id'] != _id:\n raise OperationFailure(\n \"The _id field cannot be changed from {0} to {1}\"\n .format(existing_document['_id'], _id))\n break\n else:\n # can't mix modifiers with non-modifiers in update\n raise ValueError(\n 'Invalid modifier specified: {}'.format(k))\n first = False\n if not multi:\n break\n\n return {\n text_type(\"connectionId\"): self._database.client._id,\n text_type(\"err\"): None,\n text_type(\"n\"): num_updated,\n text_type(\"nModified\"): num_updated if updated_existing else 0,\n text_type(\"ok\"): 1,\n text_type(\"upserted\"): upserted_id,\n text_type(\"updatedExisting\"): updated_existing,\n }", "metadata": "root.Collection._update", "header": "['class', 'Collection', '(', 'object', ')', ':', '___EOS___']", "index": 337 } ]
[ { "span": "for field in nested_field_list[:-1]:", "start_line": 425, "start_column": 28, "end_line": 425, "end_column": 64 }, { "span": "for field in nested_field_list:", "start_line": 473, "start_column": 28, "end_line": 473, "end_column": 59 }, { "span": "for field in nested_field_list[:-1]:", "start_line": 553, "start_column": 28, "end_line": 553, "end_column": 64 } ]
[ { "span": "for field, value in iteritems(v):", "start_line": 405, "start_column": 20, "end_line": 405, "end_column": 53 }, { "span": "for field, value in iteritems(v):", "start_line": 447, "start_column": 20, "end_line": 447, "end_column": 53 }, { "span": "for field, value in iteritems(v):", "start_line": 509, "start_column": 20, "end_line": 509, "end_column": 53 } ]
1
true
[ "[CLS]_", "Nest", "ed_", "loops_", "with_", "same_", "variable_", "[SEP]_", "class_", "Collection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update_", "(_", "self_", ",_", "spec_", ",_", "document_", ",_", "upsert_", "=_", "False_", ",_", "manipulate", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "multi_", "=_", "False_", ",_", "check", "\\u", "keys_", "=_", "False_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "is", "\\u", "mapping_", "(_", "'", "spec", "'_", ",_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validat", "e\\u", "is", "\\u", "mapping_", "(_", "'", "document", "'_", ",_", "document_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "update", "d\\u", "existing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upse", "rted", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "updated_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "exist", "ing", "\\u", "document_", "in_", "itertools_", "._", "chain_", "(_", "self_", "._", "\\u", "iter", "\\u", "documents_", "(_", "spec_", ")_", ",_", "[_", "None_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "was", "\\u", "insert", " ", "for", " ", "the", " ", "set", "On", "Insert", " ", "update", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "was", "\\u", "insert_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "sentinel", " ", "document", " ", "means", " ", "we", " ", "shou", "ld", " ", "do", " ", "an", " ", "upsert_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exist", "ing", "\\u", "document_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "upsert_", "or_", "num", "\\u", "updated_", ":_", "\\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", "id_", "=_", "document_", "._", "get_", "(_", "'\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "insert_", "=_", "dict_", "(_", "spec_", ",_", "\\u", "id_", "=_", "\\u", "id_", ")_", "if_", "\\u", "id_", "else_", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "insert_", "=_", "self_", "._", "\\u", "expand", "\\u", "dots_", "(_", "to", "\\u", "insert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upse", "rted", "\\u", "id_", "=_", "self_", "._", "\\u", "insert_", "(_", "self_", "._", "\\u", "discard", "\\u", "operators_", "(_", "to", "\\u", "insert_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "document_", "=_", "self_", "._", "\\u", "documents_", "[_", "upse", "rted", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "was", "\\u", "insert_", "=_", "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 ", " _", "update", "d\\u", "existing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "updated_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subd", "ocu", "ment_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "iteritems_", "(_", "document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "'$", "set", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "positional", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "iterkeys_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'$'_", "in_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "positional", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "positional", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "self_", "._", "\\u", "update", "\\u", "document", "\\u", "fields", "\\u", "positional", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "document_", ",_", "v_", ",_", "spec_", ",_", "\\u", "set\\u", "updater_", ",_", "subd", "ocu", "ment_", ")_", "\\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_", "self_", "._", "\\u", "update", "\\u", "document", "\\u", "fields_", "(_", "exist", "ing", "\\u", "document_", ",_", "v_", ",_", "\\u", "set\\u", "updater_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'$", "set", "On", "Insert", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "was", "\\u", "insert_", ":_", "\\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_", "positional", "_", "=_", "any_", "(_", "'$'_", "in_", "key_", "for_", "key_", "in_", "iterkeys_", "(_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "positional", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "use", " ", "\\u", "set\\u", "updater_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "self_", "._", "\\u", "update", "\\u", "document", "\\u", "fields", "\\u", "positional", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "document_", ",_", "v_", ",_", "spec_", ",_", "\\u", "set\\u", "updater_", ",_", "subd", "ocu", "ment_", ")_", "\\u\\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", "update", "\\u", "document", "\\u", "fields_", "(_", "exist", "ing", "\\u", "document_", ",_", "v_", ",_", "\\u", "set\\u", "updater_", ")_", "\\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_", "k_", "==_", "'$", "unse", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "field_", ",_", "value_", "in_", "iteritems_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "has", "\\u", "key_", "(_", "exist", "ing", "\\u", "document_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "remove", "\\u", "key_", "(_", "exist", "ing", "\\u", "document_", ",_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'$", "inc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "positional", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "iterkeys_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'$'_", "in_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "positional", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "positional", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "self_", "._", "\\u", "update", "\\u", "document", "\\u", "fields", "\\u", "positional", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "document_", ",_", "v_", ",_", "spec_", ",_", "\\u", "inc", "\\u", "updater_", ",_", "subd", "ocu", "ment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "document", "\\u", "fields_", "(_", "exist", "ing", "\\u", "document_", ",_", "v_", ",_", "\\u", "inc", "\\u", "updater_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'$", "add", "To", "Set", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "field_", ",_", "value_", "in_", "iteritems_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nest", "ed", "\\u", "field", "\\u", "list_", "=_", "field_", "._", "rsplit_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "nest", "ed", "\\u", "field", "\\u", "list_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field_", "not_", "in_", "exist", "ing", "\\u", "document_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "document", " ", "shou", "ld", " ", "be", " ", "a", " ", "list", " ", "append", " ", "to", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'$", "each", "'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "append", " ", "the", " ", "list", " ", "to", " ", "the", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "+=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "for_", "obj_", "in_", "list_", "(_", "value_", "[_", "'$", "each", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "obj_", "not_", "in_", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "not_", "in_", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "push", " ", "to", " ", "array", " ", "in", " ", "a", " ", "nest", "ed", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "nest", "ed", " ", "attribute", "s", " ", "if", " ", "the", "y", " ", "do", " ", "not", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "exist", "ing", "\\u", "document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field_", "not_", "in_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "[_", "field_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ocu", "ment_", "=_", "subd", "ocu", "ment_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "push", "ing", " ", "a", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "push", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "in_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "list", " ", "exist", "s", ",", " ", "then", " ", "use", " ", "tha", "t", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "=_", "subd", "ocu", "ment_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", "and_", "'$", "each", "'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "+=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "for_", "obj_", "in_", "list_", "(_", "value_", "[_", "'$", "each", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "obj_", "not_", "in_", "push", "\\u", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "not_", "in_", "push", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "=_", "push", "\\u", "results_", "\\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_", "k_", "==_", "'$", "pull", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "field_", ",_", "value_", "in_", "iteritems_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nest", "ed", "\\u", "field", "\\u", "list_", "=_", "field_", "._", "rsplit_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "nest", "ed", " ", "fields", " ", "include", "s", " ", "a", " ", "positional", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "find", " ", "tha", "t", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'$'_", "in_", "nest", "ed", "\\u", "field", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "self_", "._", "\\u", "get", "\\u", "subd", "ocu", "ment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "document_", ",_", "spec_", ",_", "nest", "ed", "\\u", "field", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "shou", "ld", " ", "be", " ", "a", " ", "dictionar", "y", " ", "sinc", "e", " ", "we", "'", "re", " ", "pull", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pull", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "last", " ", "subd", "oc", " ", "shou", "ld", " ", "be", " ", "an", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "pull", "\\u", "key_", ",_", "pull", "\\u", "value_", "in_", "iteritems_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "if_", "obj_", "[_", "pull", "\\u", "key_", "]_", "!=_", "pull", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "pull", "\\u", "results_", "._", "append_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "!=_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pull", "\\u", "results_", "._", "append_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cann", "ot", " ", "write", " ", "to", " ", "doc", " ", "direct", "ly", " ", "as", " ", "it", " ", "doe", "sn", "'", "t", " ", "save", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", "ing", "\\u", "document_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "=_", "pull", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arr_", "=_", "exist", "ing", "\\u", "document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "nest", "ed", "\\u", "field", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field_", "not_", "in_", "arr_", ":_", "\\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_", "arr_", "=_", "arr_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "arr_", ",_", "list_", ")_", ":_", "\\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_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "idx_", ",_", "obj_", "in_", "enumerate_", "(_", "arr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "filter", "\\u", "appli", "es_", "(_", "value_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "del_", "arr_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "idx_", ",_", "obj_", "in_", "enumerate_", "(_", "arr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "value_", "==_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "del_", "arr_", "[_", "idx_", "]_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'$", "pull", "All", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "field_", ",_", "value_", "in_", "iteritems_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nest", "ed", "\\u", "field", "\\u", "list_", "=_", "field_", "._", "rsplit_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "nest", "ed", "\\u", "field", "\\u", "list_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field_", "in_", "exist", "ing", "\\u", "document_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arr_", "=_", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "for_", "obj_", "in_", "arr_", "if_", "obj_", "not_", "in_", "value_", "]_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "exist", "ing", "\\u", "document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "nest", "ed", "\\u", "field_", "in_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "nest", "ed", "\\u", "field_", "not_", "in_", "subd", "ocu", "ment_", ":_", "\\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_", "subd", "ocu", "ment_", "=_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "in_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arr_", "=_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "for_", "obj_", "in_", "arr_", "if_", "obj_", "not_", "in_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'$", "push", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "field_", ",_", "value_", "in_", "iteritems_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nest", "ed", "\\u", "field", "\\u", "list_", "=_", "field_", "._", "rsplit_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "nest", "ed", "\\u", "field", "\\u", "list_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field_", "not_", "in_", "exist", "ing", "\\u", "document_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "document", " ", "shou", "ld", " ", "be", " ", "a", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "append", " ", "to", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'$", "each", "'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "append", " ", "the", " ", "list", " ", "to", " ", "the", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "+=_", "list_", "(_", "value_", "[_", "'$", "each", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exist", "ing", "\\u", "document_", "[_", "field_", "]_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "nest", "ed", " ", "fields", " ", "include", "s", " ", "a", " ", "positional", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "find", " ", "tha", "t", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'$'_", "in_", "nest", "ed", "\\u", "field", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "self_", "._", "\\u", "get", "\\u", "subd", "ocu", "ment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "document_", ",_", "spec_", ",_", "nest", "ed", "\\u", "field", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "push", "ing", " ", "a", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "push", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "in_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "list", " ", "exist", "s", ",", " ", "then", " ", "use", " ", "tha", "t", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "=_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "see", " ", "if", " ", "we", " ", "have", " ", "the", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "{", " ", "'$", "each", "':", " ", "[]", " ", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'$", "each", "'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "+=_", "list_", "(_", "value_", "[_", "'$", "each", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cann", "ot", " ", "write", " ", "to", " ", "doc", " ", "direct", "ly", " ", "as", " ", "it", " ", "doe", "sn", "'", "t", " ", "save", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", "ing", "\\u", "document_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "=_", "push", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "push", " ", "to", " ", "array", " ", "in", " ", "a", " ", "nest", "ed", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "nest", "ed", " ", "attribute", "s", " ", "if", " ", "the", "y", " ", "do", " ", "not", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "=_", "exist", "ing", "\\u", "document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field_", "not_", "in_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subd", "ocu", "ment_", "[_", "field_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ocu", "ment_", "=_", "subd", "ocu", "ment_", "[_", "field_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "push", "ing", " ", "a", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "push", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "in_", "subd", "ocu", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "list", " ", "exist", "s", ",", " ", "then", " ", "use", " ", "tha", "t", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "=_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", "and_", "'$", "each", "'_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "+=_", "list_", "(_", "value_", "[_", "'$", "each", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "push", "\\u", "results_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ocu", "ment_", "[_", "nest", "ed", "\\u", "field", "\\u", "list_", "[_", "-_", "1_", "]_", "]_", "=_", "push", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "entire", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "key_", "in_", "document_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "key_", "._", "startswith_", "(_", "'$'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "mix", " ", "modifiers", " ", "with", " ", "non", "-", "modifiers", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "'", "field", " ", "names", " ", "cann", "ot", " ", "start", " ", "with", " ", "$", " ", "[{}]", "'_", "._", "format_", "(_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "id_", "=_", "spec_", "._", "get_", "(_", "'\\u", "id", "'_", ",_", "exist", "ing", "\\u", "document_", "._", "get_", "(_", "'\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "document_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exist", "ing", "\\u", "document_", "[_", "'\\u", "id", "'_", "]_", "=_", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exist", "ing", "\\u", "document_", "._", "update_", "(_", "self_", "._", "\\u", "internal", "ize", "\\u", "dict_", "(_", "document_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exist", "ing", "\\u", "document_", "[_", "'\\u", "id", "'_", "]_", "!=_", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Opera", "tion", "Failure_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "\\u", "id", " ", "field", " ", "cann", "ot", " ", "be", " ", "change", "d", " ", "from", " ", "{", "0", "}", " ", "to", " ", "{", "1", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "exist", "ing", "\\u", "document_", "[_", "'\\u", "id", "'_", "]_", ",_", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "mix", " ", "modifiers", " ", "with", " ", "non", "-", "modifiers", " ", "in", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inva", "lid", " ", "modifier", " ", "specified", ":", " ", "{}'_", "._", "format_", "(_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "multi_", ":_", "\\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_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "type_", "(_", "\"", "connecti", "on", "Id", "\"_", ")_", ":_", "self_", "._", "\\u", "database_", "._", "client_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "type_", "(_", "\"", "err", "\"_", ")_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "type_", "(_", "\"", "n", "\"_", ")_", ":_", "num", "\\u", "updated_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "type_", "(_", "\"", "n", "Modifie", "d", "\"_", ")_", ":_", "num", "\\u", "updated_", "if_", "update", "d\\u", "existing_", "else_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "type_", "(_", "\"", "ok", "\"_", ")_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "type_", "(_", "\"", "upse", "rted", "\"_", ")_", ":_", "upse", "rted", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text", "\\u", "type_", "(_", "\"", "update", "d", "Exist", "ing", "\"_", ")_", ":_", "update", "d\\u", "existing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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, 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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 ]
Wrong number of arguments in a call
VisTrails/VisTrails/vistrails/core/vistrail/controller.py
[ { "content": "def vt_action(description_or_f=None):\n def get_f(f, description=None):\n def new_f(self, *args, **kwargs):\n self.flush_delayed_actions()\n action = f(self, *args, **kwargs)\n if action is not None:\n self.add_new_action(action, description)\n self.perform_action(action)\n return action\n return new_f\n\n if isinstance(description_or_f, basestring):\n d = description_or_f\n def wrap(f):\n return get_f(f, d)\n return wrap\n else:\n return get_f(description_or_f)", "metadata": "root.vt_action", "header": "['module', '___EOS___']", "index": 100 }, { "content": " def create_module_from_descriptor(self, *args, **kwargs):\n return self.create_module_from_descriptor_static(self.id_scope,\n *args, **kwargs)", "metadata": "root.VistrailController.create_module_from_descriptor", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 609 }, { "content": " def create_module(self, *args, **kwargs):\n return self.create_module_static(self.id_scope, *args, **kwargs)", "metadata": "root.VistrailController.create_module", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 666 }, { "content": " def create_connection_from_ids(self, output_id, output_port_spec,\n input_id, input_port_spec):\n output_module = self.current_pipeline.modules[output_id]\n input_module = self.current_pipeline.modules[input_id]\n return self.create_connection(output_module, output_port_spec, \n input_module, input_port_spec)", "metadata": "root.VistrailController.create_connection_from_ids", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 691 }, { "content": " def create_function(self, *args, **kwargs):\n return self.create_function_static(self.id_scope, *args, **kwargs)", "metadata": "root.VistrailController.create_function", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 788 }, { "content": " def add_module_from_descriptor(self, descriptor, x=0.0, y=0.0, \n internal_version=-1):\n module = self.create_module_from_descriptor(descriptor, x, y, \n internal_version)\n action = self.add_module_action(module)\n return module", "metadata": "root.VistrailController.add_module_from_descriptor", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1041 }, { "content": " def add_module(self, identifier, name, namespace='', x=0.0, y=0.0, \n internal_version=-1):\n \"\"\" addModule(x: int, y: int, identifier, name: str, namespace='') \n -> Module\n Add a new module into the current pipeline\n \n \"\"\"\n module = self.create_module(identifier, name, namespace, x, y,\n internal_version)\n action = self.add_module_action(module)\n return module", "metadata": "root.VistrailController.add_module", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1048 }, { "content": " def delete_module(self, module_id):\n \"\"\" delete_module(module_id: int) -> version id\n Delete a module from the current pipeline\n \n \"\"\"\n return self.delete_module_list([module_id])", "metadata": "root.VistrailController.delete_module", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1060 }, { "content": " def add_connection(self, output_id, output_port_spec, \n input_id, input_port_spec):\n \"\"\" add_connection(output_id: long,\n output_port_spec: PortSpec | str,\n input_id: long,\n input_port_spec: PortSpec | str) -> Connection\n Add a new connection into Vistrail\n \n \"\"\"\n connection = \\\n self.create_connection_from_ids(output_id, output_port_spec, \n input_id, input_port_spec)\n action = self.add_connection_action(connection)\n return connection", "metadata": "root.VistrailController.add_connection", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1126 }, { "content": " def delete_connection(self, id):\n \"\"\" delete_connection(id: int) -> version id\n Delete a connection with id 'id'\n \n \"\"\"\n return self.delete_connection_list([id])", "metadata": "root.VistrailController.delete_connection", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1141 }, { "content": " def add_function(self, module, function_name):\n function = self.create_function(module, function_name)\n action = self.add_function_action(module, function)\n return function", "metadata": "root.VistrailController.add_function", "header": "['class', 'VistrailController', '(', 'object', ')', ':', '___EOS___']", "index": 1167 } ]
[ { "span": "self.add_module_action(module)", "start_line": 1045, "start_column": 17, "end_line": 1045, "end_column": 47 }, { "span": "self.add_module_action(module)", "start_line": 1057, "start_column": 17, "end_line": 1057, "end_column": 47 }, { "span": "self.delete_module_list([module_id])", "start_line": 1065, "start_column": 15, "end_line": 1065, "end_column": 51 }, { "span": "self.add_connection_action(connection)", "start_line": 1138, "start_column": 17, "end_line": 1138, "end_column": 55 }, { "span": "self.delete_connection_list([id])", "start_line": 1146, "start_column": 15, "end_line": 1146, "end_column": 48 }, { "span": "self.add_function_action(module, function)", "start_line": 1169, "start_column": 17, "end_line": 1169, "end_column": 59 } ]
[ { "span": "def wrap(f):", "start_line": 113, "start_column": 8, "end_line": 113, "end_column": 20 } ]
1
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "call_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "vt", "\\u", "action_", "(_", "description", "\\u", "or", "\\u", "f_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "f_", "(_", "f_", ",_", "description_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "new", "\\u", "f_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flush", "\\u", "delayed", "\\u", "actions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "f_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "new", "\\u", "action_", "(_", "action_", ",_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "perform", "\\u", "action_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "description", "\\u", "or", "\\u", "f_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "description", "\\u", "or", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrap_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "f_", "(_", "f_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrap_", "\\u\\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_", "get", "\\u", "f_", "(_", "description", "\\u", "or", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "module", "\\u", "from", "\\u", "descriptor_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "create", "\\u", "module", "\\u", "from", "\\u", "descrip", "tor", "\\u", "static_", "(_", "self_", "._", "id", "\\u", "scope_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "module_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "create", "\\u", "module", "\\u", "static_", "(_", "self_", "._", "id", "\\u", "scope_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "connecti", "on", "\\u", "from", "\\u", "ids_", "(_", "self_", ",_", "output", "\\u", "id_", ",_", "output", "\\u", "port", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", ",_", "input", "\\u", "port", "\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "module_", "=_", "self_", "._", "current", "\\u", "pipeline_", "._", "modules_", "[_", "output", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "module_", "=_", "self_", "._", "current", "\\u", "pipeline_", "._", "modules_", "[_", "input", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "create", "\\u", "connection_", "(_", "output", "\\u", "module_", ",_", "output", "\\u", "port", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "module_", ",_", "input", "\\u", "port", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "function_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "create", "\\u", "function", "\\u", "static_", "(_", "self_", "._", "id", "\\u", "scope_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "module", "\\u", "from", "\\u", "descriptor_", "(_", "self_", ",_", "descriptor_", ",_", "x_", "=_", "0.0_", ",_", "y_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "=_", "self_", "._", "create", "\\u", "module", "\\u", "from", "\\u", "descriptor_", "(_", "descriptor_", ",_", "x_", ",_", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "module", "\\u", "action_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "module_", "(_", "self_", ",_", "identifier_", ",_", "name_", ",_", "namespace_", "=_", "''_", ",_", "x_", "=_", "0.0_", ",_", "y_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "add", "Modul", "e", "(", "x", ":", " ", "int", ",", " ", "y", ":", " ", "int", ",", " ", "identifi", "er", ",", " ", "name", ":", " ", "str", ",", " ", "namespace", "=''", ")", " ", "\\", "10", ";", " ", " ", " ", "->", " ", "Modul", "e", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "new", " ", "module", " ", "int", "o", " ", "the", " ", "current", " ", "pipeline", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "self_", "._", "create", "\\u", "module_", "(_", "identifier_", ",_", "name_", ",_", "namespace_", ",_", "x_", ",_", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "internal", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "module", "\\u", "action_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "module_", "(_", "self_", ",_", "module", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "delete", "\\u", "module", "(", "module", "\\u", "id", ":", " ", "int", ")", " ", "->", " ", "version", " ", "id", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "a", " ", "module", " ", "from", " ", "the", " ", "current", " ", "pipeline", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "delete", "\\u", "module", "\\u", "list_", "(_", "[_", "module", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "connection_", "(_", "self_", ",_", "output", "\\u", "id_", ",_", "output", "\\u", "port", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", ",_", "input", "\\u", "port", "\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "add", "\\u", "connecti", "on", "(", "output", "\\u", "id", ":", " ", "long", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "output", "\\u", "port", "\\u", "spec", ":", " ", "Port", "Spec", " ", "|", " ", "str", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "input", "\\u", "id", ":", " ", "long", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "input", "\\u", "port", "\\u", "spec", ":", " ", "Port", "Spec", " ", "|", " ", "str", ")", " ", "->", " ", "Connect", "ion", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "new", " ", "connecti", "on", " ", "int", "o", " ", "Vis", "trail", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "=_", "self_", "._", "create", "\\u", "connecti", "on", "\\u", "from", "\\u", "ids_", "(_", "output", "\\u", "id_", ",_", "output", "\\u", "port", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", ",_", "input", "\\u", "port", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "connecti", "on", "\\u", "action_", "(_", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "connection_", "(_", "self_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "delete", "\\u", "connecti", "on", "(", "id", ":", " ", "int", ")", " ", "->", " ", "version", " ", "id", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "a", " ", "connecti", "on", " ", "with", " ", "id", " ", "'", "id", "'", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "delete", "\\u", "connecti", "on", "\\u", "list_", "(_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vis", "trail", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "function_", "(_", "self_", ",_", "module_", ",_", "function", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", "=_", "self_", "._", "create", "\\u", "function_", "(_", "module_", ",_", "function", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "self_", "._", "add", "\\u", "function", "\\u", "action_", "(_", "module_", ",_", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 2, 2,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 2, 2, 2 ]
Imprecise assert
lvieirajr/mongorest/tests/resource/resource_meta.py
[ { "content": " def test_meta_adds_url_map_to_class_that_inherits_from_resource(self):\n class ResourceChild(Resource):\n rules = [Rule('/', methods=['GET'], endpoint='test')]\n\n def test(self, requet):\n return Response(status=999)\n\n for rule in ResourceChild.rules:\n self.assertTrue(rule in list(ResourceChild.url_map.iter_rules()))", "metadata": "root.TestResourceMeta.test_meta_adds_url_map_to_class_that_inherits_from_resource", "header": "['class', 'TestResourceMeta', '(', 'TestCase', ')', ':', '___EOS___']", "index": 12 }, { "content": " def test_meta_adds_url_map_to_class_that_inherits_from_resources_child_classes(self):\n class ResourceChild1(Resource):\n rules = [Rule('/', methods=['GET'], endpoint='test1')]\n\n def test1(self, requet):\n return Response(status=999)\n\n class ResourceChild2(Resource):\n rules = [Rule('/', methods=['GET'], endpoint='test2')]\n\n def test2(self, requet):\n return Response(status=999)\n\n class ResourceChildsChild(ResourceChild1, ResourceChild2):\n pass\n\n for rule in ResourceChild1.rules + ResourceChild2.rules:\n self.assertTrue(\n rule in list(ResourceChildsChild.url_map.iter_rules())\n )", "metadata": "root.TestResourceMeta.test_meta_adds_url_map_to_class_that_inherits_from_resources_child_classes", "header": "['class', 'TestResourceMeta', '(', 'TestCase', ')', ':', '___EOS___']", "index": 22 } ]
[ { "span": "self.assertTrue(rule in list(ResourceChild.url_map.iter_rules()))", "start_line": 20, "start_column": 12, "end_line": 20, "end_column": 77 }, { "span": "self.assertTrue(\n rule in list(ResourceChildsChild.url_map.iter_rules())\n )", "start_line": 39, "start_column": 12, "end_line": 41, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Reso", "urc", "e", "Meta_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "meta", "\\u", "adds", "\\u", "url", "\\u", "map", "\\u", "to", "\\u", "class", "\\u", "tha", "t", "\\u", "inherits", "\\u", "from", "\\u", "resource_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Reso", "urc", "e", "Child_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "[_", "Rule_", "(_", "'/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ",_", "endpoint_", "=_", "'", "test", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "self_", ",_", "reque", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "status_", "=_", "999_", ")_", "\\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_", "rule_", "in_", "Reso", "urc", "e", "Child_", "._", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "rule_", "in_", "list_", "(_", "Reso", "urc", "e", "Child_", "._", "url", "\\u", "map_", "._", "iter", "\\u", "rules_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Reso", "urc", "e", "Meta_", "(_", "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", "meta", "\\u", "adds", "\\u", "url", "\\u", "map", "\\u", "to", "\\u", "class", "\\u", "tha", "t", "\\u", "inherits", "\\u", "from", "\\u", "resource", "s", "\\u", "child", "\\u", "classes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Reso", "urc", "e", "Chil", "d1_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "[_", "Rule_", "(_", "'/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ",_", "endpoint_", "=_", "'", "test", "1", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test1_", "(_", "self_", ",_", "reque", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "status_", "=_", "999_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Chil", "d2_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "[_", "Rule_", "(_", "'/'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ",_", "endpoint_", "=_", "'", "test", "2", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test2_", "(_", "self_", ",_", "reque", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "status_", "=_", "999_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Chil", "ds", "Child_", "(_", "Reso", "urc", "e", "Chil", "d1_", ",_", "Reso", "urc", "e", "Chil", "d2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "rule_", "in_", "Reso", "urc", "e", "Chil", "d1_", "._", "rules_", "+_", "Reso", "urc", "e", "Chil", "d2_", "._", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rule_", "in_", "list_", "(_", "Reso", "urc", "e", "Chil", "ds", "Child_", "._", "url", "\\u", "map_", "._", "iter", "\\u", "rules_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
pingali/dgit/dgitcore/contrib/repomanagers/gitmanager.py
[ { "content": " def init(self, username, reponame, force, backend=None):\n \"\"\"\n Initialize a Git repo\n\n Parameters\n ----------\n\n username, reponame : Repo name is tuple (name, reponame)\n force: force initialization of the repo even if exists\n backend: backend that must be used for this (e.g. s3)\n \"\"\"\n key = self.key(username, reponame)\n\n # In local filesystem-based server, add a repo\n server_repodir = self.server_rootdir(username,\n reponame,\n create=False)\n\n # Force cleanup if needed\n if os.path.exists(server_repodir) and not force:\n raise RepositoryExists()\n\n if os.path.exists(server_repodir):\n shutil.rmtree(server_repodir)\n os.makedirs(server_repodir)\n\n # Initialize the repo\n with cd(server_repodir):\n git.init(\".\", \"--bare\")\n\n if backend is not None:\n backend.init_repo(server_repodir)\n\n # Now clone the filesystem-based repo\n repodir = self.rootdir(username, reponame, create=False)\n\n # Prepare it if needed\n if os.path.exists(repodir) and not force:\n raise Exception(\"Local repo already exists\")\n if os.path.exists(repodir):\n shutil.rmtree(repodir)\n os.makedirs(repodir)\n\n # Now clone...\n with cd(os.path.dirname(repodir)):\n git.clone(server_repodir, '--no-hardlinks')\n\n url = server_repodir\n if backend is not None:\n url = backend.url(username, reponame)\n\n repo = Repo(username, reponame)\n repo.manager = self\n repo.remoteurl = url\n repo.rootdir = self.rootdir(username, reponame)\n\n self.add(repo)\n return repo", "metadata": "root.GitRepoManager.init", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 229 }, { "content": " def clone(self, url, backend=None):\n \"\"\"\n Clone a URL\n\n Parameters\n ----------\n\n url : URL of the repo. Supports s3://, git@, http://\n \"\"\"\n\n\n # s3://bucket/git/username/repo.git\n username = self.username\n reponame = url.split(\"/\")[-1] # with git\n reponame = reponame.replace(\".git\",\"\")\n\n key = (username, reponame)\n\n # In local filesystem-based server, add a repo\n server_repodir = self.server_rootdir(username,\n reponame,\n create=False)\n\n rootdir = self.rootdir(username, reponame, create=False)\n\n\n if backend is None:\n # Backend is standard git repo (https://, git@...)\n with cd(os.path.dirname(rootdir)):\n self._run(['clone', '--no-hardlinks', url])\n else:\n # Backend is s3\n # Sync if needed.\n if not os.path.exists(server_repodir):\n # s3 -> .dgit/git/pingali/hello.git -> .dgit/datasets/pingali/hello\n backend.clone_repo(url, server_repodir)\n\n # After sync clone,\n with cd(os.path.dirname(rootdir)):\n self._run(['clone', '--no-hardlinks', server_repodir])\n\n\n # Insert the notes push\n if True:\n configfile = os.path.join(rootdir, '.git', 'config')\n content = open(configfile).read()\n original = \"fetch = +refs/heads/*:refs/remotes/origin/*\"\n replacement =\"\"\"fetch = +refs/heads/*:refs/remotes/origin/*\\n fetch = +refs/notes/*:refs/notes/*\"\"\"\n if \"notes\" not in content:\n content = content.replace(original, replacement)\n with open(configfile, 'w') as fd:\n fd.write(content)\n\n # Pull the notes if any as well..\n with cd(rootdir):\n self._run(['pull','origin'])\n\n # Insert the object into the internal table we maintain...\n r = Repo(username, reponame)\n r.rootdir = rootdir\n r.remoteurl = url\n r.manager = self\n\n package = os.path.join(r.rootdir, 'datapackage.json')\n packagedata = open(package).read()\n r.package = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(packagedata)\n\n return self.add(r)", "metadata": "root.GitRepoManager.clone", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 288 }, { "content": " def add_raw(self, repo, files):\n result = None\n with cd(repo.rootdir):\n try:\n result = self._run([\"add\"] + files)\n except:\n pass", "metadata": "root.GitRepoManager.add_raw", "header": "['class', 'GitRepoManager', '(', 'RepoManagerBase', ')', ':', '___EOS___']", "index": 474 } ]
[ { "span": "key ", "start_line": 240, "start_column": 8, "end_line": 240, "end_column": 11 }, { "span": "key ", "start_line": 304, "start_column": 8, "end_line": 304, "end_column": 11 }, { "span": "result ", "start_line": 478, "start_column": 16, "end_line": 478, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "username_", ",_", "repon", "ame_", ",_", "force_", ",_", "backend_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "a", " ", "Git", " ", "repo", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ",", " ", "repon", "ame", " ", ":", " ", "Rep", "o", " ", "name", " ", "is", " ", "tuple", " ", "(", "name", ",", " ", "repon", "ame", ")", "\\", "10", ";", " ", " ", " ", " ", "force", ":", " ", "force", " ", "initialization", " ", "of", " ", "the", " ", "repo", " ", "even", " ", "if", " ", "exist", "s", "\\", "10", ";", " ", " ", " ", " ", "back", "end", ":", " ", "back", "end", " ", "tha", "t", " ", "must", " ", "be", " ", "used", " ", "for", " ", "this", " ", "(", "e", ".", "g", ".", " ", "s3", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "key_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "local", " ", "filesystem", "-", "based", " ", "server", ",", " ", "add", " ", "a", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "repo", "dir_", "=_", "self_", "._", "server", "\\u", "rootdir_", "(_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repon", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Force", " ", "clean", "up", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "server", "\\u", "repo", "dir_", ")_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Repos", "itor", "y", "Exists_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "server", "\\u", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "the", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "cd_", "(_", "server", "\\u", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "._", "init_", "(_", "\".\"_", ",_", "\"--", "bare", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "backend_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "._", "init", "\\u", "repo_", "(_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "clone", " ", "the", " ", "filesystem", "-", "based", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo", "dir_", "=_", "self_", "._", "rootdir_", "(_", "username_", ",_", "repon", "ame_", ",_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "it", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "repo", "dir_", ")_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Local", " ", "repo", " ", "alr", "ead", "y", " ", "exist", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "clone", "..._", "\\u\\u\\uNL\\u\\u\\u_", "with_", "cd_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "repo", "dir_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "._", "clone_", "(_", "server", "\\u", "repo", "dir_", ",_", "'--", "no", "-", "hard", "link", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "server", "\\u", "repo", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "backend_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "backend_", "._", "url_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo_", "=_", "Repo_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "manager_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "remote", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "rootdir_", "=_", "self_", "._", "rootdir_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone_", "(_", "self_", ",_", "url_", ",_", "backend_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clone", " ", "a", " ", "URL", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "url", " ", ":", " ", "URL", " ", "of", " ", "the", " ", "repo", ".", " ", "Supp", "orts", " ", "s3", "://", ",", " ", "git", "@", ",", " ", "http", "://", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "s3", "://", "bucket", "/", "git", "/", "user", "name", "/", "repo", ".", "git_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "self_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repon", "ame_", "=_", "url_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "-_", "1_", "]_", "#", " ", "with", " ", "git_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repon", "ame_", "=_", "repon", "ame_", "._", "replace_", "(_", "\".", "git", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "local", " ", "filesystem", "-", "based", " ", "server", ",", " ", "add", " ", "a", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "repo", "dir_", "=_", "self_", "._", "server", "\\u", "rootdir_", "(_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repon", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rootdir_", "=_", "self_", "._", "rootdir_", "(_", "username_", ",_", "repon", "ame_", ",_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "backend_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Back", "end", " ", "is", " ", "standard", " ", "git", " ", "repo", " ", "(", "https", "://", ",", " ", "git", "@", "...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "cd_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "rootdir_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "[_", "'", "clone", "'_", ",_", "'--", "no", "-", "hard", "link", "s", "'_", ",_", "url_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Back", "end", " ", "is", " ", "s3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sync", " ", "if", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "server", "\\u", "repo", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "s3", " ", "->", " ", ".", "dg", "it", "/", "git", "/", "ping", "ali", "/", "hell", "o", ".", "git", " ", "->", " ", ".", "dg", "it", "/", "dataset", "s", "/", "ping", "ali", "/", "hello_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backend_", "._", "clone", "\\u", "repo_", "(_", "url_", ",_", "server", "\\u", "repo", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Af", "ter", " ", "sync", " ", "clone", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "cd_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "rootdir_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "[_", "'", "clone", "'_", ",_", "'--", "no", "-", "hard", "link", "s", "'_", ",_", "server", "\\u", "repo", "dir_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "the", " ", "note", "s", " ", "push_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "configfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "rootdir_", ",_", "'.", "git", "'_", ",_", "'", "config", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "open_", "(_", "configfile_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original_", "=_", "\"", "fetch", " ", "=", " ", "+", "refs", "/", "head", "s", "/*", ":", "refs", "/", "remotes", "/", "orig", "in", "/*\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replacement_", "=_", "\"\"\"", "fetch", " ", "=", " ", "+", "refs", "/", "head", "s", "/*", ":", "refs", "/", "remotes", "/", "orig", "in", "/*", "\\\\", "n", " ", " ", " ", " ", "fetch", " ", "=", " ", "+", "refs", "/", "note", "s", "/*", ":", "refs", "/", "note", "s", "/*", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "note", "s", "\"_", "not_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "content_", "._", "replace_", "(_", "original_", ",_", "replacement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "configfile_", ",_", "'", "w", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fd_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pul", "l", " ", "the", " ", "note", "s", " ", "if", " ", "any", " ", "as", " ", "well", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "cd_", "(_", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "[_", "'", "pull", "'_", ",_", "'", "orig", "in", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "the", " ", "object", " ", "int", "o", " ", "the", " ", "internal", " ", "table", " ", "we", " ", "maintain", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "=_", "Repo_", "(_", "username_", ",_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "rootdir_", "=_", "rootdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "remote", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "manager_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "=_", "os_", "._", "path_", "._", "join_", "(_", "r_", "._", "rootdir_", ",_", "'", "datap", "ack", "age", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package", "data_", "=_", "open_", "(_", "package_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "package_", "=_", "json_", "._", "JSO", "ND", "ecode", "r_", "(_", "object\\u", "pair", "s", "\\u", "hook_", "=_", "collections_", "._", "Order", "ed", "Dict_", ")_", "._", "decode_", "(_", "package", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "add_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Rep", "o", "Manager_", "(_", "Rep", "o", "Manager", "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_", "add", "\\u", "raw_", "(_", "self_", ",_", "repo_", ",_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\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_", "=_", "self_", "._", "\\u", "run_", "(_", "[_", "\"", "add", "\"_", "]_", "+_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
An assert statement has a side-effect
grantjenks/sorted_containers/tests/test_coverage_sortedlist.py
[ { "content": "def test_discard():\n slt = SortedList()\n\n assert slt.discard(0) == None\n assert len(slt) == 0\n slt._check()\n\n slt = SortedList([1, 2, 2, 2, 3, 3, 5], load=4)\n\n slt.discard(6)\n slt._check()\n slt.discard(4)\n slt._check()\n slt.discard(2)\n slt._check()\n\n assert all(tup[0] == tup[1] for tup in zip(slt, [1, 2, 2, 3, 3, 5]))", "metadata": "root.test_discard", "header": "['module', '___EOS___']", "index": 81 }, { "content": "def test_remove():\n slt = SortedList()\n\n assert slt.discard(0) == None\n assert len(slt) == 0\n slt._check()\n\n slt = SortedList([1, 2, 2, 2, 3, 3, 5], load=4)\n\n slt.remove(2)\n slt._check()\n\n assert all(tup[0] == tup[1] for tup in zip(slt, [1, 2, 2, 3, 3, 5]))", "metadata": "root.test_remove", "header": "['module', '___EOS___']", "index": 99 }, { "content": "def test_pop():\n slt = SortedList(range(10), load=4)\n slt._check()\n assert slt.pop() == 9\n slt._check()\n assert slt.pop(0) == 0\n slt._check()\n assert slt.pop(-2) == 7\n slt._check()\n assert slt.pop(4) == 5\n slt._check()", "metadata": "root.test_pop", "header": "['module', '___EOS___']", "index": 534 } ]
[ { "span": "assert slt.discard(0) == None", "start_line": 84, "start_column": 4, "end_line": 84, "end_column": 33 }, { "span": "assert slt.discard(0) == None", "start_line": 102, "start_column": 4, "end_line": 102, "end_column": 33 }, { "span": "assert slt.pop() == 9", "start_line": 537, "start_column": 4, "end_line": 537, "end_column": 25 }, { "span": "assert slt.pop(0) == 0", "start_line": 539, "start_column": 4, "end_line": 539, "end_column": 26 }, { "span": "assert slt.pop(-2) == 7", "start_line": 541, "start_column": 4, "end_line": 541, "end_column": 27 }, { "span": "assert slt.pop(4) == 5", "start_line": 543, "start_column": 4, "end_line": 543, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "discard_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sl", "t_", "=_", "Sorte", "d", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "sl", "t_", "._", "discard_", "(_", "0_", ")_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "sl", "t_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sl", "t_", "=_", "Sorte", "d", "List_", "(_", "[_", "1_", ",_", "2_", ",_", "2_", ",_", "2_", ",_", "3_", ",_", "3_", ",_", "5_", "]_", ",_", "load_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sl", "t_", "._", "discard_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "discard_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "discard_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "all_", "(_", "tup_", "[_", "0_", "]_", "==_", "tup_", "[_", "1_", "]_", "for_", "tup_", "in_", "zip_", "(_", "sl", "t_", ",_", "[_", "1_", ",_", "2_", ",_", "2_", ",_", "3_", ",_", "3_", ",_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "remove_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sl", "t_", "=_", "Sorte", "d", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "sl", "t_", "._", "discard_", "(_", "0_", ")_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "sl", "t_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sl", "t_", "=_", "Sorte", "d", "List_", "(_", "[_", "1_", ",_", "2_", ",_", "2_", ",_", "2_", ",_", "3_", ",_", "3_", ",_", "5_", "]_", ",_", "load_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sl", "t_", "._", "remove_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "all_", "(_", "tup_", "[_", "0_", "]_", "==_", "tup_", "[_", "1_", "]_", "for_", "tup_", "in_", "zip_", "(_", "sl", "t_", ",_", "[_", "1_", ",_", "2_", ",_", "2_", ",_", "3_", ",_", "3_", ",_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sl", "t_", "=_", "Sorte", "d", "List_", "(_", "range_", "(_", "10_", ")_", ",_", "load_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sl", "t_", "._", "pop_", "(_", ")_", "==_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sl", "t_", "._", "pop_", "(_", "0_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sl", "t_", "._", "pop_", "(_", "-_", "2_", ")_", "==_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sl", "t_", "._", "pop_", "(_", "4_", ")_", "==_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sl", "t_", "._", "\\u", "check_", "(_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 1, 1, 1, 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 ]
Unused import
tjguk/winsys/winsys/tests/test_acls.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport os, sys\nimport operator\n\nimport win32api\nimport win32con\nimport win32security\nimport ntsecuritycon\nimport tempfile\nfrom winsys._compat import unittest\n\nfrom winsys.tests import utils as testutils\nfrom winsys import accounts\nfrom winsys._security import _aces, _acls\n\neveryone, _, _ = win32security.LookupAccountName(None, \"Everyone\")\nme, _, _ = win32security.LookupAccountName(None, win32api.GetUserNameEx(win32con.NameSamCompatible))\n\n\nif __name__ == \"__main__\":\n unittest.main()\n if sys.stdout.isatty():\n raw_input(\"Press enter...\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@unittest.skipUnless(testutils.i_am_admin(), \"These tests must be run as Administrator\")\nclass TestACLs(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestACLs", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def test_acl_None(self):\n acl = _acls.acl(None)\n assert isinstance(acl, _acls.ACL) and acl.pyobject() is None", "metadata": "root.TestACLs.test_acl_None", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_acl_PyACL(self):\n dacl = win32security.ACL()\n dacl.AddAccessAllowedAceEx(win32security.ACL_REVISION_DS, 0, ntsecuritycon.FILE_READ_DATA, everyone)\n acl = _acls.acl(dacl).pyobject()\n assert dacl.GetAceCount() == 1\n assert dacl.GetAce(0) ==((win32security.ACCESS_ALLOWED_ACE_TYPE, 0), ntsecuritycon.FILE_READ_DATA, everyone)", "metadata": "root.TestACLs.test_acl_PyACL", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_acl_ACL(self):\n acl0 = _acls.ACL()\n acl = _acls.acl(acl0)\n assert acl is acl0", "metadata": "root.TestACLs.test_acl_ACL", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_acl_iterable(self):\n daces0 = [(\"Everyone\", \"R\", \"Allow\"),(\"Administrators\", \"F\", \"Allow\")]\n def iteraces():\n for dace in daces0:\n yield dace\n assert list(_acls.dacl(iteraces())) == list(_aces.dace(dace) for dace in daces0)", "metadata": "root.TestACLs.test_acl_iterable", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_ACL_iterated(self):\n #\n # This includes a test for sorting, putting deny records first\n #\n acl = _acls.acl([(\"Everyone\", \"R\", \"Allow\"),(\"Administrators\", \"F\", \"Deny\")])\n assert list(acl) == [\n _aces.dace((\"Administrators\", \"F\", \"Deny\")),\n _aces.dace((\"Everyone\", \"R\", \"Allow\"))\n ]", "metadata": "root.TestACLs.test_ACL_iterated", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_ACL_append(self):\n acl = _acls.acl([(\"Everyone\", \"R\", \"Allow\")])\n acl.append((\"Administrators\", \"F\", \"Deny\"))\n assert list(acl) == [\n _aces.dace((\"Administrators\", \"F\", \"Deny\")),\n _aces.dace((\"Everyone\", \"R\", \"Allow\"))\n ]", "metadata": "root.TestACLs.test_ACL_append", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_ACL_getitem(self):\n acl = _acls.acl([(\"Everyone\", \"R\", \"Allow\"),(\"Administrators\", \"F\", \"Deny\")])\n #\n # Note that the list is *stored* in the order entered; it\n # is only returned(via pyobject) in sorted order.\n #\n assert acl[0] ==(\"Everyone\", \"R\", \"Allow\")", "metadata": "root.TestACLs.test_ACL_getitem", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_ACL_setitem(self):\n acl = _acls.acl([(\"Everyone\", \"R\", \"Allow\"),(\"Administrators\", \"F\", \"Deny\")])\n acl[0] =((me, \"R\", \"Allow\"))\n assert acl[0] ==(me, \"R\", \"Allow\")", "metadata": "root.TestACLs.test_ACL_setitem", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 72 }, { "content": " def test_ACL_delitem(self):\n acl = _acls.acl([(\"Everyone\", \"R\", \"Allow\"),(\"Administrators\", \"F\", \"Deny\")])\n del acl[0]\n assert list(acl) == [\n _aces.dace((\"Administrators\", \"F\", \"Deny\")),\n ]", "metadata": "root.TestACLs.test_ACL_delitem", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " def test_ACL_len(self):\n aces = [(\"Everyone\", \"R\", \"Allow\"),(\"Administrators\", \"F\", \"Deny\")]\n acl = _acls.acl(aces)\n assert len(acl) == len(aces)", "metadata": "root.TestACLs.test_ACL_len", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": " def test_ACL_nonzero(self):\n assert not _acls.acl(None)\n assert not _acls.acl([])\n assert _acls.acl([(\"Everyone\", \"R\", \"Allow\")])", "metadata": "root.TestACLs.test_ACL_nonzero", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 89 }, { "content": " def test_ACL_contains(self):\n aces = [(\"Everyone\", \"R\", \"Allow\"),(\"Administrators\", \"F\", \"Deny\")]\n acl = _acls.acl(aces)\n for ace in aces:\n assert ace in acl\n assert(\"Everyone\", \"F\", \"Deny\") not in acl", "metadata": "root.TestACLs.test_ACL_contains", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_DACL_public(self):\n acl = _acls.DACL.public()\n assert list(acl) == [(\"Everyone\", \"F\", \"ALLOW\")]", "metadata": "root.TestACLs.test_DACL_public", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": " def test_DACL_private(self):\n acl = _acls.DACL.private()\n assert list(acl) == [(me, \"F\", \"ALLOW\")]", "metadata": "root.TestACLs.test_DACL_private", "header": "['class', 'TestACLs', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 105 } ]
[ { "span": "import os, sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 14 }, { "span": "import operator", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 }, { "span": "import tempfile", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 15 }, { "span": "from winsys import accounts", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "win32", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32con_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "security_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nts", "ecu", "rity", "con_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wins", "ys_", "._", "\\u", "compat_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wins", "ys_", "._", "tests_", "import_", "utils_", "as_", "testutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wins", "ys_", "import_", "accounts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wins", "ys_", "._", "\\u", "security_", "import_", "\\u", "aces", "_", ",_", "\\u", "acls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "everyone", "_", ",_", "\\u_", ",_", "\\u_", "=_", "win32", "security_", "._", "Look", "up", "Account", "Name_", "(_", "None_", ",_", "\"", "Every", "one", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "me_", ",_", "\\u_", ",_", "\\u_", "=_", "win32", "security_", "._", "Look", "up", "Account", "Name_", "(_", "None_", ",_", "win32", "api_", "._", "Get", "User", "Name", "Ex_", "(_", "win32con_", "._", "Name", "Sam", "Compatible", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "stdout_", "._", "isatty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "input_", "(_", "\"", "Press", " ", "enter", "...\"_", ")_", "\\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_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "testutils_", "._", "i", "\\u", "am", "\\u", "admin_", "(_", ")_", ",_", "\"", "The", "se", " ", "tests", " ", "must", " ", "be", " ", "run", " ", "as", " ", "Administra", "tor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "acl", "\\u", "None_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "acl_", ",_", "\\u", "acls_", "._", "ACL", "_", ")_", "and_", "acl_", "._", "pyobj", "ect_", "(_", ")_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "acl", "\\u", "Py", "ACL", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dac", "l_", "=_", "win32", "security_", "._", "ACL", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dac", "l_", "._", "Add", "Access", "All", "owe", "d", "Ace", "Ex_", "(_", "win32", "security_", "._", "ACL", "\\u", "REVISION", "\\u", "DS_", ",_", "0_", ",_", "nts", "ecu", "rity", "con_", "._", "FILE", "\\u", "READ", "\\u", "DATA_", ",_", "everyone", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "dac", "l_", ")_", "._", "pyobj", "ect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dac", "l_", "._", "Get", "Ace", "Count_", "(_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dac", "l_", "._", "Get", "Ace", "_", "(_", "0_", ")_", "==_", "(_", "(_", "win32", "security_", "._", "ACCESS", "\\u", "ALLOWED", "\\u", "ACE", "\\u", "TYPE_", ",_", "0_", ")_", ",_", "nts", "ecu", "rity", "con_", "._", "FILE", "\\u", "READ", "\\u", "DATA_", ",_", "everyone", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "acl", "\\u", "ACL", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl", "0_", "=_", "\\u", "acls_", "._", "ACL", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "acl", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "acl_", "is_", "acl", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "acl", "\\u", "iterable_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dac", "es", "0_", "=_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ",_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "iter", "aces", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dac", "e_", "in_", "dac", "es", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "dac", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "list_", "(_", "\\u", "acls_", "._", "dac", "l_", "(_", "iter", "aces", "_", "(_", ")_", ")_", ")_", "==_", "list_", "(_", "\\u", "aces", "_", "._", "dac", "e_", "(_", "dac", "e_", ")_", "for_", "dac", "e_", "in_", "dac", "es", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "iterate", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "include", "s", " ", "a", " ", "test", " ", "for", " ", "sorting", ",", " ", "put", "ting", " ", "deny", " ", "record", "s", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ",_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "acl_", ")_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "aces", "_", "._", "dac", "e_", "(_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "aces", "_", "._", "dac", "e_", "(_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "append_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acl_", "._", "append_", "(_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "acl_", ")_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "aces", "_", "._", "dac", "e_", "(_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "aces", "_", "._", "dac", "e_", "(_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "getitem", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ",_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "list", " ", "is", " ", "*", "store", "d", "*", " ", "in", " ", "the", " ", "order", " ", "enter", "ed", ";", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "only", " ", "return", "ed", "(", "via", " ", "pyobj", "ect", ")", " ", "in", " ", "sorte", "d", " ", "order", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "acl_", "[_", "0_", "]_", "==_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "setitem", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ",_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acl_", "[_", "0_", "]_", "=_", "(_", "(_", "me_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "acl_", "[_", "0_", "]_", "==_", "(_", "me_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "deli", "tem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ",_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "acl_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "acl_", ")_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "aces", "_", "._", "dac", "e_", "(_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "len_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aces", "_", "=_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ",_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "aces", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "acl_", ")_", "==_", "len_", "(_", "aces", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "nonzero_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "\\u", "acls_", "._", "acl_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "\\u", "acls_", "._", "acl_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "acls_", "._", "acl_", "(_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ACL", "\\u", "contains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aces", "_", "=_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "R", "\"_", ",_", "\"", "All", "ow", "\"_", ")_", ",_", "(_", "\"", "Administra", "tors", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "acl_", "=_", "\\u", "acls_", "._", "acl_", "(_", "aces", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ace_", "in_", "aces", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "ace_", "in_", "acl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "Den", "y", "\"_", ")_", "not_", "in_", "acl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "DAC", "L", "\\u", "public_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "DAC", "L_", "._", "public_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "acl_", ")_", "==_", "[_", "(_", "\"", "Every", "one", "\"_", ",_", "\"", "F", "\"_", ",_", "\"", "ALLOW", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "ACL", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "DAC", "L", "\\u", "private_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "acl_", "=_", "\\u", "acls_", "._", "DAC", "L_", "._", "private_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "list_", "(_", "acl_", ")_", "==_", "[_", "(_", "me_", ",_", "\"", "F", "\"_", ",_", "\"", "ALLOW", "\"_", ")_", "]_", "\\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, 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, 0, 1, 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cigroup-ol/windml/examples/missingdata/reconstruction_prediction.py
[ { "content": "\"\"\"\nPrediction with Imputated Time Series\n-------------------------------------------------------------------------\n\nThe time series of the target turbine near Reno is destroyed missing at random\n(MAR) given a certain percentage of damage. The damaged time series is\nimputated using different imputation methods: last observation carried forward\n(LOCF), linear interpolation, multiple linear regression and kNN regression.\nThe imputated time series is used for short-term wind prediction employing the\nspatio-temporal time series model with multiple linear regression. The plot\nshows the prediction MSE depending on the rate of missing data for different\nimputation methods.\n\"\"\"\n\n# Author: Jendrik Poloczek <[email protected]>\n# License: BSD 3 clause\n\nfrom windml.datasets.nrel import NREL\nfrom windml.visualization.plot_timeseries import plot_timeseries\nfrom windml.preprocessing.preprocessing import destroy\nfrom windml.preprocessing.preprocessing import interpolate\nfrom windml.preprocessing.preprocessing import repair_nrel\nfrom sklearn.neighbors import KNeighborsRegressor\nfrom sklearn import linear_model\nfrom sklearn.svm import SVR\nfrom sklearn.grid_search import GridSearchCV\nfrom sklearn.cross_validation import KFold, cross_val_score\nfrom sklearn.neighbors import KNeighborsRegressor\nfrom sklearn import linear_model\n\nfrom windml.mapping.power_mapping import PowerMapping\nfrom sklearn.neighbors import KNeighborsRegressor\n\nimport matplotlib.pyplot as plt\nimport matplotlib.dates as md\nfrom pylab import *\nfrom matplotlib.ticker import FuncFormatter\n\nfrom numpy import array\nfrom itertools import product, chain\n\nparks = {\n 'carway': 30498,\n}\n\ntimestep = 600\nmethods = ['mreg_knn', 'mreg_lin', 'linear', 'forwardcopy']\nrates = [0.1, 0.3, 0.5, 0.7, 0.9]\ndestroy_method = 'mar'\nlabels = {'linear': 'Linear Interpolation', 'forwardcopy':'LOCF',\\\n 'mreg_knn' : 'KNN Regression','mreg_lin' : 'Linear Regression'}\n\n\n\n\n\nargfuncs = {'linear': static_linear,\n 'forwardcopy' : static_forwardcopy,\n 'mreg_knn' : static_mreg_knn,\n 'mreg_lin' : static_mreg_lin}\n\n# predict with imputated series\n\n# generating destroyed measurements which are constant over all\n# methods\n\ndata = []\n\nfor park in parks.keys():\n windpark = NREL().get_windpark_nearest(parks[park], 5, 2004)\n windpark_test = NREL().get_windpark_nearest(parks[park], 5, 2005)\n\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n\n for i in xrange(2):\n\n damaged_series = {}\n de = lambda (rate) : (rate, (destroy(measurements, method=destroy_method, percentage=rate)[0]))\n\n dseries = map(de, rates)\n for rate, series in dseries:\n damaged_series[rate] = series\n\n # with reconstruction\n\n def run(pars):\n method, rate = pars\n mse = experiment(method, windpark, windpark_test, damaged_series[rate], rate)\n return method, rate, mse\n\n results = map(run, list(chain(product(methods, rates))))\n\n encoding = lambda method, rate, mse, park :\\\n {\"method\": method,\\\n \"rate\": rate,\\\n \"mse\": mse,\\\n \"park\" : park }\n\n results = [encoding(method, rate, mse, park) for (method, rate, mse) in results]\n\n for result in results:\n data.append(result)\n\nmse = {}\nfor result in data:\n keys = mse.keys()\n key = (result['method'], result['rate'], result['park'])\n if(key not in keys):\n mse[key] = []\n mse[key].append(result['mse'])\n\n# calculate mean and var, std\nmean = {}\nvar = {}\nstd = {}\n\nfor key in mse.keys():\n if(key not in mean.keys()):\n mean[key] = []\n mean[key] = array(mse[key]).mean()\n\nfor key in mse.keys():\n if(key not in var.keys()):\n var[key] = []\n var[key] = array(mse[key]).var()\n\nfor key in mse.keys():\n if(key not in std.keys()):\n std[key] = []\n std[key] = array(mse[key]).std()\n\n## mean of all means of parks, std for this\namean = {}\nastd = {}\nfor method in methods:\n for rate in rates:\n means = []\n for park in parks.keys():\n means.append(mean[method, rate, park])\n amean[method, rate] = array(means).mean()\n astd[method, rate] = array(means).std()\n\nwith plt.style.context(\"fivethirtyeight\"):\n park = \"carway\"\n figure = plt.figure(figsize=(8, 5))\n for method in methods:\n rmses = []\n yerrs = []\n for rate in rates:\n yerrs.append(std[method, rate, park])\n rmses.append(mean[method, rate, park])\n \n plt.errorbar(rates, rmses, yerr=yerrs,\\\n label=labels[method], linestyle=\"--\", marker=\"o\")\n\n plt.xlabel(\"Rate of Missing Data\")\n plt.ylabel(\"Prediction MSE\")\n plt.xlim([0.1, 0.9])\n plt.ylim([12.5, 16])\n plt.legend(loc=\"upper left\")\n plt.show()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def static_mreg_knn(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n iargs = {'method':'mreg',\n 'timestep': timestep,\n 'neighbor_series': nseries,\n 'reg' : 'knn',\n 'regargs' : {'kfold': 5, 'n' : [5,10,20,50,100], 'variant' : 'uniform'}}\n\n return iargs, nseries", "metadata": "root.static_mreg_knn", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def static_mreg_lin(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n iargs = {'method':'mreg',\n 'timestep': timestep,\n 'neighbor_series': nseries,\n 'reg' : 'linear_model'}\n return iargs, nseries", "metadata": "root.static_mreg_lin", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def static_linear(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n return {'method':'linear','timestep': timestep}, nseries", "metadata": "root.static_linear", "header": "['module', '___EOS___']", "index": 78 }, { "content": "def static_forwardcopy(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n return {'method':'forwardcopy','timestep': timestep}, nseries", "metadata": "root.static_forwardcopy", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def experiment(method, windpark, windpark_test, damaged, rate):\n args, nseries = argfuncs[method](windpark)\n reconstructed = interpolate(damaged, **args)\n\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n turbines = windpark.get_turbines()\n\n for t in range(len(turbines)):\n turbines[t].add_measurements(\\\n repair_nrel(turbines[t].get_measurements()[:10000]))\n\n # this is the target turbine, use the reconstructed here.\n turbines[-1].add_measurements(reconstructed)\n\n feature_window, horizon = 3,3\n\n mapping = PowerMapping()\n # with damaged\n X = mapping.get_features_park(windpark, feature_window, horizon)\n Y = mapping.get_labels_turbine(target, feature_window, horizon)\n\n train_to = int(math.floor(len(X)))\n train_step, test_step = 1, 1\n\n reg = linear_model.LinearRegression()\n reg = reg.fit(X[0:train_to:train_step], Y[0:train_to:train_step])\n\n # USE THE 2005 YEAR FOR TESTING, WITHOUT DAMAGE\n # predict on second year without damage\n\n turbines = windpark_test.get_turbines()\n for t in turbines:\n t.add_measurements(repair_nrel(t.get_measurements()[:10000]))\n target_test = windpark_test.get_target()\n\n XT = mapping.get_features_park(windpark_test, feature_window, horizon)\n test_to = int(math.floor(len(XT)))\n\n YT = mapping.get_labels_turbine(target_test, feature_window, horizon)[:test_to]\n y_hat = reg.predict(XT[:test_to])\n\n mse_y_hat = 0\n for i in range(0, len(y_hat)):\n y = YT[i]\n mse_y_hat += (y_hat[i] - y) ** 2\n\n mse_y_hat /= float(len(y_hat))\n\n return mse_y_hat", "metadata": "root.experiment", "header": "['module', '___EOS___']", "index": 100 } ]
[ { "span": "from windml.visualization.plot_timeseries import plot_timeseries", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 64 }, { "span": "from sklearn.neighbors import KNeighborsRegressor", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 49 }, { "span": "from sklearn.svm import SVR", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 27 }, { "span": "from sklearn.grid_search import GridSearchCV", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 44 }, { "span": "from sklearn.cross_validation import KFold, cross_val_score", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 59 }, { "span": "from sklearn.neighbors import KNeighborsRegressor", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 49 }, { "span": "from sklearn.neighbors import KNeighborsRegressor", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 49 }, { "span": "import matplotlib.dates as md", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 29 }, { "span": "from matplotlib.ticker import FuncFormatter", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Prediction", " ", "with", " ", "Imp", "utat", "ed", " ", "Time", " ", "Serie", "s", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "\\", "10", ";", "\\", "10", ";", "The", " ", "time", " ", "series", " ", "of", " ", "the", " ", "target", " ", "turb", "ine", " ", "near", " ", "Ren", "o", " ", "is", " ", "destroy", "ed", " ", "missi", "ng", " ", "at", " ", "random", "\\", "10", ";", "(", "MAR", ")", " ", "give", "n", " ", "a", " ", "cert", "ain", " ", "percentage", " ", "of", " ", "damage", ".", " ", "The", " ", "damage", "d", " ", "time", " ", "series", " ", "is", "\\", "10", ";", "imput", "ated", " ", "usi", "ng", " ", "different", " ", "imput", "ation", " ", "method", "s", ":", " ", "last", " ", "observa", "tion", " ", "carri", "ed", " ", "forward", "\\", "10", ";", "(", "LOC", "F", "),", " ", "linear", " ", "interpolati", "on", ",", " ", "multiple", " ", "linear", " ", "regress", "ion", " ", "and", " ", "k", "NN", " ", "regress", "ion", ".", "\\", "10", ";", "The", " ", "imput", "ated", " ", "time", " ", "series", " ", "is", " ", "used", " ", "for", " ", "short", "-", "term", " ", "wind", " ", "predicti", "on", " ", "employ", "ing", " ", "the", "\\", "10", ";", "spat", "io", "-", "tempora", "l", " ", "time", " ", "series", " ", "model", " ", "with", " ", "multiple", " ", "linear", " ", "regress", "ion", ".", " ", "The", " ", "plot", "\\", "10", ";", "show", "s", " ", "the", " ", "predicti", "on", " ", "MSE", " ", "depend", "ing", " ", "on", " ", "the", " ", "rate", " ", "of", " ", "missi", "ng", " ", "data", " ", "for", " ", "different", "\\", "10", ";", "imput", "ation", " ", "method", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "Jen", "dri", "k", " ", "Pol", "oc", "ze", "k", " ", "<", "jen", "dri", "k", ".", "pol", "oc", "ze", "k", "@", "made", "with", "tea", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "3", " ", "clause_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wind", "ml_", "._", "datasets_", "._", "nre", "l_", "import_", "NR", "EL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wind", "ml_", "._", "visualization", "_", "._", "plot", "\\u", "timeseries_", "import_", "plot", "\\u", "timeseries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wind", "ml_", "._", "preprocessing_", "._", "preprocessing_", "import_", "destroy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wind", "ml_", "._", "preprocessing_", "._", "preprocessing_", "import_", "interpolate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wind", "ml_", "._", "preprocessing_", "._", "preprocessing_", "import_", "repair", "\\u", "nre", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "neighbors_", "import_", "KN", "eig", "hbo", "rs", "Regressor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "linear", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "svm_", "import_", "SV", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "grid", "\\u", "search_", "import_", "Grid", "Sear", "ch", "CV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "cross", "\\u", "validation_", "import_", "KF", "old_", ",_", "cross", "\\u", "val", "\\u", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "neighbors_", "import_", "KN", "eig", "hbo", "rs", "Regressor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "import_", "linear", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wind", "ml_", "._", "mapping_", "._", "power", "\\u", "mapping_", "import_", "Power", "Mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "neighbors_", "import_", "KN", "eig", "hbo", "rs", "Regressor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "dates_", "as_", "md_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pylab_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "ticker_", "import_", "Func", "Formatter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "product_", ",_", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "park", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "car", "way", "'_", ":_", "304", "98_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "timestep_", "=_", "600_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "methods_", "=_", "[_", "'", "mre", "g", "\\u", "knn", "'_", ",_", "'", "mre", "g", "\\u", "lin", "'_", ",_", "'", "linear", "'_", ",_", "'", "forward", "copy", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rates_", "=_", "[_", "0.1_", ",_", "0.3_", ",_", "0.5_", ",_", "0.7_", ",_", "0.9_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destroy", "\\u", "method_", "=_", "'", "mar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "{_", "'", "linear", "'_", ":_", "'", "Linea", "r", " ", "Interpolation", "'_", ",_", "'", "forward", "copy", "'_", ":_", "'", "LOC", "F", "'_", ",_", "'", "mre", "g", "\\u", "knn", "'_", ":_", "'", "KN", "N", " ", "Regr", "ession", "'_", ",_", "'", "mre", "g", "\\u", "lin", "'_", ":_", "'", "Linea", "r", " ", "Regr", "ession", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "arg", "funcs_", "=_", "{_", "'", "linear", "'_", ":_", "static", "\\u", "linear_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "forward", "copy", "'_", ":_", "static", "\\u", "forward", "copy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mre", "g", "\\u", "knn", "'_", ":_", "static", "\\u", "mre", "g", "\\u", "knn", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mre", "g", "\\u", "lin", "'_", ":_", "static", "\\u", "mre", "g", "\\u", "lin_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "predi", "ct", " ", "with", " ", "imput", "ated", " ", "series_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "ing", " ", "destroy", "ed", " ", "measure", "ment", "s", " ", "whi", "ch", " ", "are", " ", "constant", " ", "over", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "park", "_", "in_", "park", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wind", "park", "_", "=_", "NR", "EL_", "(_", ")_", "._", "get", "\\u", "wind", "park", "\\u", "nearest_", "(_", "park", "s_", "[_", "park", "_", "]_", ",_", "5_", ",_", "2004", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wind", "park", "\\u", "test_", "=_", "NR", "EL_", "(_", ")_", "._", "get", "\\u", "wind", "park", "\\u", "nearest_", "(_", "park", "s_", "[_", "park", "_", "]_", ",_", "5_", ",_", "2005", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "damage", "d\\u", "series_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "de_", "=_", "lambda_", "(_", "rate_", ")_", ":_", "(_", "rate_", ",_", "(_", "destroy_", "(_", "measurements_", ",_", "method_", "=_", "destroy", "\\u", "method_", ",_", "percentage_", "=_", "rate_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dse", "ries_", "=_", "map_", "(_", "de_", ",_", "rates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rate_", ",_", "series_", "in_", "dse", "ries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "damage", "d\\u", "series_", "[_", "rate_", "]_", "=_", "series_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "reconstruction", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "pars_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", ",_", "rate_", "=_", "pars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mse_", "=_", "experiment_", "(_", "method_", ",_", "wind", "park", "_", ",_", "wind", "park", "\\u", "test_", ",_", "damage", "d\\u", "series_", "[_", "rate_", "]_", ",_", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "method_", ",_", "rate_", ",_", "mse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "map_", "(_", "run_", ",_", "list_", "(_", "chain_", "(_", "product_", "(_", "methods_", ",_", "rates_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "lambda_", "method_", ",_", "rate_", ",_", "mse_", ",_", "park", "_", ":_", "{_", "\"", "method", "\"_", ":_", "method_", ",_", "\"", "rate", "\"_", ":_", "rate_", ",_", "\"", "mse", "\"_", ":_", "mse_", ",_", "\"", "park", "\"_", ":_", "park", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "encoding_", "(_", "method_", ",_", "rate_", ",_", "mse_", ",_", "park", "_", ")_", "for_", "(_", "method_", ",_", "rate_", ",_", "mse_", ")_", "in_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "result_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "append_", "(_", "result_", ")_", "\\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_", "mse_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "mse_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "(_", "result_", "[_", "'", "method", "'_", "]_", ",_", "result_", "[_", "'", "rate", "'_", "]_", ",_", "result_", "[_", "'", "park", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "key_", "not_", "in_", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mse_", "[_", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mse_", "[_", "key_", "]_", "._", "append_", "(_", "result_", "[_", "'", "mse", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "mean", " ", "and", " ", "var", ",", " ", "std_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "mse_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "key_", "not_", "in_", "mean_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mean_", "[_", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mean_", "[_", "key_", "]_", "=_", "array_", "(_", "mse_", "[_", "key_", "]_", ")_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "mse_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "key_", "not_", "in_", "var_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "[_", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "var_", "[_", "key_", "]_", "=_", "array_", "(_", "mse_", "[_", "key_", "]_", ")_", "._", "var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "mse_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "key_", "not_", "in_", "std_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "std_", "[_", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "std_", "[_", "key_", "]_", "=_", "array_", "(_", "mse_", "[_", "key_", "]_", ")_", "._", "std_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "mean", " ", "of", " ", "all", " ", "means", " ", "of", " ", "park", "s", ",", " ", "std", " ", "for", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ame", "an_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ast", "d_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", "in_", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rate_", "in_", "rates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "means_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "park", "_", "in_", "park", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "means_", "._", "append_", "(_", "mean_", "[_", "method_", ",_", "rate_", ",_", "park", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ame", "an_", "[_", "method_", ",_", "rate_", "]_", "=_", "array_", "(_", "means_", ")_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ast", "d_", "[_", "method_", ",_", "rate_", "]_", "=_", "array_", "(_", "means_", ")_", "._", "std_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "plt_", "._", "style_", "._", "context_", "(_", "\"", "five", "thi", "rty", "eight", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "park", "_", "=_", "\"", "car", "way", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "figure_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "8_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", "in_", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rmse", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yer", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rate_", "in_", "rates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yer", "rs_", "._", "append_", "(_", "std_", "[_", "method_", ",_", "rate_", ",_", "park", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "s_", "._", "append_", "(_", "mean_", "[_", "method_", ",_", "rate_", ",_", "park", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "errorbar_", "(_", "rates_", ",_", "rmse", "s_", ",_", "yerr_", "=_", "yer", "rs_", ",_", "label_", "=_", "labels_", "[_", "method_", "]_", ",_", "linestyle_", "=_", "\"--\"_", ",_", "marker_", "=_", "\"", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "xlabel_", "(_", "\"", "Rat", "e", " ", "of", " ", "Missing", " ", "Data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylabel_", "(_", "\"", "Prediction", " ", "MSE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "[_", "0.1_", ",_", "0.9_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "[_", "12.", "5_", ",_", "16_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "legend_", "(_", "loc_", "=_", "\"", "upper", " ", "left", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "static", "\\u", "mre", "g", "\\u", "knn", "_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iar", "gs_", "=_", "{_", "'", "method", "'_", ":_", "'", "mre", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestep", "'_", ":_", "timestep_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "neighbor", "\\u", "series", "'_", ":_", "nse", "ries_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reg", "'_", ":_", "'", "knn", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rega", "rg", "s", "'_", ":_", "{_", "'", "kf", "old", "'_", ":_", "5_", ",_", "'", "n", "'_", ":_", "[_", "5_", ",_", "10_", ",_", "20_", ",_", "50_", ",_", "100_", "]_", ",_", "'", "variant", "'_", ":_", "'", "uniform", "'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "iar", "gs_", ",_", "nse", "ries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "static", "\\u", "mre", "g", "\\u", "lin_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iar", "gs_", "=_", "{_", "'", "method", "'_", ":_", "'", "mre", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestep", "'_", ":_", "timestep_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "neighbor", "\\u", "series", "'_", ":_", "nse", "ries_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reg", "'_", ":_", "'", "linear", "\\u", "model", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "iar", "gs_", ",_", "nse", "ries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "static", "\\u", "linear_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "method", "'_", ":_", "'", "linear", "'_", ",_", "'", "timestep", "'_", ":_", "timestep_", "}_", ",_", "nse", "ries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "static", "\\u", "forward", "copy_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "method", "'_", ":_", "'", "forward", "copy", "'_", ",_", "'", "timestep", "'_", ":_", "timestep_", "}_", ",_", "nse", "ries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "experiment_", "(_", "method_", ",_", "wind", "park", "_", ",_", "wind", "park", "\\u", "test_", ",_", "damage", "d_", ",_", "rate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", ",_", "nse", "ries_", "=_", "arg", "funcs_", "[_", "method_", "]_", "(_", "wind", "park", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reconstruct", "ed_", "=_", "interpolate_", "(_", "damage", "d_", ",_", "**_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "turb", "ines_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "range_", "(_", "len_", "(_", "turb", "ines_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "turb", "ines_", "[_", "t_", "]_", "._", "add", "\\u", "measurements_", "(_", "repair", "\\u", "nre", "l_", "(_", "turb", "ines_", "[_", "t_", "]_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "the", " ", "target", " ", "turb", "ine", ",", " ", "use", " ", "the", " ", "reconstruct", "ed", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "turb", "ines_", "[_", "-_", "1_", "]_", "._", "add", "\\u", "measurements_", "(_", "reconstruct", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "\\u", "window_", ",_", "horizon_", "=_", "3_", ",_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapping_", "=_", "Power", "Mapping_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with", " ", "damage", "d_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "mapping_", "._", "get", "\\u", "features", "\\u", "park", "_", "(_", "wind", "park", "_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "mapping_", "._", "get", "\\u", "labels", "\\u", "turb", "ine_", "(_", "target_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "to_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "len_", "(_", "X_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "step_", ",_", "test\\u", "step_", "=_", "1_", ",_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "=_", "linear", "\\u", "model_", "._", "Linea", "r", "Regression_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "=_", "reg_", "._", "fit_", "(_", "X_", "[_", "0_", ":_", "train", "\\u", "to_", ":_", "train", "\\u", "step_", "]_", ",_", "Y_", "[_", "0_", ":_", "train", "\\u", "to_", ":_", "train", "\\u", "step_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "USE", " ", "THE", " ", "2005", " ", "YEA", "R", " ", "FOR", " ", "TESTING", ",", " ", "WITH", "OUT", " ", "DA", "MAGE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "predi", "ct", " ", "on", " ", "second", " ", "year", " ", "with", "out", " ", "damage_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "turb", "ines_", "=_", "wind", "park", "\\u", "test_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "turb", "ines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "add", "\\u", "measurements_", "(_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "\\u", "test_", "=_", "wind", "park", "\\u", "test_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "XT", "_", "=_", "mapping_", "._", "get", "\\u", "features", "\\u", "park", "_", "(_", "wind", "park", "\\u", "test_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "to_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "len_", "(_", "XT", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "YT", "_", "=_", "mapping_", "._", "get", "\\u", "labels", "\\u", "turb", "ine_", "(_", "target", "\\u", "test_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "[_", ":_", "test\\u", "to_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "hat_", "=_", "reg_", "._", "predict_", "(_", "XT", "_", "[_", ":_", "test\\u", "to_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mse", "\\u", "y", "\\u", "hat_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "y", "\\u", "hat_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "YT", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mse", "\\u", "y", "\\u", "hat_", "+=_", "(_", "y", "\\u", "hat_", "[_", "i_", "]_", "-_", "y_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mse", "\\u", "y", "\\u", "hat_", "/=_", "float_", "(_", "len_", "(_", "y", "\\u", "hat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "mse", "\\u", "y", "\\u", "hat_", "\\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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Incomplete URL substring sanitization
operasoftware/tlsprober/probedb/certs/testcert.py
[ { "content": "\tdef testName(self):\n\t\timport certhandler\n\t\t\n\t\ttest = certhandler.Certificate(\n\"\"\"\nMIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI\nMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x\nFzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz\nMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv\ncnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz\nZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO\n0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao\nwW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj\n7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS\n8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT\nBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB\n/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg\nJYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmww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t\t\traise\n\n\t\tif not test2.IsSelfSigned():\n\t\t\traise\n\t\t\n\t\tif not test2.IsSignedBy(test2):\n\t\t\traise\n\n\t\tif test2.IsSignedBy(test):\n\t\t\traise\n\n\t\tif test.IsSignedBy(test2):\n\t\t\traise\n\t\n\t\tif not test.IssuerNameDER() or test.IssuerNameDER() != test.SubjectNameDER():\n\t\t\traise\n\t\t\n\t\tif test.IssuerNameLine() != \"/C=US/O=SecureTrust Corporation/CN=SecureTrust CA\":\n\t\t\traise\n\t\t\n\t\tif test.SubjectNameLine() != \"/C=US/O=SecureTrust Corporation/CN=SecureTrust CA\":\n\t\t\traise\n\n\t\tif not test2.IssuerNameDER() or test2.IssuerNameDER() != test2.SubjectNameDER():\n\t\t\traise\n\t\t\n\t\ttext = test2.IssuerNameLine()\n\t\tif text != \"\"\"/O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048)\"\"\":\n\t\t\traise\n\t\t\n\t\tif test2.SubjectNameLine() != \"\"\"/O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048)\"\"\":\n\t\t\traise\n\n\t\tif test.GetSerialNumber() != \"0x0CF08E5C0816A5AD427FF0EB271859D0\":\n\t\t\traise\n\t\t\n\t\tif test2.GetSerialNumber() != 0x3863b966:\n\t\t\traise\n\t\n\t\ttest_entrust = test2\n\t\ttest_digicert = certhandler.Certificate(\n\"\"\"\nMIIEwDCCA6igAwIBAgIEOGPLSjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML\nRW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp\nbmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5\nIEVudHJ1c3QubmV0IExpbWl0ZWQ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hAHQAZQAgAGMAbwBuAHMAdABpAHQA\ndQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUAIABvAGYAIAB0AGgAZQAgAEQA\naQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAAYQBuAGQAIAB0AGgAZQAgAFIA\nZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcAcgBlAGUAbQBlAG4AdAAgAHcA\naABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIAaQBsAGkAdAB5ACAAYQBuAGQA\nIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQAZQBkACAAaABlAHIAZQBpAG4A\nIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMB0GA1UdJQQWMBQGCCsGAQUFBwMB\nBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOCAQEAoSsi7eCjM1yQjiTCL5+WT1+n\nHs5sCw4Zu+bOqar1arLqkdJgTUluQphVYlKGQMebnkJ/rZyGjoQmEHKK5M9VP4xG\niDuxlYzIE55QleGAD08zJrwlrpgzkKgdlKKzIQ9ldGD8vBrPEs+8elcaCGEvbK3L\nKRPgnhYpOb9icPKBk0FhMSyqQSK9Mz54IPkPuD/7tm/hN/VW8nF/ibCi33dK2y0Q\nj7vcwo8GoAi9dl414C+wsGiduHpT66rhbbrnTW48aHy1o3Ik8/gIZ4/h3G8zQFJG\nhWnfI7Yg8bxdS4436x6yHgSCoPNlqcQNDQdSuWgbv8mRem1rdtY1zS1N6RHlxQ==\n\"\"\"\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\n\t\tif not test_digicert.IsSignedBy(test_entrust):\n\t\t\traise\n\n\t\tif not test_bugs.IsSignedBy(test_digicert):\n\t\t\traise\n\t\t\n\t\thostnames = test_bugs.ExtractHostnames();\n\t\tif \"SAN_DNS\" not in hostnames or \"Common Name\" not in hostnames:\n\t\t\traise\n\n\t\ttemp = hostnames[\"Common Name\"]\n\t\tif not (len(temp) == 1 and\n\t\t\t\t'bugs.opera.com' in temp):\n\t\t\traise\n\t\t\t\n\t\ttemp = hostnames[\"SAN_DNS\"]\n\t\tif not (len(temp) == 3 and\n\t\t\t\t'bugs.opera.com' in temp and \n\t\t\t\t'bugfiles.operasoft.com' in temp and\n\t\t\t\t'btsfiles.operasoft.com' in temp):\n\t\t\traise\n\t\t\n\t\tif test_bugs.Keysize() != 2048:\n\t\t\traise\n\t\tif test_digicert.Keysize() != 2048:\n\t\t\traise\n\t\tif test_entrust.Keysize() != 2048:\n\t\t\traise\n\t\t\n\t\tcerts = certhandler.CertificateLoadP7(\"iecerts.p7b\")\n\t\t\n\t\tfor cert in certs:\n\t\t\tif not cert.IsSelfSigned():\n\t\t\t\tprint cert.SubjectNameLine()\n\t\t\t\traise\n\t\t\t\n\n\t\tprint \"completed\"", "metadata": "root.Test.testName", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 28 } ]
[ { "span": "'bugs.opera.com' in temp)", "start_line": 213, "start_column": 4, "end_line": 213, "end_column": 28 }, { "span": "'bugs.opera.com' in temp ", "start_line": 218, "start_column": 4, "end_line": 218, "end_column": 28 }, { "span": "'bugfiles.operasoft.com' in temp ", "start_line": 219, "start_column": 4, "end_line": 219, "end_column": 36 }, { "span": "'btsfiles.operasoft.com' in temp)", "start_line": 220, "start_column": 4, "end_line": 220, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "Incomp", "lete", "_", "URL_", "substring", "_", "sani", "ti", "zation_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "import_", "cert", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test_", "=_", "cert", "handler_", "._", "Certificate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "MI", "ID", "u", "DC", "CA", "q", "Cg", "Aw", "IBA", "g", "IQ", "DP", "CO", "XA", "g", "Wpa", "1", "Cf", "/", "Dr", "J", "xh", "Z", "0", "DAN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QU", "FA", "DB", "I", "\\", "10", ";", "MQ", "sw", "CQ", "YD", "VQ", "QG", "Ew", "JV", "Uz", "Eg", "MB", "4", "GA", "1", "UE", "Ch", "MX", "U2", "Vj", "d", "XJ", "l", "VH", "J", "1c", "3", "Qg", "Q2", "9", "yc", "G", "9", "y", "YX", "Rp", "b2", "4", "x", "\\", "10", ";", "F", "z", "AV", "Bg", "NV", "BAM", "TD", "l", "Nl", "Y", "3", "Vy", "Z", "VR", "yd", "XN", "0", "IE", "NB", "MB", "4", "XD", "TA", "2", "MT", "Ew", "Nz", "E5", "Mz", "Ex", "OF", "o", "XD", "TI", "5", "MT", "Iz", "\\", "10", ";", "MT", "E5", "ND", "A1", "NV", "ow", "SD", "EL", "MA", "k", "GA", "1", "UE", "Bh", "MC", "VV", "Mx", "IDA", "e", "Bg", "NV", "BA", "o", "TF", "1", "Nl", "Y", "3", "Vy", "Z", "VR", "yd", "XN", "0", "IE", "Nv", "\\", "10", ";", "cn", "Bv", "cm", "F0", "a", "W", "9", "u", "MR", "cw", "FQ", "YD", "VQ", "QD", "Ew", "5", "TZ", "WN", "1c", "m", "VU", "cn", "Vz", "d", "CB", "DQ", "TCC", "ASI", "w", "DQ", "YJ", "Ko", "ZI", "hv", "c", "N", "\\", "10", ";", "AQ", "EB", "BQ", "AD", "gg", "EPA", "DC", "CA", "Qo", "Cg", "g", "EBA", "Ku", "kg", "e", "WV", "zf", "X", "2", "FI", "7", "CT", "8", "r", "U", "4", "ni", "VW", "J", "x", "B4", "Q2", "ZQ", "CQ", "XO", "ZE", "z", "\\", "10", ";", "Zu", "m", "+", "4", "YO", "v", "Yl", "y", "J", "0f", "wk", "W2", "Gz", "4", "BER", "QR", "wd", "bv", "C4", "u", "/", "je", "p4", "G", "6", "pk", "j", "Gn", "x2", "9", "vo", "6", "p", "QT", "64", "l", "O0", "p", "Gt", "SO", "\\", "10", ";", "0", "g", "Md", "A", "+", "9", "t", "DW", "cc", "V", "9c", "Gr", "cr", "I", "9", "f4", "Or", "2", "Yl", "SAS", "WC", "1", "2j", "uh", "b", "DC", "E", "/", "RR", "vg", "UX", "PLI", "Xg", "GZ", "bf", "2", "Iz", "Ia", "o", "\\", "10", ";", "w", "W", "8", "x", "Qm", "x", "SP", "mj", "L", "8", "xk", "037", "u", "HG", "Fa", "AJ", "s", "TQ", "3", "MB", "v", "396", "gw", "p", "EW", "o", "GQ", "RS", "0", "S", "8", "Hv", "bn", "+", "m", "Pe", "Zq", "x2", "p", "HG", "j", "\\", "10", ";", "7", "Da", "Ua", "Hp", "3p", "LH", "n", "Di", "+", "Be", "u", "K1", "cob", "vo", "mu", "L", "8", "A", "/", "b0", "1", "k", "/", "un", "K", "8", "RC", "Sc", "4", "3", "Oz", "969", "XL", "0", "Im", "nal", "0", "ug", "BS", "\\", "10", ";", "8", "kv", "NU", "3x", "HC", "za", "FD", "map", "CJ", "c", "WN", "Ff", "BZ", "ve", "A4", "+", "1", "w", "VM", "e", "T", "4", "C4", "o", "FV", "m", "Hu", "rs", "CA", "w", "EAA", "a", "OB", "n", "TC", "Bm", "j", "AT", "\\", "10", ";", "Bg", "kr", "Bg", "EE", "AY", "I", "3", "FA", "IE", "Bh", "4", "EA", "EMA", "QT", "ALB", "g", "NV", "HQ", "8", "EBA", "MC", "AY", "Y", "w", "Dw", "YD", "VR", "0", "TA", "Q", "H", "/", "BA", "U", "w", "Aw", "EB", "\\", "10", ";", "/", "z", "Ad", "Bg", "NV", "HQ", "4", "EF", "g", "QU", "Qj", "K2", "Fv", "o", "E", "/", "f5", "d", "S", "3", "r", "D", "/", "fd", "MQ", "B1", "a", "Q", "6", "8", "w", "NA", "YD", "VR", "0f", "BC", "0", "w", "Kz", "Ap", "o", "Ce", "g", "\\", "10", ";", "JY", "Y", "ja", "HR", "0c", "Do", "v", "L", "2", "Ny", "b", "C5", "z", "ZW", "N1", "cm", "V0", "cn", "Vz", "d", "C5", "jb", "20", "v", "U1", "RD", "QS", "5", "jc", "mw", "w", "EA", "YJ", "Kw", "YB", "BA", "GC", "\\", "10", ";", "Nx", "UB", "BAM", "CA", "QA", "w", "DQ", "YJ", "Ko", "ZI", "hv", "c", "NA", "QE", "FB", "QA", "Dg", "g", "EBA", "DD", "t", "T", "0", "rh", "WD", "p", "Sc", "lu", "1p", "q", "Nl", "GK", "a7", "UT", "t3", "\\", "10", ";", "6", "Z", "3", "q", "059", "c4", "EV", "le", "w3", "KW", "+", "J", "w", "UL", "KU", "BR", "Su", "Sc", "e", "NQ", "Qc", "Sc", "5", "R", "+", "DCM", "h", "/", "bw", "Qf", "2", "AQ", "Wn", "L1", "m", "A6", "s", "7", "Ll", "/", "\\", "10", ";", "3", "Xp", "v", "Xd", "Mc", "9", "P", "+", "IB", "Wl", "Cq", "QV", "xy", "Les", "Ju", "gut", "Ix", "q", "/", "3", "Hc", "u", "LH", "fm", "bx", "8", "IV", "Qr", "5", "Fi", "iu", "1c", "pr", "p6", "po", "xk", "m", "\\", "10", ";", "D5", "ku", "CL", "Dv", "/", "Wn", "Pm", "Ro", "J", "je", "On", "ny", "v", "JN", "j", "R", "7", "JL", "N", "4", "TJ", "UX", "p", "AY", "m", "Hr", "Z", "k", "Uj", "Zf", "YG", "f", "Z", "n", "MU", "Fd", "Av", "n", "Zy", "PS", "\\", "10", ";", "CP", "y", "I", "6a", "6", "Lf", "+", "Ew", "9", "Dd", "+/", "c", "Y", "y2", "i2", "e", "RD", "Aw", "b", "O", "4", "H", "3", "t", "I", "0", "/", "NL", "/", "QP", "ZL", "9", "GZ", "GB", "l", "Sm", "8", "j", "IK", "Y", "y", "Y", "wa", "5", "v", "R", "\\", "10", ";", "3", "It", "Hu", "u", "G", "5", "1", "WL", "Qo", "q", "D0", "Zw", "V4", "KW", "Ma", "bw", "TW", "+", "MZ", "Mo", "5", "qx", "N", "7", "SN", "5", "Sh", "LH", "Z", "4", "sw", "rho", "v", "O0", "C", "7", "j", "E", "=", "\\", "10", ";\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test2_", "=_", "cert", "handler_", "._", "Certificate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "MI", "IE", "XD", "CCA", "0", "Sg", "Aw", "IBA", "g", "IE", "OG", "O", "5", "Z", "j", "AN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QU", "FA", "DC", "Bt", "DE", "UM", "BIG", "A1", "UE", "Ch", "ML", "\\", "10", ";", "RW", "50", "cn", "Vz", "d", "C5", "u", "ZX", "Q", "x", "QD", "A", "+", "Bg", "NV", "BA", "s", "UN", "3d", "3d", "y", "5", "lb", "n", "Ry", "d", "XN", "0", "Lm", "5", "ld", "C", "9", "DU", "FN", "f", "Mj", "A0", "OC", "Bp", "\\", "10", ";", "bm", "Nv", "cn", "Au", "IG", "J", "5", "IH", "Jl", "Zi", "4", "g", "KG", "xp", "b", "Wl", "0c", "y", "Bs", "a", "WF", "i", "Lik", "x", "JT", "Aj", "Bg", "NV", "BA", "s", "TH", "Ch", "j", "KS", "Ax", "OT", "k", "5", "\\", "10", ";", "IE", "Vu", "d", "HJ", "1c", "3", "Qu", "bm", "V0", "IE", "xp", "b", "Wl", "0", "ZW", "Q", "x", "Mz", "Ax", "Bg", "NV", "BAM", "TK", "k", "Vu", "d", "HJ", "1c", "3", "Qu", "bm", "V0", "IE", "Nl", "cn", "Rp", "\\", "10", ";", "Zm", "lj", "YX", "Rp", "b2", "4", "g", "QX", "V0", "a", "G", "9", "ya", "XR", "5", "IC", "gy", "MD", "Q", "4", "KT", "Ae", "Fw", "05", "OT", "Ey", "Mj", "Q", "x", "Nz", "U", "w", "NT", "Fa", "Fw", "0", "x", "OT", "Ey", "\\", "10", ";", "Mj", "Q", "x", "OD", "I", "w", "NT", "Fa", "MI", "G", "0", "MR", "Q", "w", "Eg", "YD", "VQ", "QK", "Ew", "t", "Fb", "n", "Ry", "d", "XN", "0", "Lm", "5", "ld", "DF", "AMD", "4", "GA", "1", "UE", "Cx", "Q", "3d", "3d", "3", "\\", "10", ";", "Lm", "Vu", "d", "HJ", "1c", "3", "Qu", "bm", "V0", "L0", "NQ", "U1", "8", "y", "MD", "Q", "4", "IG", "lu", "Y", "2", "9", "yc", "C4", "g", "Y", "nk", "gcm", "Vm", "Li", "Ao", "b", "Gl", "ta", "XR", "z", "IG", "xp", "\\", "10", ";", "Y", "WI", "u", "KT", "El", "MCM", "GA", "1", "UE", "Cx", "Mc", "KG", "Mp", "IDE", "5", "OT", "kg", "RW", "50", "cn", "Vz", "d", "C5", "u", "ZX", "Qg", "TG", "lta", "XR", "l", "ZD", "Ez", "MD", "EG", "\\", "10", ";", "A1", "UE", "Ax", "Mq", "RW", "50", "cn", "Vz", "d", "C5", "u", "ZX", "Qg", "Q2", "Vy", "d", "Gl", "ma", "WN", "hd", "Gl", "vb", "i", "BB", "d", "XR", "ob", "3", "Jp", "d", "H", "kg", "KD", "I", "w", "ND", "gp", "\\", "10", ";", "MI", "IB", "Ij", "AN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QE", "FA", "AO", "CA", "Q", "8", "AMI", "IB", "Cg", "KC", "AQ", "EA", "r", "U1", "Lq", "RK", "Gs", "uq", "j", "IA", "c", "VF", "m", "Qq", "\\", "10", ";", "K", "0", "v", "Rv", "wt", "KT", "Y", "7", "tg", "Hal", "Z", "7d", "4", "QM", "Bz", "Qs", "how", "Nt", "TK", "9", "1e", "u", "Ha", "YN", "ZO", "LG", "p1", "8", "Ez", "o", "OH", "1", "u", "3", "Hs", "/", "l", "JB", "Qe", "\\", "10", ";", "s", "YG", "pj", "X", "24", "z", "Gt", "LA", "/", "ECD", "Ny", "rp", "UA", "k", "AH", "90", "l", "KG", "d", "CC", "mz", "i", "Av", "1", "h", "3e", "d", "Vc", "3", "kw", "3", "7", "Xa", "m", "Sr", "h", "RS", "Gl", "Vu", "X", "\\", "10", ";", "Ml", "Bv", "Pci", "6", "Z", "gz", "j", "/", "L", "24", "Sc", "F2", "i", "Uk", "Z", "/", "c", "Cov", "Ym", "j", "Zy", "/", "Gn", "7", "xx", "GW", "C4", "Le", "ks", "y", "ZB", "2", "Z", "nu", "U", "4", "q", "941", "m", "VT", "\\", "10", ";", "XT", "z", "Wn", "LL", "PK", "QP", "5", "L", "6", "RQ", "st", "RI", "zg", "U", "y", "VY", "r", "9", "sm", "RM", "Du", "SY", "B3", "Xb", "f9", "+", "5", "CF", "Vg", "h", "TA", "p", "+", "Xt", "Ip", "Gm", "G", "4", "z", "U", "/", "\\", "10", ";", "Ho", "Zd", "eno", "V", "ve", "8", "Aj", "h", "Ui", "VB", "c", "Ak", "Ca", "Tv", "A5", "Ja", "JG", "/", "+", "Ef", "Tn", "Z", "VC", "w", "Q", "5", "N3", "2", "8", "mz", "8", "MY", "IW", "Jm", "Q", "3", "DW", "1c", "AH", "\\", "10", ";", "4", "QI", "DA", "QA", "Bo", "3", "Q", "wc", "j", "AR", "Bg", "lg", "hk", "g", "Bh", "vh", "CA", "QE", "EBA", "MC", "AA", "cw", "Hw", "YD", "VR", "0", "j", "BB", "gw", "Fo", "AU", "Ve", "SB", "0", "RG", "A", "\\", "10", ";", "vt", "i", "Ju", "Qi", "j", "Mf", "mh", "JA", "k", "Wu", "XA", "w", "HQ", "YD", "VR", "0", "OB", "BY", "EF", "FX", "kg", "d", "ER", "g", "L", "7", "Yi", "bk", "Io", "z", "H", "5", "o", "SQ", "JF", "rl", "w", "MB", "0", "G", "\\", "10", ";", "CS", "q", "GS", "Ib", "2f", "Qd", "BAA", "QQ", "MA", "4b", "CF", "Y", "1", "Lj", "A6", "NC", "4", "w", "Aw", "IE", "k", "DAN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QU", "FA", "AO", "CA", "QE", "A", "\\", "10", ";", "WU", "es", "I", "YS", "KF", "8", "mc", "i", "VM", "eu", "o", "CF", "Gs", "Y", "8", "Tj", "6", "xn", "LZ", "8", "xp", "J", "d", "GG", "QC", "4", "9", "MG", "CB", "Fh", "f", "GP", "j", "K", "50", "x", "A3", "B2", "0", "q", "Mo", "\\", "10", ";", "o", "PS", "7", "mm", "Nz", "7", "W3", "l", "Kt", "vt", "FK", "kr", "xj", "YR", "0", "Cv", "r", "B4", "ul", "2p", "5c", "GZ", "1", "WE", "v", "VU", "Kc", "g", "F", "7b", "IS", "Ko", "30", "Ax", "v", "/", "5", "5", "IQ", "\\", "10", ";", "h", "7", "A6", "tc", "Od", "BT", "c", "So", "8f", "0", "Fb", "n", "Vp", "Dk", "Wm", "1", "M6", "I", "5", "H", "xq", "IK", "ia", "oh", "ow", "Xk", "CI", "ry", "qp", "tau", "3", "7", "AUX", "7", "i", "H", "0", "N1", "8", "\\", "10", ";", "f3", "v", "/", "rx", "z", "P", "5", "ts", "Hr", "V", "7b", "h", "Z", "3", "QK", "w", "0", "z", "2w", "TR", "5", "kl", "AE", "yt", "2", "+", "z", "7", "pn", "Ik", "PF", "c4", "Ys", "IV", "4", "IU", "9", "r", "Tw", "7", "6", "Nm", "f", "N", "\\", "10", ";", "B", "/", "L", "/", "CN", "Di", "3", "tm", "/", "Kq", "+", "4", "h", "4", "Yh", "PAT", "Kt", "5", "Ro", "f8", "886", "Z", "j", "XO", "P", "/", "sw", "Nl", "Q", "8", "C5", "LW", "K", "5", "Gb", "9", "Au", "w2", "Da", "cl", "Vy", "\\", "10", ";", "v", "U", "x", "Fn", "m", "G", "6", "v", "4", "SB", "kg", "PR", "0", "ml", "8", "x", "Q", "==", "\\", "10", ";\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "test_", "._", "Is", "Self", "Signe", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "test_", "._", "Is", "Signe", "d", "By_", "(_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "test2_", "._", "Is", "Self", "Signe", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "test2_", "._", "Is", "Signe", "d", "By_", "(_", "test2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test2_", "._", "Is", "Signe", "d", "By_", "(_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test_", "._", "Is", "Signe", "d", "By_", "(_", "test2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "test_", "._", "Issue", "r", "Name", "DER", "_", "(_", ")_", "or_", "test_", "._", "Issue", "r", "Name", "DER", "_", "(_", ")_", "!=_", "test_", "._", "Sub", "ject", "Name", "DER", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test_", "._", "Issue", "r", "Name", "Line_", "(_", ")_", "!=_", "\"/", "C", "=", "US", "/", "O", "=", "Secur", "e", "Trust", " ", "Cor", "porat", "ion", "/", "CN", "=", "Secur", "e", "Trust", " ", "CA", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test_", "._", "Sub", "ject", "Name", "Line_", "(_", ")_", "!=_", "\"/", "C", "=", "US", "/", "O", "=", "Secur", "e", "Trust", " ", "Cor", "porat", "ion", "/", "CN", "=", "Secur", "e", "Trust", " ", "CA", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "test2_", "._", "Issue", "r", "Name", "DER", "_", "(_", ")_", "or_", "test2_", "._", "Issue", "r", "Name", "DER", "_", "(_", ")_", "!=_", "test2_", "._", "Sub", "ject", "Name", "DER", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "test2_", "._", "Issue", "r", "Name", "Line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text_", "!=_", "\"\"\"", "/", "O", "=", "Entr", "ust", ".", "net", "/", "OU", "=", "www", ".", "entr", "ust", ".", "net", "/", "CPS", "\\u", "204", "8", " ", "inco", "rp", ".", " ", "by", " ", "ref", ".", " ", "(", "limit", "s", " ", "lia", "b", ".)", "/", "OU", "=(", "c", ")", " ", "1999", " ", "Entr", "ust", ".", "net", " ", "Limit", "ed", "/", "CN", "=", "Entr", "ust", ".", "net", " ", "Certificat", "ion", " ", "Author", "it", "y", " ", "(", "204", "8", ")\"\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test2_", "._", "Sub", "ject", "Name", "Line_", "(_", ")_", "!=_", "\"\"\"", "/", "O", "=", "Entr", "ust", ".", "net", "/", "OU", "=", "www", ".", "entr", "ust", ".", "net", "/", "CPS", "\\u", "204", "8", " ", "inco", "rp", ".", " ", "by", " ", "ref", ".", " ", "(", "limit", "s", " ", "lia", "b", ".)", "/", "OU", "=(", "c", ")", " ", "1999", " ", "Entr", "ust", ".", "net", " ", "Limit", "ed", "/", "CN", "=", "Entr", "ust", ".", "net", " ", "Certificat", "ion", " ", "Author", "it", "y", " ", "(", "204", "8", ")\"\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test_", "._", "Get", "Ser", "ial", "Number_", "(_", ")_", "!=_", "\"", "0x0", "CF", "0", "8", "E5", "C0", "816", "A5", "AD", "427", "FF", "0E", "B2", "718", "5", "9", "D0", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test2_", "._", "Get", "Ser", "ial", "Number_", "(_", ")_", "!=_", "0x3", "863", "b9", "66_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "entr", "ust", "_", "=_", "test2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "dig", "ice", "rt_", "=_", "cert", "handler_", "._", "Certificate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "MI", "IE", "w", "DC", "CA", "6", "ig", "Aw", "IBA", "g", "IE", "OG", "PL", "Sj", "AN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QU", "FA", "DC", "Bt", "DE", "UM", "BIG", "A1", "UE", "Ch", "ML", "\\", "10", ";", "RW", "50", "cn", "Vz", "d", "C5", "u", "ZX", "Q", "x", "QD", "A", "+", "Bg", "NV", "BA", "s", "UN", "3d", "3d", "y", "5", "lb", "n", "Ry", "d", "XN", "0", "Lm", "5", "ld", "C", "9", "DU", "FN", "f", "Mj", "A0", "OC", "Bp", "\\", "10", ";", "bm", "Nv", "cn", "Au", "IG", "J", "5", "IH", "Jl", "Zi", "4", "g", "KG", "xp", "b", "Wl", "0c", "y", "Bs", "a", "WF", "i", "Lik", "x", "JT", "Aj", "Bg", "NV", "BA", "s", "TH", "Ch", "j", "KS", "Ax", "OT", "k", "5", "\\", "10", ";", "IE", "Vu", "d", "HJ", "1c", "3", "Qu", "bm", "V0", "IE", "xp", "b", "Wl", "0", "ZW", "Q", "x", "Mz", "Ax", "Bg", "NV", "BAM", "TK", "k", "Vu", "d", "HJ", "1c", "3", "Qu", "bm", "V0", "IE", "Nl", "cn", "Rp", "\\", "10", ";", "Zm", "lj", "YX", "Rp", "b2", "4", "g", "QX", "V0", "a", "G", "9", "ya", "XR", "5", "IC", "gy", "MD", "Q", "4", "KT", "Ae", "Fw", "0", "w", "ODE", "x", "MD", "cy", "MD", "M", "4", "ND", "Fa", "Fw", "0", "x", "ND", "A3", "\\", "10", ";", "MD", "Ew", "ND", "Aw", "MD", "Ba", "MG", "Mx", "Cz", "AJ", "Bg", "NV", "BA", "YT", "Al", "VT", "MR", "U", "w", "Ew", "YD", "VQ", "QK", "Ew", "x", "Ea", "Wd", "p", "Q2", "Vy", "d", "CB", "J", "bm", "Mx", "\\", "10", ";", "GTA", "XB", "g", "NV", "BA", "s", "TE", "Hd", "3d", "y", "5", "ka", "Wd", "p", "Y", "2", "Vy", "d", "C5", "jb", "20", "x", "Ij", "Ag", "Bg", "NV", "BAM", "TG", "UR", "p", "Z2", "l", "DZ", "XJ", "0", "IE", "ds", "\\", "10", ";", "b2", "Jh", "b", "CB", "DQ", "SA", "o", "Mj", "A0", "OC", "kw", "gg", "Ei", "MA", "0", "GC", "Sq", "GS", "Ib", "3", "DQ", "EBA", "QUA", "A4", "IB", "Dw", "Aw", "gg", "EK", "Ao", "IBA", "QD", "E", "\\", "10", ";", "PL", "z", "Mu", "upi", "5", "p5", "CI", "6", "+0", "sh", "Gu", "Yo", "3", "Zo", "d", "OP", "z", "BR", "y", "Ge", "2", "Z", "9", "v", "3e", "Xb", "t", "Zw", "LD", "Cr", "2", "q", "ZU", "p", "VX", "Cz", "X", "/", "4", "Yb", "6", "\\", "10", ";", "r", "6", "LD", "w", "QV", "l", "Jy", "B2", "Lw", "p", "UJ", "X", "zq", "K", "9", "2", "VQ", "Ve", "b", "D", "zv", "PR", "+", "g", "BB", "oz", "FRE", "j", "8", "By", "7", "zc", "o", "M", "w", "UZ", "Sea", "Tq", "Dq", "Ye", "Q", "\\", "10", ";", "FN", "lex", "KJ", "4j", "8", "E+", "1", "Bl", "h", "Dh", "rn", "3", "B", "q", "VI", "EG", "+", "bx", "fau", "Bx", "B", "7", "pi", "w", "+", "tc", "d", "NT", "8", "Wp", "w", "Qo", "E1", "09", "BX", "Wa", "Loa", "e", "\\", "10", ";", "LLA", "Xh", "y", "BY", "V", "+/", "h", "6", "l", "Vg", "u", "Cx", "w", "Ia", "wp", "Y", "ww", "Q", "/", "GC", "8", "+", "d", "Uc", "N", "2", "TV", "t", "Pse", "qy", "Y", "5", "Ro", "ik", "y", "80", "w", "Z", "8", "Ame", "e", "XK", "\\", "10", ";", "a", "Pk", "i1", "+", "XS", "sb", "t", "IT", "Js", "Lm", "Ft", "Ck", "u", "XS", "7", "Q", "5", "HM", "Pr", "d", "J", "1", "Z", "ja", "q", "UB", "x4", "6", "v", "8", "E4", "7", "G1", "UV", "RN", "U", "+", "TV", "ce", "4", "ZH", "q", "\\", "10", ";", "u", "KC", "P", "zj", "pj", "X", "5a", "Ju", "gg", "+/", "k", "S", "7", "Ag", "MB", "AAG", "jg", "g", "Eo", "MI", "IB", "JD", "AO", "Bg", "NV", "HQ", "8", "BA", "f8", "EBA", "MC", "AQ", "Y", "w", "Eg", "YD", "\\", "10", ";", "VR", "0", "TA", "Q", "H", "/", "BA", "gw", "Bg", "EB", "/", "w", "IBA", "DA", "n", "Bg", "NV", "HS", "UE", "IDA", "e", "Bg", "gr", "Bg", "EF", "BQ", "c", "DA", "QY", "IK", "w", "YB", "BQ", "UH", "Aw", "IG", "\\", "10", ";", "CC", "s", "GA", "QU", "FB", "w", "MEM", "DM", "GCC", "s", "GA", "QU", "FB", "w", "EB", "BC", "cw", "JT", "Aj", "Bg", "gr", "Bg", "EF", "BQ", "cw", "AY", "YX", "a", "HR", "0c", "Do", "v", "L", "2", "9", "j", "\\", "10", ";", "c3", "Au", "ZW", "50", "cn", "Vz", "d", "C5", "u", "ZX", "Q", "w", "Mg", "YD", "VR", "0f", "BC", "sw", "KT", "Ano", "CW", "g", "I", "4", "Yh", "a", "HR", "0c", "Do", "v", "L", "2", "Ny", "b", "C5", "lb", "n", "Ry", "\\", "10", ";", "d", "XN", "0", "Lm", "5", "ld", "C8", "y", "MD", "Q", "4", "Y", "2E", "u", "Y", "3", "Js", "MB", "EGA", "1", "Ud", "IA", "QK", "MA", "gw", "Bg", "YE", "VR", "0", "g", "ADA", "d", "Bg", "NV", "HQ", "4", "EF", "g", "QU", "\\", "10", ";", "Q", "0", "l", "H", "589", "A0", "Zq", "ok", "v", "KM", "is", "q", "Y", "k", "8", "/", "JC", "A8", "w", "Hw", "YD", "VR", "0", "j", "BB", "gw", "Fo", "AU", "Ve", "SB", "0", "RG", "Av", "ti", "Ju", "Qi", "j", "Mf", "mh", "\\", "10", ";", "JA", "k", "Wu", "XA", "w", "GQ", "YJ", "Ko", "ZI", "hv", "Z", "9", "B0", "EA", "BA", "ww", "Ch", "s", "EV", "jc", "u", "MQ", "MC", "AI", "Ew", "DQ", "YJ", "Ko", "ZI", "hv", "c", "NA", "QE", "FB", "QA", "D", "\\", "10", ";", "gg", "EBA", "Gg", "Ul", "CI", "v", "PAD", "B6", "If", "h", "YP", "g", "9", "1", "XN", "YO", "vb", "L3", "d", "NQ", "t", "4", "AO", "HJ", "u", "6", "M", "5", "wm", "LH", "4e", "Jl", "p", "K", "4", "G", "0", "Ch", "6", "DD", "\\", "10", ";", "Wo", "y", "9", "g", "Ot", "Ix", "5", "4", "iy", "u2", "am", "OO", "90", "AC", "o", "BX", "Mi", "z", "EG", "Gm", "R1", "Z2", "C5", "Ue", "i", "Te", "dov", "3", "g3", "f", "JI", "Oq", "H", "7", "O", "/", "rd", "4", "1", "L", "\\", "10", ";", "Ga", "Ym", "4", "Az", "KR", "ws", "NZ", "Xo", "OT", "uk", "US", "QA", "7", "vd", "STI", "4", "sd", "ZQ", "6", "gm", "El", "q", "J", "/", "Z", "gal", "GA", "y", "5", "ZJ", "SW", "SL", "Se", "Xc", "B5", "+", "Z", "\\", "10", ";", "Ce", "Vo", "GP", "Lj", "q2", "rh", "6", "2", "N", "6", "JS", "3", "J", "/", "j", "8", "Jn", "/", "g", "BD", "NV", "zb", "Ba", "5", "BB", "y", "SB", "TT", "/", "Ow", "+", "h", "Dg", "GJ", "V", "8s", "D3", "5", "z", "/", "a", "F8", "Z", "\\", "10", ";", "W", "5", "VX", "4", "p", "Nf", "Sb", "z", "SP", "S", "8", "U2", "6", "j", "Gp", "m", "Eq", "rq", "HA", "dg", "Tg", "K", "8", "OV", "HV", "a4", "0o7", "K", "4", "K", "6", "/", "E", "7", "CRO", "+", "v", "/", "6", "Ts", "2p", "P2", "N", "\\", "10", ";", "Bi", "h", "OJ", "h", "XL", "n", "+", "Hb", "Rou", "k", "ES", "i", "Gr", "QO", "x", "T3", "U", "=", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "bugs_", "=_", "cert", "handler_", "._", "Certificate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\t\t\t\t\t\t\t\t\t", "\t", "\\", "10", ";", "MI", "IG", "6", "j", "CC", "Bd", "K", "g", "Aw", "IBA", "g", "IQ", "Br", "RG", "enf", "GT", "Y", "6", "Sw", "4", "6", "A6", "I", "w", "1", "FD", "AN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QU", "FA", "DB", "j", "\\", "10", ";", "MQ", "sw", "CQ", "YD", "VQ", "QG", "Ew", "JV", "Uz", "EVM", "BM", "GA", "1", "UE", "Ch", "MM", "RG", "ln", "a", "UN", "lc", "n", "Qg", "SW", "5", "j", "MR", "kw", "Fw", "YD", "VQ", "QL", "Ex", "B3", "\\", "10", ";", "d3", "cu", "ZG", "ln", "a", "WN", "lc", "n", "Qu", "Y", "2", "9", "t", "MS", "I", "w", "IA", "YD", "VQ", "QD", "Ex", "l", "Ea", "Wd", "p", "Q2", "Vy", "d", "CB", "Hb", "G", "9", "i", "Y", "Ww", "g", "Q", "0E", "g", "KD", "I", "w", "\\", "10", ";", "ND", "gp", "MB", "4", "XD", "TA", "4", "MT", "Ey", "MT", "Aw", "MD", "Aw", "MF", "o", "XD", "TE", "y", "MD", "Ey", "ND", "Iz", "NT", "k", "1", "OV", "ow", "d", "DEL", "MA", "k", "GA", "1", "UE", "Bh", "MC", "\\", "10", ";", "Tk", "8", "x", "DT", "ALB", "g", "NV", "BA", "g", "TB", "E", "9", "zb", "G", "8", "x", "DT", "ALB", "g", "NV", "BA", "c", "TB", "E", "9", "zb", "G", "8", "x", "Gz", "AZ", "Bg", "NV", "BA", "o", "TE", "k", "9", "w", "ZX", "Jh", "\\", "10", ";", "IF", "Nv", "Z", "n", "R3", "YX", "Jl", "IE", "FT", "QT", "ERM", "A8", "GA", "1", "UE", "Cx", "MIT", "3", "Bl", "cm", "Eg", "Q", "0E", "x", "F", "z", "AV", "Bg", "NV", "BAM", "TD", "m", "J", "1", "Z", "3", "Mu", "\\", "10", ";", "b3", "Bl", "cm", "Eu", "Y", "2", "9", "t", "MI", "IB", "Ij", "AN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QE", "FA", "AO", "CA", "Q", "8", "AMI", "IB", "Cg", "KC", "AQ", "EA", "u", "/", "7", "0", "Ad", "AD", "\\", "10", ";", "I", "5", "g", "S", "8", "t", "Tq", "9", "5", "WM", "e", "Vg", "AE", "Ua", "Z", "1", "OJ", "f3", "Ak", "v1", "sr", "Lr", "c", "FA", "t", "Be", "B3", "r", "No", "b", "Uk", "go", "GH", "1b", "dg", "q", "MG", "7b", "r", "Cv", "W", "\\", "10", ";", "K", "+", "QT", "7", "8", "LC", "gr", "jog", "Zt", "XD", "4", "XK", "E", "/", "f", "NN", "Sq", "e", "6", "Vy", "Uv", "JD", "rus", "D6", "8", "Uf", "Ha", "NF", "VB", "9", "7", "j", "9", "j", "+", "kz", "V6", "RN", "+", "G", "0", "\\", "10", ";", "6", "l", "KV", "N", "8", "Dc", "7c", "Bk", "/", "rel", "hz", "h", "J", "2", "B", "9", "sn", "Rf", "S", "+", "8", "Bh", "1", "k", "9", "Fv", "RL", "l", "SM", "VC", "Ks", "Xv", "7", "wq", "UG", "+", "vw", "h", "Kl", "1", "Qn", "Pu", "\\", "10", ";", "pf", "CV", "SA", "ENG", "adj", "sax", "Qq", "Oz", "9", "QQ", "zo", "Wg", "YQ", "rn", "P3", "k", "Fg", "Ff", "5", "i", "Ka", "zo", "Ol", "n1", "R", "7", "h", "AW", "+", "WG", "z", "LO", "o", "XV", "b6", "n", "\\", "10", ";", "5", "rsv", "or", "9", "Ox", "z", "8", "D8", "YX", "ag", "0c", "Dm", "Oe", "za", "Wa", "Qt", "l7", "Rr", "0", "PB", "na", "WI", "w", "AL", "DU", "Nl", "k", "9E", "7", "Gy", "0", "JV", "5", "Xh", "R0", "v", "0", "y", "\\", "10", ";", "K", "0", "RG", "l", "Ls", "Vs", "Bz", "QJ", "w", "IDA", "QA", "Bo", "4", "ID", "hz", "CCA", "4", "M", "w", "Hw", "YD", "VR", "0", "j", "BB", "gw", "Fo", "AU", "Q", "0", "l", "H", "589", "A0", "Zq", "ok", "v", "KM", "\\", "10", ";", "is", "q", "Y", "k", "8", "/", "JC", "A8", "w", "HQ", "YD", "VR", "0", "OB", "BY", "EF", "G", "6", "Ho", "g", "Og", "bg", "Tf", "WX", "I", "0", "O", "/", "NT", "TZ", "bh", "Di", "L1", "ME", "k", "GA", "1", "Ud", "EQ", "RC", "\\", "10", ";", "ME", "CCD", "m", "J", "1", "Z", "3", "Mu", "b3", "Bl", "cm", "Eu", "Y", "2", "9", "tg", "h", "Zi", "d", "Wd", "ma", "Wx", "lc", "y", "5", "vc", "GV", "y", "YX", "Nv", "Z", "n", "Qu", "Y", "2", "9", "tg", "h", "Zi", "d", "HN", "m", "\\", "10", ";", "a", "Wx", "lc", "y", "5", "vc", "GV", "y", "YX", "Nv", "Z", "n", "Qu", "Y", "2", "9", "t", "MH", "o", "GCC", "s", "GA", "QU", "FB", "w", "EB", "BG", "4", "wb", "DA", "k", "Bg", "gr", "Bg", "EF", "BQ", "cw", "AY", "YY", "\\", "10", ";", "a", "HR", "0c", "Do", "v", "L", "2", "9", "jc", "3", "Au", "ZG", "ln", "a", "WN", "lc", "n", "Qu", "Y", "2", "9", "t", "ME", "QG", "CC", "s", "GA", "QU", "FB", "z", "AC", "hj", "hod", "HR", "w", "Oi", "8", "vd", "3d", "3", "\\", "10", ";", "Lm", "Rp", "Z2", "lj", "ZX", "J", "0", "Lm", "Nvb", "S", "9", "DQ", "UN", "lc", "n", "R", "z", "L0", "Rp", "Z2", "l", "DZ", "XJ", "0", "R2", "xv", "Ym", "Fs", "Q", "0E", "y", "MD", "Q", "4", "Lm", "Ny", "d", "DA", "O", "\\", "10", ";", "Bg", "NV", "HQ", "8", "BA", "f8", "EBA", "MC", "Ba", "Aw", "DAY", "DV", "R0", "TA", "Q", "H", "/", "BA", "I", "w", "AD", "Bz", "Bg", "NV", "HR", "8", "Eb", "DB", "q", "MD", "Og", "Ma", "Av", "hi", "1", "o", "\\", "10", ";", "d", "HR", "w", "Oi", "8", "v", "Y", "3", "Js", "My", "5", "ka", "Wd", "p", "Y", "2", "Vy", "d", "C5", "jb", "20", "v", "R2", "xv", "Ym", "Fs", "Mj", "A0", "OC", "0", "y", "MD", "A4", "YS", "5", "jc", "mw", "w", "M6", "Ax", "\\", "10", ";", "o", "C", "+", "GL", "Wh", "0d", "HA", "6", "Ly", "9", "jc", "mw", "0", "Lm", "Rp", "Z2", "lj", "ZX", "J", "0", "Lm", "Nvb", "S", "9", "Hb", "G", "9", "i", "Y", "Ww", "y", "MD", "Q", "4", "LT", "I", "w", "MD", "hh", "Lm", "Ny", "\\", "10", ";", "b", "DC", "CA", "c", "YG", "A1", "Ud", "IA", "SCA", "b0", "wg", "g", "G", "5", "MI", "IB", "t", "QY", "LY", "IZ", "IA", "Yb", "9", "b", "AE", "DA", "AE", "wg", "g", "G", "k", "MD", "o", "GCC", "s", "GA", "QU", "F", "\\", "10", ";", "Bw", "IB", "Fi", "5", "od", "HR", "w", "Oi", "8", "vd", "3d", "3", "Lm", "Rp", "Z2", "lj", "ZX", "J", "0", "Lm", "Nvb", "S", "9", "zc", "2w", "t", "Y", "3", "Bz", "LX", "Jl", "c", "G", "9", "za", "XR", "vc", "nk", "u", "\\", "10", ";", "a", "HR", "t", "MI", "IB", "ZA", "YI", "Kw", "YB", "BQ", "UH", "Ag", "I", "wg", "g", "FWH", "o", "IB", "Ug", "BB", "AG", "4", "Ae", "QA", "g", "AH", "UA", "cw", "Bl", "ACAA", "bw", "Bm", "ACAA", "\\", "10", ";", "d", "AB", "o", "AG", "k", "Ac", "w", "Ag", "AE", "MA", "ZQ", "By", "AH", "QA", "a", "QB", "m", "AG", "k", "AY", "w", "Bh", "AH", "QA", "ZQ", "Ag", "AG", "MA", "bw", "Bu", "AH", "MA", "d", "AB", "p", "AH", "QA", "\\", "10", ";", "d", "QB", "0", "AG", "UA", "cw", "Ag", "AGE", "AY", "w", "Bj", "AG", "UA", "c", "AB", "0", "AGE", "Ab", "g", "Bj", "AG", "UA", "IA", "Bv", "AG", "YA", "IA", "B0", "AG", "g", "AZ", "QA", "g", "AE", "QA", "\\", "10", ";", "a", "QB", "n", "AG", "k", "AQ", "w", "Bl", "AH", "IA", "d", "AA", "g", "AE", "MA", "UA", "Av", "AE", "MA", "UA", "BT", "ACAA", "YQ", "Bu", "AG", "QA", "IA", "B0", "AG", "g", "AZ", "QA", "g", "AF", "IA", "\\", "10", ";", "ZQ", "Bs", "AH", "k", "Aa", "QB", "u", "AG", "c", "AI", "AB", "QA", "GE", "Ac", "g", "B0", "AH", "k", "AI", "ABB", "AG", "c", "Ac", "g", "Bl", "AG", "UA", "b", "QB", "l", "AG", "4", "Ad", "AA", "g", "AH", "c", "A", "\\", "10", ";", "a", "AB", "p", "AG", "MA", "a", "AA", "g", "AG", "w", "Aa", "QB", "t", "AG", "k", "Ad", "AA", "g", "AG", "w", "Aa", "QB", "h", "AG", "IA", "a", "QB", "s", "AG", "k", "Ad", "AB", "5", "ACAA", "YQ", "Bu", "AG", "QA", "\\", "10", ";", "IA", "Bh", "AH", "IA", "ZQ", "Ag", "AG", "k", "Ab", "g", "Bj", "AG", "8", "Ac", "g", "Bw", "AG", "8", "Ac", "g", "Bh", "AH", "QA", "ZQ", "Bk", "ACAA", "a", "AB", "l", "AH", "IA", "ZQ", "Bp", "AG", "4", "A", "\\", "10", ";", "IA", "Bi", "AH", "k", "AI", "AB", "y", "AG", "UA", "Z", "g", "Bl", "AH", "IA", "ZQ", "Bu", "AG", "MA", "ZQ", "Au", "MB", "0", "GA", "1", "Ud", "JQ", "QW", "MB", "QG", "CC", "s", "GA", "QU", "FB", "w", "MB", "\\", "10", ";", "Bg", "gr", "Bg", "EF", "BQ", "c", "DA", "j", "AN", "Bg", "kq", "hk", "i", "G", "9", "w", "0", "BA", "QU", "FA", "AO", "CA", "QE", "Ao", "Ss", "i", "7e", "C", "j", "M1", "y", "Qj", "i", "TCL", "5", "+", "WT", "1", "+", "n", "\\", "10", ";", "Hs", "5", "s", "Cw", "4", "Zu", "+", "b", "Oq", "ar", "1a", "r", "Lq", "kd", "J", "g", "TU", "lu", "Qp", "h", "VY", "l", "KG", "QM", "eb", "nk", "J", "/", "r", "Zy", "Gj", "o", "Qm", "EH", "KK", "5", "M", "9", "VP", "4", "x", "G", "\\", "10", ";", "i", "Du", "xl", "Y", "z", "IE", "5", "5", "Ql", "e", "GA", "D0", "8", "z", "J", "rw", "lr", "pg", "zk", "K", "gd", "l", "KK", "z", "IQ", "9", "ld", "GD", "8", "v", "Br", "PE", "s", "+", "8e", "lca", "CG", "Ev", "b", "K", "3", "L", "\\", "10", ";", "KR", "Pg", "nh", "Yp", "Ob", "9", "ic", "PK", "Bk", "0", "Fh", "MS", "yq", "QS", "K", "9", "Mz", "5", "4", "IP", "k", "Pu", "D", "/", "7", "tm", "/", "h", "N", "/", "VW", "8", "n", "F", "/", "ib", "Ci", "3", "3d", "K2", "y", "0", "Q", "\\", "10", ";", "j", "7", "vc", "wo", "8", "Go", "Ai", "9", "dl", "414", "C", "+", "ws", "Gi", "du", "Hp", "T6", "6", "rh", "bb", "rn", "TW", "4", "8a", "Hy", "1", "o3", "Ik", "8", "/", "g", "IZ", "4", "/", "h", "3", "G", "8", "z", "QF", "JG", "\\", "10", ";", "h", "Wn", "f", "I", "7", "Y", "g", "8b", "xd", "S4", "436", "x6", "y", "Hg", "SC", "o", "PN", "lq", "c", "QN", "DQ", "d", "Su", "Wg", "bv", "8", "m", "Re", "m1", "rdt", "Y", "1", "z", "S1", "N", "6", "RH", "lx", "Q", "==", "\\", "10", ";\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "test\\u", "dig", "ice", "rt_", "._", "Is", "Signe", "d", "By_", "(_", "test\\u", "entr", "ust", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "test\\u", "bugs_", "._", "Is", "Signe", "d", "By_", "(_", "test\\u", "dig", "ice", "rt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hostnames", "_", "=_", "test\\u", "bugs_", "._", "Extract", "Host", "names_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "SAN", "\\u", "DNS", "\"_", "not_", "in_", "hostnames", "_", "or_", "\"", "Common", " ", "Name", "\"_", "not_", "in_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp_", "=_", "hostnames", "_", "[_", "\"", "Common", " ", "Name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "len_", "(_", "temp_", ")_", "==_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bug", "s", ".", "opera", ".", "com", "'_", "in_", "temp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp_", "=_", "hostnames", "_", "[_", "\"", "SAN", "\\u", "DNS", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "len_", "(_", "temp_", ")_", "==_", "3_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bug", "s", ".", "opera", ".", "com", "'_", "in_", "temp_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bug", "files", ".", "opera", "soft", ".", "com", "'_", "in_", "temp_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bt", "sfi", "les", ".", "opera", "soft", ".", "com", "'_", "in_", "temp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test\\u", "bugs_", "._", "Keys", "ize_", "(_", ")_", "!=_", "2048_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test\\u", "dig", "ice", "rt_", "._", "Keys", "ize_", "(_", ")_", "!=_", "2048_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "test\\u", "entr", "ust", "_", "._", "Keys", "ize_", "(_", ")_", "!=_", "2048_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "certs_", "=_", "cert", "handler_", "._", "Certificat", "e", "Load", "P", "7_", "(_", "\"", "ie", "cert", "s", ".", "p", "7b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "cert_", "in_", "certs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "not_", "cert_", "._", "Is", "Self", "Signe", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "print_", "cert_",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r/bin/env python\n\n\"\"\"\nMiscellaneous PyCUDA functions.\n\"\"\"\n\nfrom __future__ import absolute_import, division\n\nimport atexit\nimport numbers\nfrom string import Template\n\nimport pycuda.driver as drv\nimport pycuda.gpuarray as gpuarray\nimport pycuda.elementwise as elementwise\nimport pycuda.reduction as reduction\nimport pycuda.scan as scan\nimport pycuda.tools as tools\nfrom pycuda.tools import context_dependent_memoize, dtype_to_ctype\nfrom pycuda.compiler import SourceModule\nfrom pytools import memoize\nimport numpy as np\n\nfrom . import cuda\nfrom . import cublas\n\n\ntry:\n from . import cula\n _has_cula = True\nexcept (ImportError, OSError):\n _has_cula = False\n\ntry:\n from . import cusolver\n _has_cusolver = True\nexcept (ImportError, OSError):\n _has_cusolver = False\n\ntry:\n from . import magma\n _has_magma = True\nexcept (ImportError, OSError):\n _has_magma = False\n\nisdoubletype = lambda x : True if x == np.float64 or \\\n x == np.complex128 else False\nisdoubletype.__doc__ = \"\"\"\nCheck whether a type has double precision.\n\nParameters\n----------\nt : numpy float type\n Type to test.\n\nReturns\n-------\nresult : bool\n Result.\n\"\"\"\n\niscomplextype = lambda x : True if x == np.complex64 or \\\n x == np.complex128 else False\niscomplextype.__doc__ = \"\"\"\nCheck whether a type is complex.\n\nParameters\n----------\nt : numpy float type\n Type to test.\n\nReturns\n-------\nresult : bool\n Result.\n\n\"\"\"\n\n\n\n\nglobal _global_cublas_handle\n_global_cublas_handle = None\nglobal _global_cusolver_handle\n_global_cusolver_handle = None\nglobal _global_cublas_allocator\n_global_cublas_allocator = None\n\n\n\n\n\niceil = lambda n: int(np.ceil(n))\n\n\n\n\n\n\n\nmaxabs.cache = {}\n\ncumsum.cache = {}\n\ndiff.cache = {}\n\n\n# List of available numerical types provided by numpy:\nnum_types = [np.typeDict[t] for t in \\\n np.typecodes['AllInteger']+np.typecodes['AllFloat']]\n\n# Numbers of bytes occupied by each numerical type:\nnum_nbytes = dict((np.dtype(t),t(1).nbytes) for t in num_types)\n\n\n\nget_by_index.cache = {}\n\nset_by_index.cache = {}\n\n\n\n\n\nimport operator\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n import doctest\n doctest.testmod()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "global _global_cublas_handle", "start_line": 141, "start_column": 0, "end_line": 141, "end_column": 28 }, { "span": "global _global_cusolver_handle", "start_line": 143, "start_column": 0, "end_line": 143, "end_column": 30 }, { "span": "global _global_cublas_allocator", "start_line": 145, "start_column": 0, "end_line": 145, "end_column": 31 } ]
[]
1
true
[ "[CLS]_", "Use_", "of_", "'", "global", "'_", "at_", "module_", "level_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Mis", "cell", "ane", "ous", " ", "Py", "CU", "DA", " ", "function", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "atexit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numbers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "string_", "import_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "driver_", "as_", "drv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "gpu", "array_", "as_", "gpu", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "element", "wise_", "as_", "element", "wise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "reduction_", "as_", "reduction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "scan_", "as_", "scan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "tools_", "as_", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyc", "uda", "_", "._", "tools_", "import_", "context", "\\u", "dependent", "\\u", "memoize_", ",_", "dt", "ype", "\\u", "to", "\\u", "ctype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyc", "uda", "_", "._", "compiler_", "import_", "Sou", "rce", "Module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyto", "ols_", "import_", "memoize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "cuda_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "cub", "las", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "import_", "cula", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "has", "\\u", "cula", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Import", "Error_", ",_", "OSE", "rror_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "has", "\\u", "cula", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "import_", "cus", "olve", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "has", "\\u", "cus", "olve", "r_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Import", "Error_", ",_", "OSE", "rror_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "has", "\\u", "cus", "olve", "r_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "import_", "mag", "ma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "has", "\\u", "mag", "ma_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Import", "Error_", ",_", "OSE", "rror_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "has", "\\u", "mag", "ma_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "isd", "ou", "ble", "type_", "=_", "lambda_", "x_", ":_", "True_", "if_", "x_", "==_", "np_", "._", "float64_", "or_", "x_", "==_", "np_", "._", "complex", "128_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "isd", "ou", "ble", "type_", "._", "\\u\\u", "doc\\u\\u_", "=_", "\"\"\"", "\\", "10", ";", "Check", " ", "whe", "ther", " ", "a", " ", "type", " ", "has", " ", "double", " ", "preci", "sion", ".", "\\", "10", ";", "\\", "10", ";", "Parameter", "s", "\\", "10", ";", "----------", "\\", "10", ";", "t", " ", ":", " ", "nump", "y", " ", "float", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "Type", " ", "to", " ", "test", ".", "\\", "10", ";", "\\", "10", ";", "Return", "s", "\\", "10", ";", "-------", "\\", "10", ";", "result", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Result", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "isco", "mple", "xt", "ype_", "=_", "lambda_", "x_", ":_", "True_", "if_", "x_", "==_", "np_", "._", "complex", "64_", "or_", "x_", "==_", "np_", "._", "complex", "128_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "isco", "mple", "xt", "ype_", "._", "\\u\\u", "doc\\u\\u_", "=_", "\"\"\"", "\\", "10", ";", "Check", " ", "whe", "ther", " ", "a", " ", "type", " ", "is", " ", "complex", ".", "\\", "10", ";", "\\", "10", ";", "Parameter", "s", "\\", "10", ";", "----------", "\\", "10", ";", "t", " ", ":", " ", "nump", "y", " ", "float", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "Type", " ", "to", " ", "test", ".", "\\", "10", ";", "\\", "10", ";", "Return", "s", "\\", "10", ";", "-------", "\\", "10", ";", "result", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Result", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "\\u", "global", "\\u", "cub", "las", "\\u", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "global", "\\u", "cub", "las", "\\u", "handle_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "\\u", "global", "\\u", "cus", "olve", "r", "\\u", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "global", "\\u", "cus", "olve", "r", "\\u", "handle_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "\\u", "global", "\\u", "cub", "las", "\\u", "allocat", "or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "global", "\\u", "cub", "las", "\\u", "allocat", "or_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "ice", "il_", "=_", "lambda_", "n_", ":_", "int_", "(_", "np_", "._", "ceil_", "(_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "maxa", "bs_", "._", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cumsum_", "._", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff_", "._", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "avail", "able", " ", "numerical", " ", "types", " ", "provided", " ", "by", " ", "nump", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "types_", "=_", "[_", "np_", "._", "type", "Dict_", "[_", "t_", "]_", "for_", "t_", "in_", "np_", "._", "typec", "odes_", "[_", "'", "All", "Integer", "'_", "]_", "+_", "np_", "._", "typec", "odes_", "[_", "'", "All", "Float", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Number", "s", " ", "of", " ", "bytes", " ", "occupied", " ", "by", " ", "each", " ", "numerical", " ", "type", ":_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "nbytes_", "=_", "dict_", "(_", "(_", "np_", "._", "dtype_", "(_", "t_", ")_", ",_", "t_", "(_", "1_", ")_", "._", "nbytes_", ")_", "for_", "t_", "in_", "num", "\\u", "types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "by", "\\u", "index_", "._", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "by", "\\u", "index_", "._", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doctest_", "._", "testmod_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
akamai-open/api-kickstart/examples/python/papi_prefetch_toggle.py
[ { "content": "#! /usr/bin/env python\n\n\"\"\" Copyright 2015 Akamai Technologies, Inc. All Rights Reserved.\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\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 \nSample client \nIn order to use this papi client you will need to have access turned\non for your account. Send the contract IDs you want activated in a \nrequest to [email protected].\n\nThis script pulls the contract groups, products for that group, and\nthen looks for a property named \"Papitest1\". You can change the \nparticular items it's looking for easily enough - right now all it\ndoes is pull the first group, first contract, first product, which\nis where the test property lives.\n\nWhen you run the script with the --write flag, it will toggle the\nprefetch bit on the test property.\n\nPlease send any comments, questions or ideas to [email protected]\n\nThanks!\nThe Akamai Developer Relations Team\n\n\"\"\"\n\n\n\nimport requests, logging, json\nfrom random import randint\nfrom akamai.edgegrid import EdgeGridAuth\nfrom config import EdgeGridConfig\nfrom urlparse import urljoin\nimport urllib\nsession = requests.Session()\ndebug = False\nsection_name = \"papi\"\n\n# If all parameters are set already, use them. Otherwise\n# use the config\ntry:\n\tconfig = EdgeGridConfig({\"verbose\":False},section_name, {\"write\":\"count\"})\nexcept:\n error_msg = \"ERROR: No section named %s was found in your ~/.edgerc file\\n\" % section_name\n error_msg += \"ERROR: Please generate credentials for the script functionality\\n\"\n error_msg += \"ERROR: and run 'gen_edgerc %s' to generate the credential file\\n\" % section_name\n sys.exit(error_msg)\n\nif hasattr(config, 'verbose'):\n\tdebug = config.verbose\n\nif config.debug or config.verbose:\n\tdebug = True\n\n# Enable debugging for the requests module\nif debug:\n import httplib as http_client\n http_client.HTTPConnection.debuglevel = 1\n logging.basicConfig()\n logging.getLogger().setLevel(logging.DEBUG)\n requests_log = logging.getLogger(\"requests.packages.urllib3\")\n requests_log.setLevel(logging.DEBUG)\n requests_log.propagate = True\n\n\n# Set the config options\nsession.auth = EdgeGridAuth(\n client_token=config.client_token,\n client_secret=config.client_secret,\n access_token=config.access_token\n)\n\nif hasattr(config, 'headers'):\n\tsession.headers.update(config.headers)\n\nbaseurl = '%s://%s/' % ('https', config.host)\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\tId = {}\n\ttestProperty = \"developer.akamai.com\"\n\ttestRule = \"prefetching\"\n\t(Id['group'], Id['contract']) = getGroup()\n\t(Id['property'], propertyVersion) = getProperties(Id,testProperty)\n\t(rules) = getPropertyRules(Id,propertyVersion,testRule)\n\tprint\n\tif hasattr(config, \"write\") and config.write:\n\t\tswitchPropertyStatus(Id,propertyVersion,testRule,rules)\n\t\tgetPropertyRules(Id,propertyVersion,testRule)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 54, "start_column": 0, "end_line": 54, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", " ", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Copy", "right", " ", "201", "5", " ", "Ak", "ama", "i", " ", "Techno", "logi", "es", ",", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", ".", "\\", "10", ";", " ", "\\", "10", ";", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "\\", "10", ";", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", "\\", "10", ";", "\\", "10", ";", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0", "\\", "10", ";", "\\", "10", ";", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "\\", "10", ";", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", "\\", "10", ";", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", "\\", "10", ";", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", "\\", "10", ";", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", ".", "\\", "10", ";", " ", "\\", "10", ";", "Sampl", "e", " ", "client", " ", "\\", "10", ";", "In", " ", "order", " ", "to", " ", "use", " ", "this", " ", "pap", "i", " ", "client", " ", "you", " ", "will", " ", "need", " ", "to", " ", "have", " ", "access", " ", "turn", "ed", "\\", "10", ";", "on", " ", "for", " ", "your", " ", "account", ".", " ", " ", "Sen", "d", " ", "the", " ", "contract", " ", "ID", "s", " ", "you", " ", "want", " ", "activat", "ed", " ", "in", " ", "a", " ", "\\", "10", ";", "request", " ", "to", " ", "open", "-", "developer", "@", "aka", "mai", ".", "com", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "script", " ", "pull", "s", " ", "the", " ", "contract", " ", "group", "s", ",", " ", "products", " ", "for", " ", "tha", "t", " ", "group", ",", " ", "and", "\\", "10", ";", "then", " ", "look", "s", " ", "for", " ", "a", " ", "property", " ", "named", " ", "\"", "Pap", "ites", "t1", "\".", " ", " ", "You", " ", "can", " ", "change", " ", "the", " ", "\\", "10", ";", "partic", "ular", " ", "items", " ", "it", "'", "s", " ", "look", "ing", " ", "for", " ", "easi", "ly", " ", "eno", "ugh", " ", "-", " ", "right", " ", "now", " ", "all", " ", "it", "\\", "10", ";", "doe", "s", " ", "is", " ", "pull", " ", "the", " ", "first", " ", "group", ",", " ", "first", " ", "contract", ",", " ", "first", " ", "product", ",", " ", "whi", "ch", "\\", "10", ";", "is", " ", "where", " ", "the", " ", "test", " ", "property", " ", "lives", ".", "\\", "10", ";", "\\", "10", ";", "Whe", "n", " ", "you", " ", "run", " ", "the", " ", "script", " ", "with", " ", "the", " ", "--", "write", " ", "flag", ",", " ", "it", " ", "will", " ", "toggle", " ", "the", "\\", "10", ";", "prefetch", " ", "bit", " ", "on", " ", "the", " ", "test", " ", "property", ".", "\\", "10", ";", "\\", "10", ";", "Ple", "ase", " ", "send", " ", "any", " ", "comment", "s", ",", " ", "question", "s", " ", "or", " ", "idea", "s", " ", "to", " ", "open", "-", "developer", "@", "aka", "mai", ".", "com", "\\", "10", ";", "\\", "10", ";", "Thanks", "!", "\\", "10", ";", "The", " ", "Ak", "ama", "i", " ", "Dev", "elope", "r", " ", "Relation", "s", " ", "Tea", "m", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "requests_", ",_", "logging_", ",_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "randint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aka", "mai", "_", "._", "edge", "grid_", "import_", "Ed", "ge", "Grid", "Auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "config_", "import_", "Ed", "ge", "Grid", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "=_", "requests_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section", "\\u", "name_", "=_", "\"", "pap", "i", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "all", " ", "parameter", "s", " ", "are", " ", "set", " ", "alr", "ead", "y", ",", " ", "use", " ", "them", ".", " ", " ", "Ot", "her", "wise_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "the", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "config_", "=_", "Ed", "ge", "Grid", "Config_", "(_", "{_", "\"", "verbo", "se", "\"_", ":_", "False_", "}_", ",_", "section", "\\u", "name_", ",_", "{_", "\"", "write", "\"_", ":_", "\"", "count", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "msg_", "=_", "\"", "ERROR", ":", " ", "No", " ", "section", " ", "named", " ", "%", "s", " ", "was", " ", "found", " ", "in", " ", "your", " ", "~", "/.", "edge", "rc", " ", "file", "\\\\", "n", "\"_", "%_", "section", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "msg_", "+=_", "\"", "ERROR", ":", " ", "Ple", "ase", " ", "generat", "e", " ", "cred", "ential", "s", " ", "for", " ", "the", " ", "script", " ", "functional", "it", "y", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "msg_", "+=_", "\"", "ERROR", ":", " ", "and", " ", "run", " ", "'", "gen", "\\u", "edge", "rc", " ", "%", "s", "'", " ", "to", " ", "generat", "e", " ", "the", " ", "cred", "ential", " ", "file", "\\\\", "n", "\"_", "%_", "section", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "error", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "config_", ",_", "'", "verbo", "se", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "debug_", "=_", "config_", "._", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "._", "debug_", "or_", "config_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "debug_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "debugg", "ing", " ", "for", " ", "the", " ", "request", "s", " ", "module_", "\\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 ", " _", "import_", "httplib_", "as_", "http", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http", "\\u", "client_", "._", "HTTP", "Connection_", "._", "debugl", "evel_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "s", "\\u", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "request", "s", ".", "package", "s", ".", "url", "lib", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "s", "\\u", "log_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "s", "\\u", "log_", "._", "propagate_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "config", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "._", "auth_", "=_", "Ed", "ge", "Grid", "Auth_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "token_", "=_", "config_", "._", "client", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "secret_", "=_", "config_", "._", "client", "\\u", "secret_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "token_", "=_", "config_", "._", "access", "\\u", "token_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "config_", ",_", "'", "header", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "session_", "._", "headers_", "._", "update_", "(_", "config_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "baseurl_", "=_", "'%", "s", "://", "%", "s", "/'_", "%_", "(_", "'", "https", "'_", ",_", "config_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "Id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Property_", "=_", "\"", "developer", ".", "aka", "mai", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Rule_", "=_", "\"", "prefetch", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Id_", "[_", "'", "group", "'_", "]_", ",_", "Id_", "[_", "'", "contract", "'_", "]_", ")_", "=_", "get", "Group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "Id_", "[_", "'", "property", "'_", "]_", ",_", "property", "Version_", ")_", "=_", "get", "Properties_", "(_", "Id_", ",_", "test", "Property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "rules_", ")_", "=_", "get", "Proper", "ty", "Rules_", "(_", "Id_", ",_", "property", "Version_", ",_", "test", "Rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "config_", ",_", "\"", "write", "\"_", ")_", "and_", "config_", "._", "write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "switch", "Proper", "ty", "Status_", "(_", "Id_", ",_", "property", "Version_", ",_", "test", "Rule_", ",_", "rules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Proper", "ty", "Rules_", "(_", "Id_", ",_", "property", "Version_", ",_", "test", "Rule_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''The ``methods.account`` module provides simple implementations of\ncommon methods around account creation and management.\n'''\nimport create\nimport login\nimport logout\nimport update\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import create", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 }, { "span": "import login", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 12 }, { "span": "import logout", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 13 }, { "span": "import update", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "The", " ", "``", "method", "s", ".", "account", "``", " ", "module", " ", "provide", "s", " ", "simple", " ", "implementation", "s", " ", "of", "\\", "10", ";", "common", " ", "method", "s", " ", "aro", "und", " ", "account", " ", "creati", "on", " ", "and", " ", "manage", "ment", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "create_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "update_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1 ]
Variable defined multiple times
openstack/bandit/examples/random_module.py
[ { "content": "import random\nimport os\nimport somelib\n\nbad = random.random()\nbad = random.randrange()\nbad = random.randint()\nbad = random.choice()\nbad = random.uniform()\nbad = random.triangular()\n\ngood = os.urandom()\ngood = random.SystemRandom()\n\nunknown = random()\nunknown = somelib.a.random()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "bad ", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 3 }, { "span": "bad ", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 3 }, { "span": "bad ", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 3 }, { "span": "bad ", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 3 }, { "span": "bad ", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 3 }, { "span": "good ", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 4 }, { "span": "unknown ", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 7 } ]
[ { "span": "bad ", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 3 }, { "span": "good ", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 4 }, { "span": "unknown ", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 7 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[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_", "some", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bad_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad_", "=_", "random_", "._", "randrange_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad_", "=_", "random_", "._", "randint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad_", "=_", "random_", "._", "choice_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad_", "=_", "random_", "._", "uniform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad_", "=_", "random_", "._", "triangular", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "good_", "=_", "os_", "._", "urandom_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good_", "=_", "random_", "._", "System", "Random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "unknown_", "=_", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unknown_", "=_", "some", "lib_", "._", "a_", "._", "random_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ggventurini/python-deltasigma/deltasigma/tests/test_simulateSNR.py
[ { "content": " def test_simulateSNR_3(self):\n \"\"\"Test function for simulateSNR() 3/4\"\"\"\n # next test: amp is a scalar\n fname = pkg_resources.resource_filename(__name__,\n \"test_data/test_snr_amp2.mat\")\n amp_ref = scipy.io.loadmat(fname)['amp'].reshape((-1,))[0]\n snr_ref = scipy.io.loadmat(fname)['snr'].reshape((-1,))[0]\n ABCD = scipy.io.loadmat(fname)['ABCD'].reshape((4, 5))\n\n order = 3\n osr = 256\n nlev = 2\n f0 = 0.\n Hinf = 1.25\n form = 'CIFB'\n ntf = ds.synthesizeNTF(order, osr, 2, Hinf, f0)\n\n snr, amp = ds.simulateSNR(ABCD, osr, amp_ref, f0, nlev)\n self.assertTrue(np.allclose(snr, snr_ref, atol=1e-5, rtol=1e-5))\n self.assertTrue(np.allclose(amp, amp_ref, atol=1e-5, rtol=1e-5))", "metadata": "root.TestSimulateSNR.test_simulateSNR_3", "header": "['class', 'TestSimulateSNR', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 123 }, { "content": " def test_simulateSNR_4(self):\n \"\"\"Test function for simulateSNR() 4/4\"\"\"\n SNR_ref = np.array([23.0421, 32.1100, 43.3758, 53.1791,\n 65.5504, 70.5023, 73.4608, 76.2416, 77.8770,\n 78.2733, 79.3729, 79.5728, 80.8729, 82.7461,\n 83.0723, 84.8488, 84.3327])\n AMP_ref = np.array([-70, -60, -50, -40, -30, -20, -15, -10, -9, -8, -7,\n -6, -5, -4, -3, -2, -1, 0])\n\n order = 4\n osr = 32\n M = 8\n NG = -50\n ING = -10\n f0 = 1./ 16\n quadrature = 1\n form = 'PFB'\n nlev = M + 1\n z0 = np.exp(1j*2*np.pi*f0)\n bw = 1./ osr\n delta = 2\n FullScale = M\n ntf0 = ds.synthesizeQNTF(order, osr, f0, NG, ING)\n ABCD = ds.realizeQNTF(ntf0, form, True)\n #print(ABCD)\n #ds.PlotExampleSpectrum(ntf0, M, osr, f0, quadrature=True)\n a, b = ds.simulateSNR(ABCD, osr, None, f0, nlev);\n assert np.allclose(a[6:], SNR_ref, atol=10, rtol=1e-3)\n assert np.allclose(b[5:], AMP_ref, atol=1)", "metadata": "root.TestSimulateSNR.test_simulateSNR_4", "header": "['class', 'TestSimulateSNR', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 144 } ]
[ { "span": "form ", "start_line": 137, "start_column": 8, "end_line": 137, "end_column": 12 }, { "span": "ntf ", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 11 }, { "span": "quadrature ", "start_line": 159, "start_column": 8, "end_line": 159, "end_column": 18 }, { "span": "z0 ", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 10 }, { "span": "bw ", "start_line": 163, "start_column": 8, "end_line": 163, "end_column": 10 }, { "span": "delta ", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 13 }, { "span": "FullScale ", "start_line": 165, "start_column": 8, "end_line": 165, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Simulate", "SNR", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simulat", "e", "SNR", "\\u", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "function", " ", "for", " ", "simulat", "e", "SNR", "()", " ", "3", "/", "4", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "next", " ", "test", ":", " ", "amp", " ", "is", " ", "a", " ", "scalar_", "\\u\\u\\uNL\\u\\u\\u_", "fname_", "=_", "pkg", "\\u", "resources_", "._", "resource", "\\u", "filename_", "(_", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "data", "/", "test\\u", "snr", "\\u", "amp", "2", ".", "mat", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amp", "\\u", "ref_", "=_", "scipy_", "._", "io_", "._", "loadm", "at_", "(_", "fname_", ")_", "[_", "'", "amp", "'_", "]_", "._", "reshape_", "(_", "(_", "-_", "1_", ",_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snr", "\\u", "ref_", "=_", "scipy_", "._", "io_", "._", "loadm", "at_", "(_", "fname_", ")_", "[_", "'", "snr", "'_", "]_", "._", "reshape_", "(_", "(_", "-_", "1_", ",_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ABC", "D_", "=_", "scipy_", "._", "io_", "._", "loadm", "at_", "(_", "fname_", ")_", "[_", "'", "ABC", "D", "'_", "]_", "._", "reshape_", "(_", "(_", "4_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "osr", "_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nle", "v_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f0_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Hin", "f_", "=_", "1.25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "'", "CIF", "B", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ntf", "_", "=_", "ds_", "._", "synthesi", "ze", "NT", "F_", "(_", "order_", ",_", "osr", "_", ",_", "2_", ",_", "Hin", "f_", ",_", "f0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "snr_", ",_", "amp_", "=_", "ds_", "._", "simulat", "e", "SNR", "_", "(_", "ABC", "D_", ",_", "osr", "_", ",_", "amp", "\\u", "ref_", ",_", "f0_", ",_", "nle", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "np_", "._", "allclose_", "(_", "snr_", ",_", "snr", "\\u", "ref_", ",_", "atol_", "=_", "1e-5_", ",_", "rtol_", "=_", "1e-5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "np_", "._", "allclose_", "(_", "amp_", ",_", "amp", "\\u", "ref_", ",_", "atol_", "=_", "1e-5_", ",_", "rtol_", "=_", "1e-5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simulate", "SNR", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simulat", "e", "SNR", "\\u", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "function", " ", "for", " ", "simulat", "e", "SNR", "()", " ", "4", "/", "4", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SNR", "\\u", "ref_", "=_", "np_", "._", "array_", "(_", "[_", "23.", "042", "1_", ",_", "32.", "1100", "_", ",_", "43.", "375", "8_", ",_", "53.", "179", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "65.", "550", "4_", ",_", "70.", "502", "3_", ",_", "73.", "460", "8_", ",_", "76.", "241", "6_", ",_", "77.", "877", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "78.", "273", "3_", ",_", "79.", "372", "9_", ",_", "79.", "572", "8_", ",_", "80.", "872", "9_", ",_", "82.", "746", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "83.", "072", "3_", ",_", "84", ".8", "488", "_", ",_", "84", ".3", "327", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AMP", "\\u", "ref_", "=_", "np_", "._", "array_", "(_", "[_", "-_", "70_", ",_", "-_", "60_", ",_", "-_", "50_", ",_", "-_", "40_", ",_", "-_", "30_", ",_", "-_", "20_", ",_", "-_", "15_", ",_", "-_", "10_", ",_", "-_", "9_", ",_", "-_", "8_", ",_", "-_", "7_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "6_", ",_", "-_", "5_", ",_", "-_", "4_", ",_", "-_", "3_", ",_", "-_", "2_", ",_", "-_", "1_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "osr", "_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NG_", "=_", "-_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ING_", "=_", "-_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f0_", "=_", "1._", "/_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quadra", "ture_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "'", "PF", "B", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nle", "v_", "=_", "M_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z0_", "=_", "np_", "._", "exp_", "(_", "1j_", "*_", "2_", "*_", "np_", "._", "pi_", "*_", "f0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bw_", "=_", "1._", "/_", "osr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Full", "Scale_", "=_", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ntf", "0_", "=_", "ds_", "._", "synthesi", "ze", "QN", "TF", "_", "(_", "order_", ",_", "osr", "_", ",_", "f0_", ",_", "NG_", ",_", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ABC", "D_", "=_", "ds_", "._", "realize", "QN", "TF", "_", "(_", "ntf", "0_", ",_", "form_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "(", "ABC", "D", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "ds", ".", "Plot", "Exam", "ple", "Spect", "rum", "(", "ntf", "0", ",", " ", "M", ",", " ", "osr", ",", " ", "f0", ",", " ", "quadra", "ture", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "a_", ",_", "b_", "=_", "ds_", "._", "simulat", "e", "SNR", "_", "(_", "ABC", "D_", ",_", "osr", "_", ",_", "None_", ",_", "f0_", ",_", "nle", "v_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "np_", "._", "allclose_", "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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 ]
Variable defined multiple times
jrk/llvm-py/test/testall.py
[ { "content": "def do_module():\n print \" Testing class Module\"\n m = Module.new('test')\n m.target = 'a'\n a = m.target\n m.data_layout = 'a'\n a = m.data_layout\n m.add_type_name('a', ti)\n m.delete_type_name('a')\n s = str(m)\n s = m == Module.new('a')\n m.add_global_variable(ti, 'b')\n m.get_global_variable_named('b')\n gvs = list(m.global_variables)\n ft = Type.function(ti, [ti])\n m.add_function(ft, \"func\")\n m.get_function_named(\"func\")\n m.get_or_insert_function(ft, \"func\")\n m.get_or_insert_function(Type.function(ti, []), \"func\")\n m.get_or_insert_function(ft, \"func2\")\n fns = list(m.functions)\n try:\n m.verify()\n except LLVMException:\n pass\n\n class strstream(object):\n def __init__(self):\n self.s = ''\n\n def write(self, data):\n self.s += data\n\n def read(self):\n return self.s\n\n ss = strstream()\n m2 = Module.new('test')\n m2.add_type_name('myint', ti)\n m2.to_bitcode(ss)\n m3 = Module.from_bitcode(ss)\n t = m2 == m3\n ss2 = strstream()\n ss2.write(str(m))\n m4 = Module.from_assembly(ss2)\n t = m4 == m\n t = m4.pointer_size\n mA = Module.new('ma')\n mB = Module.new('mb')\n mA.link_in(mB)", "metadata": "root.do_module", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def do_type():\n print \" Testing class Type\"\n for i in range(1,100):\n Type.int(i)\n Type.float()\n Type.double()\n Type.x86_fp80()\n Type.fp128()\n Type.ppc_fp128()\n Type.function(ti, [ti]*100, True)\n Type.function(ti, [ti]*100, False)\n Type.struct([ti]*100)\n Type.packed_struct([ti]*100)\n Type.array(ti, 100)\n ptr = Type.pointer(ti, 4)\n pte = ptr.pointee\n Type.vector(ti, 100)\n Type.void()\n Type.label()\n Type.opaque()\n s = str(ti)\n s = ti == Type.float()\n Type.opaque().refine(Type.int())\n s = ti.width\n ft = Type.function(ti, [ti]*10)\n ft.return_type\n ft.vararg\n s = list(ft.args)\n ft.arg_count\n st = Type.struct([ti]*10)\n s = st.element_count\n s = list(st.elements)\n s = st.packed\n st = Type.packed_struct([ti]*10)\n s = st.element_count\n s = list(st.elements)\n s = st.packed\n at = Type.array(ti, 100)\n s = at.element\n s = at.count\n pt = Type.pointer(ti, 10)\n pt.address_space\n vt = Type.vector(ti, 100)\n s = vt.element\n s = vt.count\n Type.int(32) == Type.int(64)\n Type.int(32) != Type.int(64)\n Type.int(32) != Type.float()", "metadata": "root.do_type", "header": "['module', '___EOS___']", "index": 102 }, { "content": "def do_value():\n print \" Testing class Value\"\n k = Constant.int(ti, 42)\n k.name = 'a'\n s = k.name\n t = k.type\n s = str(k)\n s = k == Constant.int(ti, 43)\n i = k.value_id\n i = k.use_count\n i = k.uses", "metadata": "root.do_value", "header": "['module', '___EOS___']", "index": 159 }, { "content": "def do_global_value():\n print \" Testing class GlobalValue\"\n m = Module.new('a')\n gv = GlobalVariable.new(m, Type.int(), 'b')\n s = gv.is_declaration\n m = gv.module\n gv.linkage = LINKAGE_EXTERNAL\n s = gv.linkage\n gv.section = '.text'\n s = gv.section\n gv.visibility = VISIBILITY_HIDDEN\n s = gv.visibility\n gv.alignment = 8\n s = gv.alignment", "metadata": "root.do_global_value", "header": "['module', '___EOS___']", "index": 232 }, { "content": "def do_global_variable():\n print \" Testing class GlobalVariable\"\n m = Module.new('a')\n gv = GlobalVariable.new(m, Type.int(), 'b')\n gv = GlobalVariable.get(m, 'b')\n gv.delete()\n gv = GlobalVariable.new(m, Type.int(), 'c')\n gv.initializer = Constant.int( ti, 10 )\n s = gv.initializer\n gv.global_constant = True\n s = gv.global_constant", "metadata": "root.do_global_variable", "header": "['module', '___EOS___']", "index": 248 }, { "content": "def do_function():\n print \" Testing class Function\"\n ft = Type.function(ti, [ti]*20)\n zz = Function.new(Module.new('z'), ft, 'foobar')\n del zz\n Function.new(Module.new('zz'), ft, 'foobar')\n m = Module.new('a')\n f = Function.new(m, ft, 'func')\n f.delete()\n ft = Type.function(ti, [ti]*20)\n f = Function.new(m, ft, 'func2')\n has_nounwind = f.does_not_throw\n f.does_not_throw = True\n f2 = Function.intrinsic(m, INTR_COS, [ti])\n g = f.intrinsic_id\n f.calling_convenion = CC_FASTCALL\n g = f.calling_convenion\n f.collector = 'a'\n c = f.collector\n a = list(f.args)\n g = f.basic_block_count\n g = f.get_entry_basic_block()\n g = f.append_basic_block('a')\n g = f.get_entry_basic_block()\n g = list(f.basic_blocks)\n f.add_attribute(ATTR_NO_RETURN)\n f.add_attribute(ATTR_ALWAYS_INLINE)\n f.remove_attribute(ATTR_NO_RETURN)\n # LLVM misbehaves:\n #try:\n # f.verify()\n #except LLVMException:\n # pass", "metadata": "root.do_function", "header": "['module', '___EOS___']", "index": 273 }, { "content": "def do_builder():\n print \" Testing class Builder\"\n m = Module.new('a')\n ft = Type.function(ti, [ti])\n f = Function.new(m, ft, 'func')\n blk = f.append_basic_block('b')\n b = Builder.new(blk)\n b.ret(Constant.int(ti, 10))\n b.position_at_beginning(blk)\n b.position_at_end(blk)\n b.position_before(blk.instructions[0])\n blk2 = b.block\n b.ret_void()\n b.ret(Constant.int(ti, 10))\n _do_builder_mrv()\n #b.ret_many([Constant.int(ti, 10)]*10)\n b.branch(blk)\n b.cbranch(Constant.int(Type.int(1), 1), blk, blk)\n b.switch(f.args[0], blk)\n b.invoke(f, [Constant.int(ti,10)], blk, blk)\n b.unwind()\n b.unreachable()\n v = f.args[0]\n fv = Constant.real(Type.float(), \"1.0\")\n k = Constant.int(ti, 10)\n b.add(v, v)\n b.fadd(fv, fv)\n b.sub(v, v)\n b.fsub(fv, fv)\n b.mul(v, v)\n b.fmul(fv, fv)\n b.udiv(v, v)\n b.sdiv(v, v)\n b.fdiv(fv, fv)\n b.urem(v, v)\n b.srem(v, v)\n b.frem(fv, fv)\n b.shl(v, k)\n b.lshr(v, k)\n b.ashr(v, k)\n b.and_(v, v)\n b.or_(v, v)\n b.xor(v, v)\n b.neg(v)\n b.not_(v)\n p = b.malloc(Type.int())\n b.malloc_array(Type.int(), k)\n b.alloca(Type.int())\n b.alloca_array(Type.int(), k)\n b.free(p)\n b.load(p)\n b.store(k, p)\n # TODO gep\n b.trunc(v, Type.int(1))\n b.zext(v, Type.int(64))\n b.sext(v, Type.int(64))\n b.fptoui(fv, ti)\n b.fptosi(fv, ti)\n b.uitofp(k, Type.float())\n b.sitofp(k, Type.float())\n b.fptrunc(Constant.real(Type.double(), \"1.0\"), Type.float())\n b.fpext(Constant.real(Type.float(), \"1.0\"), Type.double())\n b.ptrtoint(p, ti)\n b.inttoptr(k, Type.pointer(Type.int()))\n b.bitcast(v, Type.float())\n b.icmp(IPRED_ULT, v, v)\n b.fcmp(RPRED_ULT, fv, fv)\n vi = Constant.vector([Constant.int(ti,42)]*10)\n vf = Constant.vector([Constant.real(Type.float(), 3.14)]*10)\n # TODO b.extract_value(v, 0)\n b.call(f, [v])\n b.select(Constant.int(Type.int(1), 1), blk, blk)\n b.vaarg(v, Type.int())\n b.extract_element(vi, v)\n b.insert_element(vi, v, v)\n b.shuffle_vector(vi, vi, vi)\n # NOTE: phi nodes without incoming values segfaults in LLVM during\n # destruction.\n i = b.phi(Type.int())\n i.add_incoming(v, blk)\n t = i.is_terminator == False\n t = i.is_binary_op == False\n t = i.is_shift == False\n t = i.is_cast == False\n t = i.is_logical_shift == False\n t = i.is_arithmetic_shift == False\n t = i.is_associative == False\n t = i.is_commutative == False\n t = i.is_volatile == False\n t = i.opcode\n t = i.opcode_name", "metadata": "root.do_builder", "header": "['module', '___EOS___']", "index": 396 }, { "content": "def do_targetdata():\n print \" Testing class TargetData\"\n t = TargetData.new('')\n v = str(t)\n v = t.byte_order\n v = t.pointer_size\n v = t.target_integer_type\n ty = Type.int()\n v = t.size(ty)\n v = t.store_size(ty)\n v = t.abi_size(ty)\n v = t.abi_alignment(ty)\n v = t.callframe_alignment(ty)\n v = t.preferred_alignment(ty)\n sty = Type.struct([ty, ty])\n v = t.element_at_offset(sty, 0)\n v = t.offset_of_element(sty, 0)\n m = Module.new('a')\n gv = m.add_global_variable(ty, 'gv')\n v = t.preferred_alignment(gv)", "metadata": "root.do_targetdata", "header": "['module', '___EOS___']", "index": 509 }, { "content": "def do_genericvalue():\n print \" Testing class GenericValue\"\n v = GenericValue.int(ti, 1)\n v = GenericValue.int_signed(ti, 1)\n v = GenericValue.real(Type.float(), 3.14)\n a = v.as_int()\n a = v.as_int_signed()\n a = v.as_real(Type.float())", "metadata": "root.do_genericvalue", "header": "['module', '___EOS___']", "index": 531 } ]
[ { "span": "a ", "start_line": 54, "start_column": 4, "end_line": 54, "end_column": 5 }, { "span": "s ", "start_line": 59, "start_column": 4, "end_line": 59, "end_column": 5 }, { "span": "t ", "start_line": 91, "start_column": 4, "end_line": 91, "end_column": 5 }, { "span": "t ", "start_line": 95, "start_column": 4, "end_line": 95, "end_column": 5 }, { "span": "s ", "start_line": 122, "start_column": 4, "end_line": 122, "end_column": 5 }, { "span": "s ", "start_line": 123, "start_column": 4, "end_line": 123, "end_column": 5 }, { "span": "s ", "start_line": 125, "start_column": 4, "end_line": 125, "end_column": 5 }, { "span": "s ", "start_line": 129, "start_column": 4, "end_line": 129, "end_column": 5 }, { "span": "s ", "start_line": 132, "start_column": 4, "end_line": 132, "end_column": 5 }, { "span": "s ", "start_line": 133, "start_column": 4, "end_line": 133, "end_column": 5 }, { "span": "s ", "start_line": 134, "start_column": 4, "end_line": 134, "end_column": 5 }, { "span": "s ", "start_line": 136, "start_column": 4, "end_line": 136, "end_column": 5 }, { "span": "s ", "start_line": 137, "start_column": 4, "end_line": 137, "end_column": 5 }, { "span": "s ", "start_line": 138, "start_column": 4, "end_line": 138, "end_column": 5 }, { "span": "s ", "start_line": 140, "start_column": 4, "end_line": 140, "end_column": 5 }, { "span": "s ", "start_line": 141, "start_column": 4, "end_line": 141, "end_column": 5 }, { "span": "s ", "start_line": 145, "start_column": 4, "end_line": 145, "end_column": 5 }, { "span": "s ", "start_line": 163, "start_column": 4, "end_line": 163, "end_column": 5 }, { "span": "s ", "start_line": 165, "start_column": 4, "end_line": 165, "end_column": 5 }, { "span": "i ", "start_line": 167, "start_column": 4, "end_line": 167, "end_column": 5 }, { "span": "i ", "start_line": 168, "start_column": 4, "end_line": 168, "end_column": 5 }, { "span": "s ", "start_line": 236, "start_column": 4, "end_line": 236, "end_column": 5 }, { "span": "s ", "start_line": 239, "start_column": 4, "end_line": 239, "end_column": 5 }, { "span": "s ", "start_line": 241, "start_column": 4, "end_line": 241, "end_column": 5 }, { "span": "s ", "start_line": 243, "start_column": 4, "end_line": 243, "end_column": 5 }, { "span": "gv ", "start_line": 251, "start_column": 4, "end_line": 251, "end_column": 6 }, { "span": "s ", "start_line": 256, "start_column": 4, "end_line": 256, "end_column": 5 }, { "span": "g ", "start_line": 287, "start_column": 4, "end_line": 287, "end_column": 5 }, { "span": "g ", "start_line": 289, "start_column": 4, "end_line": 289, "end_column": 5 }, { "span": "g ", "start_line": 293, "start_column": 4, "end_line": 293, "end_column": 5 }, { "span": "g ", "start_line": 294, "start_column": 4, "end_line": 294, "end_column": 5 }, { "span": "g ", "start_line": 295, "start_column": 4, "end_line": 295, "end_column": 5 }, { "span": "g ", "start_line": 296, "start_column": 4, "end_line": 296, "end_column": 5 }, { "span": "t ", "start_line": 476, "start_column": 4, "end_line": 476, "end_column": 5 }, { "span": "t ", "start_line": 477, "start_column": 4, "end_line": 477, "end_column": 5 }, { "span": "t ", "start_line": 478, "start_column": 4, "end_line": 478, "end_column": 5 }, { "span": "t ", "start_line": 479, "start_column": 4, "end_line": 479, "end_column": 5 }, { "span": "t ", "start_line": 480, "start_column": 4, "end_line": 480, "end_column": 5 }, { "span": "t ", "start_line": 481, "start_column": 4, "end_line": 481, "end_column": 5 }, { "span": "t ", "start_line": 482, "start_column": 4, "end_line": 482, "end_column": 5 }, { "span": "t ", "start_line": 483, "start_column": 4, "end_line": 483, "end_column": 5 }, { "span": "t ", "start_line": 484, "start_column": 4, "end_line": 484, "end_column": 5 }, { "span": "t ", "start_line": 485, "start_column": 4, "end_line": 485, "end_column": 5 }, { "span": "v ", "start_line": 512, "start_column": 4, "end_line": 512, "end_column": 5 }, { "span": "v ", "start_line": 513, "start_column": 4, "end_line": 513, "end_column": 5 }, { "span": "v ", "start_line": 514, "start_column": 4, "end_line": 514, "end_column": 5 }, { "span": "v ", "start_line": 515, "start_column": 4, "end_line": 515, "end_column": 5 }, { "span": "v ", "start_line": 517, "start_column": 4, "end_line": 517, "end_column": 5 }, { "span": "v ", "start_line": 518, "start_column": 4, "end_line": 518, "end_column": 5 }, { "span": "v ", "start_line": 519, "start_column": 4, "end_line": 519, "end_column": 5 }, { "span": "v ", "start_line": 520, "start_column": 4, "end_line": 520, "end_column": 5 }, { "span": "v ", "start_line": 521, "start_column": 4, "end_line": 521, "end_column": 5 }, { "span": "v ", "start_line": 522, "start_column": 4, "end_line": 522, "end_column": 5 }, { "span": "v ", "start_line": 524, "start_column": 4, "end_line": 524, "end_column": 5 }, { "span": "v ", "start_line": 525, "start_column": 4, "end_line": 525, "end_column": 5 }, { "span": "v ", "start_line": 533, "start_column": 4, "end_line": 533, "end_column": 5 }, { "span": "v ", "start_line": 534, "start_column": 4, "end_line": 534, "end_column": 5 }, { "span": "a ", "start_line": 536, "start_column": 4, "end_line": 536, "end_column": 5 }, { "span": "a ", "start_line": 537, "start_column": 4, "end_line": 537, "end_column": 5 } ]
[ { "span": "gv ", "start_line": 252, "start_column": 4, "end_line": 252, "end_column": 6 } ]
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_", "do", "\\u", "module_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Modul", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "Module_", "._", "new_", "(_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "target_", "=_", "'", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "m_", "._", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "data\\u", "layout_", "=_", "'", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "m_", "._", "data\\u", "layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "\\u", "type", "\\u", "name_", "(_", "'", "a", "'_", ",_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "delete", "\\u", "type", "\\u", "name_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "str_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "m_", "==_", "Module_", "._", "new_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "\\u", "global", "\\u", "variable_", "(_", "ti_", ",_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "get", "\\u", "global", "\\u", "variab", "le", "\\u", "named_", "(_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv", "s_", "=_", "list_", "(_", "m_", "._", "global", "\\u", "variables_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "=_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "ti_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "\\u", "function_", "(_", "ft_", ",_", "\"", "func", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "get", "\\u", "function", "\\u", "named_", "(_", "\"", "func", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "ft_", ",_", "\"", "func", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "]_", ")_", ",_", "\"", "func", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "get", "\\u", "or", "\\u", "insert", "\\u", "function_", "(_", "ft_", ",_", "\"", "func", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fns_", "=_", "list_", "(_", "m_", "._", "functions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "._", "verify_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "LLVM", "Exception_", ":_", "\\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_", "class_", "strs", "tream_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "s_", "=_", "''_", "\\u\\u\\uNEWLINE\\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 ", " _", "self_", "._", "s_", "+=_", "data_", "\\u\\u\\uNEWLINE\\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 ", " _", "return_", "self_", "._", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ss_", "=_", "strs", "tream_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "Module_", "._", "new_", "(_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "._", "add", "\\u", "type", "\\u", "name_", "(_", "'", "myi", "nt", "'_", ",_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "._", "to", "\\u", "bit", "code_", "(_", "ss_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m3_", "=_", "Module_", "._", "from", "\\u", "bit", "code_", "(_", "ss_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "m2_", "==_", "m3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "2_", "=_", "strs", "tream_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ss", "2_", "._", "write_", "(_", "str_", "(_", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m4", "_", "=_", "Module_", "._", "from", "\\u", "assembly_", "(_", "ss", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "m4", "_", "==_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "m4", "_", "._", "point", "er", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "A_", "=_", "Module_", "._", "new_", "(_", "'", "ma", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "B_", "=_", "Module_", "._", "new_", "(_", "'", "mb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "A_", "._", "link", "\\u", "in_", "(_", "m", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "type_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Type", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Type_", "._", "int_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Type_", "._", "float_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "double_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "x8", "6", "\\u", "fp", "80_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "fp", "128_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "pp", "c\\u", "fp", "128_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "ti_", "]_", "*_", "100_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "ti_", "]_", "*_", "100_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "struct_", "(_", "[_", "ti_", "]_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "pack", "ed", "\\u", "struct_", "(_", "[_", "ti_", "]_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "array_", "(_", "ti_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptr_", "=_", "Type_", "._", "pointer_", "(_", "ti_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pte", "_", "=_", "ptr_", "._", "point", "ee_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "vector_", "(_", "ti_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "void_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "label_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "opaque", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "str_", "(_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "ti_", "==_", "Type_", "._", "float_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "opaque", "_", "(_", ")_", "._", "refine", "_", "(_", "Type_", "._", "int_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "ti_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "=_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "ti_", "]_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "._", "return", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "._", "vara", "rg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "list_", "(_", "ft_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "._", "arg", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "Type_", "._", "struct_", "(_", "[_", "ti_", "]_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "st_", "._", "element", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "list_", "(_", "st_", "._", "elements_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "st_", "._", "packed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "Type_", "._", "pack", "ed", "\\u", "struct_", "(_", "[_", "ti_", "]_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "st_", "._", "element", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "list_", "(_", "st_", "._", "elements_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "st_", "._", "packed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "at_", "=_", "Type_", "._", "array_", "(_", "ti_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "at_", "._", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "at_", "._", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "=_", "Type_", "._", "pointer_", "(_", "ti_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "._", "address", "\\u", "space_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vt_", "=_", "Type_", "._", "vector_", "(_", "ti_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "vt_", "._", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "vt_", "._", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "int_", "(_", "32_", ")_", "==_", "Type_", "._", "int_", "(_", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "int_", "(_", "32_", ")_", "!=_", "Type_", "._", "int_", "(_", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Type_", "._", "int_", "(_", "32_", ")_", "!=_", "Type_", "._", "float_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "value_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "Constant_", "._", "int_", "(_", "ti_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "._", "name_", "=_", "'", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "k_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "k_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "str_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "k_", "==_", "Constant_", "._", "int_", "(_", "ti_", ",_", "43_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "k_", "._", "value", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "k_", "._", "use", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "k_", "._", "uses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "global", "\\u", "value_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Global", "Value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "Module_", "._", "new_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "=_", "Global", "Variable_", "._", "new_", "(_", "m_", ",_", "Type_", "._", "int_", "(_", ")_", ",_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "gv_", "._", "is", "\\u", "declaration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "gv_", "._", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "._", "linkage", "_", "=_", "LINK", "AGE", "\\u", "EXTERNAL", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "gv_", "._", "linkage", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "._", "section_", "=_", "'.", "text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "gv_", "._", "section_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "._", "visibility_", "=_", "VISI", "BILITY", "\\u", "HIDDEN", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "gv_", "._", "visibility_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "._", "alignment_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "gv_", "._", "alignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "global", "\\u", "variable_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Global", "Varia", "ble", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "Module_", "._", "new_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "=_", "Global", "Variable_", "._", "new_", "(_", "m_", ",_", "Type_", "._", "int_", "(_", ")_", ",_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "=_", "Global", "Variable_", "._", "get_", "(_", "m_", ",_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "=_", "Global", "Variable_", "._", "new_", "(_", "m_", ",_", "Type_", "._", "int_", "(_", ")_", ",_", "'", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "._", "initializer_", "=_", "Constant_", "._", "int_", "(_", "ti_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "gv_", "._", "initializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "._", "global", "\\u", "constant_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "gv_", "._", "global", "\\u", "constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "function_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Function", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "=_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "ti_", "]_", "*_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zz_", "=_", "Function_", "._", "new_", "(_", "Module_", "._", "new_", "(_", "'", "z", "'_", ")_", ",_", "ft_", ",_", "'", "fooba", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "zz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Function_", "._", "new_", "(_", "Module_", "._", "new_", "(_", "'", "zz", "'_", ")_", ",_", "ft_", ",_", "'", "fooba", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "Module_", "._", "new_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "Function_", "._", "new_", "(_", "m_", ",_", "ft_", ",_", "'", "func", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "=_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "ti_", "]_", "*_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "Function_", "._", "new_", "(_", "m_", ",_", "ft_", ",_", "'", "func", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "noun", "wind_", "=_", "f_", "._", "doe", "s", "\\u", "not", "\\u", "throw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "doe", "s", "\\u", "not", "\\u", "throw_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f2_", "=_", "Function_", "._", "intrinsic", "_", "(_", "m_", ",_", "INT", "R", "\\u", "COS", "_", ",_", "[_", "ti_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "f_", "._", "intrinsic", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "calling", "\\u", "conve", "nio", "n_", "=_", "CC", "\\u", "FAST", "CALL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "f_", "._", "calling", "\\u", "conve", "nio", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "collector_", "=_", "'", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "f_", "._", "collector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "list_", "(_", "f_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "f_", "._", "basic", "\\u", "block", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "f_", "._", "get", "\\u", "entry", "\\u", "basic", "\\u", "block_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "f_", "._", "append", "\\u", "basic", "\\u", "block_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "f_", "._", "get", "\\u", "entry", "\\u", "basic", "\\u", "block_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "list_", "(_", "f_", "._", "basic", "\\u", "blocks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "add", "\\u", "attribute_", "(_", "ATT", "R", "\\u", "NO", "\\u", "RETURN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "add", "\\u", "attribute_", "(_", "ATT", "R", "\\u", "ALWAYS", "\\u", "IN", "LINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "remove", "\\u", "attribute_", "(_", "ATT", "R", "\\u", "NO", "\\u", "RETURN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "LLVM", " ", "mis", "behave", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "f", ".", "verify", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "except", " ", "LLVM", "Except", "ion", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pass_", "\\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_", "do", "\\u", "builder_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Build", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "Module_", "._", "new_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ft_", "=_", "Type_", "._", "function_", "(_", "ti_", ",_", "[_", "ti_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "Function_", "._", "new_", "(_", "m_", ",_", "ft_", ",_", "'", "func", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blk_", "=_", "f_", "._", "append", "\\u", "basic", "\\u", "block_", "(_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "Builder_", "._", "new_", "(_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "ret_", "(_", "Constant_", "._", "int_", "(_", "ti_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "position", "\\u", "at", "\\u", "beginn", "ing_", "(_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "position", "\\u", "at", "\\u", "end_", "(_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "position", "\\u", "before_", "(_", "blk_", "._", "instructions_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blk", "2_", "=_", "b_", "._", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "ret", "\\u", "void_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "ret_", "(_", "Constant_", "._", "int_", "(_", "ti_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "do", "\\u", "builde", "r", "\\u", "mr", "v_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "b", ".", "ret", "\\u", "many", "([", "Const", "ant", ".", "int", "(", "ti", ",", " ", "10", ")]", "*", "10", ")_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "branch_", "(_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "cb", "ranch", "_", "(_", "Constant_", "._", "int_", "(_", "Type_", "._", "int_", "(_", "1_", ")_", ",_", "1_", ")_", ",_", "blk_", ",_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "switch_", "(_", "f_", "._", "args_", "[_", "0_", "]_", ",_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "invoke_", "(_", "f_", ",_", "[_", "Constant_", "._", "int_", "(_", "ti_", ",_", "10_", ")_", "]_", ",_", "blk_", ",_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "unw", "ind_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "unreachable", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "f_", "._", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fv_", "=_", "Constant_", "._", "real_", "(_", "Type_", "._", "float_", "(_", ")_", ",_", "\"", "1.0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "Constant_", "._", "int_", "(_", "ti_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "add_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fad", "d_", "(_", "fv_", ",_", "fv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "sub_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fsu", "b_", "(_", "fv_", ",_", "fv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "mul_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fm", "ul_", "(_", "fv_", ",_", "fv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "udi", "v_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "sdi", "v_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fdi", "v_", "(_", "fv_", ",_", "fv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "ure", "m_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "sre", "m_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fre", "m_", "(_", "fv_", ",_", "fv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "shl", "_", "(_", "v_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "lsh", "r_", "(_", "v_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "ash", "r_", "(_", "v_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "and\\u_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "or\\u_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "xor_", "(_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "neg_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "not", "\\u_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "b_", "._", "malloc", "_", "(_", "Type_", "._", "int_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "malloc", "\\u", "array_", "(_", "Type_", "._", "int_", "(_", ")_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "allo", "ca_", "(_", "Type_", "._", "int_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "allo", "ca", "\\u", "array_", "(_", "Type_", "._", "int_", "(_", ")_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "free_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "load_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "store_", "(_", "k_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "ge", "p_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "trunc", "_", "(_", "v_", ",_", "Type_", "._", "int_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "ze", "xt_", "(_", "v_", ",_", "Type_", "._", "int_", "(_", "64_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "sex", "t_", "(_", "v_", ",_", "Type_", "._", "int_", "(_", "64_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fp", "tou", "i_", "(_", "fv_", ",_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fp", "tos", "i_", "(_", "fv_", ",_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "uit", "ofp", "_", "(_", "k_", ",_", "Type_", "._", "float_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "sit", "ofp", "_", "(_", "k_", ",_", "Type_", "._", "float_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fp", "trunc", "_", "(_", "Constant_", "._", "real_", "(_", "Type_", "._", "double_", "(_", ")_", ",_", "\"", "1.0", "\"_", ")_", ",_", "Type_", "._", "float_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fp", "ext_", "(_", "Constant_", "._", "real_", "(_", "Type_", "._", "float_", "(_", ")_", ",_", "\"", "1.0", "\"_", ")_", ",_", "Type_", "._", "double_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "ptr", "toi", "nt_", "(_", "p_", ",_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "int", "top", "tr_", "(_", "k_", ",_", "Type_", "._", "pointer_", "(_", "Type_", "._", "int_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "bit", "cast_", "(_", "v_", ",_", "Type_", "._", "float_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "icmp", "_", "(_", "IP", "RED", "\\u", "ULT", "_", ",_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "fcm", "p_", "(_", "RP", "RED", "\\u", "ULT", "_", ",_", "fv_", ",_", "fv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi_", "=_", "Constant_", "._", "vector_", "(_", "[_", "Constant_", "._", "int_", "(_", "ti_", ",_", "42_", ")_", "]_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vf_", "=_", "Constant_", "._", "vector_", "(_", "[_", "Constant_", "._", "real_", "(_", "Type_", "._", "float_", "(_", ")_", ",_", "3.14", "_", ")_", "]_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "b", ".", "extract", "\\u", "value", "(", "v", ",", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "call_", "(_", "f_", ",_", "[_", "v_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "select_", "(_", "Constant_", "._", "int_", "(_", "Type_", "._", "int_", "(_", "1_", ")_", ",_", "1_", ")_", ",_", "blk_", ",_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "va", "arg_", "(_", "v_", ",_", "Type_", "._", "int_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "extract", "\\u", "element_", "(_", "vi_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "insert", "\\u", "element_", "(_", "vi_", ",_", "v_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "shu", "ffle", "\\u", "vector_", "(_", "vi_", ",_", "vi_", ",_", "vi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "phi", " ", "nodes", " ", "with", "out", " ", "inco", "ming", " ", "values", " ", "seg", "faults", " ", "in", " ", "LLVM", " ", "dur", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "destruct", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "b_", "._", "phi_", "(_", "Type_", "._", "int_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "add", "\\u", "incoming_", "(_", "v_", ",_", "blk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "terminator", "_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "binar", "y", "\\u", "op_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "shift_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "cast_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "logical", "\\u", "shift_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "arithmetic", "\\u", "shift_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "associ", "ative_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "commu", "tative", "_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "is", "\\u", "volatile", "_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "opcode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "i_", "._", "opcode", "\\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_", "def_", "do", "\\u", "target", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Target", "Data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "Target", "Data_", "._", "new_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "str_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "byte", "\\u", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "point", "er", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "target", "\\u", "integ", "er", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ty_", "=_", "Type_", "._", "int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "size_", "(_", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "store", "\\u", "size_", "(_", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "abi", "\\u", "size_", "(_", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "abi", "\\u", "alignment_", "(_", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "call", "frame", "\\u", "alignment_", "(_", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "prefer", "red", "\\u", "alignment_", "(_", "ty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sty", "_", "=_", "Type_", "._", "struct_", "(_", "[_", "ty_", ",_", "ty_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "element", "\\u", "at", "\\u", "offset_", "(_", "sty", "_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "offset", "\\u", "of", "\\u", "element_", "(_", "sty", "_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "Module_", "._", "new_", "(_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gv_", "=_", "m_", "._", "add", "\\u", "global", "\\u", "variable_", "(_", "ty_", ",_", "'", "gv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "t_", "._", "prefer", "red", "\\u", "alignment_", "(_", "gv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "gener", "ic", "value_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", " ", " ", " ", "Test", "ing", " ", "class", " ", "Gene", "ric", "Value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Gene", "ric", "Value_", "._", "int_", "(_", "ti_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Gene", "ric", "Value_", "._", "int\\u", "signed_", "(_", "ti_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "Gene", "ric", "Value_", "._", "real_", "(_", "Type_", "._", "float_", "(_", ")_", ",_", "3.14", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "v_", "._", "as", "\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 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 0, 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 ]
Constant in conditional expression or statement
kayhayen/Nuitka/tests/basics/ComparisonChains.py
[ { "content": "def inOperatorChain():\n print(\"In operator chains:\")\n print(3 in [3,4] in [[3,4]])\n print(3 in [3,4] not in [[3,4]])\n\n if 3 in [3,4] in [[3,4]]:\n print(\"Yes\")\n else:\n print(\"No\")\n\n if 3 in [3,4] not in [[3,4]]:\n print(\"Yes\")\n else:\n print(\"No\")", "metadata": "root.inOperatorChain", "header": "['module', '___EOS___']", "index": 122 } ]
[ { "span": "3 in [3,4] in [[3,4]]:", "start_line": 127, "start_column": 7, "end_line": 127, "end_column": 28 }, { "span": "3 in [3,4] not in [[3,4]]:", "start_line": 132, "start_column": 7, "end_line": 132, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Constant_", "in_", "conditional", "_", "expression_", "or_", "statement_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "in", "Opera", "tor", "Chain_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "In", " ", "opera", "tor", " ", "chain", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "in_", "[_", "[_", "3_", ",_", "4_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "not_", "in_", "[_", "[_", "3_", ",_", "4_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "in_", "[_", "[_", "3_", ",_", "4_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Ye", "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 ", " _", "print_", "(_", "\"", "No", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "3_", "in_", "[_", "3_", ",_", "4_", "]_", "not_", "in_", "[_", "[_", "3_", ",_", "4_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Ye", "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 ", " _", "print_", "(_", "\"", "No", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
catap/namebench/libnamebench/tk.py
[ { "content": "# Copyright 2009 Google Inc. All Rights Reserved.\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\"\"\"Tk user interface implementation for namebench.\"\"\"\n\n__author__ = '[email protected] (Thomas Stromberg)'\n\nimport datetime\nimport os\nimport Queue\nimport sys\nimport threading\nimport tkFont\n# Wildcard imports are evil.\nfrom Tkinter import *\nimport tkMessageBox\nimport traceback\n\nimport addr_util\nimport base_ui\nimport conn_quality\nimport nameserver_list\nimport sys_nameservers\nimport util\n\nTHREAD_UNSAFE_TK = 0\nLOG_FILE_PATH = util.GenerateOutputFilename('log')\n\n\n\nglobal_message_queue = Queue.Queue()\nglobal_last_message = None\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def closedWindowHandler():\n print 'Au revoir, mes amis!'\n sys.exit(1)", "metadata": "root.closedWindowHandler", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def AddMsg(message, master=None, backup_notifier=None, **kwargs):\n \"\"\"Add a message to the global queue for output.\"\"\"\n global global_message_queue\n global global_last_message\n global THREAD_UNSAFE_TK\n\n new_message = StatusMessage(message, **kwargs)\n if new_message != global_last_message:\n global_message_queue.put(new_message)\n\n if master:\n try:\n master.event_generate('<<msg>>', when='tail')\n global_last_message = new_message\n # Tk thread-safety workaround #1\n except TclError:\n # If we aren't thread safe, we already assume this won't work.\n if not THREAD_UNSAFE_TK:\n print 'First TCL Error:'\n traceback.print_exc()\n try:\n backup_notifier(-1)\n THREAD_UNSAFE_TK = 1\n except:\n print 'Backup notifier failure:'\n traceback.print_exc()", "metadata": "root.AddMsg", "header": "['module', '___EOS___']", "index": 48 }, { "content": "class StatusMessage(object):\n \"\"\"Messages to be passed from to the main thread from children.\n\n Used to avoid thread issues inherent with Tk.\n \"\"\"\n", "metadata": "root.StatusMessage", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def __init__(self, message, error=False, count=False, total=False,\n enable_button=None, debug=False):\n self.message = message\n self.error = error\n self.count = count\n self.debug = debug\n self.total = total\n self.enable_button = enable_button", "metadata": "root.StatusMessage.__init__", "header": "['class', 'StatusMessage', '(', 'object', ')', ':', '___EOS___']", "index": 82 }, { "content": "class WorkerThread(threading.Thread, base_ui.BaseUI):\n \"\"\"Handle benchmarking and preparation in a separate UI thread.\"\"\"\n\n\n", "metadata": "root.WorkerThread", "header": "['module', '___EOS___']", "index": 92 }, { "content": " def __init__(self, supplied_ns, global_ns, regional_ns, options, data_source=None, master=None,\n backup_notifier=None):\n threading.Thread.__init__(self)\n self.SetupDataStructures()\n self.status_callback = self.msg\n self.data_src = data_source\n self.backup_notifier = backup_notifier\n self.include_internal = False\n self.supplied_ns = supplied_ns\n self.global_ns = global_ns\n self.regional_ns = regional_ns\n self.master = master\n self.options = options\n self.resource_dir = os.path.dirname(os.path.dirname(__file__))", "metadata": "root.WorkerThread.__init__", "header": "['class', 'WorkerThread', '(', 'threading', '.', 'Thread', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 95 }, { "content": " def msg(self, message, **kwargs):\n \"\"\"Add messages to the main queue.\"\"\"\n return AddMsg(message, master=self.master, backup_notifier=self.backup_notifier, **kwargs)", "metadata": "root.WorkerThread.msg", "header": "['class', 'WorkerThread', '(', 'threading', '.', 'Thread', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 110 }, { "content": " def run(self):\n self.msg('Started thread', enable_button=False)\n try:\n self.PrepareTestRecords()\n self.PrepareNameServers()\n self.PrepareBenchmark()\n self.RunAndOpenReports()\n except nameserver_list.OutgoingUdpInterception:\n (exc_type, exception, tb) = sys.exc_info()\n self.msg('Outgoing requests were intercepted!', error=exception)\n except nameserver_list.TooFewNameservers:\n (exc_type, exception, tb) = sys.exc_info()\n self.msg('Too few nameservers to test', error=exception)\n except conn_quality.OfflineConnection:\n (exc_type, exception, tb) = sys.exc_info()\n self.msg('The connection appears to be offline!', error=exception)\n except:\n (exc_type, exception, tb) = sys.exc_info()\n traceback.print_exc(tb)\n error_msg = '\\n'.join(traceback.format_tb(tb)[-4:])\n self.msg(exception, error=error_msg)\n self.msg(None, enable_button=True)", "metadata": "root.WorkerThread.run", "header": "['class', 'WorkerThread', '(', 'threading', '.', 'Thread', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 114 }, { "content": "class NameBenchGui(object):\n \"\"\"The main GUI.\"\"\"\n\n", "metadata": "root.NameBenchGui", "header": "['module', '___EOS___']", "index": 138 }, { "content": " def __init__(self, options, supplied_ns, global_ns, regional_ns, version=None):\n self.options = options\n self.supplied_ns = supplied_ns\n self.global_ns = global_ns\n self.regional_ns = regional_ns\n self.version = version", "metadata": "root.NameBenchGui.__init__", "header": "['class', 'NameBenchGui', '(', 'object', ')', ':', '___EOS___']", "index": 141 }, { "content": " def Execute(self):\n self.root = Tk()\n app = MainWindow(self.root, self.options, self.supplied_ns, self.global_ns,\n self.regional_ns, self.version)\n app.DrawWindow()\n self.root.bind('<<msg>>', app.MessageHandler)\n self.root.mainloop()", "metadata": "root.NameBenchGui.Execute", "header": "['class', 'NameBenchGui', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": "class MainWindow(Frame, base_ui.BaseUI):\n \"\"\"The main Tk GUI class.\"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.MainWindow", "header": "['module', '___EOS___']", "index": 157 }, { "content": " def __init__(self, master, options, supplied_ns, global_ns, regional_ns, version=None):\n \"\"\"TODO(tstromberg): Remove duplication from NameBenchGui class.\"\"\"\n Frame.__init__(self)\n self.SetupDataStructures()\n self.master = master\n self.options = options\n self.supplied_ns = supplied_ns\n self.global_ns = global_ns\n self.regional_ns = regional_ns\n self.version = version\n try:\n self.log_file = open(LOG_FILE_PATH, 'w')\n except:\n print 'Failed to open %s for write' % LOG_FILE_PATH\n self.master.protocol('WM_DELETE_WINDOW', closedWindowHandler)", "metadata": "root.MainWindow.__init__", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 160 }, { "content": " def UpdateStatus(self, message, count=None, total=None, error=None, debug=False):\n \"\"\"Update our little status window.\"\"\"\n if not message:\n return None\n\n if total:\n state = '%s... [%s/%s]' % (message, count, total)\n elif count:\n state = '%s%s' % (message, '.' * count)\n else:\n state = message\n\n print '> %s' % str(state)\n try:\n self.log_file.write('%s: %s\\r\\n' % (datetime.datetime.now(), state))\n self.log_file.flush()\n except:\n pass\n if not debug:\n self.status.set(state[0:75])", "metadata": "root.MainWindow.UpdateStatus", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 176 }, { "content": " def DrawWindow(self):\n \"\"\"Draws the user interface.\"\"\"\n self.nameserver_form = StringVar()\n self.status = StringVar()\n self.query_count = IntVar()\n self.data_source = StringVar()\n self.health_performance = StringVar()\n self.location = StringVar()\n self.use_global = IntVar()\n self.use_regional = IntVar()\n self.use_censor_checks = IntVar()\n self.share_results = IntVar()\n\n self.master.title('namebench')\n outer_frame = Frame(self.master)\n outer_frame.grid(row=0, padx=16, pady=16)\n inner_frame = Frame(outer_frame, relief=GROOVE, bd=2, padx=12, pady=12)\n inner_frame.grid(row=0, columnspan=2)\n status = Label(outer_frame, text='...', textvariable=self.status)\n status.grid(row=15, sticky=W, column=0)\n\n if sys.platform[:3] == 'win':\n seperator_width = 490\n else:\n seperator_width = 585\n\n bold_font = tkFont.Font(font=status['font'])\n bold_font['weight'] = 'bold'\n\n ns_label = Label(inner_frame, text='Nameservers')\n ns_label.grid(row=0, columnspan=2, sticky=W)\n ns_label['font'] = bold_font\n\n nameservers = Entry(inner_frame, bg='white',\n textvariable=self.nameserver_form,\n width=80)\n nameservers.grid(row=1, columnspan=2, sticky=W, padx=4, pady=2)\n self.nameserver_form.set(', '.join(nameserver_list.InternalNameServers()))\n\n global_button = Checkbutton(inner_frame,\n text='Include global DNS providers (Google Public DNS, OpenDNS, UltraDNS, etc.)',\n variable=self.use_global)\n global_button.grid(row=2, columnspan=2, sticky=W)\n global_button.toggle()\n\n regional_button = Checkbutton(inner_frame,\n text='Include best available regional DNS services',\n variable=self.use_regional)\n regional_button.grid(row=3, columnspan=2, sticky=W)\n regional_button.toggle()\n\n separator = Frame(inner_frame, height=2, width=seperator_width, bd=1, relief=SUNKEN)\n separator.grid(row=4, padx=5, pady=5, columnspan=2)\n\n ds_label = Label(inner_frame, text='Options')\n ds_label.grid(row=5, column=0, sticky=W)\n ds_label['font'] = bold_font\n\n censorship_button = Checkbutton(inner_frame, text='Include censorship checks',\n variable=self.use_censor_checks)\n censorship_button.grid(row=6, columnspan=2, sticky=W)\n\n share_button = Checkbutton(inner_frame,\n text='Upload and share your anonymized results (help speed up the internet!)',\n variable=self.share_results)\n\n # Old versions of Tk do not support two-dimensional padding.\n try:\n share_button.grid(row=7, columnspan=2, sticky=W, pady=[0,10])\n except TclError:\n share_button.grid(row=7, columnspan=2, sticky=W)\n\n loc_label = Label(inner_frame, text='Your location')\n loc_label.grid(row=10, column=0, sticky=W)\n loc_label['font'] = bold_font\n\n run_count_label = Label(inner_frame, text='Health Check Performance')\n run_count_label.grid(row=10, column=1, sticky=W)\n run_count_label['font'] = bold_font\n\n self.DiscoverLocation()\n self.LoadDataSources()\n source_titles = self.data_src.ListSourceTitles()\n left_dropdown_width = max([len(x) for x in source_titles]) - 3\n\n location_choices = [self.country, '(Other)']\n location = OptionMenu(inner_frame, self.location, *location_choices)\n location.configure(width=left_dropdown_width)\n location.grid(row=11, column=0, sticky=W)\n self.location.set(location_choices[0])\n\n mode_choices = ['Fast', 'Slow (unstable network)']\n right_dropdown_width = max([len(x) for x in mode_choices]) - 3\n health_performance = OptionMenu(inner_frame, self.health_performance, *mode_choices)\n health_performance.configure(width=right_dropdown_width)\n health_performance.grid(row=11, column=1, sticky=W)\n self.health_performance.set(mode_choices[0])\n\n ds_label = Label(inner_frame, text='Query Data Source')\n ds_label.grid(row=12, column=0, sticky=W)\n ds_label['font'] = bold_font\n\n numqueries_label = Label(inner_frame, text='Number of queries')\n numqueries_label.grid(row=12, column=1, sticky=W)\n numqueries_label['font'] = bold_font\n\n data_source = OptionMenu(inner_frame, self.data_source, *source_titles)\n data_source.configure(width=left_dropdown_width)\n data_source.grid(row=13, column=0, sticky=W)\n self.data_source.set(source_titles[0])\n\n query_count = Entry(inner_frame, bg='white', textvariable=self.query_count)\n query_count.grid(row=13, column=1, sticky=W, padx=4)\n query_count.configure(width=right_dropdown_width + 6)\n self.query_count.set(self.options.query_count)\n\n self.button = Button(outer_frame, command=self.StartJob)\n self.button.grid(row=15, sticky=E, column=1, pady=4, padx=1)\n self.UpdateRunState(running=True)\n self.UpdateRunState(running=False)\n self.UpdateStatus('namebench %s is ready!' % self.version)", "metadata": "root.MainWindow.DrawWindow", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 197 }, { "content": " def MessageHandler(self, unused_event):\n \"\"\"Pinged when there is a new message in our queue to handle.\"\"\"\n while global_message_queue.qsize():\n m = global_message_queue.get()\n if m.error:\n self.ErrorPopup(m.message, m.error)\n elif m.enable_button == False:\n self.UpdateRunState(running=True)\n elif m.enable_button == True:\n self.UpdateRunState(running=False)\n self.UpdateStatus(m.message, count=m.count, total=m.total, error=m.error, debug=m.debug)", "metadata": "root.MainWindow.MessageHandler", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 319 }, { "content": " def ErrorPopup(self, title, message):\n print 'Showing popup: %s' % title\n tkMessageBox.showerror(str(title), str(message), master=self.master)", "metadata": "root.MainWindow.ErrorPopup", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 331 }, { "content": " def UpdateRunState(self, running=True):\n \"\"\"Update the run state of the window, using nasty threading hacks.\"\"\"\n\n global THREAD_UNSAFE_TK\n # try/except blocks added to work around broken Tcl/Tk libraries\n # shipped with Fedora 11 (not thread-safe).\n # See http://code.google.com/p/namebench/issues/detail?id=23'\n if THREAD_UNSAFE_TK:\n return\n\n if running:\n try:\n self.button.config(state=DISABLED)\n self.button.config(text='Running')\n except TclError:\n THREAD_UNSAFE_TK = True\n self.UpdateStatus('Unable to disable button due to broken Tk library')\n self.UpdateStatus('Running...')\n else:\n try:\n self.button.config(state=NORMAL)\n self.button.config(text='Start Benchmark')\n except TclError:\n pass", "metadata": "root.MainWindow.UpdateRunState", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 335 }, { "content": " def StartJob(self):\n \"\"\"Events that get called when the Start button is pressed.\"\"\"\n\n self.ProcessForm()\n thread = WorkerThread(self.supplied_ns, self.global_ns, self.regional_ns, self.options,\n data_source=self.data_src,\n master=self.master, backup_notifier=self.MessageHandler)\n thread.start()", "metadata": "root.MainWindow.StartJob", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 360 }, { "content": " def ProcessForm(self):\n \"\"\"Read form and populate instance variables.\"\"\"\n\n self.supplied_ns = addr_util.ExtractIPTuplesFromString(self.nameserver_form.get())\n if not self.use_global.get():\n self.global_ns = []\n if not self.use_regional.get():\n self.regional_ns = []\n\n if 'Slow' in self.health_performance.get():\n self.options.health_thread_count = 10\n\n self.options.query_count = self.query_count.get()\n self.options.input_source = self.data_src.ConvertSourceTitleToType(self.data_source.get())\n self.options.enable_censorship_checks = self.use_censor_checks.get()\n self.options.upload_results = self.share_results.get()", "metadata": "root.MainWindow.ProcessForm", "header": "['class', 'MainWindow', '(', 'Frame', ',', 'base_ui', '.', 'BaseUI', ')', ':', '___EOS___']", "index": 369 } ]
[ { "span": "import sys_nameservers", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "9", " ", "Goo", "gle", " ", "Inc", ".", " ", "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", "\");", "_", "\\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_", "\"\"\"", "Tk", " ", "user", " ", "interface", " ", "implementation", " ", "for", " ", "name", "bench", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "tstr", "omb", "erg", "@", "google", ".", "com", " ", "(", "Tho", "mas", " ", "Str", "omb", "erg", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tk", "Font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wildcard", " ", "import", "s", " ", "are", " ", "evil", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Tkinter_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tk", "Messag", "e", "Box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "addr", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base", "\\u", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "conn", "\\u", "quality_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nameserv", "er", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys", "\\u", "nameservers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "THREAD", "\\u", "UNS", "AF", "E", "\\u", "TK", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG", "\\u", "FILE", "\\u", "PATH_", "=_", "util_", "._", "Generate", "Output", "Filename_", "(_", "'", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global", "\\u", "message", "\\u", "queue_", "=_", "Queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "last", "\\u", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "close", "d", "Window", "Handler_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Au", " ", "revo", "ir", ",", " ", "mes", " ", "ami", "s", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Add", "Msg_", "(_", "message_", ",_", "master_", "=_", "None_", ",_", "backup", "\\u", "notifier_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "message", " ", "to", " ", "the", " ", "global", " ", "queue", " ", "for", " ", "output", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "global", "\\u", "message", "\\u", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "global", "\\u", "last", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "THREAD", "\\u", "UNS", "AF", "E", "\\u", "TK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "message_", "=_", "Status", "Message_", "(_", "message_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "message_", "!=_", "global", "\\u", "last", "\\u", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global", "\\u", "message", "\\u", "queue_", "._", "put_", "(_", "new", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "master_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "master_", "._", "event", "\\u", "generate_", "(_", "'<<", "msg", ">>'_", ",_", "when_", "=_", "'", "tail", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "last", "\\u", "message_", "=_", "new", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tk", " ", "thread", "-", "safety", " ", "workar", "ound", " ", "#", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tcl", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "are", "n", "'", "t", " ", "thread", " ", "safe", ",", " ", "we", " ", "alr", "ead", "y", " ", "assume", " ", "this", " ", "won", "'", "t", " ", "work", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "THREAD", "\\u", "UNS", "AF", "E", "\\u", "TK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Fi", "rst", " ", "TCL", " ", "Error", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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 ", " _", "backup", "\\u", "notifier_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "THREAD", "\\u", "UNS", "AF", "E", "\\u", "TK", "_", "=_", "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 ", " _", "print_", "'", "Back", "up", " ", "notifier", " ", "fail", "ure", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Status", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Messag", "es", " ", "to", " ", "be", " ", "pass", "ed", " ", "from", " ", "to", " ", "the", " ", "main", " ", "thread", " ", "from", " ", "child", "ren", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Us", "ed", " ", "to", " ", "avoid", " ", "thread", " ", "issue", "s", " ", "inh", "eren", "t", " ", "with", " ", "Tk", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Status", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "message_", ",_", "error_", "=_", "False_", ",_", "count_", "=_", "False_", ",_", "total_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enable", "\\u", "button_", "=_", "None_", ",_", "debug_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "message_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error_", "=_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "count_", "=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug_", "=_", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total_", "=_", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable", "\\u", "button_", "=_", "enable", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Worke", "r", "Thread_", "(_", "threading_", "._", "Thread_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "bench", "marking", " ", "and", " ", "preparation", " ", "in", " ", "a", " ", "separate", " ", "UI", " ", "thread", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Worke", "r", "Thread_", "(_", "threading_", "._", "Thread_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "supplie", "d\\u", "ns_", ",_", "global", "\\u", "ns_", ",_", "regional", "\\u", "ns_", ",_", "options_", ",_", "data\\u", "source_", "=_", "None_", ",_", "master_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backup", "\\u", "notifier_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Set", "up", "Data", "Structur", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status", "\\u", "callback_", "=_", "self_", "._", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "src_", "=_", "data\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "backup", "\\u", "notifier_", "=_", "backup", "\\u", "notifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "include", "\\u", "internal_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "supplie", "d\\u", "ns_", "=_", "supplie", "d\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "global", "\\u", "ns_", "=_", "global", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "regional", "\\u", "ns_", "=_", "regional", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "master_", "=_", "master_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resource", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Worke", "r", "Thread_", "(_", "threading_", "._", "Thread_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "msg_", "(_", "self_", ",_", "message_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "message", "s", " ", "to", " ", "the", " ", "main", " ", "queue", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Add", "Msg_", "(_", "message_", ",_", "master_", "=_", "self_", "._", "master_", ",_", "backup", "\\u", "notifier_", "=_", "self_", "._", "backup", "\\u", "notifier_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Worke", "r", "Thread_", "(_", "threading_", "._", "Thread_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "msg_", "(_", "'", "Start", "ed", " ", "thread", "'_", ",_", "enable", "\\u", "button_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Prepare", "Test", "Records_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Prepare", "Name", "Server", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Prepare", "Benchmark", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Run", "And", "Open", "Report", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "nameserv", "er", "\\u", "list_", "._", "Out", "goi", "ng", "Udp", "Interc", "eption", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "exc", "\\u", "type_", ",_", "exception_", ",_", "tb_", ")_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "msg_", "(_", "'", "Out", "goi", "ng", " ", "request", "s", " ", "wer", "e", " ", "intercept", "ed", "!'_", ",_", "error_", "=_", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "nameserv", "er", "\\u", "list_", "._", "Too", "Fe", "w", "Names", "erver", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "exc", "\\u", "type_", ",_", "exception_", ",_", "tb_", ")_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "msg_", "(_", "'", "Too", " ", "few", " ", "nameservers", " ", "to", " ", "test", "'_", ",_", "error_", "=_", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "conn", "\\u", "quality_", "._", "Off", "line", "Connection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "exc", "\\u", "type_", ",_", "exception_", ",_", "tb_", ")_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "msg_", "(_", "'", "The", " ", "connecti", "on", " ", "appear", "s", " ", "to", " ", "be", " ", "offline", "!'_", ",_", "error_", "=_", "exception_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "exc", "\\u", "type_", ",_", "exception_", ",_", "tb_", ")_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "msg_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "-_", "4_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "msg_", "(_", "exception_", ",_", "error_", "=_", "error", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "msg_", "(_", "None_", ",_", "enable", "\\u", "button_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Name", "Ben", "ch", "Gui_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "main", " ", "GU", "I", ".\"\"\"_", "\\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_", "Name", "Ben", "ch", "Gui_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "options_", ",_", "supplie", "d\\u", "ns_", ",_", "global", "\\u", "ns_", ",_", "regional", "\\u", "ns_", ",_", "version_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "supplie", "d\\u", "ns_", "=_", "supplie", "d\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "global", "\\u", "ns_", "=_", "global", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "regional", "\\u", "ns_", "=_", "regional", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Name", "Ben", "ch", "Gui_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "root_", "=_", "Tk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "Main", "Window_", "(_", "self_", "._", "root_", ",_", "self_", "._", "options_", ",_", "self_", "._", "supplie", "d\\u", "ns_", ",_", "self_", "._", "global", "\\u", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "regional", "\\u", "ns_", ",_", "self_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "Draw", "Window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "._", "bind_", "(_", "'<<", "msg", ">>'_", ",_", "app_", "._", "Messag", "e", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "._", "mainloop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "main", " ", "Tk", " ", "GU", "I", " ", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "master_", ",_", "options_", ",_", "supplie", "d\\u", "ns_", ",_", "global", "\\u", "ns_", ",_", "regional", "\\u", "ns_", ",_", "version_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "TOD", "O", "(", "tstr", "omb", "erg", "):", " ", "Remove", " ", "duplicat", "ion", " ", "from", " ", "Name", "Ben", "ch", "Gui", " ", "class", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Frame_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Set", "up", "Data", "Structur", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "master_", "=_", "master_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "supplie", "d\\u", "ns_", "=_", "supplie", "d\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "global", "\\u", "ns_", "=_", "global", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "regional", "\\u", "ns_", "=_", "regional", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "\\u", "file_", "=_", "open_", "(_", "LOG", "\\u", "FILE", "\\u", "PATH_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Fail", "ed", " ", "to", " ", "open", " ", "%", "s", " ", "for", " ", "write", "'_", "%_", "LOG", "\\u", "FILE", "\\u", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "master_", "._", "protocol_", "(_", "'", "WM", "\\u", "DELET", "E", "\\u", "WIND", "OW", "'_", ",_", "close", "d", "Window", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Update", "Status_", "(_", "self_", ",_", "message_", ",_", "count_", "=_", "None_", ",_", "total_", "=_", "None_", ",_", "error_", "=_", "None_", ",_", "debug_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "our", " ", "litt", "le", " ", "status", " ", "window", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "message_", ":_", "\\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_", "total_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "'%", "s", "...", " ", "[", "%", "s", "/", "%", "s", "]'_", "%_", "(_", "message_", ",_", "count_", ",_", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "'%", "s", "%", "s", "'_", "%_", "(_", "message_", ",_", "'.'_", "*_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'>", " ", "%", "s", "'_", "%_", "str_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log", "\\u", "file_", "._", "write_", "(_", "'%", "s", ":", " ", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ",_", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "file_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "._", "set_", "(_", "state_", "[_", "0_", ":_", "75_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Draw", "Window_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Draw", "s", " ", "the", " ", "user", " ", "interface", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nameserv", "er", "\\u", "form_", "=_", "String", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "String", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query", "\\u", "count_", "=_", "Int", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "source_", "=_", "String", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "health", "\\u", "performance_", "=_", "String", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "location_", "=_", "String", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "\\u", "global_", "=_", "Int", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "\\u", "regional", "_", "=_", "Int", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "\\u", "cens", "or", "\\u", "checks_", "=_", "Int", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "share", "\\u", "results_", "=_", "Int", "Var_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "master_", "._", "title_", "(_", "'", "name", "bench", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outer", "\\u", "frame_", "=_", "Frame_", "(_", "self_", "._", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outer", "\\u", "frame_", "._", "grid_", "(_", "row_", "=_", "0_", ",_", "padx_", "=_", "16_", ",_", "pady_", "=_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inner", "\\u", "frame_", "=_", "Frame_", "(_", "outer", "\\u", "frame_", ",_", "relief_", "=_", "GRO", "OV", "E_", ",_", "bd_", "=_", "2_", ",_", "padx_", "=_", "12_", ",_", "pady_", "=_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inner", "\\u", "frame_", "._", "grid_", "(_", "row_", "=_", "0_", ",_", "columnspan_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "Label_", "(_", "outer", "\\u", "frame_", ",_", "text_", "=_", "'...'_", ",_", "textvariable_", "=_", "self_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "._", "grid_", "(_", "row_", "=_", "15_", ",_", "sticky_", "=_", "W_", ",_", "column_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "platform_", "[_", ":_", "3_", "]_", "==_", "'", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seperat", "or", "\\u", "width_", "=_", "490", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seperat", "or", "\\u", "width_", "=_", "585", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bold", "\\u", "font_", "=_", "tk", "Font_", "._", "Font_", "(_", "font_", "=_", "status_", "[_", "'", "font", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bold", "\\u", "font_", "[_", "'", "weight", "'_", "]_", "=_", "'", "bold", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ns", "\\u", "label_", "=_", "Label_", "(_", "inner", "\\u", "frame_", ",_", "text_", "=_", "'", "Names", "erver", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns", "\\u", "label_", "._", "grid_", "(_", "row_", "=_", "0_", ",_", "columnspan_", "=_", "2_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns", "\\u", "label_", "[_", "'", "font", "'_", "]_", "=_", "bold", "\\u", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nameservers", "_", "=_", "Entry_", "(_", "inner", "\\u", "frame_", ",_", "bg_", "=_", "'", "white", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "textvariable_", "=_", "self_", "._", "nameserv", "er", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nameservers", "_", "._", "grid_", "(_", "row_", "=_", "1_", ",_", "columnspan_", "=_", "2_", ",_", "sticky_", "=_", "W_", ",_", "padx_", "=_", "4_", ",_", "pady_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nameserv", "er", "\\u", "form_", "._", "set_", "(_", "',", " ", "'_", "._", "join_", "(_", "nameserv", "er", "\\u", "list_", "._", "Intern", "al", "Name", "Server", "s_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "button_", "=_", "Checkb", "utton_", "(_", "inner", "\\u", "frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "'", "Include", " ", "global", " ", "DNS", " ", "provide", "rs", " ", "(", "Goo", "gle", " ", "Public", " ", "DNS", ",", " ", "Open", "DNS", ",", " ", "Ult", "ra", "DNS", ",", " ", "etc", ".)", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "variable_", "=_", "self_", "._", "use", "\\u", "global_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "button_", "._", "grid_", "(_", "row_", "=_", "2_", ",_", "columnspan_", "=_", "2_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "button_", "._", "toggle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "regional", "\\u", "button_", "=_", "Checkb", "utton_", "(_", "inner", "\\u", "frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "'", "Include", " ", "best", " ", "avail", "able", " ", "regional", " ", "DNS", " ", "service", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "variable_", "=_", "self_", "._", "use", "\\u", "regional", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regional", "\\u", "button_", "._", "grid_", "(_", "row_", "=_", "3_", ",_", "columnspan_", "=_", "2_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regional", "\\u", "button_", "._", "toggle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "separator_", "=_", "Frame_", "(_", "inner", "\\u", "frame_", ",_", "height_", "=_", "2_", ",_", "width_", "=_", "seperat", "or", "\\u", "width_", ",_", "bd_", "=_", "1_", ",_", "relief_", "=_", "SUN", "KEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "separator_", "._", "grid_", "(_", "row_", "=_", "4_", ",_", "padx_", "=_", "5_", ",_", "pady_", "=_", "5_", ",_", "columnspan_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ds", "\\u", "label_", "=_", "Label_", "(_", "inner", "\\u", "frame_", ",_", "text_", "=_", "'", "Optio", "ns", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "\\u", "label_", "._", "grid_", "(_", "row_", "=_", "5_", ",_", "column_", "=_", "0_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "\\u", "label_", "[_", "'", "font", "'_", "]_", "=_", "bold", "\\u", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cens", "ors", "hip", "\\u", "button_", "=_", "Checkb", "utton_", "(_", "inner", "\\u", "frame_", ",_", "text_", "=_", "'", "Include", " ", "cens", "ors", "hip", " ", "checks", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "variable_", "=_", "self_", "._", "use", "\\u", "cens", "or", "\\u", "checks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cens", "ors", "hip", "\\u", "button_", "._", "grid_", "(_", "row_", "=_", "6_", ",_", "columnspan_", "=_", "2_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "share", "\\u", "button_", "=_", "Checkb", "utton_", "(_", "inner", "\\u", "frame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "'", "Upload", " ", "and", " ", "share", " ", "your", " ", "anonym", "ize", "d", " ", "results", " ", "(", "help", " ", "speed", " ", "up", " ", "the", " ", "interne", "t", "!)", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "variable_", "=_", "self_", "._", "share", "\\u", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Old", " ", "version", "s", " ", "of", " ", "Tk", " ", "do", " ", "not", " ", "support", " ", "two", "-", "dimension", "al", " ", "padd", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "share", "\\u", "button_", "._", "grid_", "(_", "row_", "=_", "7_", ",_", "columnspan_", "=_", "2_", ",_", "sticky_", "=_", "W_", ",_", "pady_", "=_", "[_", "0_", ",_", "10_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tcl", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "share", "\\u", "button_", "._", "grid_", "(_", "row_", "=_", "7_", ",_", "columnspan_", "=_", "2_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc", "\\u", "label_", "=_", "Label_", "(_", "inner", "\\u", "frame_", ",_", "text_", "=_", "'", "You", "r", " ", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "label_", "._", "grid_", "(_", "row_", "=_", "10_", ",_", "column_", "=_", "0_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc", "\\u", "label_", "[_", "'", "font", "'_", "]_", "=_", "bold", "\\u", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run", "\\u", "count", "\\u", "label_", "=_", "Label_", "(_", "inner", "\\u", "frame_", ",_", "text_", "=_", "'", "Health", " ", "Check", " ", "Perform", "anc", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "count", "\\u", "label_", "._", "grid_", "(_", "row_", "=_", "10_", ",_", "column_", "=_", "1_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "count", "\\u", "label_", "[_", "'", "font", "'_", "]_", "=_", "bold", "\\u", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Discover", "Location_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Load", "Data", "Sources_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "titles_", "=_", "self_", "._", "data\\u", "src_", "._", "List", "Sou", "rce", "Titles", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "\\u", "dropdown", "\\u", "width_", "=_", "max_", "(_", "[_", "len_", "(_", "x_", ")_", "for_", "x_", "in_", "source", "\\u", "titles_", "]_", ")_", "-_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "location", "\\u", "choices_", "=_", "[_", "self_", "._", "country_", ",_", "'(", "Ot", "her", ")'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "Optio", "n", "Menu_", "(_", "inner", "\\u", "frame_", ",_", "self_", "._", "location_", ",_", "*_", "location", "\\u", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "._", "configure_", "(_", "width_", "=_", "left", "\\u", "dropdown", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "._", "grid_", "(_", "row_", "=_", "11_", ",_", "column_", "=_", "0_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "location_", "._", "set_", "(_", "location", "\\u", "choices_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mode", "\\u", "choices_", "=_", "[_", "'", "Fast", "'_", ",_", "'", "Slow", " ", "(", "unstable", " ", "network", ")'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "\\u", "dropdown", "\\u", "width_", "=_", "max_", "(_", "[_", "len_", "(_", "x_", ")_", "for_", "x_", "in_", "mode", "\\u", "choices_", "]_", ")_", "-_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "health", "\\u", "performance_", "=_", "Optio", "n", "Menu_", "(_", "inner", "\\u", "frame_", ",_", "self_", "._", "health", "\\u", "performance_", ",_", "*_", "mode", "\\u", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "health", "\\u", "performance_", "._", "configure_", "(_", "width_", "=_", "right", "\\u", "dropdown", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "health", "\\u", "performance_", "._", "grid_", "(_", "row_", "=_", "11_", ",_", "column_", "=_", "1_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "health", "\\u", "performance_", "._", "set_", "(_", "mode", "\\u", "choices_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ds", "\\u", "label_", "=_", "Label_", "(_", "inner", "\\u", "frame_", ",_", "text_", "=_", "'", "Query", " ", "Data", " ", "Sou", "rce", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "\\u", "label_", "._", "grid_", "(_", "row_", "=_", "12_", ",_", "column_", "=_", "0_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "\\u", "label_", "[_", "'", "font", "'_", "]_", "=_", "bold", "\\u", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "querie", "s", "\\u", "label_", "=_", "Label_", "(_", "inner", "\\u", "frame_", ",_", "text_", "=_", "'", "Number", " ", "of", " ", "querie", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "querie", "s", "\\u", "label_", "._", "grid_", "(_", "row_", "=_", "12_", ",_", "column_", "=_", "1_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "querie", "s", "\\u", "label_", "[_", "'", "font", "'_", "]_", "=_", "bold", "\\u", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "source_", "=_", "Optio", "n", "Menu_", "(_", "inner", "\\u", "frame_", ",_", "self_", "._", "data\\u", "source_", ",_", "*_", "source", "\\u", "titles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "source_", "._", "configure_", "(_", "width_", "=_", "left", "\\u", "dropdown", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "source_", "._", "grid_", "(_", "row_", "=_", "13_", ",_", "column_", "=_", "0_", ",_", "sticky_", "=_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data\\u", "source_", "._", "set_", "(_", "source", "\\u", "titles_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "count_", "=_", "Entry_", "(_", "inner", "\\u", "frame_", ",_", "bg_", "=_", "'", "white", "'_", ",_", "textvariable_", "=_", "self_", "._", "query", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "count_", "._", "grid_", "(_", "row_", "=_", "13_", ",_", "column_", "=_", "1_", ",_", "sticky_", "=_", "W_", ",_", "padx_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "count_", "._", "configure_", "(_", "width_", "=_", "right", "\\u", "dropdown", "\\u", "width_", "+_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query", "\\u", "count_", "._", "set_", "(_", "self_", "._", "options_", "._", "query", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "button_", "=_", "Button_", "(_", "outer", "\\u", "frame_", ",_", "command_", "=_", "self_", "._", "Start", "Job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "button_", "._", "grid_", "(_", "row_", "=_", "15_", ",_", "sticky_", "=_", "E_", ",_", "column_", "=_", "1_", ",_", "pady_", "=_", "4_", ",_", "padx_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Update", "Run", "State_", "(_", "running_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Update", "Run", "State_", "(_", "running_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Update", "Status_", "(_", "'", "name", "bench", " ", "%", "s", " ", "is", " ", "read", "y", "!'_", "%_", "self_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Messag", "e", "Handler_", "(_", "self_", ",_", "unu", "sed", "\\u", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ping", "ed", " ", "whe", "n", " ", "there", " ", "is", " ", "a", " ", "new", " ", "message", " ", "in", " ", "our", " ", "queue", " ", "to", " ", "handle", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "global", "\\u", "message", "\\u", "queue_", "._", "qsize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "global", "\\u", "message", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Error", "Popup_", "(_", "m_", "._", "message_", ",_", "m_", "._", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "m_", "._", "enable", "\\u", "button_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Update", "Run", "State_", "(_", "running_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "m_", "._", "enable", "\\u", "button_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Update", "Run", "State_", "(_", "running_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Update", "Status_", "(_", "m_", "._", "message_", ",_", "count_", "=_", "m_", "._", "count_", ",_", "total_", "=_", "m_", "._", "total_", ",_", "error_", "=_", "m_", "._", "error_", ",_", "debug_", "=_", "m_", "._", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Error", "Popup_", "(_", "self_", ",_", "title_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Show", "ing", " ", "popu", "p", ":", " ", "%", "s", "'_", "%_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tk", "Messag", "e", "Box_", "._", "shower", "ror_", "(_", "str_", "(_", "title_", ")_", ",_", "str_", "(_", "message_", ")_", ",_", "master_", "=_", "self_", "._", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Update", "Run", "State_", "(_", "self_", ",_", "running_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "the", " ", "run", " ", "state", " ", "of", " ", "the", " ", "window", ",", " ", "usi", "ng", " ", "nas", "ty", " ", "thread", "ing", " ", "hack", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "THREAD", "\\u", "UNS", "AF", "E", "\\u", "TK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", "/", "except", " ", "blocks", " ", "adde", "d", " ", "to", " ", "work", " ", "aro", "und", " ", "broken", " ", "Tcl", "/", "Tk", " ", "libraries_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ship", "ped", " ", "with", " ", "Fe", "dor", "a", " ", "11", " ", "(", "not", " ", "thread", "-", "safe", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "name", "bench", "/", "issue", "s", "/", "deta", "il", "?", "id", "=", "23", "'_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "THREAD", "\\u", "UNS", "AF", "E", "\\u", "TK", "_", ":_", "\\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_", "running_", ":_", "\\u\\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_", "._", "button_", "._", "config_", "(_", "state_", "=_", "DISABLED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "button_", "._", "config_", "(_", "text_", "=_", "'", "Run", "ning", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tcl", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "THREAD", "\\u", "UNS", "AF", "E", "\\u", "TK", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Update", "Status_", "(_", "'", "Una", "ble", " ", "to", " ", "disable", " ", "button", " ", "due", " ", "to", " ", "broken", " ", "Tk", " ", "librar", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Update", "Status_", "(_", "'", "Run", "ning", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "button_", "._", "config_", "(_", "state_", "=_", "NORMAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "button_", "._", "config_", "(_", "text_", "=_", "'", "Start", " ", "Benchmark", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Tcl", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Start", "Job_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Event", "s", " ", "tha", "t", " ", "get", " ", "call", "ed", " ", "whe", "n", " ", "the", " ", "Start", " ", "button", " ", "is", " ", "presse", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Process", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "=_", "Worke", "r", "Thread_", "(_", "self_", "._", "supplie", "d\\u", "ns_", ",_", "self_", "._", "global", "\\u", "ns_", ",_", "self_", "._", "regional", "\\u", "ns_", ",_", "self_", "._", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "source_", "=_", "self_", "._", "data\\u", "src_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "master_", "=_", "self_", "._", "master_", ",_", "backup", "\\u", "notifier_", "=_", "self_", "._", "Messag", "e", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Window_", "(_", "Frame_", ",_", "base", "\\u", "ui_", "._", "Base", "UI_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Process", "Form_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "form", " ", "and", " ", "populate", " ", "instance", " ", "variab", "les", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "supplie", "d\\u", "ns_", "=_", "addr", "\\u", "util_", "._", "Extract", "IP", "Tuples", "Fro", "m", "String_", "(_", "self_", "._", "nameserv", "er", "\\u", "form_", "._", "get_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "use", "\\u", "global_", "._", "get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "global", "\\u", "ns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "use", "\\u", "regional", "_", "._", "get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "regional", "\\u", "ns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "Slow", "'_", "in_", "self_", "._", "health", "\\u", "performance_", "._", "get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "options_", "._", "health", "\\u", "thread", "\\u", "count_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "options_", "._", "query", "\\u", "count_", "=_", "self_", "._", "query", "\\u", "count_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "._", "input", "\\u", "source_", "=_", "self_", "._", "data\\u", "src_", "._", "Convert", "Sou", "rce", "Tit", "le", "To", "Type_", "(_", "self_", "._", "data\\u", "source_", "._", "get_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "._", "enable", "\\u", "cens", "ors", "hip", "\\u", "checks_", "=_", "self_", "._", "use", "\\u", "cens", "or", "\\u", "checks_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "._", "upload", "\\u", "results_", "=_", "self_", "._", "share", "\\u", "results_", "._", "get_", "(_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
mihaip/streamspigot/app/feedplayback/handlers.py
[ { "content": " def get(self):\n self._write_error(410)\n return\n frequency = self.request.get('frequency')\n frequency_modulo = int(self.request.get('frequency_modulo'))\n\n current_modulo = data.get_modulo_for_frequency(frequency)\n if current_modulo != frequency_modulo:\n logging.info('Not advancing for modulo %d today '\n '(which is modulo %d)' % (frequency_modulo, current_modulo))\n return\n\n subscriptions = data.get_subscriptions_with_frequency_and_modulo(\n frequency, frequency_modulo)\n\n for subscription in subscriptions:\n taskqueue.add(\n queue_name='feedplayback-advance',\n url='/tasks/feed-playback/advance',\n params={'subscription_id': subscription.id})\n\n logging.info('Advanced %d subscriptions' % len(subscriptions))\n self.response.out.write('OK')", "metadata": "root.AdvanceCronHandler.get", "header": "['class', 'AdvanceCronHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 20 }, { "content": " def post(self):\n self._write_error(410)\n return\n subscription_id = self.request.get('subscription_id')\n subscription = data.get_subscription_by_id(subscription_id)\n subscription.advance()\n self.response.out.write('OK')", "metadata": "root.AdvanceTaskHandler.post", "header": "['class', 'AdvanceTaskHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 45 }, { "content": " def get(self):\n self._write_error(410)\n return\n url = self.request.get('url').strip()\n if not url:\n self._write_input_error('Missing \"url\" parameter')\n return\n\n try:\n start_date = datetime.datetime.strptime(\n self.request.get('start-date'), '%Y-%m-%d')\n except ValueError:\n start_date = datetime.datetime(1970, 1, 1)\n\n self._write_json({\n 'firstItem': data.get_start_item_contents(url, start_date).as_json_dict(),\n })", "metadata": "root.PreviewHandler.get", "header": "['class', 'PreviewHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 54 }, { "content": " def post(self):\n self._write_error(410)\n return\n url = self.request.get('url').strip()\n if not url:\n self._write_input_error('Missing \"url\" parameter')\n return\n\n try:\n start_date = datetime.datetime.strptime(\n self.request.get('start-date'), '%Y-%m-%d')\n except ValueError:\n start_date = datetime.datetime(1970, 1, 1)\n frequency = self.request.get('frequency')\n\n subscription = data.create_subscription(\n url,\n start_date,\n frequency)\n\n feed_info = data.get_feed_info_from_feed_url(url)\n feed_title = feed_info.title\n subscription_html_url = '%s/feed-playback/subscription/%s' % (\n CONSTANTS.APP_URL, subscription.id)\n\n subscription.create_reader_stream(\n intro_html_url=subscription_html_url,\n intro_title='Feed playback for \"%s\" has begun' % feed_title,\n intro_body=self._render_template(\n 'feedplayback/intro-body.snippet', {\n 'subscription_html_url': subscription_html_url,\n 'feed_url': url,\n 'feed_title': feed_title,\n 'item_count': len(feed_info.item_ids) - subscription.position,\n 'frequency': _FREQUENCY_DISPLAY_NAMES[frequency],\n }))\n\n self._write_json(subscription.as_json_dict())", "metadata": "root.CreateHandler.post", "header": "['class', 'CreateHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 73 }, { "content": " def get(self):\n self._write_error(410)\n return\n url = self.request.get('url').strip()\n if not url:\n self._write_input_error('Missing \"url\" parameter')\n return\n\n feed_info = data.get_feed_info(url)\n if feed_info:\n self._write_json(feed_info.as_json_dict())\n else:\n self._write_input_error('Invalid \"url\" parameter')", "metadata": "root.FeedInfoHandler.get", "header": "['class', 'FeedInfoHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 113 }, { "content": " def get(self, subscription_id):\n self._write_error(410)\n return\n subscription = data.get_subscription_by_id(subscription_id)\n\n if not subscription:\n self._write_not_found()\n return\n\n feed_info = data.get_feed_info_from_feed_url(subscription.feed_url)\n\n self._write_template('feedplayback/subscription.html', {\n 'feed_title': feed_info.title,\n 'feed_url': subscription.feed_url,\n 'subscription_id': subscription_id,\n 'subscription_feed_url': subscription.get_subscription_feed_url(),\n 'subscription_reader_url': subscription.get_subscription_reader_url(),\n 'position': subscription.position + 1,\n 'item_count': len(feed_info.item_ids),\n 'frequency': _FREQUENCY_DISPLAY_NAMES[subscription.frequency]\n })", "metadata": "root.SubscriptionHandler.get", "header": "['class', 'SubscriptionHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 128 }, { "content": " def post(self):\n self._write_error(410)\n return\n subscription_id = self.request.get('subscription_id')\n subscription = data.get_subscription_by_id(subscription_id)\n subscription.advance()\n self.redirect('/feed-playback/subscription/%s' % subscription_id)", "metadata": "root.SubscriptionAdvanceHandler.post", "header": "['class', 'SubscriptionAdvanceHandler', '(', 'base', '.', 'handlers', '.', 'BaseHandler', ')', ':', '___EOS___']", "index": 151 } ]
[ { "span": "frequency = self.request.get('frequency')", "start_line": 23, "start_column": 8, "end_line": 23, "end_column": 49 }, { "span": "subscription_id = self.request.get('subscription_id')", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 61 }, { "span": "url = self.request.get('url').strip()", "start_line": 57, "start_column": 8, "end_line": 57, "end_column": 45 }, { "span": "url = self.request.get('url').strip()", "start_line": 76, "start_column": 8, "end_line": 76, "end_column": 45 }, { "span": "url = self.request.get('url').strip()", "start_line": 116, "start_column": 8, "end_line": 116, "end_column": 45 }, { "span": "subscription = data.get_subscription_by_id(subscription_id)", "start_line": 131, "start_column": 8, "end_line": 131, "end_column": 67 }, { "span": "subscription_id = self.request.get('subscription_id')", "start_line": 154, "start_column": 8, "end_line": 154, "end_column": 61 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Advance", "Cro", "n", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "error_", "(_", "410", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frequency_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "freque", "nc", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "freque", "nc", "y", "\\u", "modulo", "_", "=_", "int_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "freque", "nc", "y", "\\u", "modulo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "modulo", "_", "=_", "data_", "._", "get", "\\u", "modulo", "\\u", "for", "\\u", "frequency_", "(_", "frequency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "modulo", "_", "!=_", "freque", "nc", "y", "\\u", "modulo", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Not", " ", "adv", "anci", "ng", " ", "for", " ", "modulo", " ", "%", "d", " ", "toda", "y", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "whi", "ch", " ", "is", " ", "modulo", " ", "%", "d", ")'_", "%_", "(_", "freque", "nc", "y", "\\u", "modulo", "_", ",_", "current", "\\u", "modulo", "_", ")_", ")_", "\\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_", "subscriptions_", "=_", "data_", "._", "get", "\\u", "subscript", "ion", "s", "\\u", "with", "\\u", "freque", "nc", "y", "\\u", "and", "\\u", "modulo", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "frequency_", ",_", "freque", "nc", "y", "\\u", "modulo", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "subscription_", "in_", "subscriptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "queue_", "._", "add_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", "=_", "'", "feed", "playback", "-", "advance", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'/", "task", "s", "/", "feed", "-", "playback", "/", "advance", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "'", "subscript", "ion", "\\u", "id", "'_", ":_", "subscription_", "._", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Advance", "d", " ", "%", "d", " ", "subscript", "ion", "s", "'_", "%_", "len_", "(_", "subscriptions_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "'", "OK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Advance", "Task", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "error_", "(_", "410", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscript", "ion", "\\u", "id_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "subscript", "ion", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "data_", "._", "get", "\\u", "subscript", "ion", "\\u", "by", "\\u", "id_", "(_", "subscript", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "._", "advance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "'", "OK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Preview", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "error_", "(_", "410", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "url", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "input", "\\u", "error_", "(_", "'", "Missing", " ", "\"", "url", "\"", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "date_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "get_", "(_", "'", "start", "-", "date", "'_", ")_", ",_", "'%", "Y", "-%", "m", "-%", "d", "'_", ")_", "\\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 ", " _", "start", "\\u", "date_", "=_", "datetime_", "._", "datetime_", "(_", "1970_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "Item", "'_", ":_", "data_", "._", "get", "\\u", "start", "\\u", "item", "\\u", "contents_", "(_", "url_", ",_", "start", "\\u", "date_", ")_", "._", "as", "\\u", "json", "\\u", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "error_", "(_", "410", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "url", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "input", "\\u", "error_", "(_", "'", "Missing", " ", "\"", "url", "\"", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "date_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "get_", "(_", "'", "start", "-", "date", "'_", ")_", ",_", "'%", "Y", "-%", "m", "-%", "d", "'_", ")_", "\\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 ", " _", "start", "\\u", "date_", "=_", "datetime_", "._", "datetime_", "(_", "1970_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "frequency_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "freque", "nc", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subscription_", "=_", "data_", "._", "create", "\\u", "subscription_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "frequency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "feed", "\\u", "info_", "=_", "data_", "._", "get", "\\u", "feed", "\\u", "info", "\\u", "from", "\\u", "feed", "\\u", "url_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feed", "\\u", "title_", "=_", "feed", "\\u", "info_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscript", "ion", "\\u", "html", "\\u", "url_", "=_", "'%", "s", "/", "feed", "-", "playback", "/", "subscript", "ion", "/", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CONSTANT", "S_", "._", "APP", "\\u", "URL_", ",_", "subscription_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subscription_", "._", "create", "\\u", "reader", "\\u", "stream_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "intro", "\\u", "html", "\\u", "url_", "=_", "subscript", "ion", "\\u", "html", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "intro", "\\u", "title_", "=_", "'", "Feed", " ", "playback", " ", "for", " ", "\"%", "s", "\"", " ", "has", " ", "beg", "un", "'_", "%_", "feed", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "intro", "\\u", "body_", "=_", "self_", "._", "\\u", "render", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "playback", "/", "intro", "-", "body", ".", "snippet", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subscript", "ion", "\\u", "html", "\\u", "url", "'_", ":_", "subscript", "ion", "\\u", "html", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "\\u", "url", "'_", ":_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "\\u", "title", "'_", ":_", "feed", "\\u", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "item", "\\u", "count", "'_", ":_", "len_", "(_", "feed", "\\u", "info_", "._", "item", "\\u", "ids_", ")_", "-_", "subscription_", "._", "position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "freque", "nc", "y", "'_", ":_", "\\u", "FREQUENCY", "\\u", "DISPLAY", "\\u", "NAMES_", "[_", "frequency_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "json_", "(_", "subscription_", "._", "as", "\\u", "json", "\\u", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Feed", "Info", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "error_", "(_", "410", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "url", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "input", "\\u", "error_", "(_", "'", "Missing", " ", "\"", "url", "\"", " ", "parameter", "'_", ")_", "\\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_", "feed", "\\u", "info_", "=_", "data_", "._", "get", "\\u", "feed", "\\u", "info_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "feed", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "json_", "(_", "feed", "\\u", "info_", "._", "as", "\\u", "json", "\\u", "dict_", "(_", ")_", ")_", "\\u\\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", "write", "\\u", "input", "\\u", "error_", "(_", "'", "Inva", "lid", " ", "\"", "url", "\"", " ", "parameter", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "subscript", "ion", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "error_", "(_", "410", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "data_", "._", "get", "\\u", "subscript", "ion", "\\u", "by", "\\u", "id_", "(_", "subscript", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "subscription_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "not", "\\u", "found_", "(_", ")_", "\\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_", "feed", "\\u", "info_", "=_", "data_", "._", "get", "\\u", "feed", "\\u", "info", "\\u", "from", "\\u", "feed", "\\u", "url_", "(_", "subscription_", "._", "feed", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "template_", "(_", "'", "feed", "playback", "/", "subscript", "ion", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "\\u", "title", "'_", ":_", "feed", "\\u", "info_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "\\u", "url", "'_", ":_", "subscription_", "._", "feed", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subscript", "ion", "\\u", "id", "'_", ":_", "subscript", "ion", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subscript", "ion", "\\u", "feed", "\\u", "url", "'_", ":_", "subscription_", "._", "get", "\\u", "subscript", "ion", "\\u", "feed", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subscript", "ion", "\\u", "reader", "\\u", "url", "'_", ":_", "subscription_", "._", "get", "\\u", "subscript", "ion", "\\u", "reader", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "position", "'_", ":_", "subscription_", "._", "position_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "item", "\\u", "count", "'_", ":_", "len_", "(_", "feed", "\\u", "info_", "._", "item", "\\u", "ids_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "freque", "nc", "y", "'_", ":_", "\\u", "FREQUENCY", "\\u", "DISPLAY", "\\u", "NAMES_", "[_", "subscription_", "._", "frequency_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription", "Advance", "Handler_", "(_", "base_", "._", "handlers_", "._", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "error_", "(_", "410", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscript", "ion", "\\u", "id_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "subscript", "ion", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "data_", "._", "get", "\\u", "subscript", "ion", "\\u", "by", "\\u", "id_", "(_", "subscript", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "._", "advance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redirect_", "(_", "'/", "feed", "-", "playback", "/", "subscript", "ion", "/", "%", "s", "'_", "%_", "subscript", "ion", "\\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, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/python-ldap-2.3.13/Lib/ldap/__init__.py
[ { "content": "\"\"\"\nldap - base module\n\nSee http://www.python-ldap.org/ for details.\n\n$Id: __init__.py,v 1.70 2011/02/19 14:36:53 stroeder Exp $\n\"\"\"\n\n# This is also the overall release version number\n\n__version__ = '2.3.13'\n\nimport sys\n\nif __debug__:\n # Tracing is only supported in debugging mode\n import traceback\n _trace_level = 0\n _trace_file = sys.stderr\n _trace_stack_limit = None\n\nfrom _ldap import *\n\n\ntry:\n # Check if Python installation was build with thread support\n import thread\nexcept ImportError:\n LDAPLockBaseClass = DummyLock\nelse:\n import threading\n LDAPLockBaseClass = threading.Lock\n\n\n\n\n# Create module-wide lock for serializing all calls into underlying LDAP lib\n_ldap_module_lock = LDAPLock(desc='Module wide')\n\nfrom functions import open,initialize,init,get_option,set_option\n\nfrom ldap.dn import explode_dn,explode_rdn,str2dn,dn2str\ndel str2dn\ndel dn2str\n\n# More constants\n\n# For compability of 2.3 and 2.4 OpenLDAP API\nOPT_DIAGNOSTIC_MESSAGE = OPT_ERROR_STRING\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DummyLock:\n \"\"\"Define dummy class with methods compatible to threading.Lock\"\"\"", "metadata": "root.DummyLock", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self):\n pass", "metadata": "root.DummyLock.__init__", "header": "['class', 'DummyLock', ':', '___EOS___']", "index": 25 }, { "content": " def acquire(self):\n pass", "metadata": "root.DummyLock.acquire", "header": "['class', 'DummyLock', ':', '___EOS___']", "index": 27 }, { "content": " def release(self):\n pass", "metadata": "root.DummyLock.release", "header": "['class', 'DummyLock', ':', '___EOS___']", "index": 29 }, { "content": "class LDAPLock:\n \"\"\"\n Mainly a wrapper class to log all locking events.\n Note that this cumbersome approach with _lock attribute was taken\n since threading.Lock is not suitable for sub-classing.\n \"\"\"\n _min_trace_level = 2\n\n\n", "metadata": "root.LDAPLock", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def __init__(self,lock_class=None,desc=''):\n \"\"\"\n lock_class\n Class compatible to threading.Lock\n desc\n Description shown in debug log messages\n \"\"\"\n self._desc = desc\n self._lock = (lock_class or LDAPLockBaseClass)()", "metadata": "root.LDAPLock.__init__", "header": "['class', 'LDAPLock', ':', '___EOS___']", "index": 50 }, { "content": " def acquire(self):\n if __debug__:\n if _trace_level>=self._min_trace_level:\n _trace_file.write('***%s %s.acquire()\\n' % (self._desc,self.__class__.__name__))\n return self._lock.acquire()", "metadata": "root.LDAPLock.acquire", "header": "['class', 'LDAPLock', ':', '___EOS___']", "index": 60 }, { "content": " def release(self):\n if __debug__:\n if _trace_level>=self._min_trace_level:\n _trace_file.write('***%s %s.release()\\n' % (self._desc,self.__class__.__name__))\n return self._lock.release()", "metadata": "root.LDAPLock.release", "header": "['class', 'LDAPLock', ':', '___EOS___']", "index": 66 } ]
[ { "span": "import thread", "start_line": 34, "start_column": 2, "end_line": 34, "end_column": 15 }, { "span": "from functions import open,initialize,init,get_option,set_option", "start_line": 76, "start_column": 0, "end_line": 76, "end_column": 64 }, { "span": "from ldap.dn import explode_dn,explode_rdn,str2dn,dn2str", "start_line": 78, "start_column": 0, "end_line": 78, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "ldap", " ", "-", " ", "base", " ", "module", "\\", "10", ";", "\\", "10", ";", "See", " ", "http", "://", "www", ".", "python", "-", "ldap", ".", "org", "/", " ", "for", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "$", "Id", ":", " ", "\\u\\u", "init", "\\u\\u", ".", "py", ",", "v", " ", "1.7", "0", " ", "2011", "/", "02", "/", "1", "9", " ", "14", ":", "3", "6", ":", "5", "3", " ", "stro", "ede", "r", " ", "Exp", " ", "$", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "als", "o", " ", "the", " ", "over", "all", " ", "release", " ", "version", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "2.3", ".1", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Trac", "ing", " ", "is", " ", "only", " ", "support", "ed", " ", "in", " ", "debugg", "ing", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trace", "\\u", "level_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trace", "\\u", "file_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "trace", "\\u", "stack", "\\u", "limit_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "\\u", "ldap_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "Pyth", "on", " ", "installation", " ", "was", " ", "build", " ", "with", " ", "thread", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "thread_", "\\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 ", " _", "LDA", "PL", "ock", "Base", "Class_", "=_", "Du", "mm", "y", "Lock_", "\\u\\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_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LDA", "PL", "ock", "Base", "Class_", "=_", "threading_", "._", "Lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "module", "-", "wide", " ", "lock", " ", "for", " ", "serializ", "ing", " ", "all", " ", "calls", " ", "int", "o", " ", "underl", "ying", " ", "LDA", "P", " ", "lib_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "ldap", "\\u", "module", "\\u", "lock_", "=_", "LDA", "PL", "ock_", "(_", "desc_", "=_", "'", "Modul", "e", " ", "wide", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functions_", "import_", "open_", ",_", "initialize_", ",_", "init_", ",_", "get", "\\u", "option_", ",_", "set\\u", "option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ldap_", "._", "dn_", "import_", "explode", "\\u", "dn_", ",_", "explode", "\\u", "rd", "n_", ",_", "str2", "dn_", ",_", "dn", "2str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "str2", "dn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "dn", "2str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mor", "e", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "compa", "bilit", "y", " ", "of", " ", "2.3", " ", "and", " ", "2.4", " ", "Open", "LDA", "P", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "OPT", "\\u", "DIA", "GN", "OST", "IC", "\\u", "MESSAGE_", "=_", "OPT", "\\u", "ERROR", "\\u", "STRING_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Du", "mm", "y", "Lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Define", " ", "dummy", " ", "class", " ", "with", " ", "method", "s", " ", "compatible", " ", "to", " ", "thread", "ing", ".", "Lock", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Lock_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Lock_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "acquire_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Lock_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "release_", "(_", "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_", "class_", "LDA", "PL", "ock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Main", "ly", " ", "a", " ", "wrapp", "er", " ", "class", " ", "to", " ", "log", " ", "all", " ", "locking", " ", "events", ".", "\\", "10", ";", " ", " ", "Not", "e", " ", "tha", "t", " ", "this", " ", "cum", "bers", "ome", " ", "appro", "ach", " ", "with", " ", "\\u", "lock", " ", "attribute", " ", "was", " ", "take", "n", "\\", "10", ";", " ", " ", "sinc", "e", " ", "thread", "ing", ".", "Lock", " ", "is", " ", "not", " ", "suit", "able", " ", "for", " ", "sub", "-", "class", "ing", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "min", "\\u", "trace", "\\u", "level_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "LDA", "PL", "ock_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "lock", "\\u", "class_", "=_", "None_", ",_", "desc_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "lock", "\\u", "class", "\\", "10", ";", " ", " ", " ", " ", "Class", " ", "compatible", " ", "to", " ", "thread", "ing", ".", "Lock", "\\", "10", ";", " ", " ", " ", " ", "desc", "\\", "10", ";", " ", " ", " ", " ", "Descripti", "on", " ", "shown", " ", "in", " ", "debug", " ", "log", " ", "message", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "desc_", "=_", "desc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "=_", "(_", "lock", "\\u", "class_", "or_", "LDA", "PL", "ock", "Base", "Class_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LDA", "PL", "ock_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "acquire_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "trace", "\\u", "level_", ">=_", "self_", "._", "\\u", "min", "\\u", "trace", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "trace", "\\u", "file_", "._", "write_", "(_", "'**", "*", "%", "s", " ", "%", "s", ".", "acquir", "e", "()", "\\\\", "n", "'_", "%_", "(_", "self_", "._", "\\u", "desc_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LDA", "PL", "ock_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "release_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "trace", "\\u", "level_", ">=_", "self_", "._", "\\u", "min", "\\u", "trace", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "trace", "\\u", "file_", "._", "write_", "(_", "'**", "*", "%", "s", " ", "%", "s", ".", "release", "()", "\\\\", "n", "'_", "%_", "(_", "self_", "._", "\\u", "desc_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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, 2, 2, 2 ]
Testing equality to None
myusuf3/octogit/octogit/cli.py
[ { "content": "def begin():\n \"\"\"\n Usage:\n octogit [subcommand] [arguments]\n octogit login | -l | --login [(username password)]\n octogit create <repo> [<description>] [<organization>]\n octogit (issues | -i | --issues) [--assigned | -a]\n octogit (issues | -i | --issues) create <issue-title> <description>\n octogit (issues | -i | --issues) <number> [close | view]\n octogit -v | --version\n octogit help | -h | --help\n\n \"\"\"\n\n if os.path.exists(CONFIG_FILE):\n pass\n else:\n # create config file\n create_config()\n # commit changes\n commit_changes()\n\n arguments = docopt(begin.__doc__, help=None)\n\n if arguments['--version'] or arguments['-v']:\n puts(version())\n sys.exit(0)\n\n elif arguments['--help'] or arguments['-h'] or arguments['help']:\n get_help()\n sys.exit(0)\n\n elif arguments['create']:\n if arguments['<repo>'] == None:\n puts('{0}. {1}'.format(colored.blue('octogit'),\n colored.red('You need to pass both a project name and description')))\n\n else:\n project_name = arguments['<repo>']\n description = arguments['<description>'] or ''\n organization = arguments['<organization>'] or None\n create_repository(project_name, description, organization=organization)\n sys.exit()\n\n elif arguments['--issues'] or arguments['-i'] or arguments['issues']:\n url = find_github_remote()\n username, url = get_username_and_repo(url)\n if arguments['create']:\n if ['<issue-title>'] == None:\n puts('{0}. {1}'.format(colored.blue('octogit'),\n colored.red('You need to pass an issue title')))\n sys.exit(-1)\n\n else:\n issue_name = arguments['<issue-title>']\n description = arguments['<description>']\n create_issue(username, url, issue_name, description)\n sys.exit(0)\n\n issue_number = arguments['<number>']\n\n if issue_number is not None:\n if issue_number.startswith('#'):\n issue_number = issue_number[1:]\n\n if arguments['close']:\n close_issue(username, url, issue_number)\n sys.exit(0)\n elif arguments['view']:\n view_issue(username, url, issue_number)\n sys.exit(0)\n elif arguments['--assigned']:\n get_issues(username, url, (arguments['-assigned'] or arguments['-a']))\n sys.exit(0)\n else:\n get_single_issue(username, url, issue_number)\n sys.exit(0)\n else:\n get_issues(username, url, False)\n sys.exit(0)\n\n elif arguments['--login'] or arguments['-l'] or arguments['login']:\n username = arguments['username'] or None\n if username is None:\n username = raw_input(\"Github username: \")\n if len(username) == 0:\n puts(\"{0}. {1}\".format(\n colored.blue(\"octogit\"),\n colored.red(\"Username was blank\")))\n\n password = arguments['password'] or None\n if password is None:\n import getpass\n password = getpass.getpass(\"Password for %s: \" % username)\n\n login(username, password)\n else:\n get_help()\n sys.exit(0)", "metadata": "root.begin", "header": "['module', '___EOS___']", "index": 87 } ]
[ { "span": "arguments['<repo>'] == None:", "start_line": 120, "start_column": 11, "end_line": 120, "end_column": 38 }, { "span": "['<issue-title>'] == None:", "start_line": 135, "start_column": 15, "end_line": 135, "end_column": 40 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "begin_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "age", ":", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "[", "subco", "mmand", "]", " ", "[", "argu", "ment", "s", "]", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "login", " ", "|", " ", "-", "l", " ", "|", " ", "--", "login", " ", "[(", "user", "name", " ", "password", ")]", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "create", " ", "<", "repo", ">", " ", "[", "<", "description", ">]", " ", "[", "<", "organization", ">]", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "(", "issue", "s", " ", "|", " ", "-", "i", " ", "|", " ", "--", "issue", "s", ")", " ", "[-", "-", "assign", "ed", " ", "|", " ", "-", "a", "]", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "(", "issue", "s", " ", "|", " ", "-", "i", " ", "|", " ", "--", "issue", "s", ")", " ", "create", " ", "<", "issue", "-", "title", ">", " ", "<", "description", ">", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "(", "issue", "s", " ", "|", " ", "-", "i", " ", "|", " ", "--", "issue", "s", ")", " ", "<", "number", ">", " ", "[", "close", " ", "|", " ", "view", "]", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "-", "v", " ", "|", " ", "--", "version", "\\", "10", ";", " ", " ", "oct", "ogi", "t", " ", "help", " ", "|", " ", "-", "h", " ", "|", " ", "--", "help", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "CONFIG", "\\u", "FILE_", ")_", ":_", "\\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_", "#", " ", "create", " ", "config", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "commit", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "commit", "\\u", "changes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arguments_", "=_", "docopt_", "(_", "begin_", "._", "\\u\\u", "doc\\u\\u_", ",_", "help_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "arguments_", "[_", "'--", "version", "'_", "]_", "or_", "arguments_", "[_", "'-", "v", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "puts_", "(_", "version_", "(_", ")_", ")_", "\\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_", "elif_", "arguments_", "[_", "'--", "help", "'_", "]_", "or_", "arguments_", "[_", "'-", "h", "'_", "]_", "or_", "arguments_", "[_", "'", "help", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "help_", "(_", ")_", "\\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_", "elif_", "arguments_", "[_", "'", "create", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arguments_", "[_", "'<", "repo", ">'_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "puts_", "(_", "'{", "0", "}.", " ", "{", "1", "}'_", "._", "format_", "(_", "colored_", "._", "blue_", "(_", "'", "oct", "ogi", "t", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colored_", "._", "red_", "(_", "'", "You", " ", "need", " ", "to", " ", "pass", " ", "bot", "h", " ", "a", " ", "project", " ", "name", " ", "and", " ", "description", "'_", ")_", ")_", ")_", "\\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 ", " _", "project", "\\u", "name_", "=_", "arguments_", "[_", "'<", "repo", ">'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "arguments_", "[_", "'<", "description", ">'_", "]_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "organization_", "=_", "arguments_", "[_", "'<", "organization", ">'_", "]_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "repository_", "(_", "project", "\\u", "name_", ",_", "description_", ",_", "organization_", "=_", "organization_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\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_", "arguments_", "[_", "'--", "issue", "s", "'_", "]_", "or_", "arguments_", "[_", "'-", "i", "'_", "]_", "or_", "arguments_", "[_", "'", "issue", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "find", "\\u", "git", "hub", "\\u", "remote_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", ",_", "url_", "=_", "get", "\\u", "user", "name", "\\u", "and", "\\u", "repo_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arguments_", "[_", "'", "create", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "[_", "'<", "issue", "-", "title", ">'_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "puts_", "(_", "'{", "0", "}.", " ", "{", "1", "}'_", "._", "format_", "(_", "colored_", "._", "blue_", "(_", "'", "oct", "ogi", "t", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colored_", "._", "red_", "(_", "'", "You", " ", "need", " ", "to", " ", "pass", " ", "an", " ", "issue", " ", "title", "'_", ")_", ")_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issue", "\\u", "name_", "=_", "arguments_", "[_", "'<", "issue", "-", "title", ">'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "arguments_", "[_", "'<", "description", ">'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "issue_", "(_", "username_", ",_", "url_", ",_", "issue", "\\u", "name_", ",_", "description_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "issue", "\\u", "number_", "=_", "arguments_", "[_", "'<", "number", ">'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "issue", "\\u", "number_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "issue", "\\u", "number_", "._", "startswith_", "(_", "'#'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issue", "\\u", "number_", "=_", "issue", "\\u", "number_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "arguments_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close", "\\u", "issue_", "(_", "username_", ",_", "url_", ",_", "issue", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arguments_", "[_", "'", "view", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "\\u", "issue_", "(_", "username_", ",_", "url_", ",_", "issue", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arguments_", "[_", "'--", "assign", "ed", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "issues_", "(_", "username_", ",_", "url_", ",_", "(_", "arguments_", "[_", "'-", "assign", "ed", "'_", "]_", "or_", "arguments_", "[_", "'-", "a", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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 ", " _", "get", "\\u", "single", "\\u", "issue_", "(_", "username_", ",_", "url_", ",_", "issue", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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 ", " _", "get", "\\u", "issues_", "(_", "username_", ",_", "url_", ",_", "False_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arguments_", "[_", "'--", "login", "'_", "]_", "or_", "arguments_", "[_", "'-", "l", "'_", "]_", "or_", "arguments_", "[_", "'", "login", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "arguments_", "[_", "'", "user", "name", "'_", "]_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "raw", "\\u", "input_", "(_", "\"", "Git", "hub", " ", "user", "name", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "username_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "puts_", "(_", "\"{", "0", "}.", " ", "{", "1", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "colored_", "._", "blue_", "(_", "\"", "oct", "ogi", "t", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colored_", "._", "red_", "(_", "\"", "User", "name", " ", "was", " ", "blank", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "password_", "=_", "arguments_", "[_", "'", "password", "'_", "]_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "password_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "getpass_", "._", "getpass_", "(_", "\"", "Passw", "ord", " ", "for", " ", "%", "s", ":", " ", "\"_", "%_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "login_", "(_", "username_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_" ]
[ 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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tethysplatform/tethys/tethys_apps/base/__init__.py
[ { "content": "\"\"\"\n********************************************************************************\n* Name: base/__init__.py\n* Author: Nathan Swain\n* Created On: August 2013\n* Copyright: (c) Brigham Young University 2013\n* License: BSD 2-Clause\n********************************************************************************\n\"\"\"\n\nfrom tethys_apps.base.app_base import TethysAppBase\nfrom tethys_apps.base.persistent_store import PersistentStore\nfrom tethys_apps.base.controller import app_controller_maker\nfrom tethys_services.base import DatasetService, SpatialDatasetService, WpsService\nfrom tethys_apps.base.url_map import url_map_maker\nfrom tethys_apps.base.workspace import TethysWorkspace\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from tethys_apps.base.app_base import TethysAppBase", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 51 }, { "span": "from tethys_apps.base.persistent_store import PersistentStore", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 61 }, { "span": "from tethys_apps.base.controller import app_controller_maker", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 60 }, { "span": "from tethys_services.base import DatasetService, SpatialDatasetService, WpsService", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 82 }, { "span": "from tethys_apps.base.url_map import url_map_maker", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 50 }, { "span": "from tethys_apps.base.workspace import TethysWorkspace", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 54 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "***********", "***********", "***********", "***********", "***********", "***********", "***********", "***", "\\", "10", ";", "*", " ", "Name", ":", " ", "base", "/\\u", "\\u", "init", "\\u\\u", ".", "py", "\\", "10", ";", "*", " ", "Author", ":", " ", "Nat", "han", " ", "Swa", "in", "\\", "10", ";", "*", " ", "Creat", "ed", " ", "On", ":", " ", "August", " ", "2013", "\\", "10", ";", "*", " ", "Copy", "right", ":", " ", "(", "c", ")", " ", "Bri", "gha", "m", " ", "You", "ng", " ", "Univers", "it", "y", " ", "2013", "\\", "10", ";", "*", " ", "License", ":", " ", "BS", "D", " ", "2", "-", "Cla", "use", "\\", "10", ";", "***********", "***********", "***********", "***********", "***********", "***********", "***********", "***", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "teth", "ys", "\\u", "apps_", "._", "base_", "._", "app", "\\u", "base_", "import_", "Tet", "hys", "App", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "teth", "ys", "\\u", "apps_", "._", "base_", "._", "persiste", "nt", "\\u", "store_", "import_", "Persisten", "t", "Store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "teth", "ys", "\\u", "apps_", "._", "base_", "._", "controller_", "import_", "app", "\\u", "controlle", "r", "\\u", "maker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "teth", "ys", "\\u", "services_", "._", "base_", "import_", "Datas", "et", "Service_", ",_", "Spa", "tial", "Datas", "et", "Service_", ",_", "Wp", "s", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "teth", "ys", "\\u", "apps_", "._", "base_", "._", "url", "\\u", "map_", "import_", "url", "\\u", "map", "\\u", "maker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "teth", "ys", "\\u", "apps_", "._", "base_", "._", "workspace_", "import_", "Tet", "hys", "Workspace_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Except block handles 'BaseException'
iskandr/parakeet/benchmarks/matmult.py
[ { "content": "import parakeet\nimport numpy as np \n\n\n#\n#n, d = 2500, 20\n#m = 2500\n\nn,d,m = 1200,1200,1200\ndtype = 'float32'\nX = np.random.randn(m,d).astype(dtype)\nY = np.random.randn(d,n).astype(dtype)\n\nfrom compare_perf import compare_perf\n\nextra = {'BLAS (np.dot)' : np.dot}\ntry:\n import pycuda\n import pycuda.gpuarray \n import pycuda.autoinit\n\n import scikits.cuda.linalg\n import scikits.cuda.cublas \n cublas_context = scikits.cuda.cublas.cublasCreate()\n extra['cuBLAS'] = gpu_dot \nexcept:\n print \"Failed to import PyCUDA + scikits.cuda\" \n\ntry:\n import numba \n\n \n\n extra['numba'] = call_numba \n\nexcept:\n print \"Failed to import Numba\" \n pass \n\ncompare_perf(matmult_high_level, [X,Y],\n cpython=True,\n # numba can't run the nested comprehensions so we use\n # a special loopy version instead \n numba=False,\n extra = extra, \n suppress_output = False,\n propagate_exceptions = False)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 7 }, { "span": "except:", "start_line": 56, "start_column": 0, "end_line": 56, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "para", "ke", "et_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "n", ",", " ", "d", " ", "=", " ", "2500", ",", " ", "20_", "\\u\\u\\uNL\\u\\u\\u_", "#", "m", " ", "=", " ", "2500_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", ",_", "d_", ",_", "m_", "=_", "1200_", ",_", "1200_", ",_", "1200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "'", "float", "32", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "m_", ",_", "d_", ")_", "._", "astype_", "(_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "d_", ",_", "n_", ")_", "._", "astype_", "(_", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "compare", "\\u", "perf_", "import_", "compare", "\\u", "perf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "{_", "'", "BLAS", " ", "(", "np", ".", "dot", ")'_", ":_", "np_", "._", "dot_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pyc", "uda", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "gpu", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyc", "uda", "_", "._", "autoi", "nit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "scikit", "s_", "._", "cuda_", "._", "linalg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scikit", "s_", "._", "cuda_", "._", "cub", "las", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cub", "las", "\\u", "context_", "=_", "scikit", "s_", "._", "cuda_", "._", "cub", "las", "_", "._", "cub", "las", "Create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra_", "[_", "'", "cu", "BLAS", "'_", "]_", "=_", "gpu", "\\u", "dot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Fail", "ed", " ", "to", " ", "import", " ", "Py", "CU", "DA", " ", "+", " ", "scikit", "s", ".", "cud", "a", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "numba_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "extra_", "[_", "'", "numb", "a", "'_", "]_", "=_", "call", "\\u", "numba_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Fail", "ed", " ", "to", " ", "import", " ", "Num", "ba", "\"_", "\\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_", "compare", "\\u", "perf_", "(_", "mat", "mult", "\\u", "high", "\\u", "level_", ",_", "[_", "X_", ",_", "Y_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpy", "tho", "n_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "numb", "a", " ", "can", "'", "t", " ", "run", " ", "the", " ", "nest", "ed", " ", "compre", "hens", "ion", "s", " ", "so", " ", "we", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "special", " ", "loop", "y", " ", "version", " ", "inst", "ead", " _", "\\u\\u\\uNL\\u\\u\\u_", "numba_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "extra_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suppress", "\\u", "output_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "propagate", "\\u", "exceptions_", "=_", "False_", ")_" ]
[ 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, 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, 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 ]
Testing equality to None
binhex/moviegrabber/lib/site-packages/Cheetah/Tests/xmlrunner.py
[ { "content": " def run(self, test):\n \"\"\"Run the given test case or test suite.\"\"\"\n class_ = test.__class__\n classname = class_.__module__ + \".\" + class_.__name__\n if self._stream == None:\n filename = \"TEST-%s.xml\" % classname\n if self._filename:\n filename = self._filename\n stream = file(os.path.join(self._path, filename), \"w\")\n stream.write('<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n')\n else:\n stream = self._stream\n\n result = _XMLTestResult(classname)\n start_time = time.time()\n\n # TODO: Python 2.5: Use the with statement\n old_stdout = sys.stdout\n old_stderr = sys.stderr\n sys.stdout = StringIO()\n sys.stderr = StringIO()\n\n try:\n test(result)\n try:\n out_s = sys.stdout.getvalue()\n except AttributeError:\n out_s = \"\"\n try:\n err_s = sys.stderr.getvalue()\n except AttributeError:\n err_s = \"\"\n finally:\n sys.stdout = old_stdout\n sys.stderr = old_stderr\n\n time_taken = time.time() - start_time\n result.print_report(stream, time_taken, out_s, err_s)\n if self._stream == None:\n stream.close()\n\n return result", "metadata": "root.XMLTestRunner.run", "header": "['class', 'XMLTestRunner', '(', 'object', ')', ':', '___EOS___']", "index": 165 } ]
[ { "span": "self._stream == None:", "start_line": 169, "start_column": 11, "end_line": 169, "end_column": 31 }, { "span": "self._stream == None:", "start_line": 203, "start_column": 11, "end_line": 203, "end_column": 31 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "XML", "Test", "Runner_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "the", " ", "give", "n", " ", "test", " ", "case", " ", "or", " ", "test", " ", "suit", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class\\u_", "=_", "test_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classname_", "=_", "class\\u_", "._", "\\u\\u", "module\\u\\u_", "+_", "\".\"_", "+_", "class\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "stream_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "\"", "TEST", "-%", "s", ".", "xml", "\"_", "%_", "classname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "file_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "path_", ",_", "filename_", ")_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "write_", "(_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "utf", "-", "8", "\"?", ">\\\\", "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 ", " _", "stream_", "=_", "self_", "._", "\\u", "stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "\\u", "XML", "Test", "Result_", "(_", "classname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Pyth", "on", " ", "2.5", ":", " ", "Us", "e", " ", "the", " ", "with", " ", "statement_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "stdout_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "stderr_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "s_", "=_", "sys_", "._", "stdout_", "._", "getvalue_", "(_", ")_", "\\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 ", " _", "out", "\\u", "s_", "=_", "\"\"_", "\\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 ", " _", "err", "\\u", "s_", "=_", "sys_", "._", "stderr_", "._", "getvalue_", "(_", ")_", "\\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 ", " _", "err", "\\u", "s_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "=_", "old", "\\u", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "old", "\\u", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time", "\\u", "taken_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "print", "\\u", "report_", "(_", "stream_", ",_", "time", "\\u", "taken_", ",_", "out", "\\u", "s_", ",_", "err", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "stream_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
fatcloud/PyCV-time/opencv-official-samples/2.4.9/camshift.py
[ { "content": "#!/usr/bin/env python\n\n'''\nCamshift tracker\n================\n\nThis is a demo that shows mean-shift based tracking\nYou select a color objects such as your face and it tracks it.\nThis reads from video camera (0 by default, or the camera number the user enters)\n\nhttp://www.robinhewitt.com/research/track/camshift.html\n\nUsage:\n------\n camshift.py [<video source>]\n\n To initialize tracking, select the object with mouse\n\nKeys:\n-----\n ESC - exit\n b - toggle back-projected probability visualization\n'''\n\nimport numpy as np\nimport cv2\nimport video\n\n\n\n\nif __name__ == '__main__':\n import sys\n try: video_src = sys.argv[1]\n except: video_src = 0\n print __doc__\n App(video_src).run()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def run(self):\n while True:\n ret, self.frame = self.cam.read()\n vis = self.frame.copy()\n hsv = cv2.cvtColor(self.frame, cv2.COLOR_BGR2HSV)\n mask = cv2.inRange(hsv, np.array((0., 60., 32.)), np.array((180., 255., 255.)))\n\n if self.selection:\n x0, y0, x1, y1 = self.selection\n self.track_window = (x0, y0, x1-x0, y1-y0)\n hsv_roi = hsv[y0:y1, x0:x1]\n mask_roi = mask[y0:y1, x0:x1]\n hist = cv2.calcHist( [hsv_roi], [0], mask_roi, [16], [0, 180] )\n cv2.normalize(hist, hist, 0, 255, cv2.NORM_MINMAX);\n self.hist = hist.reshape(-1)\n self.show_hist()\n\n vis_roi = vis[y0:y1, x0:x1]\n cv2.bitwise_not(vis_roi, vis_roi)\n vis[mask == 0] = 0\n\n if self.tracking_state == 1:\n self.selection = None\n prob = cv2.calcBackProject([hsv], [0], self.hist, [0, 180], 1)\n prob &= mask\n term_crit = ( cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1 )\n track_box, self.track_window = cv2.CamShift(prob, self.track_window, term_crit)\n\n if self.show_backproj:\n vis[:] = prob[...,np.newaxis]\n try: cv2.ellipse(vis, track_box, (0, 0, 255), 2)\n except: print track_box\n\n cv2.imshow('camshift', vis)\n\n ch = 0xFF & cv2.waitKey(5)\n if ch == 27:\n break\n if ch == ord('b'):\n self.show_backproj = not self.show_backproj\n cv2.destroyAllWindows()", "metadata": "root.App.run", "header": "['class', 'App', '(', 'object', ')', ':', '___EOS___']", "index": 70 } ]
[ { "span": "except: ", "start_line": 116, "start_column": 4, "end_line": 116, "end_column": 11 }, { "span": "except: ", "start_line": 101, "start_column": 16, "end_line": 101, "end_column": 23 } ]
[]
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_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Cam", "shift", " ", "track", "er", "\\", "10", ";", "==============", "==", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "is", " ", "a", " ", "demo", " ", "tha", "t", " ", "show", "s", " ", "mean", "-", "shift", " ", "based", " ", "track", "ing", "\\", "10", ";", "You", " ", "select", " ", "a", " ", "color", " ", "object", "s", " ", "suc", "h", " ", "as", " ", "your", " ", "face", " ", "and", " ", "it", " ", "tracks", " ", "it", ".", "\\", "10", ";", "Thi", "s", " ", "reads", " ", "from", " ", "video", " ", "came", "ra", " ", "(", "0", " ", "by", " ", "default", ",", " ", "or", " ", "the", " ", "came", "ra", " ", "number", " ", "the", " ", "user", " ", "enter", "s", ")", "\\", "10", ";", "\\", "10", ";", "http", "://", "www", ".", "robi", "nhe", "wit", "t", ".", "com", "/", "research", "/", "track", "/", "cam", "shift", ".", "html", "\\", "10", ";", "\\", "10", ";", "Us", "age", ":", "\\", "10", ";", "------", "\\", "10", ";", " ", " ", " ", " ", "cam", "shift", ".", "py", " ", "[", "<", "video", " ", "source", ">]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "initialize", " ", "track", "ing", ",", " ", "select", " ", "the", " ", "object", " ", "with", " ", "mouse", "\\", "10", ";", "\\", "10", ";", "Keys", ":", "\\", "10", ";", "-----", "\\", "10", ";", " ", " ", " ", " ", "ESC", " ", " ", " ", "-", " ", "exit", "\\", "10", ";", " ", " ", " ", " ", "b", " ", "-", " ", "toggle", " ", "back", "-", "projected", " ", "probabilit", "y", " ", "visualization", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cv2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "video_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "video", "\\u", "src_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "video", "\\u", "src_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "App_", "(_", "video", "\\u", "src_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "App_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", ",_", "self_", "._", "frame_", "=_", "self_", "._", "cam_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "=_", "self_", "._", "frame_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hsv_", "=_", "cv2_", "._", "cvt", "Color_", "(_", "self_", "._", "frame_", ",_", "cv2_", "._", "COLOR", "\\u", "BG", "R2", "HS", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask_", "=_", "cv2_", "._", "in", "Range_", "(_", "hsv_", ",_", "np_", "._", "array_", "(_", "(_", "0._", ",_", "60._", ",_", "32.", "_", ")_", ")_", ",_", "np_", "._", "array_", "(_", "(_", "180._", ",_", "255.", "_", ",_", "255.", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "selection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x0_", ",_", "y0_", ",_", "x1_", ",_", "y1_", "=_", "self_", "._", "selection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "track", "\\u", "window_", "=_", "(_", "x0_", ",_", "y0_", ",_", "x1_", "-_", "x0_", ",_", "y1_", "-_", "y0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hsv", "\\u", "roi_", "=_", "hsv_", "[_", "y0_", ":_", "y1_", ",_", "x0_", ":_", "x1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mask", "\\u", "roi_", "=_", "mask_", "[_", "y0_", ":_", "y1_", ",_", "x0_", ":_", "x1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hist_", "=_", "cv2_", "._", "calc", "Hist_", "(_", "[_", "hsv", "\\u", "roi_", "]_", ",_", "[_", "0_", "]_", ",_", "mask", "\\u", "roi_", ",_", "[_", "16_", "]_", ",_", "[_", "0_", ",_", "180_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "normalize_", "(_", "hist_", ",_", "hist_", ",_", "0_", ",_", "255_", ",_", "cv2_", "._", "NORM", "\\u", "MIN", "MAX_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hist_", "=_", "hist_", "._", "reshape_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "\\u", "hist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vis", "\\u", "roi_", "=_", "vis_", "[_", "y0_", ":_", "y1_", ",_", "x0_", ":_", "x1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv2_", "._", "bitwise", "\\u", "not_", "(_", "vis", "\\u", "roi_", ",_", "vis", "\\u", "roi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vis_", "[_", "mask_", "==_", "0_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "track", "ing", "\\u", "state_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "selection_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "=_", "cv2_", "._", "calc", "Back", "Project_", "(_", "[_", "hsv_", "]_", ",_", "[_", "0_", "]_", ",_", "self_", "._", "hist_", ",_", "[_", "0_", ",_", "180_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "&=_", "mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "term", "\\u", "crit_", "=_", "(_", "cv2_", "._", "TERM", "\\u", "CRIT", "ERI", "A", "\\u", "EPS", "_", "|_", "cv2_", "._", "TERM", "\\u", "CRIT", "ERI", "A", "\\u", "COUNT_", ",_", "10_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "box_", ",_", "self_", "._", "track", "\\u", "window_", "=_", "cv2_", "._", "Cam", "Shift_", "(_", "prob_", ",_", "self_", "._", "track", "\\u", "window_", ",_", "term", "\\u", "crit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "show", "\\u", "backp", "roj", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "vis_", "[_", ":_", "]_", "=_", "prob_", "[_", "..._", ",_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "cv2_", "._", "ellipse_", "(_", "vis_", ",_", "track", "\\u", "box_", ",_", "(_", "0_", ",_", "0_", ",_", "255_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "print_", "track", "\\u", "box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cv2_", "._", "imshow_", "(_", "'", "cam", "shift", "'_", ",_", "vis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ch_", "=_", "0xFF_", "&_", "cv2_", "._", "wait", "Key_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ch_", "==_", "27_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ch_", "==_", "ord_", "(_", "'", "b", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "backp", "roj", "_", "=_", "not_", "self_", "._", "show", "\\u", "backp", "roj", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
VisTrails/VisTrails/vistrails/packages/spreadsheet/spreadsheet_tabcontroller.py
[ { "content": " def insertTabWidget(self, index, tabWidget, sheetLabel):\n \"\"\" insertTabWidget(index: int, tabWidget: QWidget, sheetLabel: str)\n -> int\n Insert a tab widget to the controller at some location\n\n \"\"\"\n if sheetLabel==None:\n sheetLabel = 'Sheet %d' % (len(self.tabWidgets)+1)\n if not tabWidget in self.tabWidgets:\n self.tabWidgets.append(tabWidget)\n tabWidget.setWindowTitle(sheetLabel)\n return self.insertTab(index, tabWidget, sheetLabel)", "metadata": "root.StandardWidgetTabController.insertTabWidget", "header": "['class', 'StandardWidgetTabController', '(', 'QtGui', '.', 'QTabWidget', ')', ':', '___EOS___']", "index": 450 }, { "content": " def saveSpreadsheet(self, fileName=None):\n \"\"\" saveSpreadsheet(fileName: str) -> None\n Save the current spreadsheet to a file if fileName is not\n None. Else, pop up a dialog to ask for a file name.\n\n \"\"\"\n def serialize_locator(locator):\n wrapper = XMLWrapper()\n dom = wrapper.create_document('spreadsheet_locator')\n root = dom.documentElement\n root.setAttribute(\"version\", \"1.0\")\n locator.serialize(dom,root)\n return dom.toxml()\n\n def need_save():\n from vistrails.gui.vistrails_window import _app\n need_save_vt = False\n for t in self.tabWidgets:\n dim = t.getDimension()\n for r in xrange(dim[0]):\n for c in xrange(dim[1]):\n info = t.getCellPipelineInfo(r,c)\n if info:\n controller = info[0]['controller']\n view = _app.ensureController(controller)\n if view:\n controller = view.get_controller()\n if controller.changed:\n need_save_vt = True\n return need_save_vt\n\n if need_save():\n show_warning('Save Spreadsheet', 'Please save your vistrails and try again.')\n return\n\n if fileName==None:\n fileName = self.spreadsheetFileName\n if fileName:\n indexFile = open(fileName, 'w')\n indexFile.write(str(len(self.tabWidgets))+'\\n')\n for t in self.tabWidgets:\n dim = t.getDimension()\n sheet = spreadsheetRegistry.getSheetByType(type(t))\n indexFile.write('%s\\n'%str((str(t.windowTitle()),\n sheet,\n dim[0], dim[1])))\n for r in xrange(dim[0]):\n for c in xrange(dim[1]):\n info = t.getCellPipelineInfo(r,c)\n if info:\n newinfo0 = copy.copy(info[0])\n newinfo0['pipeline'] = None\n newinfo0['actions'] = []\n newinfo0['locator'] = \\\n serialize_locator(newinfo0['controller'].locator)\n newinfo0['controller'] = None\n indexFile.write('%s\\n'\n %str((r, c,\n newinfo0,\n info[1], info[2])))\n indexFile.write('---\\n')\n indexFile.write(str(len(self.executedPipelines[0]))+'\\n')\n for vistrail in self.executedPipelines[0]:\n indexFile.write('%s\\n'%str((serialize_locator(vistrail[0].locator),\n vistrail[1])))\n self.changeSpreadsheetFileName(fileName)\n indexFile.close()\n else:\n self.saveSpreadsheetAs()", "metadata": "root.StandardWidgetTabController.saveSpreadsheet", "header": "['class', 'StandardWidgetTabController', '(', 'QtGui', '.', 'QTabWidget', ')', ':', '___EOS___']", "index": 625 } ]
[ { "span": "sheetLabel==None:", "start_line": 456, "start_column": 11, "end_line": 456, "end_column": 27 }, { "span": "fileName==None:", "start_line": 660, "start_column": 11, "end_line": 660, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Standard", "Wid", "get", "Tab", "Controller_", "(_", "Qt", "Gui_", "._", "QT", "ab", "Widget_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "Tab", "Widget_", "(_", "self_", ",_", "index_", ",_", "tab", "Widget_", ",_", "sheet", "Label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "insert", "Tab", "Wid", "get", "(", "index", ":", " ", "int", ",", " ", "tab", "Wid", "get", ":", " ", "QW", "idge", "t", ",", " ", "sheet", "Label", ":", " ", "str", ")", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "->", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "Insert", " ", "a", " ", "tab", " ", "widget", " ", "to", " ", "the", " ", "controlle", "r", " ", "at", " ", "some", " ", "location", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sheet", "Label_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sheet", "Label_", "=_", "'", "She", "et", " ", "%", "d", "'_", "%_", "(_", "len_", "(_", "self_", "._", "tab", "Widgets_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "tab", "Widget_", "in_", "self_", "._", "tab", "Widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tab", "Widgets_", "._", "append_", "(_", "tab", "Widget_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "Widget_", "._", "set", "Window", "Title_", "(_", "sheet", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "insert", "Tab_", "(_", "index_", ",_", "tab", "Widget_", ",_", "sheet", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Standard", "Wid", "get", "Tab", "Controller_", "(_", "Qt", "Gui_", "._", "QT", "ab", "Widget_", ")_", ":_", "\\u\\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", "Spread", "sheet_", "(_", "self_", ",_", "file", "Name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "save", "Spread", "sheet", "(", "file", "Name", ":", " ", "str", ")", " ", "->", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Save", " ", "the", " ", "current", " ", "spreadsheet", " ", "to", " ", "a", " ", "file", " ", "if", " ", "file", "Name", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", ".", " ", "Else", ",", " ", "pop", " ", "up", " ", "a", " ", "dialog", " ", "to", " ", "ask", " ", "for", " ", "a", " ", "file", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "serialize", "\\u", "locator_", "(_", "locator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapper_", "=_", "XML", "Wrapper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "=_", "wrapper_", "._", "create", "\\u", "document_", "(_", "'", "spreadsheet", "\\u", "locator", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "dom_", "._", "document", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "set", "Attribute_", "(_", "\"", "version", "\"_", ",_", "\"", "1.0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locator_", "._", "serialize_", "(_", "dom_", ",_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dom_", "._", "tox", "ml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "need", "\\u", "save_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vist", "rail", "s_", "._", "gui_", "._", "vist", "rail", "s", "\\u", "window_", "import_", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "\\u", "save", "\\u", "vt_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "self_", "._", "tab", "Widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "t_", "._", "get", "Dimension_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "xrange_", "(_", "dim_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "c_", "in_", "xrange_", "(_", "dim_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info_", "=_", "t_", "._", "get", "Cel", "l", "Pipe", "line", "Info_", "(_", "r_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "controller_", "=_", "info_", "[_", "0_", "]_", "[_", "'", "controlle", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "\\u", "app_", "._", "ensure", "Controller_", "(_", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "controller_", "=_", "view_", "._", "get", "\\u", "controller_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "controller_", "._", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "need", "\\u", "save", "\\u", "vt_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "need", "\\u", "save", "\\u", "vt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "need", "\\u", "save_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "\\u", "warning_", "(_", "'", "Save", " ", "Spread", "sheet", "'_", ",_", "'", "Ple", "ase", " ", "save", " ", "your", " ", "vist", "rail", "s", " ", "and", " ", "try", " ", "again", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file", "Name_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Name_", "=_", "self_", "._", "spreadsheet", "File", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "File_", "=_", "open_", "(_", "file", "Name_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "File_", "._", "write_", "(_", "str_", "(_", "len_", "(_", "self_", "._", "tab", "Widgets_", ")_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "self_", "._", "tab", "Widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "t_", "._", "get", "Dimension_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sheet_", "=_", "spreadsheet", "Registry_", "._", "get", "She", "et", "By", "Type_", "(_", "type_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "File_", "._", "write_", "(_", "'%", "s", "\\\\", "n", "'_", "%_", "str_", "(_", "(_", "str_", "(_", "t_", "._", "window", "Title_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sheet_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dim_", "[_", "0_", "]_", ",_", "dim_", "[_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "xrange_", "(_", "dim_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "c_", "in_", "xrange_", "(_", "dim_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info_", "=_", "t_", "._", "get", "Cel", "l", "Pipe", "line", "Info_", "(_", "r_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "newi", "nfo", "0_", "=_", "copy_", "._", "copy_", "(_", "info_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newi", "nfo", "0_", "[_", "'", "pipeline", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newi", "nfo", "0_", "[_", "'", "action", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newi", "nfo", "0_", "[_", "'", "locator", "'_", "]_", "=_", "serialize", "\\u", "locator_", "(_", "newi", "nfo", "0_", "[_", "'", "controlle", "r", "'_", "]_", "._", "locator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newi", "nfo", "0_", "[_", "'", "controlle", "r", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "File_", "._", "write_", "(_", "'%", "s", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "str_", "(_", "(_", "r_", ",_", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "newi", "nfo", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "[_", "1_", "]_", ",_", "info_", "[_", "2_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index", "File_", "._", "write_", "(_", "'---", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index", "File_", "._", "write_", "(_", "str_", "(_", "len_", "(_", "self_", "._", "executed", "Pipe", "lines_", "[_", "0_", "]_", ")_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "vist", "rail", "_", "in_", "self_", "._", "executed", "Pipe", "lines_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "File_", "._", "write_", "(_", "'%", "s", "\\\\", "n", "'_", "%_", "str_", "(_", "(_", "serialize", "\\u", "locator_", "(_", "vist", "rail", "_", "[_", "0_", "]_", "._", "locator_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vist", "rail", "_", "[_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "change", "Spread", "sheet", "File", "Name_", "(_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "File_", "._", "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_", "._", "save", "Spread", "sheet", "As_", "(_", ")_", "\\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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
scottrice/Ice/ice/tasks/engine.py
[ { "content": "# encoding: utf-8\n\nimport os\n\nfrom pysteam import paths as steam_paths\nfrom pysteam import shortcuts\nfrom pysteam import steam as steam_module\n\nfrom ice import backups\nfrom ice import configuration\nfrom ice import consoles\nfrom ice import emulators\nfrom ice import paths\nfrom ice import settings\nfrom ice.logs import logger\nfrom ice.persistence.config_file_backing_store import ConfigFileBackingStore\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TaskEngine(object):\n\n", "metadata": "root.TaskEngine", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, steam):\n self.steam = steam\n\n logger.debug(\"Initializing Ice\")\n # We want to ignore the anonymous context, cause theres no reason to sync\n # ROMs for it since you cant log in as said user.\n is_user_context = lambda context: context.user_id != 'anonymous'\n self.users = filter(is_user_context, steam_module.local_user_contexts(self.steam))", "metadata": "root.TaskEngine.__init__", "header": "['class', 'TaskEngine', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def run(self, tasks, app_settings, dry_run=False):\n if self.steam is None:\n logger.error(\"Cannot run Ice because Steam doesn't appear to be installed\")\n return\n\n logger.info(\"=========== Starting Ice ===========\")\n\n for task in tasks:\n task(app_settings, self.users, dry_run=dry_run)", "metadata": "root.TaskEngine.run", "header": "['class', 'TaskEngine', '(', 'object', ')', ':', '___EOS___']", "index": 28 } ]
[ { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "from pysteam import paths as steam_paths", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 40 }, { "span": "from pysteam import shortcuts", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 29 }, { "span": "from ice import backups", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 23 }, { "span": "from ice import configuration", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 29 }, { "span": "from ice import consoles", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 24 }, { "span": "from ice import emulators", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 25 }, { "span": "from ice import paths", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 21 }, { "span": "from ice import settings", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 24 }, { "span": "from ice.persistence.config_file_backing_store import ConfigFileBackingStore", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 76 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyst", "eam_", "import_", "paths_", "as_", "steam", "\\u", "paths_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyst", "eam_", "import_", "shortcuts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyst", "eam_", "import_", "steam", "_", "as_", "steam", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ice_", "import_", "backups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ice_", "import_", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ice_", "import_", "console", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ice_", "import_", "emulator", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ice_", "import_", "paths_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ice_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ice_", "._", "logs_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ice_", "._", "persistence_", "._", "config", "\\u", "file", "\\u", "backing", "\\u", "store_", "import_", "Config", "File", "Back", "ing", "Store_", "\\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_", "Task", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Task", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "steam", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "steam", "_", "=_", "steam", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Initializ", "ing", " ", "Ice", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "want", " ", "to", " ", "ignore", " ", "the", " ", "anonym", "ous", " ", "context", ",", " ", "caus", "e", " ", "there", "s", " ", "no", " ", "reason", " ", "to", " ", "sync_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ROM", "s", " ", "for", " ", "it", " ", "sinc", "e", " ", "you", " ", "cant", " ", "log", " ", "in", " ", "as", " ", "sai", "d", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "user", "\\u", "context_", "=_", "lambda_", "context_", ":_", "context_", "._", "user", "\\u", "id_", "!=_", "'", "anonym", "ous", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "users_", "=_", "filter_", "(_", "is", "\\u", "user", "\\u", "context_", ",_", "steam", "\\u", "module_", "._", "local", "\\u", "user", "\\u", "contexts_", "(_", "self_", "._", "steam", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "tasks_", ",_", "app", "\\u", "settings_", ",_", "dry", "\\u", "run_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "steam", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Cann", "ot", " ", "run", " ", "Ice", " ", "bec", "aus", "e", " ", "Ste", "am", " ", "doe", "sn", "'", "t", " ", "appear", " ", "to", " ", "be", " ", "install", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"====", "=======", " ", "Start", "ing", " ", "Ice", " ", "=========", "==\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "task_", "in_", "tasks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "(_", "app", "\\u", "settings_", ",_", "self_", "._", "users_", ",_", "dry", "\\u", "run_", "=_", "dry", "\\u", "run_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
nskinkel/oppy/oppy/tests/unit/connection/test_connectionbuildtask.py
[ { "content": " @mock.patch('twisted.internet.defer.Deferred', autospec=True)\n def test_connectionMade(self, mock_deferred):\n mock_sendVersionsCell = mock.Mock()\n mock_sendVersionsCell.return_value = mock_deferred\n self.cbt._sendVersionsCell = mock_sendVersionsCell\n\n self.cbt.connectionMade()\n\n self.assertEqual(mock_sendVersionsCell.call_count, 1)\n self.assertEqual(self.cbt._tasks.addCallback.call_count, 6)\n self.assertTrue(mock.call(self.cbt._processVersionsCell) in\n self.cbt._tasks.addCallback.call_args_list)\n self.assertTrue(mock.call(self.cbt._processCertsCell) in\n self.cbt._tasks.addCallback.call_args_list)\n self.assertTrue(mock.call(self.cbt._processAuthChallengeCell) in\n self.cbt._tasks.addCallback.call_args_list)\n self.assertTrue(mock.call(self.cbt._processNetInfoCell) in\n self.cbt._tasks.addCallback.call_args_list)\n self.assertTrue(mock.call(self.cbt._sendNetInfoCell) in\n self.cbt._tasks.addCallback.call_args_list)\n self.assertTrue(mock.call(self.cbt._connectionSucceeded) in\n self.cbt._tasks.addCallback.call_args_list)\n self.cbt._tasks.addErrback.assert_called_once_with(\n self.cbt._connectionFailed)", "metadata": "root.ConnectionBuildTaskTest.test_connectionMade", "header": "['class', 'ConnectionBuildTaskTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 28 } ]
[ { "span": "self.assertTrue(mock.call(self.cbt._processVersionsCell) in\n self.cbt._tasks.addCallback.call_args_list)", "start_line": 38, "start_column": 8, "end_line": 39, "end_column": 67 }, { "span": "self.assertTrue(mock.call(self.cbt._processCertsCell) in\n self.cbt._tasks.addCallback.call_args_list)", "start_line": 40, "start_column": 8, "end_line": 41, "end_column": 67 }, { "span": "self.assertTrue(mock.call(self.cbt._processAuthChallengeCell) in\n self.cbt._tasks.addCallback.call_args_list)", "start_line": 42, "start_column": 8, "end_line": 43, "end_column": 67 }, { "span": "self.assertTrue(mock.call(self.cbt._processNetInfoCell) in\n self.cbt._tasks.addCallback.call_args_list)", "start_line": 44, "start_column": 8, "end_line": 45, "end_column": 67 }, { "span": "self.assertTrue(mock.call(self.cbt._sendNetInfoCell) in\n self.cbt._tasks.addCallback.call_args_list)", "start_line": 46, "start_column": 8, "end_line": 47, "end_column": 67 }, { "span": "self.assertTrue(mock.call(self.cbt._connectionSucceeded) in\n self.cbt._tasks.addCallback.call_args_list)", "start_line": 48, "start_column": 8, "end_line": 49, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Connect", "ion", "Build", "Task", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "twist", "ed", ".", "interne", "t", ".", "defer", ".", "Defe", "rre", "d", "'_", ",_", "autospec_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "connecti", "on", "Made", "_", "(_", "self_", ",_", "mock", "\\u", "deferred_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "send", "Version", "s", "Cell_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "send", "Version", "s", "Cell_", "._", "return", "\\u", "value_", "=_", "mock", "\\u", "deferred_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "send", "Version", "s", "Cell_", "=_", "mock", "\\u", "send", "Version", "s", "Cell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "connecti", "on", "Made", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mock", "\\u", "send", "Version", "s", "Cell_", "._", "call", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Callback_", "._", "call", "\\u", "count_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mock_", "._", "call_", "(_", "self_", "._", "cb", "t_", "._", "\\u", "process", "Version", "s", "Cell_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Callback_", "._", "call", "\\u", "args", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mock_", "._", "call_", "(_", "self_", "._", "cb", "t_", "._", "\\u", "process", "Cert", "s", "Cell_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Callback_", "._", "call", "\\u", "args", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mock_", "._", "call_", "(_", "self_", "._", "cb", "t_", "._", "\\u", "process", "Auth", "Chall", "enge", "Cell_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Callback_", "._", "call", "\\u", "args", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mock_", "._", "call_", "(_", "self_", "._", "cb", "t_", "._", "\\u", "process", "Net", "Info", "Cell_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Callback_", "._", "call", "\\u", "args", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mock_", "._", "call_", "(_", "self_", "._", "cb", "t_", "._", "\\u", "send", "Net", "Info", "Cell_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Callback_", "._", "call", "\\u", "args", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mock_", "._", "call_", "(_", "self_", "._", "cb", "t_", "._", "\\u", "connecti", "on", "Succeed", "ed_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Callback_", "._", "call", "\\u", "args", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "tasks_", "._", "add", "Errback_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cb", "t_", "._", "\\u", "connecti", "on", "Failed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2 ]
Imprecise assert
saltstack/salt/tests/unit/stateconf_test.py
[ { "content": " def test_state_config(self):\n result = self._render_sls('''\n.sls_params:\n stateconf.set:\n - name1: value1\n - name2: value2\n\n.extra:\n stateconf:\n - set\n - name: value\n\n# --- end of state config ---\n\ntest:\n cmd.run:\n - name: echo name1={{sls_params.name1}} name2={{sls_params.name2}} {{extra.name}}\n - cwd: /\n''', sls='test')\n self.assertEqual(len(result), 3)\n self.assertTrue('test::sls_params' in result and 'test' in result)\n self.assertTrue('test::extra' in result)\n self.assertEqual(result['test']['cmd.run'][0]['name'],\n 'echo name1=value1 name2=value2 value')", "metadata": "root.StateConfigRendererTestCase.test_state_config", "header": "['class', 'StateConfigRendererTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_state_prefix(self):\n result = self._render_sls('''\n.test:\n cmd.run:\n - name: echo renamed\n - cwd: /\n\nstate_id:\n cmd:\n - run\n - name: echo not renamed\n - cwd: /\n''', sls='test')\n self.assertEqual(len(result), 2)\n self.assertTrue('test::test' in result)\n self.assertTrue('state_id' in result)", "metadata": "root.StateConfigRendererTestCase.test_state_prefix", "header": "['class', 'StateConfigRendererTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 137 }, { "content": " def test_dot_state_id_in_requisites(self):\n for req in REQUISITES:\n result = self._render_sls('''\n.test:\n cmd.run:\n - name: echo renamed\n - cwd: /\n\nstate_id:\n cmd.run:\n - name: echo not renamed\n - cwd: /\n - {0}:\n - cmd: .test\n\n '''.format(req), sls='test')\n self.assertEqual(len(result), 2)\n self.assertTrue('test::test' in result)\n self.assertTrue('state_id' in result)\n self.assertEqual(\n result['state_id']['cmd.run'][2][req][0]['cmd'], 'test::test'\n )", "metadata": "root.StateConfigRendererTestCase.test_dot_state_id_in_requisites", "header": "['class', 'StateConfigRendererTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 154 }, { "content": " def test_relative_include_and_extend(self):\n result = self._render_sls('''\ninclude:\n - some.helper\n - .utils\n\nextend:\n .utils::some_state:\n cmd.run:\n - name: echo overridden\n ''', sls='test.work')\n self.assertTrue('test.utils::some_state' in result['extend'])", "metadata": "root.StateConfigRendererTestCase.test_relative_include_and_extend", "header": "['class', 'StateConfigRendererTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 197 } ]
[ { "span": "self.assertTrue('test::extra' in result)", "start_line": 89, "start_column": 8, "end_line": 89, "end_column": 48 }, { "span": "self.assertTrue('test::test' in result)", "start_line": 151, "start_column": 8, "end_line": 151, "end_column": 47 }, { "span": "self.assertTrue('state_id' in result)", "start_line": 152, "start_column": 8, "end_line": 152, "end_column": 45 }, { "span": "self.assertTrue('test::test' in result)", "start_line": 171, "start_column": 12, "end_line": 171, "end_column": 51 }, { "span": "self.assertTrue('state_id' in result)", "start_line": 172, "start_column": 12, "end_line": 172, "end_column": 49 }, { "span": "self.assertTrue('test.utils::some_state' in result['extend'])", "start_line": 208, "start_column": 8, "end_line": 208, "end_column": 69 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "State", "Config", "Render", "er", "Test", "Case_", "(_", "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", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "\\u", "render", "\\u", "sl", "s_", "(_", "'''", "\\", "10", ";", ".", "sl", "s", "\\u", "params", ":", "\\", "10", ";", " ", " ", "state", "conf", ".", "set", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name", "1", ":", " ", "value", "1", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name2", ":", " ", "value", "2", "\\", "10", ";", "\\", "10", ";", ".", "extra", ":", "\\", "10", ";", " ", " ", "state", "conf", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name", ":", " ", "value", "\\", "10", ";", "\\", "10", ";", "#", " ", "---", " ", "end", " ", "of", " ", "state", " ", "config", " ", "---", "\\", "10", ";", "\\", "10", ";", "test", ":", "\\", "10", ";", " ", " ", "cmd", ".", "run", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name", ":", " ", "echo", " ", "name", "1", "={", "{", "sl", "s", "\\u", "params", ".", "name", "1", "}}", " ", "name2", "={", "{", "sl", "s", "\\u", "params", ".", "name2", "}}", " ", "{{", "extra", ".", "name", "}}\\", "10", ";", " ", " ", " ", " ", "-", " ", "cw", "d", ":", " ", "/", "\\", "10", ";'", "''_", ",_", "sl", "s_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test", "::", "sl", "s", "\\u", "params", "'_", "in_", "result_", "and_", "'", "test", "'_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test", "::", "extra", "'_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "'", "test", "'_", "]_", "[_", "'", "cmd", ".", "run", "'_", "]_", "[_", "0_", "]_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "echo", " ", "name", "1", "=", "value", "1", " ", "name2", "=", "value", "2", " ", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Config", "Render", "er", "Test", "Case_", "(_", "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", "prefix_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "\\u", "render", "\\u", "sl", "s_", "(_", "'''", "\\", "10", ";", ".", "test", ":", "\\", "10", ";", " ", " ", "cmd", ".", "run", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name", ":", " ", "echo", " ", "renamed", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "cw", "d", ":", " ", "/", "\\", "10", ";", "\\", "10", ";", "state", "\\u", "id", ":", "\\", "10", ";", " ", " ", "cmd", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "run", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name", ":", " ", "echo", " ", "not", " ", "renamed", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "cw", "d", ":", " ", "/", "\\", "10", ";'", "''_", ",_", "sl", "s_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test", "::", "test", "'_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "state", "\\u", "id", "'_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Config", "Render", "er", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dot", "\\u", "state", "\\u", "id", "\\u", "in", "\\u", "requisit", "es_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "req_", "in_", "REQ", "UI", "SITE", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "\\u", "render", "\\u", "sl", "s_", "(_", "'''", "\\", "10", ";", ".", "test", ":", "\\", "10", ";", " ", " ", "cmd", ".", "run", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name", ":", " ", "echo", " ", "renamed", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "cw", "d", ":", " ", "/", "\\", "10", ";", "\\", "10", ";", "state", "\\u", "id", ":", "\\", "10", ";", " ", " ", "cmd", ".", "run", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "name", ":", " ", "echo", " ", "not", " ", "renamed", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "cw", "d", ":", " ", "/", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "{", "0", "}:", "\\", "10", ";", " ", " ", "-", " ", "cmd", ":", " ", ".", "test", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "._", "format_", "(_", "req_", ")_", ",_", "sl", "s_", "=_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test", "::", "test", "'_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "state", "\\u", "id", "'_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "state", "\\u", "id", "'_", "]_", "[_", "'", "cmd", ".", "run", "'_", "]_", "[_", "2_", "]_", "[_", "req_", "]_", "[_", "0_", "]_", "[_", "'", "cmd", "'_", "]_", ",_", "'", "test", "::", "test", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "State", "Config", "Render", "er", "Test", "Case_", "(_", "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", "relative", "\\u", "include", "\\u", "and", "\\u", "extend_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "\\u", "render", "\\u", "sl", "s_", "(_", "'''", "\\", "10", ";", "include", ":", "\\", "10", ";", " ", " ", "-", " ", "some", ".", "help", "er", "\\", "10", ";", " ", " ", "-", " ", ".", "util", "s", "\\", "10", ";", "\\", "10", ";", "extend", ":", "\\", "10", ";", " ", " ", ".", "util", "s", "::", "some", "\\u", "state", ":", "\\", "10", ";", " ", " ", " ", " ", "cmd", ".", "run", ":", "\\", "10", ";", " ", " ", "-", " ", "name", ":", " ", "echo", " ", "overrid", "den", "\\", "10", ";", " ", " ", " ", " ", "'''_", ",_", "sl", "s_", "=_", "'", "test", ".", "work", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test", ".", "util", "s", "::", "some", "\\u", "state", "'_", "in_", "result_", "[_", "'", "extend", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
fp7-ofelia/ocf/optin_manager/src/python/scripts/setup_ch.py
[ { "content": "'''\nCreated on Jul 19, 2010\n\n@author: jnaous\n'''\nfrom django.core.urlresolvers import reverse\nfrom django.test import Client\nfrom expedient.common.tests.client import test_get_and_post_form\nfrom django.contrib.auth.models import User\nfrom pyquery import PyQuery as pq\nfrom openflow.plugin.models import OpenFlowInterface, NonOpenFlowConnection\nfrom geni.planetlab.models import PlanetLabNode\n\ntry:\n from setup_expedient_params import \\\n SUPERUSER_USERNAME, SUPERUSER_PASSWORD,\\\n USER_INFO,\\\n PL_AGGREGATE_INFO,\\\n OF_AGGREGATE_INFO,\\\n OF_PL_CONNECTIONS\n \nexcept ImportError:\n print \"\"\"\nCould not import setup_om_params module. Make sure this\nmodule exists and that it contains the following variables:\n SUPERUSER_USERNAME, SUPERUSER_PASSWORD,\n CH_PASSWORD, CH_USERNAME\n\"\"\"\n raise\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def run():\n client = Client()\n client.login(username=SUPERUSER_USERNAME,\n password=SUPERUSER_PASSWORD)\n \n # Add all planetlab aggregates\n for pl_agg in PL_AGGREGATE_INFO:\n print \"adding pl agg %s\" % pl_agg[\"url\"]\n response = test_get_and_post_form(\n client,\n reverse(\"planetlab_aggregate_create\"),\n pl_agg,\n )\n print \"got response %s\" % response\n assert response.status_code == 302\n \n for of_agg in OF_AGGREGATE_INFO:\n print \"adding of agg %s\" % of_agg[\"url\"]\n response = test_get_and_post_form(\n client,\n reverse(\"openflow_aggregate_create\"),\n of_agg,\n del_params=[\"verify_certs\"],\n )\n assert response.status_code == 302\n \n for cnxn_tuple in OF_PL_CONNECTIONS:\n print \"adding cnxn %s\" % (cnxn_tuple,)\n NonOpenFlowConnection.objects.get_or_create(\n of_iface=OpenFlowInterface.objects.get(\n switch__datapath_id=cnxn_tuple[0],\n port_num=cnxn_tuple[1],\n ),\n resource=PlanetLabNode.objects.get(name=cnxn_tuple[2]),\n )\n \n client.logout()\n \n for username, info in USER_INFO.items():\n # create user\n User.objects.create_user(\n username=username, email=info[\"email\"], password=info[\"password\"])\n \n client.login(username=username, password=info[\"password\"])\n # create project and slice\n for project in info[\"projects\"]:\n response = test_get_and_post_form(\n client, reverse(\"project_create\"),\n params=dict(\n name=project[\"name\"],\n description=project[\"description\"],\n ),\n )\n assert response.status_code == 302\n # This code is missing the project id. Need to get somehow to use reverse.\n # for slice in project[\"slices\"]:\n # response = test_get_and_post_form(\n # client, reverse(\"slice_create\"),\n # params=dict(\n # name=slice[\"name\"],\n # description=slice[\"description\"],\n # ),\n # )\n # assert response.status_code == 302\n client.logout()", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 30 } ]
[ { "span": "from pyquery import PyQuery as pq", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Ju", "l", " ", "1", "9", ",", " ", "2010", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "jn", "ao", "us", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "common_", "._", "tests_", "._", "client_", "import_", "test\\u", "get", "\\u", "and", "\\u", "post", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyq", "uery_", "import_", "Py", "Query_", "as_", "pq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openf", "low_", "._", "plugin_", "._", "models_", "import_", "Open", "Flow", "Interface_", ",_", "Non", "Open", "Flow", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "geni", "_", "._", "planet", "lab_", "._", "models_", "import_", "Planet", "Lab", "Node_", "\\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_", "setup", "\\u", "expe", "die", "nt", "\\u", "params_", "import_", "SUPER", "USER", "\\u", "USERNAME_", ",_", "SUPER", "USER", "\\u", "PASSWORD_", ",_", "USER", "\\u", "INFO_", ",_", "PL", "\\u", "AGG", "REG", "ATE", "\\u", "INFO_", ",_", "OF", "\\u", "AGG", "REG", "ATE", "\\u", "INFO_", ",_", "OF", "\\u", "PL", "\\u", "CONNECTION", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"\"", "\\", "10", ";", "Cou", "ld", " ", "not", " ", "import", " ", "setup", "\\u", "om", "\\u", "params", " ", "module", ".", " ", "Make", " ", "sure", " ", "this", "\\", "10", ";", "module", " ", "exist", "s", " ", "and", " ", "tha", "t", " ", "it", " ", "contain", "s", " ", "the", " ", "follow", "ing", " ", "variab", "les", ":", "\\", "10", ";", " ", " ", " ", " ", "SUPER", "USER", "\\u", "USER", "NAME", ",", " ", "SUPER", "USER", "\\u", "PASS", "WORD", ",", "\\", "10", ";", " ", " ", " ", " ", "CH", "\\u", "PASS", "WORD", ",", " ", "CH", "\\u", "USER", "NAME", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "login_", "(_", "username_", "=_", "SUPER", "USER", "\\u", "USERNAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "SUPER", "USER", "\\u", "PASSWORD_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "all", " ", "planet", "lab", " ", "aggregates", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pl", "\\u", "agg_", "in_", "PL", "\\u", "AGG", "REG", "ATE", "\\u", "INFO_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "addin", "g", " ", "pl", " ", "agg", " ", "%", "s", "\"_", "%_", "pl", "\\u", "agg_", "[_", "\"", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "test\\u", "get", "\\u", "and", "\\u", "post", "\\u", "form_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "planet", "lab", "\\u", "aggre", "gate", "\\u", "create", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pl", "\\u", "agg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "got", " ", "response", " ", "%", "s", "\"_", "%_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "._", "status", "\\u", "code_", "==_", "302_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "of", "\\u", "agg_", "in_", "OF", "\\u", "AGG", "REG", "ATE", "\\u", "INFO_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "addin", "g", " ", "of", " ", "agg", " ", "%", "s", "\"_", "%_", "of", "\\u", "agg_", "[_", "\"", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "test\\u", "get", "\\u", "and", "\\u", "post", "\\u", "form_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "\"", "openf", "low", "\\u", "aggre", "gate", "\\u", "create", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "of", "\\u", "agg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "del", "\\u", "params_", "=_", "[_", "\"", "verify", "\\u", "cert", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "._", "status", "\\u", "code_", "==_", "302_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cn", "xn", "\\u", "tuple_", "in_", "OF", "\\u", "PL", "\\u", "CONNECTION", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "addin", "g", " ", "cn", "xn", " ", "%", "s", "\"_", "%_", "(_", "cn", "xn", "\\u", "tuple_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Non", "Open", "Flow", "Connection_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "of", "\\u", "iface_", "=_", "Open", "Flow", "Interface_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "switch", "\\u\\u", "datapath", "\\u", "id_", "=_", "cn", "xn", "\\u", "tuple_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port", "\\u", "num_", "=_", "cn", "xn", "\\u", "tuple_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource_", "=_", "Planet", "Lab", "Node_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "cn", "xn", "\\u", "tuple_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "._", "logout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "username_", ",_", "info_", "in_", "USER", "\\u", "INFO_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "username_", ",_", "email_", "=_", "info_", "[_", "\"", "email", "\"_", "]_", ",_", "password_", "=_", "info_", "[_", "\"", "password", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "login_", "(_", "username_", "=_", "username_", ",_", "password_", "=_", "info_", "[_", "\"", "password", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "project", " ", "and", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "project_", "in_", "info_", "[_", "\"", "project", "s", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "test\\u", "get", "\\u", "and", "\\u", "post", "\\u", "form_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "client_", ",_", "reverse_", "(_", "\"", "project", "\\u", "create", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "project_", "[_", "\"", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "project_", "[_", "\"", "description", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "._", "status", "\\u", "code_", "==_", "302_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "code", " ", "is", " ", "missi", "ng", " ", "the", " ", "project", " ", "id", ".", " ", "Ne", "ed", " ", "to", " ", "get", " ", "some", "how", " ", "to", " ", "use", " ", "reverse", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "slice", " ", "in", " ", "project", "[\"", "slice", "s", "\"]", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", " ", "=", " ", "test\\u", "get", "\\u", "and", "\\u", "post", "\\u", "form", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "client", ",", " ", "reverse", "(\"", "slice", "\\u", "create", "\")", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "params", "=", "dict", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "name", "=", "slice", "[\"", "name", "\"]", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "description", "=", "slice", "[\"", "description", "\"]", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", " ", "response", ".", "status", "\\u", "code", " ", "==", " ", "302_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "._", "logout_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
treeio/treeio/treeio/changes/south_migrations/0001_initial.py
[ { "content": "# encoding: utf-8\n# Copyright 2011 Tree.io Limited\n# This file is part of Treeio.\n# License www.tree.io/license\n\n# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n models = {\n 'auth.group': {\n 'Meta': {'object_name': 'Group'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n 'auth.permission': {\n 'Meta': {'ordering': \"('content_type__app_label', 'content_type__model', 'codename')\", 'unique_together': \"(('content_type', 'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n 'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Group']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n 'changes.change': {\n 'Meta': {'ordering': \"['-date_created']\", 'object_name': 'Change'},\n 'change_from': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'change_set': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['changes.ChangeSet']\"}),\n 'change_to': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'change_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'date_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'field': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})\n },\n 'changes.changeset': {\n 'Meta': {'ordering': \"('-date_created', 'name')\", 'object_name': 'ChangeSet'},\n 'author': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'author'\", 'null': 'True', 'to': \"orm['core.User']\"}),\n 'date_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'details': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'object': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'changeset_object_set'\", 'to': \"orm['core.Object']\"}),\n 'resolved_by': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['core.User']\", 'null': 'True', 'blank': 'True'}),\n 'resolved_on': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'status': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['changes.ChangeSetStatus']\"})\n },\n 'changes.changesetstatus': {\n 'Meta': {'ordering': \"('hidden', '-active', 'name')\", 'object_name': 'ChangeSetStatus', '_ormbases': ['core.Object']},\n 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'details': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'object_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': \"orm['core.Object']\", 'unique': 'True', 'primary_key': 'True'})\n },\n 'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'core.group': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Group'},\n 'details': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'child_set'\", 'null': 'True', 'to': \"orm['core.Group']\"})\n },\n 'core.object': {\n 'Meta': {'object_name': 'Object'},\n 'date_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'everybody_execute': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'everybody_read': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'everybody_write': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['core.Group']\"}),\n 'group_execute': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'group_read': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'group_write': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'links': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': \"'links_rel_+'\", 'null': 'True', 'to': \"orm['core.Object']\"}),\n 'nuvius_resource': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'object_name': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),\n 'object_type': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),\n 'subscribers': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': \"'subscriptions'\", 'null': 'True', 'symmetrical': 'False', 'to': \"orm['core.User']\"}),\n 'trash': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['core.User']\"}),\n 'user_execute': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'user_read': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'user_write': ('django.db.models.fields.BooleanField', [], {'default': 'False'})\n },\n 'core.user': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'User'},\n 'default_group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'default_user_set'\", 'null': 'True', 'to': \"orm['core.Group']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),\n 'other_groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': \"orm['core.Group']\", 'null': 'True', 'blank': 'True'}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"})\n }\n }\n\n complete_apps = ['changes']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def forwards(self, orm):\n\n # Adding model 'ChangeSetStatus'\n db.create_table('changes_changesetstatus', (\n ('object_ptr', self.gf('django.db.models.fields.related.OneToOneField')(\n to=orm['core.Object'], unique=True, primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')\n (max_length=256)),\n ('details', self.gf('django.db.models.fields.TextField')\n (null=True, blank=True)),\n ('active', self.gf('django.db.models.fields.BooleanField')\n (default=True)),\n ('hidden', self.gf('django.db.models.fields.BooleanField')\n (default=False)),\n ))\n db.send_create_signal('changes', ['ChangeSetStatus'])\n\n # Adding model 'ChangeSet'\n db.create_table('changes_changeset', (\n ('id', self.gf('django.db.models.fields.AutoField')\n (primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')\n (max_length=255)),\n ('object', self.gf('django.db.models.fields.related.ForeignKey')\n (related_name='changeset_object_set', to=orm['core.Object'])),\n ('author', self.gf('django.db.models.fields.related.ForeignKey')(\n blank=True, related_name='author', null=True, to=orm['core.User'])),\n ('resolved_by', self.gf('django.db.models.fields.related.ForeignKey')(\n to=orm['core.User'], null=True, blank=True)),\n ('resolved_on', self.gf('django.db.models.fields.DateTimeField')\n (null=True, blank=True)),\n ('status', self.gf('django.db.models.fields.related.ForeignKey')\n (to=orm['changes.ChangeSetStatus'])),\n ('details', self.gf('django.db.models.fields.TextField')\n (null=True, blank=True)),\n ('date_created', self.gf('django.db.models.fields.DateTimeField')\n (default=datetime.datetime.now)),\n ))\n db.send_create_signal('changes', ['ChangeSet'])\n\n # Adding model 'Change'\n db.create_table('changes_change', (\n ('id', self.gf('django.db.models.fields.AutoField')\n (primary_key=True)),\n ('change_set', self.gf('django.db.models.fields.related.ForeignKey')(\n to=orm['changes.ChangeSet'])),\n ('change_type', self.gf('django.db.models.fields.CharField')\n (max_length=255, null=True, blank=True)),\n ('field', self.gf('django.db.models.fields.CharField')\n (max_length=255, null=True, blank=True)),\n ('change_from', self.gf('django.db.models.fields.TextField')\n (null=True, blank=True)),\n ('change_to', self.gf('django.db.models.fields.TextField')\n (null=True, blank=True)),\n ('date_created', self.gf('django.db.models.fields.DateTimeField')\n (default=datetime.datetime.now)),\n ))\n db.send_create_signal('changes', ['Change'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 14 }, { "content": " def backwards(self, orm):\n\n # Deleting model 'ChangeSetStatus'\n db.delete_table('changes_changesetstatus')\n\n # Deleting model 'ChangeSet'\n db.delete_table('changes_changeset')\n\n # Deleting model 'Change'\n db.delete_table('changes_change')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 73 } ]
[ { "span": "from django.db import models", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Tree", ".", "io", " ", "Limit", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Tree", "io", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", " ", "www", ".", "tree", ".", "io", "/", "license_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "content", "\\u", "type", "',", " ", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Group", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "s", ".", "change", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'-", "date", "\\u", "created", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Change", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "from", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "set", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "change", "s", ".", "Change", "Set", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "to", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "s", ".", "changeset", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'-", "date", "\\u", "created", "',", " ", "'", "name", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Change", "Set", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "author", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deta", "il", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "changeset", "\\u", "object\\u", "set", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "Object", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resolve", "d\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "User", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resolve", "d\\u", "on", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "change", "s", ".", "Change", "Set", "Status", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "s", ".", "changeset", "status", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "hidden", "',", " ", "'-", "active", "',", " ", "'", "name", "')\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Change", "Set", "Status", "'_", ",_", "'\\u", "ormbase", "s", "'_", ":_", "[_", "'", "core", ".", "Object", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deta", "il", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hidden", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "ptr", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "Object", "']\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "core", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deta", "il", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "child", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "Group", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "core", ".", "object", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Object", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "every", "body", "\\u", "execute", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "every", "body", "\\u", "read", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "every", "body", "\\u", "write", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "Group", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "\\u", "execute", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "\\u", "read", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "\\u", "write", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "link", "s", "\\u", "rel", "\\u", "+'\"", "_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "Object", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nu", "vi", "us", "\\u", "resource", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "512", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subscribers", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "subscript", "ion", "s", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trash", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "execute", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "read", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "write", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "core", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "group", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "default", "\\u", "user", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "Group", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "update", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "256", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "other", "\\u", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "core", ".", "Group", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "change", "s", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Change", "Set", "Status", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "change", "s", "\\u", "changeset", "status", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "object\\u", "ptr", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ")_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to_", "=_", "orm_", "[_", "'", "core", ".", "Object", "'_", "]_", ",_", "unique_", "=_", "True_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "max", "\\u", "length_", "=_", "256_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "deta", "il", "s", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "active", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "default_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "hidden", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "default_", "=_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "change", "s", "'_", ",_", "[_", "'", "Change", "Set", "Status", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Change", "Set", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "change", "s", "\\u", "changeset", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "object", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "relate", "d\\u", "name_", "=_", "'", "changeset", "\\u", "object\\u", "set", "'_", ",_", "to_", "=_", "orm_", "[_", "'", "core", ".", "Object", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "author", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "author", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "core", ".", "User", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "resolve", "d\\u", "by", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to_", "=_", "orm_", "[_", "'", "core", ".", "User", "'_", "]_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "resolve", "d\\u", "on", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "status", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "to_", "=_", "orm_", "[_", "'", "change", "s", ".", "Change", "Set", "Status", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "deta", "il", "s", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "\\u", "created", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "default_", "=_", "datetime_", "._", "datetime_", "._", "now_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "change", "s", "'_", ",_", "[_", "'", "Change", "Set", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Change", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "change", "s", "\\u", "change", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "change", "\\u", "set", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to_", "=_", "orm_", "[_", "'", "change", "s", ".", "Change", "Set", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "change", "\\u", "type", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "field", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "change", "\\u", "from", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "change", "\\u", "to", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "date", "\\u", "created", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "default_", "=_", "datetime_", "._", "datetime_", "._", "now_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "change", "s", "'_", ",_", "[_", "'", "Change", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Change", "Set", "Status", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "table_", "(_", "'", "change", "s", "\\u", "changeset", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Change", "Set", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "change", "s", "\\u", "changeset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Change", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "change", "s", "\\u", "change", "'_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
michael-lazar/rtv/rtv/objects.py
[ { "content": "@contextmanager\ndef curses_session():\n \"\"\"\n Setup terminal and initialize curses. Most of this copied from\n curses.wrapper in order to convert the wrapper into a context manager.\n \"\"\"\n\n try:\n # Curses must wait for some time after the Escape key is pressed to\n # check if it is the beginning of an escape sequence indicating a\n # special key. The default wait time is 1 second, which means that\n # http://stackoverflow.com/questions/27372068\n os.environ['ESCDELAY'] = '25'\n\n # Initialize curses\n stdscr = curses.initscr()\n\n # Turn off echoing of keys, and enter cbreak mode, where no buffering\n # is performed on keyboard input\n curses.noecho()\n curses.cbreak()\n\n # In keypad mode, escape sequences for special keys (like the cursor\n # keys) will be interpreted and a special value like curses.KEY_LEFT\n # will be returned\n stdscr.keypad(1)\n\n # Start color, too. Harmless if the terminal doesn't have color; user\n # can test with has_color() later on. The try/catch works around a\n # minor bit of over-conscientiousness in the curses module -- the error\n # return from C start_color() is ignorable.\n try:\n curses.start_color()\n except:\n pass\n\n # Hide the blinking cursor\n curses.curs_set(0)\n\n # Assign the terminal's default (background) color to code -1\n curses.use_default_colors()\n\n yield stdscr\n\n finally:\n if 'stdscr' in locals():\n stdscr.keypad(0)\n curses.echo()\n curses.nocbreak()\n curses.endwin()", "metadata": "root.curses_session", "header": "['module', '___EOS___']", "index": 25 } ]
[ { "span": "except:", "start_line": 58, "start_column": 8, "end_line": 58, "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_", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "curse", "s", "\\u", "session_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "up", " ", "termina", "l", " ", "and", " ", "initialize", " ", "curse", "s", ".", " ", "Mos", "t", " ", "of", " ", "this", " ", "copie", "d", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "curse", "s", ".", "wrapp", "er", " ", "in", " ", "order", " ", "to", " ", "convert", " ", "the", " ", "wrapp", "er", " ", "int", "o", " ", "a", " ", "context", " ", "manage", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Curs", "es", " ", "must", " ", "wait", " ", "for", " ", "some", " ", "time", " ", "after", " ", "the", " ", "Esc", "ape", " ", "key", " ", "is", " ", "presse", "d", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "it", " ", "is", " ", "the", " ", "beginn", "ing", " ", "of", " ", "an", " ", "escape", " ", "sequence", " ", "indicati", "ng", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "special", " ", "key", ".", " ", "The", " ", "default", " ", "wait", " ", "time", " ", "is", " ", "1", " ", "second", ",", " ", "whi", "ch", " ", "means", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "273", "720", "68_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "ESC", "DELAY", "'_", "]_", "=_", "'", "25", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "curses_", "\\u\\u\\uNL\\u\\u\\u_", "stdscr_", "=_", "curses_", "._", "inits", "cr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Turn", " ", "off", " ", "echo", "ing", " ", "of", " ", "keys", ",", " ", "and", " ", "enter", " ", "cb", "reak", " ", "mode", ",", " ", "where", " ", "no", " ", "bufferi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "perform", "ed", " ", "on", " ", "keyb", "oard", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "curses_", "._", "noe", "cho", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "cb", "reak", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "keypa", "d", " ", "mode", ",", " ", "escape", " ", "sequence", "s", " ", "for", " ", "special", " ", "keys", " ", "(", "like", " ", "the", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keys", ")", " ", "will", " ", "be", " ", "interprete", "d", " ", "and", " ", "a", " ", "special", " ", "value", " ", "like", " ", "curse", "s", ".", "KEY", "\\u", "LEFT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "be", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "stdscr_", "._", "keypa", "d_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "color", ",", " ", "too", ".", " ", " ", "Harm", "less", " ", "if", " ", "the", " ", "termina", "l", " ", "doe", "sn", "'", "t", " ", "have", " ", "color", ";", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "test", " ", "with", " ", "has", "\\u", "color", "()", " ", "late", "r", " ", "on", ".", " ", " ", "The", " ", "try", "/", "catch", " ", "works", " ", "aro", "und", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mino", "r", " ", "bit", " ", "of", " ", "over", "-", "cons", "cie", "nti", "ous", "ness", " ", "in", " ", "the", " ", "curse", "s", " ", "module", " ", "--", " ", "the", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "from", " ", "C", " ", "start", "\\u", "color", "()", " ", "is", " ", "ign", "ora", "ble", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curses_", "._", "start", "\\u", "color_", "(_", ")_", "\\u\\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_", "#", " ", "Hi", "de", " ", "the", " ", "blink", "ing", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curses_", "._", "curs", "\\u", "set_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assign", " ", "the", " ", "termina", "l", "'", "s", " ", "default", " ", "(", "background", ")", " ", "color", " ", "to", " ", "code", " ", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "curses_", "._", "use", "\\u", "default", "\\u", "colors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "stdscr_", "\\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 ", " _", "if_", "'", "stds", "cr", "'_", "in_", "locals_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stdscr_", "._", "keypa", "d_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "echo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "noc", "break_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "end", "win_", "(_", ")_", "\\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, 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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, 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 ]
Unused import
treyhunner/django-simple-history/simple_history/tests/tests/test_admin.py
[ { "content": "from datetime import datetime, timedelta\n\nfrom mock import patch, ANY\nfrom django_webtest import WebTest\nfrom django.contrib.admin import AdminSite\nfrom django.contrib.messages.storage.fallback import FallbackStorage\nfrom django.db.transaction import atomic\nfrom django.test.utils import override_settings\nfrom django.test.client import RequestFactory\nfrom django import VERSION\nfrom django.core.urlresolvers import reverse\nfrom django.conf import settings\nfrom django.utils.encoding import force_text\n\ntry:\n from django.contrib.auth import get_user_model\n User = get_user_model()\nexcept ImportError: # Django < 1.5\n from django.contrib.auth.models import User\ntry:\n from django.contrib.admin.utils import quote\nexcept ImportError: # Django < 1.7\n from django.contrib.admin.util import quote\n\nfrom simple_history.models import HistoricalRecords\nfrom simple_history.admin import SimpleHistoryAdmin\nfrom ..models import Book, Person, Poll, State, Employee\n\n\ntoday = datetime(2021, 1, 1, 10, 0)\ntomorrow = today + timedelta(days=1)\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_history_url(obj, history_index=None, site=\"admin\"):\n app, model = obj._meta.app_label, obj._meta.model_name\n if history_index is not None:\n history = obj.history.order_by('history_id')[history_index]\n return reverse(\n \"{site}:{app}_{model}_simple_history\".format(\n site=site, app=app, model=model),\n args=[quote(obj.pk), quote(history.history_id)],\n )\n else:\n return reverse(\"{site}:{app}_{model}_history\".format(\n site=site, app=app, model=model), args=[quote(obj.pk)])", "metadata": "root.get_history_url", "header": "['module', '___EOS___']", "index": 33 }, { "content": "class AdminSiteTest(WebTest):\n\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.AdminSiteTest", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def setUp(self):\n self.user = User.objects.create_superuser('user_login',\n '[email protected]', 'pass')", "metadata": "root.AdminSiteTest.setUp", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 48 }, { "content": " def tearDown(self):\n try:\n del HistoricalRecords.thread.request\n except AttributeError:\n pass", "metadata": "root.AdminSiteTest.tearDown", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 52 }, { "content": " def login(self, user=None):\n if user is None:\n user = self.user\n form = self.app.get(reverse('admin:index')).maybe_follow().form\n form['username'] = user.username\n form['password'] = 'pass'\n return form.submit()", "metadata": "root.AdminSiteTest.login", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_history_list(self):\n model_name = self.user._meta.model_name\n self.assertEqual(model_name, 'customuser')\n self.login()\n poll = Poll(question=\"why?\", pub_date=today)\n poll._history_user = self.user\n poll.save()\n response = self.app.get(get_history_url(poll))\n self.assertIn(get_history_url(poll, 0), response.unicode_normal_body)\n self.assertIn(\"Poll object\", response.unicode_normal_body)\n self.assertIn(\"Created\", response.unicode_normal_body)\n self.assertIn(self.user.username, response.unicode_normal_body)", "metadata": "root.AdminSiteTest.test_history_list", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 66 }, { "content": " def test_history_form_permission(self):\n self.login(self.user)\n person = Person.objects.create(name='Sandra Hale')\n self.app.get(get_history_url(person, 0), status=403)", "metadata": "root.AdminSiteTest.test_history_form_permission", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_invalid_history_form(self):\n self.login()\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n response = self.app.get(get_history_url(poll, 0))\n response.form['question'] = \"\"\n response = response.form.submit()\n self.assertEqual(response.status_code, 200)\n self.assertIn(\"This field is required\", response.unicode_normal_body)", "metadata": "root.AdminSiteTest.test_invalid_history_form", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 84 }, { "content": " def test_history_form(self):\n self.login()\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n poll.question = \"how?\"\n poll.save()\n\n # Make sure form for initial version is correct\n response = self.app.get(get_history_url(poll, 0))\n self.assertEqual(response.form['question'].value, \"why?\")\n self.assertEqual(response.form['pub_date_0'].value, \"2021-01-01\")\n self.assertEqual(response.form['pub_date_1'].value, \"10:00:00\")\n\n # Create new version based on original version\n response.form['question'] = \"what?\"\n response.form['pub_date_0'] = \"2021-01-02\"\n response = response.form.submit()\n self.assertEqual(response.status_code, 302)\n if VERSION < (1, 4, 0):\n self.assertTrue(response.headers['location']\n .endswith(get_history_url(poll)))\n else:\n self.assertTrue(response.headers['location']\n .endswith(reverse('admin:tests_poll_changelist')))\n\n # Ensure form for second version is correct\n response = self.app.get(get_history_url(poll, 1))\n self.assertEqual(response.form['question'].value, \"how?\")\n self.assertEqual(response.form['pub_date_0'].value, \"2021-01-01\")\n self.assertEqual(response.form['pub_date_1'].value, \"10:00:00\")\n\n # Ensure form for new third version is correct\n response = self.app.get(get_history_url(poll, 2))\n self.assertEqual(response.form['question'].value, \"what?\")\n self.assertEqual(response.form['pub_date_0'].value, \"2021-01-02\")\n self.assertEqual(response.form['pub_date_1'].value, \"10:00:00\")\n\n # Ensure current version of poll is correct\n poll = Poll.objects.get()\n self.assertEqual(poll.question, \"what?\")\n self.assertEqual(poll.pub_date, tomorrow)\n self.assertEqual([p.history_user for p in Poll.history.all()],\n [self.user, None, None])", "metadata": "root.AdminSiteTest.test_history_form", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 93 }, { "content": " def test_history_user_on_save_in_admin(self):\n self.login()\n\n # Ensure polls created via admin interface save correct user\n add_page = self.app.get(reverse('admin:tests_poll_add'))\n add_page.form['question'] = \"new poll?\"\n add_page.form['pub_date_0'] = \"2012-01-01\"\n add_page.form['pub_date_1'] = \"10:00:00\"\n changelist_page = add_page.form.submit().follow()\n self.assertEqual(Poll.history.get().history_user, self.user)\n\n # Ensure polls saved on edit page in admin interface save correct user\n change_page = changelist_page.click(\"Poll object\")\n change_page.form.submit()\n self.assertEqual([p.history_user for p in Poll.history.all()],\n [self.user, self.user])", "metadata": "root.AdminSiteTest.test_history_user_on_save_in_admin", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 136 }, { "content": " def test_underscore_in_pk(self):\n self.login()\n book = Book(isbn=\"9780147_513731\")\n book._history_user = self.user\n book.save()\n response = self.app.get(get_history_url(book))\n self.assertIn(book.history.all()[0].revert_url(),\n response.unicode_normal_body)", "metadata": "root.AdminSiteTest.test_underscore_in_pk", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 153 }, { "content": " def test_historical_user_no_setter(self):\n \"\"\"Demonstrate admin error without `_historical_user` setter.\n (Issue #43)\n\n \"\"\"\n self.login()\n add_page = self.app.get(reverse('admin:tests_document_add'))\n self.assertRaises(AttributeError, add_page.form.submit)", "metadata": "root.AdminSiteTest.test_historical_user_no_setter", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 162 }, { "content": " def test_historical_user_with_setter(self):\n \"\"\"Documented work-around for #43\"\"\"\n self.login()\n add_page = self.app.get(reverse('admin:tests_paper_add'))\n add_page.form.submit()", "metadata": "root.AdminSiteTest.test_historical_user_with_setter", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 171 }, { "content": " def test_history_user_not_saved(self):\n self.login()\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n historical_poll = poll.history.all()[0]\n self.assertIsNone(\n historical_poll.history_user,\n \"No way to know of request, history_user should be unset.\",\n )", "metadata": "root.AdminSiteTest.test_history_user_not_saved", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 177 }, { "content": " def test_middleware_saves_user(self):\n overridden_settings = {\n 'MIDDLEWARE_CLASSES':\n settings.MIDDLEWARE_CLASSES\n + ['simple_history.middleware.HistoryRequestMiddleware'],\n }\n with override_settings(**overridden_settings):\n self.login()\n form = self.app.get(reverse('admin:tests_book_add')).form\n form[\"isbn\"] = \"9780147_513731\"\n form.submit()\n book = Book.objects.get()\n historical_book = book.history.all()[0]\n\n self.assertEqual(historical_book.history_user, self.user,\n \"Middleware should make the request available to \"\n \"retrieve history_user.\")", "metadata": "root.AdminSiteTest.test_middleware_saves_user", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 186 }, { "content": " def test_middleware_unsets_request(self):\n overridden_settings = {\n 'MIDDLEWARE_CLASSES':\n settings.MIDDLEWARE_CLASSES\n + ['simple_history.middleware.HistoryRequestMiddleware'],\n }\n with override_settings(**overridden_settings):\n self.login()\n self.app.get(reverse('admin:tests_book_add'))\n self.assertFalse(hasattr(HistoricalRecords.thread, 'request'))", "metadata": "root.AdminSiteTest.test_middleware_unsets_request", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 204 }, { "content": " def test_rolled_back_user_does_not_lead_to_foreign_key_error(self):\n # This test simulates the rollback of a user after a request (which\n # happens, e.g. in test cases), and verifies that subsequently\n # creating a new entry does not fail with a foreign key error.\n\n overridden_settings = {\n 'MIDDLEWARE_CLASSES':\n settings.MIDDLEWARE_CLASSES\n + ['simple_history.middleware.HistoryRequestMiddleware'],\n }\n with override_settings(**overridden_settings):\n self.login()\n self.assertEqual(\n self.app.get(reverse('admin:tests_book_add')).status_code,\n 200,\n )\n\n book = Book.objects.create(isbn=\"9780147_513731\")\n\n historical_book = book.history.all()[0]\n\n self.assertIsNone(\n historical_book.history_user,\n \"No way to know of request, history_user should be unset.\",\n )", "metadata": "root.AdminSiteTest.test_rolled_back_user_does_not_lead_to_foreign_key_error", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 215 }, { "content": " def test_middleware_anonymous_user(self):\n overridden_settings = {\n 'MIDDLEWARE_CLASSES':\n settings.MIDDLEWARE_CLASSES\n + ['simple_history.middleware.HistoryRequestMiddleware'],\n }\n with override_settings(**overridden_settings):\n self.app.get(reverse('admin:index'))\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n historical_poll = poll.history.all()[0]\n self.assertEqual(historical_poll.history_user, None,\n \"Middleware request user should be able to \"\n \"be anonymous.\")", "metadata": "root.AdminSiteTest.test_middleware_anonymous_user", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 241 }, { "content": " def test_other_admin(self):\n \"\"\"Test non-default admin instances.\n\n Make sure non-default admin instances can resolve urls and\n render pages.\n \"\"\"\n self.login()\n state = State.objects.create()\n history_url = get_history_url(state, site=\"other_admin\")\n self.app.get(history_url)\n change_url = get_history_url(state, 0, site=\"other_admin\")\n self.app.get(change_url)", "metadata": "root.AdminSiteTest.test_other_admin", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 255 }, { "content": " def test_deleteting_user(self):\n \"\"\"Test deletes of a user does not cascade delete the history\"\"\"\n self.login()\n poll = Poll(question=\"why?\", pub_date=today)\n poll._history_user = self.user\n poll.save()\n\n historical_poll = poll.history.all()[0]\n self.assertEqual(historical_poll.history_user, self.user)\n\n self.user.delete()\n\n historical_poll = poll.history.all()[0]\n self.assertEqual(historical_poll.history_user, None)", "metadata": "root.AdminSiteTest.test_deleteting_user", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 268 }, { "content": " def test_missing_one_to_one(self):\n \"\"\"A relation to a missing one-to-one model should still show\n history\"\"\"\n self.login()\n manager = Employee.objects.create()\n employee = Employee.objects.create(manager=manager)\n employee.manager = None\n employee.save()\n manager.delete()\n response = self.app.get(get_history_url(employee, 0))\n self.assertEqual(response.status_code, 200)", "metadata": "root.AdminSiteTest.test_missing_one_to_one", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 283 }, { "content": " def test_history_deleted_instance(self):\n \"\"\"Ensure history page can be retrieved even for deleted instances\"\"\"\n self.login()\n employee = Employee.objects.create()\n employee_pk = employee.pk\n employee.delete()\n employee.pk = employee_pk\n response = self.app.get(get_history_url(employee))\n self.assertEqual(response.status_code, 200)", "metadata": "root.AdminSiteTest.test_history_deleted_instance", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 295 }, { "content": " def test_response_change(self):\n \"\"\"\n Test the response_change method that it works with a _change_history\n in the POST and settings.SIMPLE_HISTORY_EDIT set to True\n \"\"\"\n request = RequestFactory().post('/')\n request.POST = {'_change_history': True}\n request.session = 'session'\n request._messages = FallbackStorage(request)\n request.path = '/awesome/url/'\n\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n poll.question = \"how?\"\n poll.save()\n\n admin_site = AdminSite()\n admin = SimpleHistoryAdmin(Poll, admin_site)\n\n with patch('simple_history.admin.SIMPLE_HISTORY_EDIT', True):\n response = admin.response_change(request, poll)\n\n self.assertEqual(response['Location'], '/awesome/url/')", "metadata": "root.AdminSiteTest.test_response_change", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 305 }, { "content": " def test_response_change_change_history_setting_off(self):\n \"\"\"\n Test the response_change method that it works with a _change_history\n in the POST and settings.SIMPLE_HISTORY_EDIT set to False\n \"\"\"\n request = RequestFactory().post('/')\n request.POST = {'_change_history': True}\n request.session = 'session'\n request._messages = FallbackStorage(request)\n request.path = '/awesome/url/'\n request.user = self.user\n\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n poll.question = \"how?\"\n poll.save()\n\n admin_site = AdminSite()\n admin = SimpleHistoryAdmin(Poll, admin_site)\n\n response = admin.response_change(request, poll)\n\n with patch(\n 'simple_history.admin.admin.ModelAdmin.response_change'\n ) as m_admin:\n m_admin.return_value = 'it was called'\n response = admin.response_change(request, poll)\n\n self.assertEqual(response, 'it was called')", "metadata": "root.AdminSiteTest.test_response_change_change_history_setting_off", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 328 }, { "content": " def test_response_change_no_change_history(self):\n request = RequestFactory().post('/')\n request.session = 'session'\n request._messages = FallbackStorage(request)\n request.user = self.user\n\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n poll.question = \"how?\"\n poll.save()\n\n admin_site = AdminSite()\n admin = SimpleHistoryAdmin(Poll, admin_site)\n\n with patch(\n 'simple_history.admin.admin.ModelAdmin.response_change'\n ) as m_admin:\n m_admin.return_value = 'it was called'\n response = admin.response_change(request, poll)\n\n self.assertEqual(response, 'it was called')", "metadata": "root.AdminSiteTest.test_response_change_no_change_history", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 357 }, { "content": " def test_history_form_view_without_getting_history(self):\n request = RequestFactory().post('/')\n request.session = 'session'\n request._messages = FallbackStorage(request)\n request.user = self.user\n\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n poll.question = \"how?\"\n poll.save()\n history = poll.history.all()[0]\n\n admin_site = AdminSite()\n admin = SimpleHistoryAdmin(Poll, admin_site)\n\n with patch('simple_history.admin.render') as mock_render:\n admin.history_form_view(request, poll.id, history.pk)\n\n context = {\n # Verify this is set for original object\n 'original': poll,\n 'change_history': False,\n\n 'title': 'Revert %s' % force_text(poll),\n 'adminform': ANY,\n 'object_id': poll.id,\n 'is_popup': False,\n 'media': ANY,\n 'errors': ANY,\n 'app_label': 'tests',\n 'original_opts': ANY,\n 'changelist_url': '/admin/tests/poll/',\n 'change_url': ANY,\n 'history_url': '/admin/tests/poll/1/history/',\n 'add': False,\n 'change': True,\n 'has_add_permission': admin.has_add_permission(request),\n 'has_change_permission': admin.has_change_permission(\n request, poll),\n 'has_delete_permission': admin.has_delete_permission(\n request, poll),\n 'has_file_field': True,\n 'has_absolute_url': False,\n 'form_url': '',\n 'opts': ANY,\n 'content_type_id': ANY,\n 'save_as': admin.save_as,\n 'save_on_top': admin.save_on_top,\n 'root_path': getattr(admin_site, 'root_path', None),\n }\n\n mock_render.assert_called_once_with(\n request, template_name=admin.object_history_form_template,\n dictionary=context, current_app=admin_site.name)", "metadata": "root.AdminSiteTest.test_history_form_view_without_getting_history", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 378 }, { "content": " def test_history_form_view_getting_history(self):\n request = RequestFactory().post('/')\n request.session = 'session'\n request._messages = FallbackStorage(request)\n request.user = self.user\n request.POST = {'_change_history': True}\n\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n poll.question = \"how?\"\n poll.save()\n history = poll.history.all()[0]\n\n admin_site = AdminSite()\n admin = SimpleHistoryAdmin(Poll, admin_site)\n\n with patch('simple_history.admin.render') as mock_render:\n with patch('simple_history.admin.SIMPLE_HISTORY_EDIT', True):\n admin.history_form_view(request, poll.id, history.pk)\n\n context = {\n # Verify this is set for history object not poll object\n 'original': history.instance,\n 'change_history': True,\n\n 'title': 'Revert %s' % force_text(history.instance),\n 'adminform': ANY,\n 'object_id': poll.id,\n 'is_popup': False,\n 'media': ANY,\n 'errors': ANY,\n 'app_label': 'tests',\n 'original_opts': ANY,\n 'changelist_url': '/admin/tests/poll/',\n 'change_url': ANY,\n 'history_url': '/admin/tests/poll/{pk}/history/'.format(\n pk=poll.pk),\n 'add': False,\n 'change': True,\n 'has_add_permission': admin.has_add_permission(request),\n 'has_change_permission': admin.has_change_permission(\n request, poll),\n 'has_delete_permission': admin.has_delete_permission(\n request, poll),\n 'has_file_field': True,\n 'has_absolute_url': False,\n 'form_url': '',\n 'opts': ANY,\n 'content_type_id': ANY,\n 'save_as': admin.save_as,\n 'save_on_top': admin.save_on_top,\n 'root_path': getattr(admin_site, 'root_path', None),\n }\n\n mock_render.assert_called_once_with(\n request, template_name=admin.object_history_form_template,\n dictionary=context, current_app=admin_site.name)", "metadata": "root.AdminSiteTest.test_history_form_view_getting_history", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 432 }, { "content": " def test_history_form_view_getting_history_with_setting_off(self):\n request = RequestFactory().post('/')\n request.session = 'session'\n request._messages = FallbackStorage(request)\n request.user = self.user\n request.POST = {'_change_history': True}\n\n poll = Poll.objects.create(question=\"why?\", pub_date=today)\n poll.question = \"how?\"\n poll.save()\n history = poll.history.all()[0]\n\n admin_site = AdminSite()\n admin = SimpleHistoryAdmin(Poll, admin_site)\n\n with patch('simple_history.admin.render') as mock_render:\n with patch('simple_history.admin.SIMPLE_HISTORY_EDIT', False):\n admin.history_form_view(request, poll.id, history.pk)\n\n context = {\n # Verify this is set for history object not poll object\n 'original': poll,\n 'change_history': False,\n\n 'title': 'Revert %s' % force_text(poll),\n 'adminform': ANY,\n 'object_id': poll.id,\n 'is_popup': False,\n 'media': ANY,\n 'errors': ANY,\n 'app_label': 'tests',\n 'original_opts': ANY,\n 'changelist_url': '/admin/tests/poll/',\n 'change_url': ANY,\n 'history_url': '/admin/tests/poll/1/history/',\n 'add': False,\n 'change': True,\n 'has_add_permission': admin.has_add_permission(request),\n 'has_change_permission': admin.has_change_permission(\n request, poll),\n 'has_delete_permission': admin.has_delete_permission(\n request, poll),\n 'has_file_field': True,\n 'has_absolute_url': False,\n 'form_url': '',\n 'opts': ANY,\n 'content_type_id': ANY,\n 'save_as': admin.save_as,\n 'save_on_top': admin.save_on_top,\n 'root_path': getattr(admin_site, 'root_path', None),\n }\n\n mock_render.assert_called_once_with(\n request, template_name=admin.object_history_form_template,\n dictionary=context, current_app=admin_site.name)", "metadata": "root.AdminSiteTest.test_history_form_view_getting_history_with_setting_off", "header": "['class', 'AdminSiteTest', '(', 'WebTest', ')', ':', '___EOS___']", "index": 489 } ]
[ { "span": "from django.db.transaction import atomic", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mock_", "import_", "patch_", ",_", "ANY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "web", "test_", "import_", "Web", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "import_", "Admi", "n", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "messages_", "._", "storage_", "._", "fallback_", "import_", "Fallback", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "transaction_", "import_", "atomic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "utils_", "import_", "override", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "._", "client_", "import_", "Request", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "force", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "get", "\\u", "user", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "=_", "get", "\\u", "user", "\\u", "model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "#", " ", "Dj", "ang", "o", " ", "<", " ", "1.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\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 ", " _", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "utils_", "import_", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "#", " ", "Dj", "ang", "o", " ", "<", " ", "1.7", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "util_", "import_", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "simple", "\\u", "history_", "._", "models_", "import_", "Histori", "cal", "Records_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "simple", "\\u", "history_", "._", "admin_", "import_", "Simple", "Hist", "ory", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "models_", "import_", "Book_", ",_", "Person_", ",_", "Poll", "_", ",_", "State_", ",_", "Employe", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "today_", "=_", "datetime_", "(_", "202", "1_", ",_", "1_", ",_", "1_", ",_", "10_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tomorrow", "_", "=_", "today_", "+_", "timedelta_", "(_", "days_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "obj_", ",_", "histo", "ry", "\\u", "index_", "=_", "None_", ",_", "site_", "=_", "\"", "admin", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", ",_", "model_", "=_", "obj_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "obj_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "histo", "ry", "\\u", "index_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "history_", "=_", "obj_", "._", "history_", "._", "order", "\\u", "by_", "(_", "'", "histo", "ry", "\\u", "id", "'_", ")_", "[_", "histo", "ry", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "reverse_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "site", "}:", "{", "app", "}\\u", "{", "model", "}\\u", "simple", "\\u", "histo", "ry", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "site_", ",_", "app_", "=_", "app_", ",_", "model_", "=_", "model_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "quote_", "(_", "obj_", "._", "pk_", ")_", ",_", "quote_", "(_", "history_", "._", "histo", "ry", "\\u", "id_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\"{", "site", "}:", "{", "app", "}\\u", "{", "model", "}\\u", "histo", "ry", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "site_", "=_", "site_", ",_", "app_", "=_", "app_", ",_", "model_", "=_", "model_", ")_", ",_", "args_", "=_", "[_", "quote_", "(_", "obj_", "._", "pk_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\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INE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "User_", "._", "objects_", "._", "create", "\\u", "superuser_", "(_", "'", "user", "\\u", "login", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "u", "@", "example", ".", "com", "'_", ",_", "'", "pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "Histori", "cal", "Records_", "._", "thread_", "._", "request_", "\\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_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "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_", "login_", "(_", "self_", ",_", "user_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "=_", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "index", "'_", ")_", ")_", "._", "may", "be", "\\u", "follow_", "(_", ")_", "._", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "user", "name", "'_", "]_", "=_", "user_", "._", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "'", "password", "'_", "]_", "=_", "'", "pass", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "\\u", "name_", "=_", "self_", "._", "user_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "model", "\\u", "name_", ",_", "'", "custom", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "=_", "Poll", "_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "\\u", "histo", "ry", "\\u", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "poll_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "poll_", ",_", "0_", ")_", ",_", "response_", "._", "unicode", "\\u", "normal", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "Poll", " ", "object", "\"_", ",_", "response_", "._", "unicode", "\\u", "normal", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "Creat", "ed", "\"_", ",_", "response_", "._", "unicode", "\\u", "normal", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "self_", "._", "user_", "._", "username_", ",_", "response_", "._", "unicode", "\\u", "normal", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "form", "\\u", "permission_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "person_", "=_", "Person_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Sand", "ra", " ", "Hal", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "person_", ",_", "0_", ")_", ",_", "status_", "=_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "histo", "ry", "\\u", "form_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "poll_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "form_", "[_", "'", "question", "'_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "response_", "._", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", "\"_", ",_", "response_", "._", "unicode", "\\u", "normal", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "form_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "question_", "=_", "\"", "how", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "form", " ", "for", " ", "initial", " ", "version", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "poll_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "question", "'_", "]_", "._", "value_", ",_", "\"", "wh", "y", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "0", "'_", "]_", "._", "value_", ",_", "\"", "202", "1", "-0", "1", "-0", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "1", "'_", "]_", "._", "value_", ",_", "\"", "10", ":", "00", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "new", " ", "version", " ", "based", " ", "on", " ", "original", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "form_", "[_", "'", "question", "'_", "]_", "=_", "\"", "what", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "0", "'_", "]_", "=_", "\"", "202", "1", "-0", "1", "-0", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "response_", "._", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "VERSION_", "<_", "(_", "1_", ",_", "4_", ",_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "response_", "._", "headers_", "[_", "'", "location", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "._", "endswith_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "poll_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "response_", "._", "headers_", "[_", "'", "location", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "._", "endswith_", "(_", "reverse_", "(_", "'", "admin", ":", "tests", "\\u", "poll", "\\u", "changeli", "st", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "form", " ", "for", " ", "second", " ", "version", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "poll_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "question", "'_", "]_", "._", "value_", ",_", "\"", "how", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "0", "'_", "]_", "._", "value_", ",_", "\"", "202", "1", "-0", "1", "-0", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "1", "'_", "]_", "._", "value_", ",_", "\"", "10", ":", "00", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "form", " ", "for", " ", "new", " ", "third", " ", "version", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "poll_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "question", "'_", "]_", "._", "value_", ",_", "\"", "what", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "0", "'_", "]_", "._", "value_", ",_", "\"", "202", "1", "-0", "1", "-0", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "1", "'_", "]_", "._", "value_", ",_", "\"", "10", ":", "00", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "current", " ", "version", " ", "of", " ", "poll", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "poll_", "._", "question_", ",_", "\"", "what", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "poll_", "._", "pub", "\\u", "date_", ",_", "tomorrow", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "p_", "._", "histo", "ry", "\\u", "user_", "for_", "p_", "in_", "Poll", "_", "._", "history_", "._", "all_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "user_", ",_", "None_", ",_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "user", "\\u", "on", "\\u", "save", "\\u", "in", "\\u", "admin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "polls", " ", "created", " ", "via", " ", "admin", " ", "interface", " ", "save", " ", "correct", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "page_", "=_", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "tests", "\\u", "poll", "\\u", "add", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "page_", "._", "form_", "[_", "'", "question", "'_", "]_", "=_", "\"", "new", " ", "poll", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "page_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "0", "'_", "]_", "=_", "\"", "2012", "-0", "1", "-0", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "page_", "._", "form_", "[_", "'", "pub", "\\u", "date", "\\u", "1", "'_", "]_", "=_", "\"", "10", ":", "00", ":", "00", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changeli", "st", "\\u", "page_", "=_", "add", "\\u", "page_", "._", "form_", "._", "submit_", "(_", ")_", "._", "follow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Poll", "_", "._", "history_", "._", "get_", "(_", ")_", "._", "histo", "ry", "\\u", "user_", ",_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "polls", " ", "saved", " ", "on", " ", "edit", " ", "page", " ", "in", " ", "admin", " ", "interface", " ", "save", " ", "correct", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "change", "\\u", "page_", "=_", "changeli", "st", "\\u", "page_", "._", "click_", "(_", "\"", "Poll", " ", "object", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change", "\\u", "page_", "._", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "p_", "._", "histo", "ry", "\\u", "user_", "for_", "p_", "in_", "Poll", "_", "._", "history_", "._", "all_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "self_", "._", "user_", ",_", "self_", "._", "user_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "underscore", "\\u", "in", "\\u", "pk_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "book_", "=_", "Book_", "(_", "isbn", "_", "=_", "\"", "978", "014", "7", "\\u", "513", "731", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "book_", "._", "\\u", "histo", "ry", "\\u", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "book_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "book_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "book_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "revert", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "unicode", "\\u", "normal", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "historical", "\\u", "user", "\\u", "no", "\\u", "setter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Demo", "nstr", "ate", " ", "admin", " ", "error", " ", "with", "out", " ", "`\\u", "historical", "\\u", "user", "`", " ", "sette", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "Issue", " ", "#", "4", "3", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "page_", "=_", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "tests", "\\u", "document", "\\u", "add", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Attribute", "Error_", ",_", "add", "\\u", "page_", "._", "form_", "._", "submit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "historical", "\\u", "user", "\\u", "with", "\\u", "setter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Document", "ed", " ", "work", "-", "aro", "und", " ", "for", " ", "#", "4", "3", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "page_", "=_", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "tests", "\\u", "pape", "r", "\\u", "add", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "page_", "._", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "user", "\\u", "not", "\\u", "saved_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "historical", "\\u", "poll_", "=_", "poll_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "historical", "\\u", "poll_", "._", "histo", "ry", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "way", " ", "to", " ", "know", " ", "of", " ", "request", ",", " ", "histo", "ry", "\\u", "user", " ", "shou", "ld", " ", "be", " ", "unse", "t", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "middle", "ware", "\\u", "save", "s", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overrid", "den", "\\u", "settings_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIDDLE", "WARE", "\\u", "CLASSE", "S", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "[_", "'", "simple", "\\u", "histo", "ry", ".", "middle", "ware", ".", "Hist", "ory", "Request", "Mid", "dle", "ware", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "override", "\\u", "settings_", "(_", "**_", "overrid", "den", "\\u", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "tests", "\\u", "book", "\\u", "add", "'_", ")_", ")_", "._", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "[_", "\"", "isbn", "\"_", "]_", "=_", "\"", "978", "014", "7", "\\u", "513", "731", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "book_", "=_", "Book_", "._", "objects_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "historical", "\\u", "book_", "=_", "book_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "historical", "\\u", "book_", "._", "histo", "ry", "\\u", "user_", ",_", "self_", "._", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mid", "dle", "ware", " ", "shou", "ld", " ", "make", " ", "the", " ", "request", " ", "avail", "able", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "retrieve", " ", "histo", "ry", "\\u", "user", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "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", "middle", "ware", "\\u", "unse", "ts", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overrid", "den", "\\u", "settings_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIDDLE", "WARE", "\\u", "CLASSE", "S", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "[_", "'", "simple", "\\u", "histo", "ry", ".", "middle", "ware", ".", "Hist", "ory", "Request", "Mid", "dle", "ware", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "override", "\\u", "settings_", "(_", "**_", "overrid", "den", "\\u", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "tests", "\\u", "book", "\\u", "add", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "Histori", "cal", "Records_", "._", "thread_", ",_", "'", "request", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "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", "rolle", "d\\u", "back", "\\u", "user", "\\u", "doe", "s", "\\u", "not", "\\u", "lead", "\\u", "to", "\\u", "foreign", "\\u", "key", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "simulat", "es", " ", "the", " ", "rollback", " ", "of", " ", "a", " ", "user", " ", "after", " ", "a", " ", "request", " ", "(", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "happ", "ens", ",", " ", "e", ".", "g", ".", " ", "in", " ", "test", " ", "case", "s", "),", " ", "and", " ", "verifie", "s", " ", "tha", "t", " ", "subsequen", "tl", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "creati", "ng", " ", "a", " ", "new", " ", "entry", " ", "doe", "s", " ", "not", " ", "fail", " ", "with", " ", "a", " ", "foreign", " ", "key", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overrid", "den", "\\u", "settings_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIDDLE", "WARE", "\\u", "CLASSE", "S", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "[_", "'", "simple", "\\u", "histo", "ry", ".", "middle", "ware", ".", "Hist", "ory", "Request", "Mid", "dle", "ware", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "override", "\\u", "settings_", "(_", "**_", "overrid", "den", "\\u", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "tests", "\\u", "book", "\\u", "add", "'_", ")_", ")_", "._", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "book_", "=_", "Book_", "._", "objects_", "._", "create_", "(_", "isbn", "_", "=_", "\"", "978", "014", "7", "\\u", "513", "731", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "historical", "\\u", "book_", "=_", "book_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "historical", "\\u", "book_", "._", "histo", "ry", "\\u", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "way", " ", "to", " ", "know", " ", "of", " ", "request", ",", " ", "histo", "ry", "\\u", "user", " ", "shou", "ld", " ", "be", " ", "unse", "t", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "middle", "ware", "\\u", "anonym", "ous", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "overrid", "den", "\\u", "settings_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIDDLE", "WARE", "\\u", "CLASSE", "S", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "MIDDLE", "WARE", "\\u", "CLASSES_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "[_", "'", "simple", "\\u", "histo", "ry", ".", "middle", "ware", ".", "Hist", "ory", "Request", "Mid", "dle", "ware", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "override", "\\u", "settings_", "(_", "**_", "overrid", "den", "\\u", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "._", "get_", "(_", "reverse_", "(_", "'", "admin", ":", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "historical", "\\u", "poll_", "=_", "poll_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "historical", "\\u", "poll_", "._", "histo", "ry", "\\u", "user_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mid", "dle", "ware", " ", "request", " ", "user", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", " ", "anonym", "ous", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "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", "other", "\\u", "admin_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "non", "-", "default", " ", "admin", " ", "instance", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "sure", " ", "non", "-", "default", " ", "admin", " ", "instance", "s", " ", "can", " ", "resolve", " ", "urls", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "render", " ", "page", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "State_", "._", "objects_", "._", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "histo", "ry", "\\u", "url_", "=_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "state_", ",_", "site_", "=_", "\"", "other", "\\u", "admin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "get_", "(_", "histo", "ry", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change", "\\u", "url_", "=_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "state_", ",_", "0_", ",_", "site_", "=_", "\"", "other", "\\u", "admin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "._", "get_", "(_", "change", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "ting", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "delete", "s", " ", "of", " ", "a", " ", "user", " ", "doe", "s", " ", "not", " ", "cascade", " ", "delete", " ", "the", " ", "histo", "ry", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "=_", "Poll", "_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "\\u", "histo", "ry", "\\u", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "historical", "\\u", "poll_", "=_", "poll_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "historical", "\\u", "poll_", "._", "histo", "ry", "\\u", "user_", ",_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "historical", "\\u", "poll_", "=_", "poll_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "historical", "\\u", "poll_", "._", "histo", "ry", "\\u", "user_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "missi", "ng", "\\u", "one", "\\u", "to", "\\u", "one_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "relation", " ", "to", " ", "a", " ", "missi", "ng", " ", "one", "-", "to", "-", "one", " ", "model", " ", "shou", "ld", " ", "still", " ", "show", "\\", "10", ";", " ", " ", " ", " ", "histo", "ry", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "=_", "Employe", "e_", "._", "objects_", "._", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "employee_", "=_", "Employe", "e_", "._", "objects_", "._", "create_", "(_", "manager_", "=_", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "employee_", "._", "manager_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "employee_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manager_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "employee_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "delete", "d\\u", "instance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "histo", "ry", " ", "page", " ", "can", " ", "be", " ", "retrieved", " ", "even", " ", "for", " ", "delete", "d", " ", "instance", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "employee_", "=_", "Employe", "e_", "._", "objects_", "._", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "employ", "ee", "\\u", "pk_", "=_", "employee_", "._", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "employee_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "employee_", "._", "pk_", "=_", "employ", "ee", "\\u", "pk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "get", "\\u", "histo", "ry", "\\u", "url_", "(_", "employee_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "response", "\\u", "change_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "response", "\\u", "change", " ", "method", " ", "tha", "t", " ", "it", " ", "works", " ", "with", " ", "a", " ", "\\u", "change", "\\u", "histo", "ry", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "POST", " ", "and", " ", "settings", ".", "SIMPLE", "\\u", "HISTORY", "\\u", "EDIT", " ", "set", " ", "to", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "post_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "POST_", "=_", "{_", "'\\u", "change", "\\u", "histo", "ry", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "'", "session", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "messages_", "=_", "Fallback", "Storage_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "path_", "=_", "'/", "aw", "eso", "me", "/", "url", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "question_", "=_", "\"", "how", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "site_", "=_", "Admi", "n", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "Simple", "Hist", "ory", "Admin_", "(_", "Poll", "_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "SIMPLE", "\\u", "HISTORY", "\\u", "EDIT", "'_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "admin_", "._", "response", "\\u", "change_", "(_", "request_", ",_", "poll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "[_", "'", "Locat", "ion", "'_", "]_", ",_", "'/", "aw", "eso", "me", "/", "url", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "response", "\\u", "change", "\\u", "change", "\\u", "histo", "ry", "\\u", "setti", "ng", "\\u", "off_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "response", "\\u", "change", " ", "method", " ", "tha", "t", " ", "it", " ", "works", " ", "with", " ", "a", " ", "\\u", "change", "\\u", "histo", "ry", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "POST", " ", "and", " ", "settings", ".", "SIMPLE", "\\u", "HISTORY", "\\u", "EDIT", " ", "set", " ", "to", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "post_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "POST_", "=_", "{_", "'\\u", "change", "\\u", "histo", "ry", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "'", "session", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "messages_", "=_", "Fallback", "Storage_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "path_", "=_", "'/", "aw", "eso", "me", "/", "url", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "question_", "=_", "\"", "how", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "site_", "=_", "Admi", "n", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "Simple", "Hist", "ory", "Admin_", "(_", "Poll", "_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "admin_", "._", "response", "\\u", "change_", "(_", "request_", ",_", "poll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "admin", ".", "Model", "Admi", "n", ".", "response", "\\u", "change", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "as_", "m", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "admin_", "._", "return", "\\u", "value_", "=_", "'", "it", " ", "was", " ", "call", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "admin_", "._", "response", "\\u", "change_", "(_", "request_", ",_", "poll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "'", "it", " ", "was", " ", "call", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "response", "\\u", "change", "\\u", "no", "\\u", "change", "\\u", "history_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "post_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "'", "session", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "messages_", "=_", "Fallback", "Storage_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "question_", "=_", "\"", "how", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "site_", "=_", "Admi", "n", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "Simple", "Hist", "ory", "Admin_", "(_", "Poll", "_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "admin", ".", "Model", "Admi", "n", ".", "response", "\\u", "change", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "as_", "m", "\\u", "admin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m", "\\u", "admin_", "._", "return", "\\u", "value_", "=_", "'", "it", " ", "was", " ", "call", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "admin_", "._", "response", "\\u", "change_", "(_", "request_", ",_", "poll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", ",_", "'", "it", " ", "was", " ", "call", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "form", "\\u", "view", "\\u", "with", "out", "\\u", "getti", "ng", "\\u", "history_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "post_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "'", "session", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "messages_", "=_", "Fallback", "Storage_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "question_", "=_", "\"", "how", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "history_", "=_", "poll_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "site_", "=_", "Admi", "n", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "Simple", "Hist", "ory", "Admin_", "(_", "Poll", "_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "render", "'_", ")_", "as_", "mock", "\\u", "render_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "._", "histo", "ry", "\\u", "form", "\\u", "view_", "(_", "request_", ",_", "poll_", "._", "id_", ",_", "history_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "this", " ", "is", " ", "set", " ", "for", " ", "original", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "'_", ":_", "poll_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "histo", "ry", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "'", "Rever", "t", " ", "%", "s", "'_", "%_", "force", "\\u", "text_", "(_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "form", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "poll_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "popu", "p", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "media", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "s", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "'", "tests", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "\\u", "opts", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "changeli", "st", "\\u", "url", "'_", ":_", "'/", "admin", "/", "tests", "/", "poll", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "url", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "histo", "ry", "\\u", "url", "'_", ":_", "'/", "admin", "/", "tests", "/", "poll", "/", "1", "/", "histo", "ry", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "add", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "add", "\\u", "permission_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "change", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "change", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "delete", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "delete", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "file", "\\u", "field", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "abs", "olute", "\\u", "url", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "url", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "opts", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "\\u", "id", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "as", "'_", ":_", "admin_", "._", "save", "\\u", "as_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "on", "\\u", "top", "'_", ":_", "admin_", "._", "save", "\\u", "on", "\\u", "top_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "path", "'_", ":_", "getattr_", "(_", "admin", "\\u", "site_", ",_", "'", "root", "\\u", "path", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "render_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "template", "\\u", "name_", "=_", "admin_", "._", "object\\u", "histo", "ry", "\\u", "form", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dictionary_", "=_", "context_", ",_", "current", "\\u", "app_", "=_", "admin", "\\u", "site_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "form", "\\u", "view", "\\u", "getti", "ng", "\\u", "history_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "post_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "'", "session", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "messages_", "=_", "Fallback", "Storage_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "POST_", "=_", "{_", "'\\u", "change", "\\u", "histo", "ry", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "question_", "=_", "\"", "how", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "history_", "=_", "poll_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "site_", "=_", "Admi", "n", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "Simple", "Hist", "ory", "Admin_", "(_", "Poll", "_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "render", "'_", ")_", "as_", "mock", "\\u", "render_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "patch_", "(_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "SIMPLE", "\\u", "HISTORY", "\\u", "EDIT", "'_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "._", "histo", "ry", "\\u", "form", "\\u", "view_", "(_", "request_", ",_", "poll_", "._", "id_", ",_", "history_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "this", " ", "is", " ", "set", " ", "for", " ", "histo", "ry", " ", "object", " ", "not", " ", "poll", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "'_", ":_", "history_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "histo", "ry", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "'", "Rever", "t", " ", "%", "s", "'_", "%_", "force", "\\u", "text_", "(_", "history_", "._", "instance_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "form", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "poll_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "popu", "p", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "media", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "s", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "'", "tests", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "\\u", "opts", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "changeli", "st", "\\u", "url", "'_", ":_", "'/", "admin", "/", "tests", "/", "poll", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "url", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "histo", "ry", "\\u", "url", "'_", ":_", "'/", "admin", "/", "tests", "/", "poll", "/{", "pk", "}/", "histo", "ry", "/'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pk_", "=_", "poll_", "._", "pk_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "add", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "add", "\\u", "permission_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "change", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "change", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "delete", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "delete", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "file", "\\u", "field", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "abs", "olute", "\\u", "url", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "url", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "opts", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "\\u", "id", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "as", "'_", ":_", "admin_", "._", "save", "\\u", "as_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "on", "\\u", "top", "'_", ":_", "admin_", "._", "save", "\\u", "on", "\\u", "top_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "path", "'_", ":_", "getattr_", "(_", "admin", "\\u", "site_", ",_", "'", "root", "\\u", "path", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "render_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "template", "\\u", "name_", "=_", "admin_", "._", "object\\u", "histo", "ry", "\\u", "form", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dictionary_", "=_", "context_", ",_", "current", "\\u", "app_", "=_", "admin", "\\u", "site_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n", "Site", "Test_", "(_", "Web", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "histo", "ry", "\\u", "form", "\\u", "view", "\\u", "getti", "ng", "\\u", "histo", "ry", "\\u", "with", "\\u", "setti", "ng", "\\u", "off_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "Request", "Factory_", "(_", ")_", "._", "post_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "'", "session", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "\\u", "messages_", "=_", "Fallback", "Storage_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "POST_", "=_", "{_", "'\\u", "change", "\\u", "histo", "ry", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "Poll", "_", "._", "objects_", "._", "create_", "(_", "question_", "=_", "\"", "wh", "y", "?\"_", ",_", "pub", "\\u", "date_", "=_", "today_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "question_", "=_", "\"", "how", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "history_", "=_", "poll_", "._", "history_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "site_", "=_", "Admi", "n", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "Simple", "Hist", "ory", "Admin_", "(_", "Poll", "_", ",_", "admin", "\\u", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "render", "'_", ")_", "as_", "mock", "\\u", "render_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "patch_", "(_", "'", "simple", "\\u", "histo", "ry", ".", "admin", ".", "SIMPLE", "\\u", "HISTORY", "\\u", "EDIT", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "._", "histo", "ry", "\\u", "form", "\\u", "view_", "(_", "request_", ",_", "poll_", "._", "id_", ",_", "history_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "this", " ", "is", " ", "set", " ", "for", " ", "histo", "ry", " ", "object", " ", "not", " ", "poll", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "'_", ":_", "poll_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "histo", "ry", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "'", "Rever", "t", " ", "%", "s", "'_", "%_", "force", "\\u", "text_", "(_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "form", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "poll_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "popu", "p", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "media", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "s", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "'", "tests", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "\\u", "opts", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "changeli", "st", "\\u", "url", "'_", ":_", "'/", "admin", "/", "tests", "/", "poll", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "\\u", "url", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "histo", "ry", "\\u", "url", "'_", ":_", "'/", "admin", "/", "tests", "/", "poll", "/", "1", "/", "histo", "ry", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "add", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "add", "\\u", "permission_", "(_", "request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "change", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "change", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "delete", "\\u", "permissi", "on", "'_", ":_", "admin_", "._", "has", "\\u", "delete", "\\u", "permission_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "poll_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "file", "\\u", "field", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "abs", "olute", "\\u", "url", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "url", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "opts", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "\\u", "id", "'_", ":_", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "as", "'_", ":_", "admin_", "._", "save", "\\u", "as_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "save", "\\u", "on", "\\u", "top", "'_", ":_", "admin_", "._", "save", "\\u", "on", "\\u", "top_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "path", "'_", ":_", "getattr_", "(_", "admin", "\\u", "site_", ",_", "'", "root", "\\u", "path", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "render_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "template", "\\u", "name_", "=_", "admin_", "._", "object\\u", "histo", "ry", "\\u", "form", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dictionary_", "=_", "context_", ",_", "current", "\\u", "app_", "=_", "admin", "\\u", "site_", "._", "name_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ReactiveX/RxPY/tests/test_observable/py3_tofuture.py
[ { "content": " def test_future_failure(self):\n loop = asyncio.get_event_loop()\n success = [True, False]\n\n @asyncio.coroutine\n def go():\n error = Exception('woops')\n\n source = Observable.throw_exception(error)\n\n future = source.to_future(asyncio.Future)\n\n def done(future):\n try:\n value = future.result()\n except Exception as ex:\n success[1] = str(ex) == str(error)\n else:\n success[0] = False\n\n future.add_done_callback(done)\n\n loop.run_until_complete(go())\n assert(all(success))", "metadata": "root.TestToFuture.test_future_failure", "header": "['class', 'TestToFuture', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 44 } ]
[ { "span": "value ", "start_line": 58, "start_column": 20, "end_line": 58, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "To", "Future_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "future", "\\u", "failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loop_", "=_", "asyncio_", "._", "get", "\\u", "event", "\\u", "loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "[_", "True_", ",_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "asyncio_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "go_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "Exception_", "(_", "'", "woo", "ps", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "Observable_", "._", "throw", "\\u", "exception_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "future_", "=_", "source_", "._", "to", "\\u", "future_", "(_", "asyncio_", "._", "Future_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "done_", "(_", "future_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "future_", "._", "result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "success_", "[_", "1_", "]_", "=_", "str_", "(_", "ex_", ")_", "==_", "str_", "(_", "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 ", " ", "_", "success_", "[_", "0_", "]_", "=_", "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_", "future_", "._", "add", "\\u", "don", "e\\u", "callback_", "(_", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop_", "._", "run", "\\u", "unti", "l\\u", "complete_", "(_", "go_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "all_", "(_", "success_", ")_", ")_" ]
[ 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, 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 ]
Unused import
ilayn/harold/setup.py
[ { "content": "\"\"\"A setuptools based setup module.\nSee:\nhttps://packaging.python.org/en/latest/distributing.html\nhttps://github.com/pypa/sampleproject\n\"\"\"\n\n# Always prefer setuptools over distutils\nfrom setuptools import setup, find_packages\n# To use a consistent encoding\nfrom codecs import open\nfrom os import path\nimport io\n\nhere = path.abspath(path.dirname(__file__))\n\n# Get the long description from the relevant file\n\n\n \nlong_description = read('README.rst', 'CHANGES.txt')\n\nsetup(\n name='harold',\n author='Ilhan Polat',\n author_email='[email protected]',\n url='https://github.com/ilayn/harold',\n version='0.1.1a8',\n description='A control systems library for Python3',\n long_description=long_description,\n license='MIT',\n classifiers=[\n 'Development Status :: 3 - Alpha',\n 'Topic :: Software Development :: Build Tools',\n 'License :: OSI Approved :: MIT License',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5',\n 'Intended Audience :: Science/Research',\n 'Intended Audience :: Developers',\n 'Topic :: Software Development',\n 'Topic :: Scientific/Engineering',\n 'Operating System :: Microsoft :: Windows',\n 'Operating System :: Unix',\n 'Operating System :: MacOS'\n ],\n packages=['harold'],\n package_dir={'harold': 'harold'},\n install_requires=['numpy','scipy','tabulate'],\n tests_require=['numpy','nose'],\n test_suite = 'nose.collector',\n keywords='control-theory PID controller design industrial automation',\n # List additional groups of dependencies here (e.g. development\n # dependencies). You can install these using the following syntax,\n # for example:\n # $ pip install -e .[dev,test]\n extras_require={\n 'dev': ['check-manifest'],\n 'test': ['coverage'],\n },\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def read(*filenames, **kwargs):\n encoding = kwargs.get('encoding', 'utf-8')\n sep = kwargs.get('sep', '\\n')\n buf = []\n for filename in filenames:\n with io.open(filename, encoding=encoding) as f:\n buf.append(f.read())\n return sep.join(buf)", "metadata": "root.read", "header": "['module', '___EOS___']", "index": 18 } ]
[ { "span": "from setuptools import setup, find_packages", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 43 }, { "span": "from codecs import open", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "A", " ", "setup", "tool", "s", " ", "based", " ", "setup", " ", "module", ".", "\\", "10", ";", "See", ":", "\\", "10", ";", "https", "://", "packaging", ".", "python", ".", "org", "/", "en", "/", "late", "st", "/", "distribu", "ting", ".", "html", "\\", "10", ";", "https", "://", "git", "hub", ".", "com", "/", "pypa", "/", "sample", "project", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "prefer", " ", "setup", "tool", "s", " ", "over", " ", "distutils_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "To", " ", "use", " ", "a", " ", "consistent", " ", "encoding_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "codecs_", "import_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "here_", "=_", "path_", "._", "abspath_", "(_", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "long", " ", "description", " ", "from", " ", "the", " ", "rele", "van", "t", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "long", "\\u", "description_", "=_", "read_", "(_", "'", "READ", "ME", ".", "rst", "'_", ",_", "'", "CHANGE", "S", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "har", "old", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Il", "han", " ", "Pola", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "har", "old", ".", "of", ".", "python", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "ila", "yn", "/", "har", "old", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "1.1", "a8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "A", " ", "control", " ", "system", "s", " ", "librar", "y", " ", "for", " ", "Pyth", "on", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "long", "\\u", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "MIT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "3", " ", "-", " ", "Al", "pha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Build", " ", "Tool", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "MIT", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Sci", "ence", "/", "Rese", "arch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Micro", "soft", " ", "::", " ", "Window", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Uni", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Mac", "OS", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "har", "old", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "dir_", "=_", "{_", "'", "har", "old", "'_", ":_", "'", "har", "old", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "'", "nump", "y", "'_", ",_", "'", "sci", "py", "'_", ",_", "'", "tabul", "ate", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests", "\\u", "require_", "=_", "[_", "'", "nump", "y", "'_", ",_", "'", "nose", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "'", "nose", ".", "collect", "or", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "control", "-", "theory", " ", "PID", " ", "controlle", "r", " ", "design", " ", "ind", "ustr", "ial", " ", "automati", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "addition", "al", " ", "group", "s", " ", "of", " ", "dependen", "cies", " ", "here", " ", "(", "e", ".", "g", ".", " ", "develop", "ment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dependen", "cies", ").", " ", "You", " ", "can", " ", "install", " ", "these", " ", "usi", "ng", " ", "the", " ", "follow", "ing", " ", "synta", "x", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "example", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", " ", "pip", " ", "install", " ", "-", "e", " ", ".", "[", "dev", ",", "test", "]_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "s", "\\u", "require_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dev", "'_", ":_", "[_", "'", "check", "-", "manifest", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "[_", "'", "covera", "ge", "'_", "]_", ",_", "\\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_", "read_", "(_", "*_", "filenames_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "kwargs_", "._", "get_", "(_", "'", "encoding", "'_", ",_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sep_", "=_", "kwargs_", "._", "get_", "(_", "'", "sep", "'_", ",_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "filename_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "io_", "._", "open_", "(_", "filename_", ",_", "encoding_", "=_", "encoding_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
numba/numba/numba/targets/linalg.py
[ { "content": "def dot_2_vm(context, builder, sig, args):\n \"\"\"\n np.dot(vector, matrix)\n \"\"\"\n def dot_impl(a, b):\n m, = a.shape\n _m, n = b.shape\n out = numpy.empty((n, ), a.dtype)\n return numpy.dot(a, b, out)\n\n res = context.compile_internal(builder, dot_impl, sig, args)\n return impl_ret_new_ref(context, builder, sig.return_type, res)", "metadata": "root.dot_2_vm", "header": "['module', '___EOS___']", "index": 253 }, { "content": "def dot_2_mv(context, builder, sig, args):\n \"\"\"\n np.dot(matrix, vector)\n \"\"\"\n def dot_impl(a, b):\n m, n = a.shape\n _n, = b.shape\n out = numpy.empty((m, ), a.dtype)\n return numpy.dot(a, b, out)\n\n res = context.compile_internal(builder, dot_impl, sig, args)\n return impl_ret_new_ref(context, builder, sig.return_type, res)", "metadata": "root.dot_2_mv", "header": "['module', '___EOS___']", "index": 267 }, { "content": "def dot_3_vm(context, builder, sig, args):\n \"\"\"\n np.dot(vector, matrix, out)\n np.dot(matrix, vector, out)\n \"\"\"\n xty, yty, outty = sig.args\n assert outty == sig.return_type\n dtype = xty.dtype\n\n x = make_array(xty)(context, builder, args[0])\n y = make_array(yty)(context, builder, args[1])\n out = make_array(outty)(context, builder, args[2])\n x_shapes = cgutils.unpack_tuple(builder, x.shape)\n y_shapes = cgutils.unpack_tuple(builder, y.shape)\n out_shapes = cgutils.unpack_tuple(builder, out.shape)\n if xty.ndim < yty.ndim:\n # Vector * matrix\n # Asked for x * y, we will compute y.T * x\n mty = yty\n m_shapes = y_shapes\n do_trans = yty.layout == 'F'\n m_data, v_data = y.data, x.data\n\n def check_args(a, b, out):\n m, = a.shape\n _m, n = b.shape\n if m != _m:\n raise ValueError(\"incompatible array sizes for \"\n \"np.dot(a, b) (vector * matrix)\")\n if out.shape != (n,):\n raise ValueError(\"incompatible output array size for \"\n \"np.dot(a, b, out) (vector * matrix)\")\n else:\n # Matrix * vector\n # We will compute x * y\n mty = xty\n m_shapes = x_shapes\n do_trans = xty.layout == 'C'\n m_data, v_data = x.data, y.data\n\n def check_args(a, b, out):\n m, _n = a.shape\n n, = b.shape\n if n != _n:\n raise ValueError(\"incompatible array sizes for np.dot(a, b) \"\n \"(matrix * vector)\")\n if out.shape != (m,):\n raise ValueError(\"incompatible output array size for \"\n \"np.dot(a, b, out) (matrix * vector)\")\n\n context.compile_internal(builder, check_args,\n signature(types.none, *sig.args), args)\n for val in m_shapes:\n check_c_int(context, builder, val)\n\n call_xxgemv(context, builder, do_trans, mty, m_shapes, m_data,\n v_data, out.data)\n\n return impl_ret_borrowed(context, builder, sig.return_type,\n out._getvalue())", "metadata": "root.dot_3_vm", "header": "['module', '___EOS___']", "index": 342 }, { "content": " @overload(numpy.linalg.cholesky)\n def cho_impl(a):\n ensure_lapack()\n\n _check_linalg_matrix(a, \"cholesky\")\n\n xxpotrf_sig = types.intc(types.int8, types.int8, types.intp,\n types.CPointer(a.dtype), types.intp)\n xxpotrf = types.ExternalFunction(\"numba_xxpotrf\", xxpotrf_sig)\n\n kind = ord(get_blas_kind(a.dtype, \"cholesky\"))\n UP = ord('U')\n LO = ord('L')\n\n def cho_impl(a):\n n = a.shape[-1]\n if a.shape[-2] != n:\n msg = \"Last 2 dimensions of the array must be square.\"\n raise numpy.linalg.LinAlgError(msg)\n\n # The output is allocated in C order\n out = a.copy()\n # Pass UP since xxpotrf() operates in F order\n # The semantics ensure this works fine\n # (out is really its Hermitian in F order, but UP instructs\n # xxpotrf to compute the Hermitian of the upper triangle\n # => they cancel each other)\n r = xxpotrf(kind, UP, n, out.ctypes, n)\n if r < 0:\n fatal_error_func()\n assert 0 # unreachable\n if r > 0:\n raise numpy.linalg.LinAlgError(\n \"Matrix is not positive definite.\")\n # Zero out upper triangle, in F order\n for col in range(n):\n out[:col, col] = 0\n return out\n\n return cho_impl", "metadata": "root.cho_impl", "header": "['module', '___EOS___']", "index": 717 } ]
[ { "span": "m,", "start_line": 258, "start_column": 8, "end_line": 258, "end_column": 9 }, { "span": "_n,", "start_line": 273, "start_column": 8, "end_line": 273, "end_column": 10 }, { "span": "dtype ", "start_line": 349, "start_column": 4, "end_line": 349, "end_column": 9 }, { "span": "out_shapes ", "start_line": 356, "start_column": 4, "end_line": 356, "end_column": 14 }, { "span": "LO ", "start_line": 729, "start_column": 8, "end_line": 729, "end_column": 10 } ]
[]
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_", "dot", "\\u", "2", "\\u", "vm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "vector", ",", " ", "matrix", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dot", "\\u", "impl_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "m_", ",_", "n_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "numpy_", "._", "empty_", "(_", "(_", "n_", ",_", ")_", ",_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "dot_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "dot", "\\u", "impl_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "new", "\\u", "ref_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dot", "\\u", "2", "\\u", "mv_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "matrix", ",", " ", "vector", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dot", "\\u", "impl_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "n_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "n_", ",_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "numpy_", "._", "empty_", "(_", "(_", "m_", ",_", ")_", ",_", "a_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "dot_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "dot", "\\u", "impl_", ",_", "sig_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "new", "\\u", "ref_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dot", "\\u", "3", "\\u", "vm_", "(_", "context_", ",_", "builder_", ",_", "sig_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "vector", ",", " ", "matrix", ",", " ", "out", ")", "\\", "10", ";", " ", " ", " ", " ", "np", ".", "dot", "(", "matrix", ",", " ", "vector", ",", " ", "out", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xt", "y_", ",_", "yt", "y_", ",_", "outt", "y_", "=_", "sig_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "outt", "y_", "==_", "sig_", "._", "return", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "xt", "y_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "make", "\\u", "array_", "(_", "xt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "make", "\\u", "array_", "(_", "yt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "make", "\\u", "array_", "(_", "outt", "y_", ")_", "(_", "context_", ",_", "builder_", ",_", "args_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "x_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "y_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "shapes_", "=_", "cg", "utils_", "._", "unpack", "\\u", "tuple_", "(_", "builder_", ",_", "out_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xt", "y_", "._", "ndim_", "<_", "yt", "y_", "._", "ndim_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Vector", " ", "*", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", "ked", " ", "for", " ", "x", " ", "*", " ", "y", ",", " ", "we", " ", "will", " ", "compute", " ", "y", ".", "T", " ", "*", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mt", "y_", "=_", "yt", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "shapes_", "=_", "y", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "trans_", "=_", "yt", "y_", "._", "layout_", "==_", "'", "F", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "data_", ",_", "v", "\\u", "data_", "=_", "y_", "._", "data_", ",_", "x_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "args_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "m_", ",_", "n_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "!=_", "\\u", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "array", " ", "size", "s", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "np", ".", "dot", "(", "a", ",", " ", "b", ")", " ", "(", "vector", " ", "*", " ", "matrix", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out_", "._", "shape_", "!=_", "(_", "n_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "output", " ", "array", " ", "size", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "np", ".", "dot", "(", "a", ",", " ", "b", ",", " ", "out", ")", " ", "(", "vector", " ", "*", " ", "matrix", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Matrix", " ", "*", " ", "vector_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "will", " ", "compute", " ", "x", " ", "*", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mt", "y_", "=_", "xt", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "shapes_", "=_", "x", "\\u", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "trans_", "=_", "xt", "y_", "._", "layout_", "==_", "'", "C", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m", "\\u", "data_", ",_", "v", "\\u", "data_", "=_", "x_", "._", "data_", ",_", "y_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "args_", "(_", "a_", ",_", "b_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", ",_", "\\u", "n_", "=_", "a_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", ",_", "=_", "b_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "!=_", "\\u", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "array", " ", "size", "s", " ", "for", " ", "np", ".", "dot", "(", "a", ",", " ", "b", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "matrix", " ", "*", " ", "vector", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out_", "._", "shape_", "!=_", "(_", "m_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "incomp", "atible", " ", "output", " ", "array", " ", "size", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "np", ".", "dot", "(", "a", ",", " ", "b", ",", " ", "out", ")", " ", "(", "matrix", " ", "*", " ", "vector", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "compile", "\\u", "internal_", "(_", "builder_", ",_", "check", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "(_", "types_", "._", "none_", ",_", "*_", "sig_", "._", "args_", ")_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "m", "\\u", "shapes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "c\\u", "int_", "(_", "context_", ",_", "builder_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "call", "\\u", "xx", "gem", "v_", "(_", "context_", ",_", "builder_", ",_", "do", "\\u", "trans_", ",_", "mt", "y_", ",_", "m", "\\u", "shapes_", ",_", "m", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "v", "\\u", "data_", ",_", "out_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "impl", "\\u", "ret", "\\u", "borrow", "ed_", "(_", "context_", ",_", "builder_", ",_", "sig_", "._", "return", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "._", "\\u", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "overload", "_", "(_", "numpy_", "._", "linalg_", "._", "choles", "ky_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cho", "\\u", "impl_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ensure", "\\u", "lap", "ack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "check", "\\u", "linalg", "\\u", "matrix_", "(_", "a_", ",_", "\"", "choles", "ky", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xx", "pot", "rf", "\\u", "sig_", "=_", "types_", "._", "int", "c_", "(_", "types_", "._", "int8_", ",_", "types_", "._", "int8_", ",_", "types_", "._", "intp", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "CP", "oint", "er_", "(_", "a_", "._", "dtype_", ")_", ",_", "types_", "._", "intp", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xx", "pot", "rf_", "=_", "types_", "._", "Exter", "nal", "Function_", "(_", "\"", "numb", "a", "\\u", "xx", "pot", "rf", "\"_", ",_", "xx", "pot", "rf", "\\u", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "ord_", "(_", "get", "\\u", "bla", "s", "\\u", "kind_", "(_", "a_", "._", "dtype_", ",_", "\"", "choles", "ky", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UP_", "=_", "ord_", "(_", "'", "U", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LO", "_", "=_", "ord_", "(_", "'", "L", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cho", "\\u", "impl_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "a_", "._", "shape_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "._", "shape_", "[_", "-_", "2_", "]_", "!=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Las", "t", " ", "2", " ", "dimension", "s", " ", "of", " ", "the", " ", "array", " ", "must", " ", "be", " ", "square", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "output", " ", "is", " ", "allocated", " ", "in", " ", "C", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "a_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pass", " ", "UP", " ", "sinc", "e", " ", "xx", "pot", "rf", "()", " ", "operate", "s", " ", "in", " ", "F", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "semantics", " ", "ensure", " ", "this", " ", "works", " ", "fine", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "out", " ", "is", " ", "reall", "y", " ", "its", " ", "Her", "mit", "ian", " ", "in", " ", "F", " ", "order", ",", " ", "but", " ", "UP", " ", "instruct", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "xx", "pot", "rf", " ", "to", " ", "compute", " ", "the", " ", "Her", "mit", "ian", " ", "of", " ", "the", " ", "upper", " ", "triangle_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "=>", " ", "the", "y", " ", "cancel", " ", "each", " ", "other", ")_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "xx", "pot", "rf_", "(_", "kind_", ",_", "UP_", ",_", "n_", ",_", "out_", "._", "ctypes_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fat", "al", "\\u", "error", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "#", " ", "unreachable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "r_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "numpy_", "._", "linalg_", "._", "Lin", "Alg", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Matrix", " ", "is", " ", "not", " ", "posit", "ive", " ", "definit", "e", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Zero", " ", "out", " ", "upper", " ", "triangle", ",", " ", "in", " ", "F", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "col_", "in_", "range_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "[_", ":_", "col_", ",_", "col_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cho", "\\u", "impl_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0,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ubKey, options):\n \"\"\"checks to see if host is in the known_hosts file for the user.\n returns 0 if it isn't, 1 if it is and is the same, 2 if it's changed.\n \"\"\"\n keyType = common.getNS(pubKey)[0]\n retVal = 0\n\n if not options['known-hosts'] and not os.path.exists(os.path.expanduser('~/.ssh/')):\n print 'Creating ~/.ssh directory...'\n os.mkdir(os.path.expanduser('~/.ssh'))\n kh_file = options['known-hosts'] or '~/.ssh/known_hosts'\n try:\n known_hosts = open(os.path.expanduser(kh_file))\n except IOError:\n return 0\n for line in known_hosts.xreadlines():\n split = line.split()\n if len(split) < 3:\n continue\n hosts, hostKeyType, encodedKey = split[:3]\n if host not in hosts.split(','): # incorrect host\n continue\n if hostKeyType != keyType: # incorrect type of key\n continue\n try:\n decodedKey = base64.decodestring(encodedKey)\n except:\n continue\n if decodedKey == pubKey:\n return 1\n else:\n retVal = 2\n return retVal", "metadata": "root.isInKnownHosts", "header": "['module', '___EOS___']", "index": 80 } ]
[ { "span": "except:", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "In", "Kno", "wn", "Host", "s_", "(_", "host_", ",_", "pub", "Key_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "checks", " ", "to", " ", "see", " ", "if", " ", "host", " ", "is", " ", "in", " ", "the", " ", "know", "n", "\\u", "host", "s", " ", "file", " ", "for", " ", "the", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "0", " ", "if", " ", "it", " ", "isn", "'", "t", ",", " ", "1", " ", "if", " ", "it", " ", "is", " ", "and", " ", "is", " ", "the", " ", "same", ",", " ", "2", " ", "if", " ", "it", "'", "s", " ", "change", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "Type_", "=_", "common_", "._", "get", "NS_", "(_", "pub", "Key_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret", "Val_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "options_", "[_", "'", "know", "n", "-", "host", "s", "'_", "]_", "and_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/.", "ssh", "/'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Creat", "ing", " ", "~", "/.", "ssh", " ", "director", "y", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/.", "ssh", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kh", "\\u", "file_", "=_", "options_", "[_", "'", "know", "n", "-", "host", "s", "'_", "]_", "or_", "'", "~", "/.", "ssh", "/", "know", "n", "\\u", "host", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "know", "n", "\\u", "hosts_", "=_", "open_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "kh", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "know", "n", "\\u", "hosts_", "._", "xre", "adl", "ines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "split_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "split_", ")_", "<_", "3_", ":_", "\\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_", "hosts_", ",_", "host", "Key", "Type_", ",_", "encode", "d", "Key_", "=_", "split_", "[_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host_", "not_", "in_", "hosts_", "._", "split_", "(_", "','_", ")_", ":_", "#", " ", "incorrect", " ", "host_", "\\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_", "host", "Key", "Type_", "!=_", "key", "Type_", ":_", "#", " ", "incorrect", " ", "type", " ", "of", " ", "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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "decode", "d", "Key_", "=_", "base64_", "._", "decode", "string_", "(_", "encode", "d", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "decode", "d", "Key_", "==_", "pub", "Key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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 ", " _", "ret", "Val_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret", "Val_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
`__eq__` not overridden when adding attributes
CenterForOpenScience/osf.io/website/institutions/model.py
[ { "content": "class AffiliatedInstitutionsList(list):\n '''\n A list to implement append and remove methods to a private node list through a\n public Institution-returning property. Initialization should occur with the instance of the public list,\n the object the list belongs to, and the private attribute ( a list) the public property\n is attached to, and as the return value of the property.\n Ex:\n class Node():\n _affiliated_institutions = []\n\n @property\n affiliated_institutions(self):\n return AffiliatedInstitutionsList(\n [Institution(node) for node in self._affiliated_institutions],\n obj=self, private_target='_affiliated_institutions')\n )\n '''\n\n", "metadata": "root.AffiliatedInstitutionsList", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self, init, obj, private_target):\n super(AffiliatedInstitutionsList, self).__init__(init or [])\n self.obj = obj\n self.target = private_target", "metadata": "root.AffiliatedInstitutionsList.__init__", "header": "['class', 'AffiliatedInstitutionsList', '(', 'list', ')', ':', '___EOS___']", "index": 25 }, { "content": " def append(self, to_append):\n temp_list = getattr(self.obj, self.target)\n temp_list.append(to_append.node)\n setattr(self.obj, self.target, temp_list)", "metadata": "root.AffiliatedInstitutionsList.append", "header": "['class', 'AffiliatedInstitutionsList', '(', 'list', ')', ':', '___EOS___']", "index": 30 }, { "content": " def remove(self, to_remove):\n temp_list = getattr(self.obj, self.target)\n temp_list.remove(to_remove.node)\n setattr(self.obj, self.target, temp_list)", "metadata": "root.AffiliatedInstitutionsList.remove", "header": "['class', 'AffiliatedInstitutionsList', '(', 'list', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "class AffiliatedInstitutionsList(list):", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 39 } ]
[ { "span": "self.obj ", "start_line": 27, "start_column": 8, "end_line": 27, "end_column": 16 }, { "span": "self.target ", "start_line": 28, "start_column": 8, "end_line": 28, "end_column": 19 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Affi", "liat", "ed", "Institut", "ion", "s", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "list", " ", "to", " ", "implement", " ", "append", " ", "and", " ", "remove", " ", "method", "s", " ", "to", " ", "a", " ", "private", " ", "node", " ", "list", " ", "through", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "public", " ", "Institut", "ion", "-", "return", "ing", " ", "property", ".", " ", "Initializ", "ation", " ", "shou", "ld", " ", "occur", " ", "with", " ", "the", " ", "instance", " ", "of", " ", "the", " ", "public", " ", "list", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "object", " ", "the", " ", "list", " ", "belo", "ngs", " ", "to", ",", " ", "and", " ", "the", " ", "private", " ", "attribute", " ", "(", " ", "a", " ", "list", ")", " ", "the", " ", "public", " ", "property", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "attache", "d", " ", "to", ",", " ", "and", " ", "as", " ", "the", " ", "return", " ", "value", " ", "of", " ", "the", " ", "property", ".", "\\", "10", ";", " ", "Ex", ":", "\\", "10", ";", " ", "class", " ", "Node", "():", "\\", "10", ";", " ", " ", " ", " ", "\\u", "affi", "liat", "ed", "\\u", "institution", "s", " ", "=", " ", "[]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "property", "\\", "10", ";", " ", " ", " ", " ", "affi", "liat", "ed", "\\u", "institution", "s", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Affi", "liat", "ed", "Institut", "ion", "s", "List", "(", "\\", "10", ";", " ", " ", " ", " ", "[", "Institut", "ion", "(", "node", ")", " ", "for", " ", "node", " ", "in", " ", "self", ".\\u", "affi", "liat", "ed", "\\u", "institution", "s", "],", "\\", "10", ";", " ", " ", " ", " ", "obj", "=", "self", ",", " ", "private", "\\u", "target", "='", "\\u", "affi", "liat", "ed", "\\u", "institution", "s", "')", "\\", "10", ";", " ", " ", " ", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Affi", "liat", "ed", "Institut", "ion", "s", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "init_", ",_", "obj_", ",_", "private", "\\u", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Affi", "liat", "ed", "Institut", "ion", "s", "List_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "init_", "or_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "obj_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target_", "=_", "private", "\\u", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Affi", "liat", "ed", "Institut", "ion", "s", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append_", "(_", "self_", ",_", "to", "\\u", "append_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "list_", "=_", "getattr_", "(_", "self_", "._", "obj_", ",_", "self_", "._", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "list_", "._", "append_", "(_", "to", "\\u", "append_", "._", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", "._", "obj_", ",_", "self_", "._", "target_", ",_", "temp", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Affi", "liat", "ed", "Institut", "ion", "s", "List_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove_", "(_", "self_", ",_", "to", "\\u", "remove_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "list_", "=_", "getattr_", "(_", "self_", "._", "obj_", ",_", "self_", "._", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "list_", "._", "remove_", "(_", "to", "\\u", "remove_", "._", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", "._", "obj_", ",_", "self_", "._", "target_", ",_", "temp", "\\u", "list_", ")_", "\\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, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 1, 1, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
viewfinderco/viewfinder/backend/www/test/versioning_test.py
[ { "content": " def testInlineInvalidationsMigration(self):\n \"\"\"Ensure that the INLINE_INVALIDATIONS migration works correctly.\"\"\"\n episode_id = Episode.ConstructEpisodeId(1, self._device_ids[0], 1)\n photo_id = Photo.ConstructPhotoId(1, self._device_ids[0], 1)\n request = {'activity': self._tester.CreateActivityDict(self._cookie),\n 'episode': {'episode_id': episode_id,\n 'timestamp': 1},\n 'photos': [self._CreatePhotoDict(self._cookie, photo_id=photo_id)]}\n self._SendRequest('upload_episode', self._cookie, request,\n version=Message.EXTRACT_MD5_HASHES)\n\n request = {'episodes': [{'episode_id': episode_id,\n 'photo_ids': [photo_id]}]}\n self._SendRequest('remove_photos', self._cookie, request,\n version=Message.EXTRACT_MD5_HASHES)\n\n request = {'activity': self._tester.CreateActivityDict(self._cookie),\n 'viewpoint_id': self._user.private_vp_id,\n 'viewed_seq': 2}\n self._SendRequest('update_viewpoint', self._cookie, request,\n version=Message.EXTRACT_MD5_HASHES)\n\n response = self._SendRequest('query_notifications', self._cookie, {},\n version=Message.EXTRACT_MD5_HASHES)\n\n # upload_episode notification.\n notify_dict = response['notifications'][1]\n self.assertFalse('inline' in notify_dict)\n self.assertTrue('activity' in notify_dict)\n self.assertEqual(notify_dict['activity']['update_seq'], 1)\n\n # remove_photos notification.\n notify_dict = response['notifications'][2]\n self.assertFalse('inline' in notify_dict)\n self.assertFalse('activity' in notify_dict)\n\n # update_viewpoint notification.\n notify_dict = response['notifications'][3]\n self.assertFalse('inline' in notify_dict)\n self.assertFalse('activity' in notify_dict)", "metadata": "root.VersioningTestCase.testInlineInvalidationsMigration", "header": "['class', 'VersioningTestCase', '(', 'service_base_test', '.', 'ServiceBaseTestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " def testSupportMultipleIdentitiesPerContact(self):\n \"\"\"Ensure that the SUPPORT_MULTIPLE_IDENTITIES_PER_CONTACT migration works correctly.\"\"\"\n identity_key = 'Email:' + self._user2.email\n\n # Create an identity to exercise the 'contact_user_id' field of the down-level response.\n self._UpdateOrAllocateDBObject(Identity, key=identity_key, user_id=21)\n\n # This contact is for a registered user.\n contact_dict = Contact.CreateContactDict(user_id=self._user.user_id,\n identities_properties=[(identity_key, 'work'),\n ('Email:' + self._user3.email, 'home'),\n ('Phone:+13191234567', 'mobile')],\n timestamp=1,\n contact_source=Contact.GMAIL,\n name='Mike Purtell',\n given_name='Mike',\n family_name='Purtell',\n rank=3)\n self._UpdateOrAllocateDBObject(Contact, **contact_dict)\n\n # This contact has been removed and shouldn't show up in down-level client queries.\n contact_dict = Contact.CreateContactDict(user_id=self._user.user_id,\n identities_properties=None,\n timestamp=1,\n contact_source=Contact.GMAIL,\n contact_id='gm:onetwothree',\n sort_key=Contact.CreateSortKey('gm:onetwothree', 1),\n labels=[Contact.REMOVED])\n self._UpdateOrAllocateDBObject(Contact, **contact_dict)\n\n # This contact has unknown identities.\n contact_dict = Contact.CreateContactDict(user_id=self._user.user_id,\n identities_properties=[('Email:[email protected]', 'work'),\n ('Email:[email protected]', 'home'),\n ('Phone:+13191234567', 'mobile')],\n timestamp=1,\n contact_source=Contact.GMAIL,\n name='Some One',\n given_name='Some',\n family_name='Body',\n rank=5)\n self._UpdateOrAllocateDBObject(Contact, **contact_dict)\n\n # This contact has just a phone number and shouldn't show up in down-level client queries.\n contact_dict = Contact.CreateContactDict(user_id=self._user.user_id,\n identities_properties=[('Phone:+13191234567', 'mobile')],\n timestamp=1,\n contact_source=Contact.GMAIL,\n name='Some One with just a phone',\n given_name='Some',\n family_name='Body',\n rank=42)\n self._UpdateOrAllocateDBObject(Contact, **contact_dict)\n\n # This contact has no identities and shouldn't show up in down-level client queries.\n contact_dict = Contact.CreateContactDict(user_id=self._user.user_id,\n identities_properties=[],\n timestamp=1,\n contact_source=Contact.GMAIL,\n name='Some One with just a phone',\n given_name='Some',\n family_name='Body',\n rank=42)\n self._UpdateOrAllocateDBObject(Contact, **contact_dict)\n\n response = self._SendRequest('query_contacts', self._cookie, {}, version=Message.SUPPRESS_BLANK_COVER_PHOTO)\n\n # Verify response is what we expect for down-level client.\n self.assertEqual(response['headers'], {'version': Message.SUPPRESS_BLANK_COVER_PHOTO})\n self.assertEqual(response['num_contacts'], 2)\n response_contact = response['contacts'][1]\n self.assertEqual(response_contact['name'], 'Mike Purtell')\n self.assertEqual(response_contact['given_name'], 'Mike')\n self.assertEqual(response_contact['family_name'], 'Purtell')\n self.assertEqual(response_contact['rank'], 3)\n self.assertEqual(response_contact['contact_user_id'], 21)\n self.assertEqual(response_contact['identity'], identity_key)\n self.assertFalse('identities' in response_contact)\n self.assertFalse('contact_id' in response_contact)\n self.assertFalse('contact_source' in response_contact)\n self.assertFalse('labels' in response_contact)\n\n response_contact = response['contacts'][0]\n self.assertEqual(response_contact['name'], 'Some One')\n self.assertEqual(response_contact['given_name'], 'Some')\n self.assertEqual(response_contact['family_name'], 'Body')\n self.assertEqual(response_contact['rank'], 5)\n self.assertEqual(response_contact['identity'], 'Email:[email protected]')\n self.assertFalse('contact_user_id' in response_contact)\n self.assertFalse('identities' in response_contact)\n self.assertFalse('contact_id' in response_contact)\n self.assertFalse('contact_source' in response_contact)\n self.assertFalse('labels' in response_contact)", "metadata": "root.VersioningTestCase.testSupportMultipleIdentitiesPerContact", "header": "['class', 'VersioningTestCase', '(', 'service_base_test', '.', 'ServiceBaseTestCase', ')', ':', '___EOS___']", "index": 229 } ]
[ { "span": "self.assertFalse('inline' in notify_dict)", "start_line": 65, "start_column": 4, "end_line": 65, "end_column": 45 }, { "span": "self.assertTrue('activity' in notify_dict)", "start_line": 66, "start_column": 4, "end_line": 66, "end_column": 46 }, { "span": "self.assertFalse('inline' in notify_dict)", "start_line": 71, "start_column": 4, "end_line": 71, "end_column": 45 }, { "span": "self.assertFalse('activity' in notify_dict)", "start_line": 72, "start_column": 4, "end_line": 72, "end_column": 47 }, { "span": "self.assertFalse('inline' in notify_dict)", "start_line": 76, "start_column": 4, "end_line": 76, "end_column": 45 }, { "span": "self.assertFalse('activity' in notify_dict)", "start_line": 77, "start_column": 4, "end_line": 77, "end_column": 47 }, { "span": "self.assertFalse('identities' in response_contact)", "start_line": 306, "start_column": 4, "end_line": 306, "end_column": 54 }, { "span": "self.assertFalse('contact_id' in response_contact)", "start_line": 307, "start_column": 4, "end_line": 307, "end_column": 54 }, { "span": "self.assertFalse('contact_source' in response_contact)", "start_line": 308, "start_column": 4, "end_line": 308, "end_column": 58 }, { "span": "self.assertFalse('labels' in response_contact)", "start_line": 309, "start_column": 4, "end_line": 309, "end_column": 50 }, { "span": "self.assertFalse('contact_user_id' in response_contact)", "start_line": 317, "start_column": 4, "end_line": 317, "end_column": 59 }, { "span": "self.assertFalse('identities' in response_contact)", "start_line": 318, "start_column": 4, "end_line": 318, "end_column": 54 }, { "span": "self.assertFalse('contact_id' in response_contact)", "start_line": 319, "start_column": 4, "end_line": 319, "end_column": 54 }, { "span": "self.assertFalse('contact_source' in response_contact)", "start_line": 320, "start_column": 4, "end_line": 320, "end_column": 58 }, { "span": "self.assertFalse('labels' in response_contact)", "start_line": 321, "start_column": 4, "end_line": 321, "end_column": 50 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Version", "ing", "Test", "Case_", "(_", "service", "\\u", "base", "\\u", "test_", "._", "Service", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "In", "line", "Inva", "lida", "tion", "s", "Migration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "tha", "t", " ", "the", " ", "IN", "LINE", "\\u", "INVALID", "ATION", "S", " ", "migrati", "on", " ", "works", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "episode", "\\u", "id_", "=_", "Episode_", "._", "Construct", "Episod", "e", "Id_", "(_", "1_", ",_", "self_", "._", "\\u", "device", "\\u", "ids_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "photo", "\\u", "id_", "=_", "Photo_", "._", "Construct", "Photo", "Id_", "(_", "1_", ",_", "self_", "._", "\\u", "device", "\\u", "ids_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "{_", "'", "activit", "y", "'_", ":_", "self_", "._", "\\u", "tester_", "._", "Creat", "e", "Activ", "it", "y", "Dict_", "(_", "self_", "._", "\\u", "cookie_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "episode", "'_", ":_", "{_", "'", "episode", "\\u", "id", "'_", ":_", "episode", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestamp", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "photo", "s", "'_", ":_", "[_", "self_", "._", "\\u", "Creat", "e", "Photo", "Dict_", "(_", "self_", "._", "\\u", "cookie_", ",_", "photo", "\\u", "id_", "=_", "photo", "\\u", "id_", ")_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Sen", "d", "Request_", "(_", "'", "upload", "\\u", "episode", "'_", ",_", "self_", "._", "\\u", "cookie_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "'", "episode", "s", "'_", ":_", "[_", "{_", "'", "episode", "\\u", "id", "'_", ":_", "episode", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "photo", "\\u", "ids", "'_", ":_", "[_", "photo", "\\u", "id_", "]_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Sen", "d", "Request_", "(_", "'", "remove", "\\u", "photo", "s", "'_", ",_", "self_", "._", "\\u", "cookie_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "{_", "'", "activit", "y", "'_", ":_", "self_", "._", "\\u", "tester_", "._", "Creat", "e", "Activ", "it", "y", "Dict_", "(_", "self_", "._", "\\u", "cookie_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "point", "\\u", "id", "'_", ":_", "self_", "._", "\\u", "user_", "._", "private", "\\u", "vp", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "viewed", "\\u", "seq", "'_", ":_", "2_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Sen", "d", "Request_", "(_", "'", "update", "\\u", "view", "point", "'_", ",_", "self_", "._", "\\u", "cookie_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "Sen", "d", "Request_", "(_", "'", "query", "\\u", "notification", "s", "'_", ",_", "self_", "._", "\\u", "cookie_", ",_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "Message_", "._", "EXTRACT", "\\u", "MD", "5", "\\u", "HAS", "HE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upload", "\\u", "episode", " ", "notification", "._", "\\u\\u\\uNL\\u\\u\\u_", "notif", "y", "\\u", "dict_", "=_", "response_", "[_", "'", "notification", "s", "'_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "inline", "'_", "in_", "notif", "y", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "activit", "y", "'_", "in_", "notif", "y", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "notif", "y", "\\u", "dict_", "[_", "'", "activit", "y", "'_", "]_", "[_", "'", "update", "\\u", "seq", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", "\\u", "photo", "s", " ", "notification", "._", "\\u\\u\\uNL\\u\\u\\u_", "notif", "y", "\\u", "dict_", "=_", "response_", "[_", "'", "notification", "s", "'_", "]_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "inline", "'_", "in_", "notif", "y", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "activit", "y", "'_", "in_", "notif", "y", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "view", "point", " ", "notification", "._", "\\u\\u\\uNL\\u\\u\\u_", "notif", "y", "\\u", "dict_", "=_", "response_", "[_", "'", "notification", "s", "'_", "]_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "inline", "'_", "in_", "notif", "y", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "activit", "y", "'_", "in_", "notif", "y", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Version", "ing", "Test", "Case_", "(_", "service", "\\u", "base", "\\u", "test_", "._", "Service", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Supp", "ort", "Multipl", "e", "Ident", "iti", "es", "Per", "Contact_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "tha", "t", " ", "the", " ", "SUPPORT", "\\u", "MULTIPLE", "\\u", "IDENT", "ITI", "ES", "\\u", "PER", "\\u", "CONTACT", " ", "migrati", "on", " ", "works", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "key_", "=_", "'", "Ema", "il", ":'_", "+_", "self_", "._", "\\u", "user2_", "._", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "identi", "ty", " ", "to", " ", "exercise", " ", "the", " ", "'", "contact", "\\u", "user", "\\u", "id", "'", " ", "field", " ", "of", " ", "the", " ", "down", "-", "level", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "Update", "Or", "Allocate", "DB", "Object_", "(_", "Identity_", ",_", "key_", "=_", "identi", "ty", "\\u", "key_", ",_", "user", "\\u", "id_", "=_", "21_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "contact", " ", "is", " ", "for", " ", "a", " ", "register", "ed", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "dict_", "=_", "Contact_", "._", "Creat", "e", "Conta", "ct", "Dict_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "\\u", "user_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "identities", "\\u", "properties_", "=_", "[_", "(_", "identi", "ty", "\\u", "key_", ",_", "'", "work", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Ema", "il", ":'_", "+_", "self_", "._", "\\u", "user3", "_", "._", "email_", ",_", "'", "home", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Phone", ":+", "131", "912", "3456", "7", "'_", ",_", "'", "mobile", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "source_", "=_", "Contact_", "._", "GMA", "IL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Mik", "e", " ", "Pur", "tell", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "n", "\\u", "name_", "=_", "'", "Mik", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "famil", "y", "\\u", "name_", "=_", "'", "Pur", "tell", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Update", "Or", "Allocate", "DB", "Object_", "(_", "Contact_", ",_", "**_", "contact", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "contact", " ", "has", " ", "bee", "n", " ", "remove", "d", " ", "and", " ", "shou", "ld", "n", "'", "t", " ", "show", " ", "up", " ", "in", " ", "down", "-", "level", " ", "client", " ", "querie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "dict_", "=_", "Contact_", "._", "Creat", "e", "Conta", "ct", "Dict_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "\\u", "user_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "identities", "\\u", "properties_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "source_", "=_", "Contact_", "._", "GMA", "IL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "id_", "=_", "'", "gm", ":", "onet", "wo", "three", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort", "\\u", "key_", "=_", "Contact_", "._", "Creat", "e", "Sort", "Key_", "(_", "'", "gm", ":", "onet", "wo", "three", "'_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "labels_", "=_", "[_", "Contact_", "._", "REMOVE", "D_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Update", "Or", "Allocate", "DB", "Object_", "(_", "Contact_", ",_", "**_", "contact", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "contact", " ", "has", " ", "unknown", " ", "identities", "._", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "dict_", "=_", "Contact_", "._", "Creat", "e", "Conta", "ct", "Dict_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "\\u", "user_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "identities", "\\u", "properties_", "=_", "[_", "(_", "'", "Ema", "il", ":", "some", "one", "@", "some", "where", ".", "com", "'_", ",_", "'", "work", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Ema", "il", ":", "some", "body", "@", "some", "where", ".", "com", "'_", ",_", "'", "home", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Phone", ":+", "131", "912", "3456", "7", "'_", ",_", "'", "mobile", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "source_", "=_", "Contact_", "._", "GMA", "IL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Some", " ", "One", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "n", "\\u", "name_", "=_", "'", "Some", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "famil", "y", "\\u", "name_", "=_", "'", "Bod", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Update", "Or", "Allocate", "DB", "Object_", "(_", "Contact_", ",_", "**_", "contact", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "contact", " ", "has", " ", "just", " ", "a", " ", "phone", " ", "number", " ", "and", " ", "shou", "ld", "n", "'", "t", " ", "show", " ", "up", " ", "in", " ", "down", "-", "level", " ", "client", " ", "querie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "dict_", "=_", "Contact_", "._", "Creat", "e", "Conta", "ct", "Dict_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "\\u", "user_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "identities", "\\u", "properties_", "=_", "[_", "(_", "'", "Phone", ":+", "131", "912", "3456", "7", "'_", ",_", "'", "mobile", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "source_", "=_", "Contact_", "._", "GMA", "IL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Some", " ", "One", " ", "with", " ", "just", " ", "a", " ", "phone", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "n", "\\u", "name_", "=_", "'", "Some", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "famil", "y", "\\u", "name_", "=_", "'", "Bod", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Update", "Or", "Allocate", "DB", "Object_", "(_", "Contact_", ",_", "**_", "contact", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "contact", " ", "has", " ", "no", " ", "identities", " ", "and", " ", "shou", "ld", "n", "'", "t", " ", "show", " ", "up", " ", "in", " ", "down", "-", "level", " ", "client", " ", "querie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "dict_", "=_", "Contact_", "._", "Creat", "e", "Conta", "ct", "Dict_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "\\u", "user_", "._", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "identities", "\\u", "properties_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "source_", "=_", "Contact_", "._", "GMA", "IL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Some", " ", "One", " ", "with", " ", "just", " ", "a", " ", "phone", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "n", "\\u", "name_", "=_", "'", "Some", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "famil", "y", "\\u", "name_", "=_", "'", "Bod", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "Update", "Or", "Allocate", "DB", "Object_", "(_", "Contact_", ",_", "**_", "contact", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "Sen", "d", "Request_", "(_", "'", "query", "\\u", "contact", "s", "'_", ",_", "self_", "._", "\\u", "cookie_", ",_", "{_", "}_", ",_", "version_", "=_", "Message_", "._", "SUPPRESS", "\\u", "BLANK", "\\u", "COVER", "\\u", "PHOTO", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "response", " ", "is", " ", "what", " ", "we", " ", "expect", " ", "for", " ", "down", "-", "level", " ", "client", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "[_", "'", "header", "s", "'_", "]_", ",_", "{_", "'", "version", "'_", ":_", "Message_", "._", "SUPPRESS", "\\u", "BLANK", "\\u", "COVER", "\\u", "PHOTO", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "[_", "'", "num", "\\u", "contact", "s", "'_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "contact_", "=_", "response_", "[_", "'", "contact", "s", "'_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "name", "'_", "]_", ",_", "'", "Mik", "e", " ", "Pur", "tell", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "give", "n", "\\u", "name", "'_", "]_", ",_", "'", "Mik", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "famil", "y", "\\u", "name", "'_", "]_", ",_", "'", "Pur", "tell", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "rank", "'_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "contact", "\\u", "user", "\\u", "id", "'_", "]_", ",_", "21_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "identi", "ty", "'_", "]_", ",_", "identi", "ty", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "identities", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "contact", "\\u", "id", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "contact", "\\u", "source", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "labels", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "contact_", "=_", "response_", "[_", "'", "contact", "s", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "name", "'_", "]_", ",_", "'", "Some", " ", "One", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "give", "n", "\\u", "name", "'_", "]_", ",_", "'", "Some", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "famil", "y", "\\u", "name", "'_", "]_", ",_", "'", "Bod", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "rank", "'_", "]_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response", "\\u", "contact_", "[_", "'", "identi", "ty", "'_", "]_", ",_", "'", "Ema", "il", ":", "some", "one", "@", "some", "where", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "contact", "\\u", "user", "\\u", "id", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "identities", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "contact", "\\u", "id", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "contact", "\\u", "source", "'_", "in_", "response", "\\u", "contact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "labels", "'_", "in_", "response", "\\u", "contact_", ")_", "\\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, 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 1, 1, 1, 1, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Use of the return value of a procedure
an0/Letterpress/code/markdown2/tools/tables-align-columns.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\"\nConvert [tables](https://github.com/trentm/python-markdown2/wiki/tables)\na given Markdown document such that columns are aligned.\n\nLimitations:\n- Can't handle tables where cells have a pipe.\n\"\"\"\n\nfrom __future__ import print_function\n\n__version__ = \"1.0.0\"\n\nimport codecs\nimport os\nfrom pprint import pprint, pformat\nimport re\nimport sys\nfrom collections import defaultdict\n\np = print\n\n\n\n#---- internal support stuff\n\n\n\n\n\n#---- mainline\n\n\nif __name__ == \"__main__\":\n sys.exit( main(sys.argv) )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main(argv):\n for path in argv[1:]:\n text = tables_align_columns(path)\n sys.stdout.write(text.encode(\n sys.stdout.encoding or \"utf-8\", 'xmlcharrefreplace'))", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 136 } ]
[ { "span": "main(sys.argv) ", "start_line": 143, "start_column": 14, "end_line": 143, "end_column": 28 } ]
[ { "span": "def main(argv):", "start_line": 136, "start_column": 0, "end_line": 136, "end_column": 15 } ]
1
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Convert", " ", "[", "tables", "](", "https", "://", "git", "hub", ".", "com", "/", "tre", "nt", "m", "/", "python", "-", "mark", "down", "2", "/", "wiki", "/", "tables", ")", "\\", "10", ";", "a", " ", "give", "n", " ", "Markdown", " ", "document", " ", "suc", "h", " ", "tha", "t", " ", "column", "s", " ", "are", " ", "aligned", ".", "\\", "10", ";", "\\", "10", ";", "Limit", "ation", "s", ":", "\\", "10", ";", "-", " ", "Can", "'", "t", " ", "handle", " ", "tables", " ", "where", " ", "cells", " ", "have", " ", "a", " ", "pipe", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "1.0", ".0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pprint_", ",_", "pformat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "---", " ", "internal", " ", "support", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#-", "---", " ", "mainl", "ine_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "main_", "(_", "sys_", "._", "argv_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "path_", "in_", "argv_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "tables", "\\u", "align", "\\u", "columns_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "text_", "._", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", "._", "encoding_", "or_", "\"", "utf", "-", "8", "\"_", ",_", "'", "xml", "char", "refre", "place", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 4, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
QuantSoftware/QuantSoftwareToolkit/QSTK/qstkfeat/features.py
[ { "content": "'''\n(c) 2011, 2012 Georgia Tech Research Corporation\nThis source code is released under the New BSD license. Please see\nhttp://wiki.quantsoftware.org/index.php?title=QSTK_License\nfor license details.\nCreated on Nov 7, 2011\n\n@author: John Cornwell\n@contact: [email protected]\n@summary: File containing various feature functions\n\n'''\n\n#''' Python imports '''\nimport random\n\n#''' 3rd Party Imports '''\nimport pandas as pand\nimport numpy as np\nimport datetime as dt\n\n#''' QSTK Imports '''\nimport QSTK.qstkutil.tsutil as tsu\nfrom QSTK.qstkutil import DataAccess as da\nimport QSTK.qstkutil.qsdateutil as du\n\n\n\n\n\n\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 pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def featMomentum(dData, lLookback=20, b_human=False ):\n '''\n @summary: N day cumulative return (based on 1) indicator\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n dfPrice = dData['close'].copy()\n \n #Calculate Returns\n tsu.returnize0(dfPrice.values)\n \n #Calculate rolling sum\n dfRet = pand.rolling_sum(dfPrice, lLookback)\n \n \n return dfRet", "metadata": "root.featMomentum", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def featHiLow(dData, lLookback=20, b_human=False ):\n '''\n @summary: 1 represents a high for the lookback -1 represents a low\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n dfPrice = dData['close']\n \n #Find Max for each price for lookback\n maxes = pand.rolling_max(dfPrice, lLookback, 1)\n \n #Find Min\n mins = pand.rolling_min(dfPrice, lLookback, 1)\n \n #Find Range\n ranges = maxes - mins\n \n #Calculate (price - min) * 2 / range -1\n dfRet = (((dfPrice-mins)*2)/ranges)-1\n \n return dfRet", "metadata": "root.featHiLow", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def featDate(dData, b_human=False ):\n '''\n @summary: Returns -1 for jan 1st 1 for dec 31st\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n \n dfPrice = dData['close']\n dfRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=np.zeros(dfPrice.shape) )\n \n for sStock in dfPrice.columns:\n tsPrice = dfPrice[sStock]\n tsRet = dfRet[sStock]\n #'' Loop over time '''\n for i in range(len(tsPrice.index)):\n #get current date\n today = tsPrice.index[i]\n \n #get days since January 1st\n days = today - dt.datetime(today.year, 1, 1)\n \n # multiply by 2, divide by 365, subtract 1\n tsRet[i] = float(days.days * 2) / 365 - 1\n \n return dfRet", "metadata": "root.featDate", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def featOption(dData, b_human=False ):\n '''\n @summary: Returns 1 if option close is today, -1 if it was yesterday\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n dfPrice = dData['close']\n dfRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=np.zeros(dfPrice.shape) )\n \n for sStock in dfPrice.columns:\n tsPrice = dfPrice[sStock]\n tsRet = dfRet[sStock]\n #'' Loop over time '''\n for i in range(len(tsPrice.index)):\n #get current date\n today = tsPrice.index[i]\n \n #get last option close\n last_close = du.getLastOptionClose(today, tsPrice.index)\n \n #get next option close\n next_close = du.getNextOptionClose(today, tsPrice.index)\n \n #get days between\n days_between = next_close - last_close\n \n #get days since last close\n days = today - last_close\n \n # multiply by 2, divide by 365, subtract 1\n tsRet[i] = float(days.days * 2) / days_between.days - 1\n \n return dfRet", "metadata": "root.featOption", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def featMA( dData, lLookback=30, bRel=True, b_human=False ):\n '''\n @summary: Calculate moving average\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n \n dfPrice = dData['close']\n \n dfRet = pand.rolling_mean(dfPrice, lLookback)\n \n if bRel:\n dfRet = dfRet / dfPrice\n if b_human: \n data2 = dfRet * dData['close']\n data3 = pand.DataFrame({\"Raw\":data2[data2.columns[0]]})\n for sym in dfRet.columns:\n if sym != '$SPX' and sym != '$VIX':\n data3[sym + \" Moving Average\"] = data2[sym]\n data3[sym] = dData['close'][sym]\n del data3['Raw']\n return data3\n return dfRet", "metadata": "root.featMA", "header": "['module', '___EOS___']", "index": 154 }, { "content": "def featEMA( dData, lLookback=20, bRel=True, b_human=False ):\n '''\n @summary: Calculate exponential moving average\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n \n dfPrice = dData['close']\n \n dfRet = pand.ewma(dfPrice, span=lLookback)\n \n if bRel:\n dfRet = dfRet / dfPrice;\n if b_human: \n data2 = dfRet*dData['close']\n data3 = pand.DataFrame({\"Raw\":data2[data2.columns[0]]})\n for sym in dfRet.columns:\n if sym != '$SPX' and sym != '$VIX':\n data3[sym + \" Moving Average\"] = data2[sym]\n data3[sym] = dData['close'][sym]\n del data3['Raw']\n return data3 \n return dfRet", "metadata": "root.featEMA", "header": "['module', '___EOS___']", "index": 181 }, { "content": "def featSTD( dData, lLookback=20, bRel=True, b_human=False ):\n '''\n @summary: Calculate standard deviation\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n \n dfPrice = dData['close'].copy()\n \n tsu.returnize1(dfPrice.values)\n dfRet = pand.rolling_std(dfPrice, lLookback)\n \n if bRel:\n dfRet = dfRet / dfPrice\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dfRet", "metadata": "root.featSTD", "header": "['module', '___EOS___']", "index": 207 }, { "content": "def featRSI( dData, lLookback=14, b_human=False):\n '''\n @summary: Calculate RSI\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to look in the past, 14 is standard\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n\n # create deltas per day\n dfDelta = dData['close'].copy()\n dfDelta.ix[1:,:] -= dfDelta.ix[:-1,:].values\n dfDelta.ix[0,:] = np.NAN\n\n dfDeltaUp = dfDelta\n dfDeltaDown = dfDelta.copy()\n \n # seperate data into positive and negative for easy calculations\n for sColumn in dfDeltaUp.columns:\n tsColDown = dfDeltaDown[sColumn]\n tsColDown[tsColDown >= 0] = 0 \n \n tsColUp = dfDeltaUp[sColumn]\n tsColUp[tsColUp <= 0] = 0\n \n # Note we take abs() of negative values, all should be positive now\n dfRolUp = pand.rolling_mean(dfDeltaUp, lLookback, min_periods=1)\n dfRolDown = pand.rolling_mean(dfDeltaDown, lLookback, min_periods=1).abs()\n \n # relative strength\n dfRS = dfRolUp / dfRolDown\n dfRSI = 100.0 - (100.0 / (1.0 + dfRS))\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n \n return dfRSI", "metadata": "root.featRSI", "header": "['module', '___EOS___']", "index": 230 }, { "content": "def featDrawDown( dData, lLookback=30, b_human=False):\n '''\n @summary: Calculate Drawdown for the stock\n @param dData: Dictionary of data to use\n @param lLookback: Days to look back\n @return: DataFrame array containing values\n @param b_human: if true return dataframe to plot\n @warning: Drawdown and RunUp can depend heavily on sample period\n '''\n \n dfPrice = dData['close']\n \n #''' Feature DataFrame will be 1:1, we can use the price as a template '''\n dfRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=np.zeros(dfPrice.shape) )\n \n dfMax = pand.rolling_max(dfPrice, lLookback)\n return (dfMax - dfPrice) / dfMax;\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dfRet", "metadata": "root.featDrawDown", "header": "['module', '___EOS___']", "index": 272 }, { "content": "def featRunUp( dData, lLookback=30, b_human=False ):\n '''\n @summary: CalculateRunup for the stock\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to calculate min over \n @return: DataFrame array containing feature values\n @param b_human: if true return dataframe to plot\n @warning: Drawdown and RunUp can depend heavily on when the sample starts\n '''\n \n dfPrice = dData['close']\n \n dfMax = pand.rolling_min(dfPrice, lLookback)\n return dfPrice / dfMax;\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dfRet", "metadata": "root.featRunUp", "header": "['module', '___EOS___']", "index": 297 }, { "content": "def featVolumeDelta( dData, lLookback=30, b_human=False ):\n '''\n @summary: Calculate moving average\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to use for MA\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n \n dfVolume = dData['volume']\n \n dfRet = pand.rolling_mean(dfVolume, lLookback)\n dfRet /= dfVolume\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close'] \n return dfRet", "metadata": "root.featVolumeDelta", "header": "['module', '___EOS___']", "index": 320 }, { "content": "def featAroon( dData, bDown=False, lLookback=25, b_human=False ):\n '''\n @summary: Calculate Aroon - indicator indicating days since a 25-day \n high/low, weighted between 0 and 100\n @param dData: Dictionary of data to use\n @param bDown: If false, calculates aroonUp (high), else aroonDown (lows)\n @param lLookback: Days to lookback to calculate high/low from\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing feature values\n '''\n \n dfPrice = dData['close']\n\n #Feature DataFrame will be 1:1, we can use the price as a template\n dfRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, \n data=np.zeros(dfPrice.shape) )\n \n #Loop through time\n for i in range(dfPrice.shape[0]):\n if( (i-lLookback) < 0 ):\n dfRet.ix[i,:] = np.NAN\n else:\n if bDown:\n dfRet.ix[i,:] = dfPrice.values[i:(i-lLookback):-1,:].argmin(\n axis=0)\n else:\n dfRet.ix[i,:] = dfPrice.values[i:(i-lLookback):-1,:].argmax(\n axis=0)\n \n dfRet = ((lLookback - 1.) - dfRet) / (lLookback - 1.) * 100.\n\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dfRet", "metadata": "root.featAroon", "header": "['module', '___EOS___']", "index": 341 }, { "content": "def featAroonDown( dData, lLookback=25, b_human=False ):\n '''\n @summary: Wrapper to call aroon with flag = true\n '''\n return featAroon(dData, bDown=True, lLookback=lLookback, b_human=b_human)", "metadata": "root.featAroonDown", "header": "['module', '___EOS___']", "index": 380 }, { "content": "def featStochastic( dData, lLookback=14, bFast=True, lMA=3, b_human=False ):\n '''\n @summary: Calculate stochastic oscillator - indicates what range of recent low-high spread we are in.\n @param dData: Dictionary of data to use\n @param bFast: If false, do slow stochastics, 3 day MA, if not use fast, no MA\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing feature values\n '''\n\n dfLow = dData['low']\n dfHigh = dData['high']\n dfPrice = dData['close']\n\n \n #''' Loop through stocks '''\n dfLows = pand.rolling_min(dfLow, lLookback)\n dfHighs = pand.rolling_max(dfHigh, lLookback)\n \n dfStoch = (dfPrice - dfLows) / (dfHighs - dfLows)\n \n #''' For fast we just take the stochastic value, slow we need 3 day MA '''\n if not bFast:\n dfStoch = pand.rolling_mean(dfStoch, lMA)\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n \n return dfStoch", "metadata": "root.featStochastic", "header": "['module', '___EOS___']", "index": 387 }, { "content": "def featBeta( dData, lLookback=14, sMarket='$SPX', b_human=False ):\n '''\n @summary: Calculate beta relative to a given stock/index.\n @param dData: Dictionary of data to use\n @param sStock: Stock to calculate beta relative to\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing feature values\n '''\n\n dfPrice = dData['close']\n\n #''' Calculate returns '''\n dfRets = dfPrice.copy()\n tsu.returnize1(dfRets.values)\n\n tsMarket = dfRets[sMarket]\n\n dfRet = pand.rolling_cov(tsMarket, dfRets, lLookback)\n dfRet /= dfRet[sMarket]\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dfRet", "metadata": "root.featBeta", "header": "['module', '___EOS___']", "index": 419 }, { "content": "def featBollinger( dData, lLookback=20, b_human=False ):\n '''\n @summary: Calculate bollinger position as a function of std deviations.\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to calculate moving average over\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing feature values\n '''\n if b_human:\n dfPrice = dData['close']\n nstdsRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=np.zeros(dfPrice.shape) )\n #average minus standard deviation\n pstdsRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=np.zeros(dfPrice.shape) ) \n data3 = pand.DataFrame({\"Raw\":dfPrice[dfPrice.columns[0]]})\n for sym in dfPrice.columns:\n if sym != '$SPX' and sym != '$VIX':\n tsPrice = dfPrice[sym]\n nstdRet = nstdsRet[sym]\n pstdRet = pstdsRet[sym]\n for i in range(len(tsPrice.index)):\n if i < lLookback - 1:\n nstdRet[i] = float('nan')\n pstdRet[i] = float('nan')\n continue \n fAvg = np.average( tsPrice[ i-(lLookback-1):i+1 ] )\n fStd = np.std( tsPrice[ i-(lLookback-1):i+1 ] )\n pstdRet[i] = fAvg+2.0*fStd\n nstdRet[i] = fAvg-2.0*fStd \n data3[sym] = dfPrice[sym]\n data3[sym + \" Lower\"] = nstdsRet[sym]\n data3[sym + \" Upper\"] = pstdsRet[sym]\n del data3['Raw']\n return data3\n else:\n dfPrice = dData['close']\n #''' Feature DataFrame will be 1:1, we can use the price as a template '''\n dfRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=np.zeros(dfPrice.shape) )\n \n #''' Loop through stocks '''\n dfAvg = pand.rolling_mean(dfPrice, lLookback)\n dfStd = pand.rolling_std(dfPrice, lLookback)\n return (dfPrice - dfAvg) / (2.0*dfStd)", "metadata": "root.featBollinger", "header": "['module', '___EOS___']", "index": 446 }, { "content": "def featCorrelation( dData, lLookback=20, sRel='$SPX', b_human=False ):\n '''\n @summary: Calculate correlation of two stocks.\n @param dData: Dictionary of data to use\n @param lLookback: Number of days to calculate moving average over\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing feature values\n '''\n\n dfPrice = dData['close']\n \n if sRel not in dfPrice.columns:\n raise KeyError( \"%s not found in data provided to featCorrelation\"%sRel )\n \n #''' Calculate returns '''\n naRets = dfPrice.values.copy()\n tsu.returnize1(naRets)\n dfHistReturns = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=naRets )\n\n #''' Feature DataFrame will be 1:1, we can use the price as a template '''\n dfRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, data=np.zeros(dfPrice.shape) )\n \n #''' Loop through stocks '''\n for sStock in dfHistReturns.columns: \n tsHistReturns = dfHistReturns[sStock]\n tsRelativeReturns = dfHistReturns[sRel]\n tsRet = dfRet[sStock]\n \n #''' Loop over time '''\n for i in range(len(tsHistReturns.index)):\n \n #''' NaN if not enough data to do lookback '''\n if i < lLookback - 1:\n tsRet[i] = float('nan')\n continue \n \n naCorr = np.corrcoef( tsHistReturns[ i-(lLookback-1):i+1 ], tsRelativeReturns[ i-(lLookback-1):i+1 ] )\n \n tsRet[i] = naCorr[0,1]\n\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dfRet", "metadata": "root.featCorrelation", "header": "['module', '___EOS___']", "index": 490 }, { "content": "def featPrice(dData, b_human=False):\n '''\n @summary: Price feature\n @param dData: Dictionary of data to use\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dData['close']", "metadata": "root.featPrice", "header": "['module', '___EOS___']", "index": 537 }, { "content": "def featVolume(dData, b_human=False):\n '''\n @summary: Volume feature\n @param dData: Dictionary of data to use\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dData['volume']", "metadata": "root.featVolume", "header": "['module', '___EOS___']", "index": 552 }, { "content": "def featRand( dData, b_human=False ):\n '''\n @summary: Random feature - used for robustness testing\n @param dData: Dictionary of data to use\n @param b_human: if true return dataframe to plot\n @return: DataFrame array containing values\n '''\n \n dfPrice = dData['close']\n \n #''' Feature DataFrame will be 1:1, we can use the price as a template '''\n dfRet = pand.DataFrame( index=dfPrice.index, columns=dfPrice.columns, \n data=np.random.randn(*dfPrice.shape) )\n \n if b_human:\n for sym in dData['close']:\n x=1000/dData['close'][sym][0]\n dData['close'][sym]=dData['close'][sym]*x\n return dData['close']\n return dfRet", "metadata": "root.featRand", "header": "['module', '___EOS___']", "index": 567 } ]
[ { "span": "import random", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 13 }, { "span": "from QSTK.qstkutil import DataAccess as da", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 42 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "(", "c", ")", " ", "2011", ",", " ", "2012", " ", "Georg", "ia", " ", "Te", "ch", " ", "Rese", "arch", " ", "Cor", "porat", "ion", "\\", "10", ";", "Thi", "s", " ", "source", " ", "code", " ", "is", " ", "released", " ", "under", " ", "the", " ", "New", " ", "BS", "D", " ", "license", ".", " ", " ", "Ple", "ase", " ", "see", "\\", "10", ";", "http", "://", "wiki", ".", "quant", "software", ".", "org", "/", "index", ".", "php", "?", "title", "=", "QS", "TK", "\\u", "License", "\\", "10", ";", "for", " ", "license", " ", "deta", "il", "s", ".", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Nov", " ", "7", ",", " ", "2011", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Joh", "n", " ", "Cor", "nw", "ell", "\\", "10", ";", "@", "contact", ":", " ", "Joh", "n", "WC", "orn", "well", "V", "@", "gma", "il", ".", "com", "\\", "10", ";", "@", "summar", "y", ":", " ", "File", " ", "contain", "ing", " ", "vari", "ous", " ", "feature", " ", "function", "s", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Pyth", "on", " ", "import", "s", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "3", "rd", " ", "Part", "y", " ", "Imports", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pandas_", "as_", "pand", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "as_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "QS", "TK", " ", "Imports", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "QS", "TK", "_", "._", "qst", "ku", "til_", "._", "tsu", "til_", "as_", "tsu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "QS", "TK", "_", "._", "qst", "ku", "til_", "import_", "Data", "Access_", "as_", "da_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "QS", "TK", "_", "._", "qst", "ku", "til_", "._", "qs", "dateutil_", "as_", "du_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "feat", "Moment", "um_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "20_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "N", " ", "day", " ", "cumul", "ative", " ", "return", " ", "(", "based", " ", "on", " ", "1", ")", " ", "indicat", "or", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Calculat", "e", " ", "Return", "s_", "\\u\\u\\uNL\\u\\u\\u_", "tsu", "_", "._", "return", "ize", "0_", "(_", "df", "Price_", "._", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Calculat", "e", " ", "rolling", " ", "sum_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "rolling", "\\u", "sum_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df", "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_", "feat", "Hi", "Low_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "20_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "1", " ", "represent", "s", " ", "a", " ", "high", " ", "for", " ", "the", " ", "look", "back", " ", "-1", " ", "represent", "s", " ", "a", " ", "low", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Fin", "d", " ", "Max", " ", "for", " ", "each", " ", "price", " ", "for", " ", "look", "back_", "\\u\\u\\uNL\\u\\u\\u_", "maxe", "s_", "=_", "pand", "_", "._", "rolling", "\\u", "max_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Fin", "d", " ", "Min_", "\\u\\u\\uNL\\u\\u\\u_", "mins_", "=_", "pand", "_", "._", "rolling", "\\u", "min_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Fin", "d", " ", "Range_", "\\u\\u\\uNL\\u\\u\\u_", "ranges_", "=_", "maxe", "s_", "-_", "mins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Calculat", "e", " ", "(", "price", " ", "-", " ", "min", ")", " ", "*", " ", "2", " ", "/", " ", "range", " ", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "(_", "(_", "(_", "df", "Price_", "-_", "mins_", ")_", "*_", "2_", ")_", "/_", "ranges_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "df", "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_", "feat", "Date_", "(_", "d", "Data_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Return", "s", " ", "-1", " ", "for", " ", "jan", " ", "1s", "t", " ", "1", " ", "for", " ", "dec", " ", "3", "1s", "t", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s", "Stock", "_", "in_", "df", "Price_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts", "Price_", "=_", "df", "Price_", "[_", "s", "Stock", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts", "Ret_", "=_", "df", "Ret_", "[_", "s", "Stock", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#'", "'", " ", "Loop", " ", "over", " ", "time", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "ts", "Price_", "._", "index_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "get", " ", "current", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "today_", "=_", "ts", "Price_", "._", "index_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "day", "s", " ", "sinc", "e", " ", "Januar", "y", " ", "1s", "t_", "\\u\\u\\uNL\\u\\u\\u_", "days_", "=_", "today_", "-_", "dt_", "._", "datetime_", "(_", "today_", "._", "year_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multipl", "y", " ", "by", " ", "2", ",", " ", "divide", " ", "by", " ", "365", ",", " ", "subtract", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "ts", "Ret_", "[_", "i_", "]_", "=_", "float_", "(_", "days_", "._", "days_", "*_", "2_", ")_", "/_", "365_", "-_", "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_", "df", "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_", "feat", "Option_", "(_", "d", "Data_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Return", "s", " ", "1", " ", "if", " ", "option", " ", "close", " ", "is", " ", "toda", "y", ",", " ", "-1", " ", "if", " ", "it", " ", "was", " ", "yesterday", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s", "Stock", "_", "in_", "df", "Price_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts", "Price_", "=_", "df", "Price_", "[_", "s", "Stock", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts", "Ret_", "=_", "df", "Ret_", "[_", "s", "Stock", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#'", "'", " ", "Loop", " ", "over", " ", "time", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "ts", "Price_", "._", "index_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "get", " ", "current", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "today_", "=_", "ts", "Price_", "._", "index_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "last", " ", "option", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "last", "\\u", "close_", "=_", "du_", "._", "get", "Las", "t", "Optio", "n", "Close_", "(_", "today_", ",_", "ts", "Price_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "next", " ", "option", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "close_", "=_", "du_", "._", "get", "Ne", "xt", "Optio", "n", "Close_", "(_", "today_", ",_", "ts", "Price_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "day", "s", " ", "between_", "\\u\\u\\uNL\\u\\u\\u_", "day", "s", "\\u", "between_", "=_", "next", "\\u", "close_", "-_", "last", "\\u", "close_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "get", " ", "day", "s", " ", "sinc", "e", " ", "last", " ", "close_", "\\u\\u\\uNL\\u\\u\\u_", "days_", "=_", "today_", "-_", "last", "\\u", "close_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multipl", "y", " ", "by", " ", "2", ",", " ", "divide", " ", "by", " ", "365", ",", " ", "subtract", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "ts", "Ret_", "[_", "i_", "]_", "=_", "float_", "(_", "days_", "._", "days_", "*_", "2_", ")_", "/_", "day", "s", "\\u", "between_", "._", "days_", "-_", "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_", "df", "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_", "feat", "MA_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "30_", ",_", "b", "Rel", "_", "=_", "True_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "movin", "g", " ", "averag", "e", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "rolling", "\\u", "mean_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "Rel", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Ret_", "=_", "df", "Ret_", "/_", "df", "Price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data2_", "=_", "df", "Ret_", "*_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "3_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "{_", "\"", "Ra", "w", "\"_", ":_", "data2_", "[_", "data2_", "._", "columns_", "[_", "0_", "]_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sym_", "in_", "df", "Ret_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sym_", "!=_", "'$", "SP", "X", "'_", "and_", "sym_", "!=_", "'$", "VI", "X", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "3_", "[_", "sym_", "+_", "\"", " ", "Movi", "ng", " ", "Average", "\"_", "]_", "=_", "data2_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "3_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "data", "3_", "[_", "'", "Ra", "w", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "EMA", "_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "20_", ",_", "b", "Rel", "_", "=_", "True_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "exponential", " ", "movin", "g", " ", "averag", "e", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "ew", "ma_", "(_", "df", "Price_", ",_", "span_", "=_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "Rel", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Ret_", "=_", "df", "Ret_", "/_", "df", "Price_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data2_", "=_", "df", "Ret_", "*_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "3_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "{_", "\"", "Ra", "w", "\"_", ":_", "data2_", "[_", "data2_", "._", "columns_", "[_", "0_", "]_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sym_", "in_", "df", "Ret_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sym_", "!=_", "'$", "SP", "X", "'_", "and_", "sym_", "!=_", "'$", "VI", "X", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data", "3_", "[_", "sym_", "+_", "\"", " ", "Movi", "ng", " ", "Average", "\"_", "]_", "=_", "data2_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "3_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "data", "3_", "[_", "'", "Ra", "w", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "STD", "_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "20_", ",_", "b", "Rel", "_", "=_", "True_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "standard", " ", "deviation", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tsu", "_", "._", "return", "ize", "1_", "(_", "df", "Price_", "._", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "rolling", "\\u", "std_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "Rel", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Ret_", "=_", "df", "Ret_", "/_", "df", "Price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "RSI", "_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "14_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "RSI", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "look", " ", "in", " ", "the", " ", "past", ",", " ", "14", " ", "is", " ", "standard", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "deltas", " ", "per", " ", "day_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Delta_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Delta_", "._", "ix_", "[_", "1_", ":_", ",_", ":_", "]_", "-=_", "df", "Delta_", "._", "ix_", "[_", ":_", "-_", "1_", ",_", ":_", "]_", "._", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Delta_", "._", "ix_", "[_", "0_", ",_", ":_", "]_", "=_", "np_", "._", "NAN", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Del", "ta", "Up_", "=_", "df", "Delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Del", "ta", "Down_", "=_", "df", "Delta_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "seperat", "e", " ", "data", " ", "int", "o", " ", "posit", "ive", " ", "and", " ", "negati", "ve", " ", "for", " ", "easy", " ", "calculati", "ons_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s", "Column_", "in_", "df", "Del", "ta", "Up_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts", "Col", "Down_", "=_", "df", "Del", "ta", "Down_", "[_", "s", "Column_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts", "Col", "Down_", "[_", "ts", "Col", "Down_", ">=_", "0_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ts", "Col", "Up_", "=_", "df", "Del", "ta", "Up_", "[_", "s", "Column_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts", "Col", "Up_", "[_", "ts", "Col", "Up_", "<=_", "0_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "we", " ", "take", " ", "abs", "()", " ", "of", " ", "negati", "ve", " ", "values", ",", " ", "all", " ", "shou", "ld", " ", "be", " ", "posit", "ive", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df", "Ro", "l", "Up_", "=_", "pand", "_", "._", "rolling", "\\u", "mean_", "(_", "df", "Del", "ta", "Up_", ",_", "l", "Look", "back_", ",_", "min", "\\u", "periods_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Ro", "l", "Down_", "=_", "pand", "_", "._", "rolling", "\\u", "mean_", "(_", "df", "Del", "ta", "Down_", ",_", "l", "Look", "back_", ",_", "min", "\\u", "periods_", "=_", "1_", ")_", "._", "abs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "strength_", "\\u\\u\\uNL\\u\\u\\u_", "df", "RS_", "=_", "df", "Ro", "l", "Up_", "/_", "df", "Ro", "l", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "RSI", "_", "=_", "100.0_", "-_", "(_", "100.0_", "/_", "(_", "1.0_", "+_", "df", "RS_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "RSI", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feat", "Draw", "Down_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "30_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "Draw", "down", " ", "for", " ", "the", " ", "stock", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Day", "s", " ", "to", " ", "look", " ", "back", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "warn", "ing", ":", " ", "Draw", "down", " ", "and", " ", "Run", "Up", " ", "can", " ", "depend", " ", "heav", "il", "y", " ", "on", " ", "sample", " ", "period", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Feature", " ", "Data", "Frame", " ", "will", " ", "be", " ", "1", ":", "1", ",", " ", "we", " ", "can", " ", "use", " ", "the", " ", "price", " ", "as", " ", "a", " ", "template", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Max_", "=_", "pand", "_", "._", "rolling", "\\u", "max_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "df", "Max_", "-_", "df", "Price_", ")_", "/_", "df", "Max_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "Run", "Up_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "30_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", "Run", "up", " ", "for", " ", "the", " ", "stock", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "calcul", "ate", " ", "min", " ", "over", " ", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "feature", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "warn", "ing", ":", " ", "Draw", "down", " ", "and", " ", "Run", "Up", " ", "can", " ", "depend", " ", "heav", "il", "y", " ", "on", " ", "whe", "n", " ", "the", " ", "sample", " ", "starts", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Max_", "=_", "pand", "_", "._", "rolling", "\\u", "min_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "df", "Price_", "/_", "df", "Max_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "Volume", "Delta_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "30_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "movin", "g", " ", "averag", "e", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "use", " ", "for", " ", "MA", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Volume_", "=_", "d", "Data_", "[_", "'", "volume", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "rolling", "\\u", "mean_", "(_", "df", "Volume_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Ret_", "/=_", "df", "Volume_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "Aro", "on_", "(_", "d", "Data_", ",_", "b", "Down_", "=_", "False_", ",_", "l", "Look", "back_", "=_", "25_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "Aro", "on", " ", "-", " ", "indicat", "or", " ", "indicati", "ng", " ", "day", "s", " ", "sinc", "e", " ", "a", " ", "25", "-", "day", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "high", "/", "low", ",", " ", "weight", "ed", " ", "bet", "ween", " ", "0", " ", "and", " ", "100", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "Down", ":", " ", "If", " ", "fal", "se", ",", " ", "calcul", "ates", " ", "aro", "on", "Up", " ", "(", "high", "),", " ", "else", " ", "aro", "on", "Down", " ", "(", "lows", ")", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Day", "s", " ", "to", " ", "look", "back", " ", "to", " ", "calcul", "ate", " ", "high", "/", "low", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "feature", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Feature", " ", "Data", "Frame", " ", "will", " ", "be", " ", "1", ":", "1", ",", " ", "we", " ", "can", " ", "use", " ", "the", " ", "price", " ", "as", " ", "a", " ", "template_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Loop", " ", "through", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "df", "Price_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "(_", "i_", "-_", "l", "Look", "back_", ")_", "<_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Ret_", "._", "ix_", "[_", "i_", ",_", ":_", "]_", "=_", "np_", "._", "NAN", "_", "\\u\\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_", "b", "Down_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Ret_", "._", "ix_", "[_", "i_", ",_", ":_", "]_", "=_", "df", "Price_", "._", "values_", "[_", "i_", ":_", "(_", "i_", "-_", "l", "Look", "back_", ")_", ":_", "-_", "1_", ",_", ":_", "]_", "._", "argmin_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Ret_", "._", "ix_", "[_", "i_", ",_", ":_", "]_", "=_", "df", "Price_", "._", "values_", "[_", "i_", ":_", "(_", "i_", "-_", "l", "Look", "back_", ")_", ":_", "-_", "1_", ",_", ":_", "]_", "._", "argmax_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df", "Ret_", "=_", "(_", "(_", "l", "Look", "back_", "-_", "1._", ")_", "-_", "df", "Ret_", ")_", "/_", "(_", "l", "Look", "back_", "-_", "1._", ")_", "*_", "100._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "Aro", "on", "Down_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "25_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Wrapper", " ", "to", " ", "call", " ", "aro", "on", " ", "with", " ", "flag", " ", "=", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "feat", "Aro", "on_", "(_", "d", "Data_", ",_", "b", "Down_", "=_", "True_", ",_", "l", "Look", "back_", "=_", "l", "Look", "back_", ",_", "b", "\\u", "human_", "=_", "b", "\\u", "human_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feat", "Sto", "chas", "tic_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "14_", ",_", "b", "Fast", "_", "=_", "True_", ",_", "l", "MA_", "=_", "3_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "stochastic", " ", "oscil", "lator", " ", "-", " ", "indicat", "es", " ", "what", " ", "range", " ", "of", " ", "recent", " ", "low", "-", "high", " ", "spread", " ", "we", " ", "are", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "Fast", ":", " ", "If", " ", "fal", "se", ",", " ", "do", " ", "slow", " ", "stochastic", "s", ",", " ", "3", " ", "day", " ", "MA", ",", " ", "if", " ", "not", " ", "use", " ", "fast", ",", " ", "no", " ", "MA", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "feature", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Low_", "=_", "d", "Data_", "[_", "'", "low", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "High_", "=_", "d", "Data_", "[_", "'", "high", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Loop", " ", "through", " ", "stocks", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Lo", "ws_", "=_", "pand", "_", "._", "rolling", "\\u", "min_", "(_", "df", "Low_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Hig", "hs_", "=_", "pand", "_", "._", "rolling", "\\u", "max_", "(_", "df", "High_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Sto", "ch_", "=_", "(_", "df", "Price_", "-_", "df", "Lo", "ws_", ")_", "/_", "(_", "df", "Hig", "hs_", "-_", "df", "Lo", "ws_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "For", " ", "fast", " ", "we", " ", "just", " ", "take", " ", "the", " ", "stochastic", " ", "value", ",", " ", "slow", " ", "we", " ", "need", " ", "3", " ", "day", " ", "MA", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "b", "Fast", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Sto", "ch_", "=_", "pand", "_", "._", "rolling", "\\u", "mean_", "(_", "df", "Sto", "ch_", ",_", "l", "MA_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "Sto", "ch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feat", "Beta", "_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "14_", ",_", "s", "Market", "_", "=_", "'$", "SP", "X", "'_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "beta", " ", "relative", " ", "to", " ", "a", " ", "give", "n", " ", "stock", "/", "index", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "s", "Stock", ":", " ", "Stock", " ", "to", " ", "calcul", "ate", " ", "beta", " ", "relative", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "feature", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Calculat", "e", " ", "return", "s", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret", "s_", "=_", "df", "Price_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tsu", "_", "._", "return", "ize", "1_", "(_", "df", "Ret", "s_", "._", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ts", "Market", "_", "=_", "df", "Ret", "s_", "[_", "s", "Market", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "rolling", "\\u", "cov_", "(_", "ts", "Market", "_", ",_", "df", "Ret", "s_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Ret_", "/=_", "df", "Ret_", "[_", "s", "Market", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "Bol", "ling", "er_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "20_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "bol", "ling", "er", " ", "position", " ", "as", " ", "a", " ", "function", " ", "of", " ", "std", " ", "deviation", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "calcul", "ate", " ", "movin", "g", " ", "averag", "e", " ", "over", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "feature", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nst", "ds", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "averag", "e", " ", "minu", "s", " ", "standard", " ", "deviation", "_", "\\u\\u\\uNL\\u\\u\\u_", "pst", "ds", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "3_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "{_", "\"", "Ra", "w", "\"_", ":_", "df", "Price_", "[_", "df", "Price_", "._", "columns_", "[_", "0_", "]_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sym_", "in_", "df", "Price_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sym_", "!=_", "'$", "SP", "X", "'_", "and_", "sym_", "!=_", "'$", "VI", "X", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts", "Price_", "=_", "df", "Price_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nst", "d", "Ret_", "=_", "nst", "ds", "Ret_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pst", "d", "Ret_", "=_", "pst", "ds", "Ret_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "ts", "Price_", "._", "index_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "i_", "<_", "l", "Look", "back_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "nst", "d", "Ret_", "[_", "i_", "]_", "=_", "float_", "(_", "'", "nan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pst", "d", "Ret_", "[_", "i_", "]_", "=_", "float_", "(_", "'", "nan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "Avg_", "=_", "np_", "._", "average_", "(_", "ts", "Price_", "[_", "i_", "-_", "(_", "l", "Look", "back_", "-_", "1_", ")_", ":_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Std", "_", "=_", "np_", "._", "std_", "(_", "ts", "Price_", "[_", "i_", "-_", "(_", "l", "Look", "back_", "-_", "1_", ")_", ":_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pst", "d", "Ret_", "[_", "i_", "]_", "=_", "f", "Avg_", "+_", "2.0_", "*_", "f", "Std", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nst", "d", "Ret_", "[_", "i_", "]_", "=_", "f", "Avg_", "-_", "2.0_", "*_", "f", "Std", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data", "3_", "[_", "sym_", "]_", "=_", "df", "Price_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "3_", "[_", "sym_", "+_", "\"", " ", "Lower", "\"_", "]_", "=_", "nst", "ds", "Ret_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "3_", "[_", "sym_", "+_", "\"", " ", "Upp", "er", "\"_", "]_", "=_", "pst", "ds", "Ret_", "[_", "sym_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "data", "3_", "[_", "'", "Ra", "w", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data", "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 ", " _", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#'", "''", " ", "Feature", " ", "Data", "Frame", " ", "will", " ", "be", " ", "1", ":", "1", ",", " ", "we", " ", "can", " ", "use", " ", "the", " ", "price", " ", "as", " ", "a", " ", "template", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Loop", " ", "through", " ", "stocks", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Avg_", "=_", "pand", "_", "._", "rolling", "\\u", "mean_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Std", "_", "=_", "pand", "_", "._", "rolling", "\\u", "std_", "(_", "df", "Price_", ",_", "l", "Look", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "df", "Price_", "-_", "df", "Avg_", ")_", "/_", "(_", "2.0_", "*_", "df", "Std", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feat", "Correla", "tion_", "(_", "d", "Data_", ",_", "l", "Look", "back_", "=_", "20_", ",_", "s", "Rel", "_", "=_", "'$", "SP", "X", "'_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Calculat", "e", " ", "correlation", " ", "of", " ", "two", " ", "stocks", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "l", "Look", "back", ":", " ", "Number", " ", "of", " ", "day", "s", " ", "to", " ", "calcul", "ate", " ", "movin", "g", " ", "averag", "e", " ", "over", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "feature", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "s", "Rel", "_", "not_", "in_", "df", "Price_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "Error_", "(_", "\"%", "s", " ", "not", " ", "found", " ", "in", " ", "data", " ", "provided", " ", "to", " ", "feat", "Correla", "tion", "\"_", "%_", "s", "Rel", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Calculat", "e", " ", "return", "s", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "na", "Ret", "s_", "=_", "df", "Price_", "._", "values_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tsu", "_", "._", "return", "ize", "1_", "(_", "na", "Ret", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "df", "Hist", "Return", "s_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "na", "Ret", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Feature", " ", "Data", "Frame", " ", "will", " ", "be", " ", "1", ":", "1", ",", " ", "we", " ", "can", " ", "use", " ", "the", " ", "price", " ", "as", " ", "a", " ", "template", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "data_", "=_", "np_", "._", "zeros_", "(_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Loop", " ", "through", " ", "stocks", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s", "Stock", "_", "in_", "df", "Hist", "Return", "s_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts", "Hist", "Return", "s_", "=_", "df", "Hist", "Return", "s_", "[_", "s", "Stock", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts", "Relative", "Return", "s_", "=_", "df", "Hist", "Return", "s_", "[_", "s", "Rel", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ts", "Ret_", "=_", "df", "Ret_", "[_", "s", "Stock", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Loop", " ", "over", " ", "time", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "ts", "Hist", "Return", "s_", "._", "index_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Na", "N", " ", "if", " ", "not", " ", "eno", "ugh", " ", "data", " ", "to", " ", "do", " ", "look", "back", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "<_", "l", "Look", "back_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ts", "Ret_", "[_", "i_", "]_", "=_", "float_", "(_", "'", "nan", "'_", ")_", "\\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_", "na", "Corr", "_", "=_", "np_", "._", "corr", "coef_", "(_", "ts", "Hist", "Return", "s_", "[_", "i_", "-_", "(_", "l", "Look", "back_", "-_", "1_", ")_", ":_", "i_", "+_", "1_", "]_", ",_", "ts", "Relative", "Return", "s_", "[_", "i_", "-_", "(_", "l", "Look", "back_", "-_", "1_", ")_", ":_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ts", "Ret_", "[_", "i_", "]_", "=_", "na", "Corr", "_", "[_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "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_", "feat", "Price_", "(_", "d", "Data_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Price", " ", "feature", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feat", "Volume_", "(_", "d", "Data_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Volume", " ", "feature", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "volume", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "feat", "Ran", "d_", "(_", "d", "Data_", ",_", "b", "\\u", "human_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Random", " ", "feature", " ", "-", " ", "used", " ", "for", " ", "robust", "ness", " ", "testi", "ng", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "d", "Data", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "data", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "b", "\\u", "human", ":", " ", "if", " ", "true", " ", "return", " ", "dataframe", " ", "to", " ", "plot", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Data", "Frame", " ", "array", " ", "contain", "ing", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Price_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "''", " ", "Feature", " ", "Data", "Frame", " ", "will", " ", "be", " ", "1", ":", "1", ",", " ", "we", " ", "can", " ", "use", " ", "the", " ", "price", " ", "as", " ", "a", " ", "template", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "df", "Ret_", "=_", "pand", "_", "._", "Data", "Frame_", "(_", "index_", "=_", "df", "Price_", "._", "index_", ",_", "columns_", "=_", "df", "Price_", "._", "columns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "*_", "df", "Price_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b", "\\u", "human_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sym_", "in_", "d", "Data_", "[_", "'", "close", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1000_", "/_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "=_", "d", "Data_", "[_", "'", "close", "'_", "]_", "[_", "sym_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d", "Data_", "[_", "'", "close", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "df", "Ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ipython/ipython-py3k/IPython/deathrow/oldfrontend/prefilterfrontend.py
[ { "content": " def __init__(self, ipython0=None, *args, **kwargs):\n \"\"\" Parameters\n ----------\n\n ipython0: an optional ipython0 instance to use for command\n prefiltering and completion.\n \"\"\"\n LineFrontEndBase.__init__(self, *args, **kwargs)\n self.shell.output_trap = RedirectorOutputTrap(\n out_callback=self.write,\n err_callback=self.write,\n )\n self.shell.traceback_trap = SyncTracebackTrap(\n formatters=self.shell.traceback_trap.formatters,\n )\n\n # Start the ipython0 instance:\n self.save_output_hooks()\n if ipython0 is None:\n # Instanciate an IPython0 InteractiveShell to be able to use the\n # prefiltering.\n # Suppress all key input, to avoid waiting\n def my_rawinput(x=None):\n return '\\n'\n old_rawinput = builtins.raw_input\n builtins.raw_input = my_rawinput\n ipython0 = InteractiveShell(\n parent=None, user_ns=self.shell.user_ns,\n user_global_ns=self.shell.user_global_ns\n )\n builtins.raw_input = old_rawinput\n self.ipython0 = ipython0\n # Set the pager:\n self.ipython0.set_hook('show_in_pager', \n lambda s, string: self.write(\"\\n\" + string))\n self.ipython0.write = self.write\n self._ip = _ip = self.ipython0\n # Make sure the raw system call doesn't get called, as we don't\n # have a stdin accessible.\n self._ip.system = self.system_call\n # XXX: Muck around with magics so that they work better\n # in our environment\n if not sys.platform.startswith('win'):\n self.ipython0.magic_ls = mk_system_call(self.system_call, \n 'ls -CF')\n # And now clean up the mess created by ipython0\n self.release_output()\n\n\n if not 'banner' in kwargs and self.banner is None:\n self.banner = self.ipython0.banner\n\n # FIXME: __init__ and start should be two different steps\n self.start()", "metadata": "root.PrefilterFrontEnd.__init__", "header": "['class', 'PrefilterFrontEnd', '(', 'LineFrontEndBase', ')', ':', '___EOS___']", "index": 68 } ]
[ { "span": "_ip ", "start_line": 104, "start_column": 19, "end_line": 104, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Pref", "ilter", "Front", "End_", "(_", "Line", "Front", "End", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "ipython", "0_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "ipython", "0", ":", " ", "an", " ", "option", "al", " ", "ipython", "0", " ", "instance", " ", "to", " ", "use", " ", "for", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "prefi", "lter", "ing", " ", "and", " ", "completion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Line", "Front", "End", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shell_", "._", "output", "\\u", "trap_", "=_", "Redirect", "or", "Output", "Tra", "p_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "out", "\\u", "callback_", "=_", "self_", "._", "write_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "err", "\\u", "callback_", "=_", "self_", "._", "write_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shell_", "._", "traceback", "\\u", "trap_", "=_", "Sync", "Trace", "back", "Tra", "p_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "=_", "self_", "._", "shell_", "._", "traceback", "\\u", "trap_", "._", "formatters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "ipython", "0", " ", "instance", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "save", "\\u", "output", "\\u", "hooks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ipython", "0_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Insta", "ncia", "te", " ", "an", " ", "IP", "yth", "on", "0", " ", "Interact", "ive", "Shel", "l", " ", "to", " ", "be", " ", "able", " ", "to", " ", "use", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prefi", "lter", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Suppress", " ", "all", " ", "key", " ", "input", ",", " ", "to", " ", "avoid", " ", "waiting_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "my", "\\u", "raw", "input_", "(_", "x_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "raw", "input_", "=_", "builtins_", "._", "raw", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtins_", "._", "raw", "\\u", "input_", "=_", "my", "\\u", "raw", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipython", "0_", "=_", "Interact", "ive", "Shell_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "None_", ",_", "user", "\\u", "ns_", "=_", "self_", "._", "shell_", "._", "user", "\\u", "ns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "global", "\\u", "ns_", "=_", "self_", "._", "shell_", "._", "user", "\\u", "global", "\\u", "ns_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtins_", "._", "raw", "\\u", "input_", "=_", "old", "\\u", "raw", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ipython", "0_", "=_", "ipython", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "pager", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ipython", "0_", "._", "set\\u", "hook_", "(_", "'", "show", "\\u", "in", "\\u", "pager", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "s_", ",_", "string_", ":_", "self_", "._", "write_", "(_", "\"\\\\", "n", "\"_", "+_", "string_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ipython", "0_", "._", "write_", "=_", "self_", "._", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ip_", "=_", "\\u", "ip_", "=_", "self_", "._", "ipython", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "raw", " ", "system", " ", "call", " ", "doe", "sn", "'", "t", " ", "get", " ", "call", "ed", ",", " ", "as", " ", "we", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "a", " ", "std", "in", " ", "accessible", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ip_", "._", "system_", "=_", "self_", "._", "system", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Mu", "ck", " ", "aro", "und", " ", "with", " ", "magic", "s", " ", "so", " ", "tha", "t", " ", "the", "y", " ", "work", " ", "bett", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "our", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ipython", "0_", "._", "magic", "\\u", "ls_", "=_", "mk", "\\u", "system", "\\u", "call_", "(_", "self_", "._", "system", "\\u", "call_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ls", " ", "-", "CF", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "And", " ", "now", " ", "clean", " ", "up", " ", "the", " ", "mess", " ", "created", " ", "by", " ", "ipython", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "release", "\\u", "output_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "'", "banner", "'_", "in_", "kwargs_", "and_", "self_", "._", "banner_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "banner_", "=_", "self_", "._", "ipython", "0_", "._", "banner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "\\u\\u", "init", "\\u\\u", " ", "and", " ", "start", " ", "shou", "ld", " ", "be", " ", "two", " ", "different", " ", "steps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "start_", "(_", ")_", "\\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,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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 ]
Except block handles 'BaseException'
MediaMath/qasino/lib/sqlite_backend.py
[ { "content": " def preload_tables_list(self, txn):\n \"\"\" \n This is used upon initial open of the db to get an actual list\n of tables from the db.\n \"\"\"\n\n self.do_sql(txn, \"SELECT tbl_name FROM sqlite_master WHERE type = 'table' and tbl_name NOT LIKE 'sqlite_%'\")\n\n rows = txn.fetchall()\n\n for row in rows:\n\n tablename = row[0]\n\n try:\n self.do_sql(txn, \"SELECT count(*) FROM %s;\" % tablename)\n\n count = txn.fetchall()\n\n self.update_table_stats(tablename, count[0][0] if count[0][0] != None and count[0][0] > 0 else -1)\n except:\n logging.info(\"SqlConnections: Failed to get number of rows for table '%s': %s\", tablename, str(e))\n pass", "metadata": "root.SqlConnections.preload_tables_list", "header": "['class', 'SqlConnections', '(', 'object', ')', ':', '___EOS___']", "index": 435 }, { "content": " def add_table_data(self, txn, table, identity):\n \"\"\" \n Add a table to the backend if it doesn't exist and insert the data.\n This is executed using adbapi in a thread pool.\n \"\"\"\n\n start_time = time.time()\n\n # For when we hit lock contention - only retry so many times.\n\n table.init_retry(5)\n\n tablename = table.get_tablename()\n\n if tablename is None:\n logging.info(\"SqlConnections: Unknown tablename from '%s'\", identity)\n return\n\n update = table.get_property('update')\n static = table.get_property('static')\n persist = table.get_property('persist')\n\n # Check if we need to save the table in case of persistence.\n\n self.data_manager.check_save_table(table, identity)\n\n # Now check if we've already added the table.\n\n try:\n if not update and not static and self.connections[identity][\"tables\"][tablename] > 0:\n logging.info(\"SqlConnections: '%s' has already sent an update or is persisted for table '%s'\", identity, tablename)\n return\n except KeyError:\n # Ignore\n pass\n\n try:\n # Wrap the create, alter tables and inserts or updates in\n # a transaction... All or none please.\n\n txn.execute(\"BEGIN;\")\n\n # Use this to detect if the table already exists - we\n # could just not do this and use the create table to\n # detect if a table is already there or not but a error on\n # the create table would mean having to restart the\n # transaction and require some weird retry logic..\n\n create_sql = \"CREATE TABLE IF NOT EXISTS '%s' ( \\n\" % tablename\n\n columns = []\n \n for column_name, column_type in table.zip_columns():\n columns.append( \"'%s' %s DEFAULT NULL\" % (column_name, column_type) )\n\n create_sql += \",\\n\".join( columns )\n\n create_sql += \")\"\n\n try:\n result = self.do_sql(txn, create_sql)\n except Exception as e:\n errorstr = str(e)\n\n # Is this a \"table already exists\" error? Then its a race condition between checking if a table exists and actually creating it.\n # This should never happen now - we are using CREATE IF NOT EXISTS ...\n if \"already exists\" in errorstr:\n # Don't need to log this as it is fairly common.\n ##logging.info(\"SqlConnections: Warning: Create table race condition '%s' for %s: '%s' ... retrying\", tablename, identity, errorstr)\n raise CreateTableException(\"Create table race condition '%s' for %s: '%s'\" % (tablename, identity, errorstr,))\n \n else:\n # Otherwise some kind of sql error, pass the exception up\n raise e\n\n\n # Merge the schemas of what might be already there and our update.\n schema = self.get_schema(txn, tablename)\n\n self.data_manager.table_merger.merge_table(txn, table, schema, self)\n\n # Now update the table.\n # Truncate and re-insert if this is static.\n # Call do_update if this is an update type.\n # Otherwise we insert.\n\n if static:\n txn.execute(\"DELETE FROM '%s';\" % tablename)\n rowcount = self.do_insert_table(txn, table)\n\n else:\n if update:\n rowcount = self.do_update_table(txn, table, identity)\n else:\n rowcount = self.do_insert_table(txn, table)\n\n txn.execute(\"COMMIT;\")\n\n except apsw.BusyError as e:\n # This should only happen if we exceed the busy timeout.\n logging.info(\"SqlConnections: Warning: Lock contention for adding table '%s': %s for %s\", tablename, str(e), identity)\n\n try:\n txn.execute(\"ROLLBACK;\")\n except:\n pass\n\n # Should we try again?\n if table.test_retry():\n logging.info(\"SqlConnections: ERROR: Retries failed for table '%s'\", tablename)\n return 0\n\n # Place this request back on the event queue for a retry.\n self.async_add_table_data(table, identity)\n\n return 0\n\n except CreateTableException as e:\n # Message when raised\n\n try:\n txn.execute(\"ROLLBACK;\")\n except:\n pass\n\n # Should we try again?\n if table.test_retry():\n logging.info(\"SqlConnections: ERROR: Retries failed for table '%s'\", tablename)\n return 0\n\n # Place this request back on the event queue for a retry.\n self.async_add_table_data(table, identity)\n\n return 0\n\n except Exception as e:\n logging.info(\"SqlConnections: ERROR: Failed to add table '%s': %s\", tablename, e)\n\n try:\n txn.execute(\"ROLLBACK;\")\n except:\n pass\n\n return 0\n\n now = time.time()\n\n nr_rows = table.get_nr_rows()\n\n properties_str = ''\n if static: properties_str += ' static'\n if update: properties_str += ' update'\n if persist: properties_str += ' persist'\n\n logging.info(\"SqlConnections: New data%s for table '%s' %d rows from '%s' (%.02f seconds)\", \n properties_str, tablename, rowcount, identity, now - start_time)\n\n # Update some informational stats used for making the tables\n # and connections tables.\n\n self.update_table_stats(tablename, rowcount, identity=identity,\n sum=not update and not static, now=now)\n \n return 1", "metadata": "root.SqlConnections.add_table_data", "header": "['class', 'SqlConnections', '(', 'object', ')', ':', '___EOS___']", "index": 546 } ]
[ { "span": "except:", "start_line": 455, "start_column": 12, "end_line": 455, "end_column": 19 }, { "span": "except:", "start_line": 650, "start_column": 12, "end_line": 650, "end_column": 19 }, { "span": "except:", "start_line": 668, "start_column": 12, "end_line": 668, "end_column": 19 }, { "span": "except:", "start_line": 686, "start_column": 12, "end_line": 686, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Sq", "l", "Connections_", "(_", "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_", "prelo", "ad", "\\u", "tables", "\\u", "list_", "(_", "self_", ",_", "txn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "upo", "n", " ", "initial", " ", "open", " ", "of", " ", "the", " ", "db", " ", "to", " ", "get", " ", "an", " ", "actual", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "tables", " ", "from", " ", "the", " ", "db", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "do", "\\u", "sql_", "(_", "txn_", ",_", "\"", "SELECT", " ", "tbl", "\\u", "name", " ", "FROM", " ", "sql", "ite", "\\u", "master", " ", "WHE", "RE", " ", "type", " ", "=", " ", "'", "table", "'", " ", "and", " ", "tbl", "\\u", "name", " ", "NOT", " ", "LI", "KE", " ", "'", "sql", "ite", "\\u", "%'", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "txn_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tablename_", "=_", "row_", "[_", "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 ", " _", "self_", "._", "do", "\\u", "sql_", "(_", "txn_", ",_", "\"", "SELECT", " ", "count", "(*", ")", " ", "FROM", " ", "%", "s", ";\"_", "%_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "txn_", "._", "fetchall_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "table", "\\u", "stats_", "(_", "tablename_", ",_", "count_", "[_", "0_", "]_", "[_", "0_", "]_", "if_", "count_", "[_", "0_", "]_", "[_", "0_", "]_", "!=_", "None_", "and_", "count_", "[_", "0_", "]_", "[_", "0_", "]_", ">_", "0_", "else_", "-_", "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 ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "Fail", "ed", " ", "to", " ", "get", " ", "number", " ", "of", " ", "rows", " ", "for", " ", "table", " ", "'%", "s", "':", " ", "%", "s", "\"_", ",_", "tablename_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sq", "l", "Connections_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "table", "\\u", "data_", "(_", "self_", ",_", "txn_", ",_", "table_", ",_", "identity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "table", " ", "to", " ", "the", " ", "back", "end", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", " ", "and", " ", "insert", " ", "the", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "executed", " ", "usi", "ng", " ", "adb", "api", " ", "in", " ", "a", " ", "thread", " ", "pool", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "whe", "n", " ", "we", " ", "hit", " ", "lock", " ", "content", "ion", " ", "-", " ", "only", " ", "retr", "y", " ", "so", " ", "many", " ", "times", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "._", "init", "\\u", "retry_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "table_", "._", "get", "\\u", "tablename_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tablename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "Un", "know", "n", " ", "tablename", " ", "from", " ", "'%", "s", "'\"_", ",_", "identity_", ")_", "\\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_", "update_", "=_", "table_", "._", "get", "\\u", "property_", "(_", "'", "update", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static_", "=_", "table_", "._", "get", "\\u", "property_", "(_", "'", "static", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "persist_", "=_", "table_", "._", "get", "\\u", "property_", "(_", "'", "persist", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "we", " ", "need", " ", "to", " ", "save", " ", "the", " ", "table", " ", "in", " ", "case", " ", "of", " ", "persiste", "nce", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "data\\u", "manager_", "._", "check", "\\u", "save", "\\u", "table_", "(_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "check", " ", "if", " ", "we", "'", "ve", " ", "alr", "ead", "y", " ", "adde", "d", " ", "the", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "update_", "and_", "not_", "static_", "and_", "self_", "._", "connections_", "[_", "identity_", "]_", "[_", "\"", "tables", "\"_", "]_", "[_", "tablename_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "'%", "s", "'", " ", "has", " ", "alr", "ead", "y", " ", "sent", " ", "an", " ", "update", " ", "or", " ", "is", " ", "persiste", "d", " ", "for", " ", "table", " ", "'%", "s", "'\"_", ",_", "identity_", ",_", "tablename_", ")_", "\\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_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wra", "p", " ", "the", " ", "create", ",", " ", "alter", " ", "tables", " ", "and", " ", "inserts", " ", "or", " ", "update", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "transaction", "...", " ", "All", " ", "or", " ", "none", " ", "plea", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txn_", "._", "execute_", "(_", "\"", "BEGIN", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "this", " ", "to", " ", "detect", " ", "if", " ", "the", " ", "table", " ", "alr", "ead", "y", " ", "exist", "s", " ", "-", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coul", "d", " ", "just", " ", "not", " ", "do", " ", "this", " ", "and", " ", "use", " ", "the", " ", "create", " ", "table", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "detect", " ", "if", " ", "a", " ", "table", " ", "is", " ", "alr", "ead", "y", " ", "there", " ", "or", " ", "not", " ", "but", " ", "a", " ", "error", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "create", " ", "table", " ", "wou", "ld", " ", "mean", " ", "hav", "ing", " ", "to", " ", "restart", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", " ", "and", " ", "require", " ", "some", " ", "weird", " ", "retr", "y", " ", "logic", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "sql_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "'%", "s", "'", " ", "(", " ", "\\\\", "n", "\"_", "%_", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "column", "\\u", "name_", ",_", "column", "\\u", "type_", "in_", "table_", "._", "zip", "\\u", "columns_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "._", "append_", "(_", "\"'", "%", "s", "'", " ", "%", "s", " ", "DEF", "AUL", "T", " ", "NULL", "\"_", "%_", "(_", "column", "\\u", "name_", ",_", "column", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create", "\\u", "sql_", "+=_", "\",", "\\\\", "n", "\"_", "._", "join_", "(_", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "sql_", "+=_", "\")\"_", "\\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 ", " _", "result_", "=_", "self_", "._", "do", "\\u", "sql_", "(_", "txn_", ",_", "create", "\\u", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "str_", "=_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Is", " ", "this", " ", "a", " ", "\"", "table", " ", "alr", "ead", "y", " ", "exist", "s", "\"", " ", "error", "?", " ", " ", "The", "n", " ", "its", " ", "a", " ", "race", " ", "condition", " ", "bet", "ween", " ", "checking", " ", "if", " ", "a", " ", "table", " ", "exist", "s", " ", "and", " ", "actual", "ly", " ", "creati", "ng", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "neve", "r", " ", "happ", "en", " ", "now", " ", "-", " ", "we", " ", "are", " ", "usi", "ng", " ", "CREATE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "alr", "ead", "y", " ", "exist", "s", "\"_", "in_", "error", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "need", " ", "to", " ", "log", " ", "this", " ", "as", " ", "it", " ", "is", " ", "fair", "ly", " ", "common", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "logg", "ing", ".", "info", "(\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "Warn", "ing", ":", " ", "Creat", "e", " ", "table", " ", "race", " ", "condition", " ", "'%", "s", "'", " ", "for", " ", "%", "s", ":", " ", "'%", "s", "'", " ", "...", " ", "retrying", "\",", " ", "tablename", ",", " ", "identi", "ty", ",", " ", "error", "str", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Creat", "e", "Table", "Exception_", "(_", "\"", "Creat", "e", " ", "table", " ", "race", " ", "condition", " ", "'%", "s", "'", " ", "for", " ", "%", "s", ":", " ", "'%", "s", "'\"_", "%_", "(_", "tablename_", ",_", "identity_", ",_", "error", "str_", ",_", ")_", ")_", "\\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_", "#", " ", "Ot", "her", "wis", "e", " ", "some", " ", "kind", " ", "of", " ", "sql", " ", "error", ",", " ", "pass", " ", "the", " ", "exception", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "the", " ", "schema", "s", " ", "of", " ", "what", " ", "mig", "ht", " ", "be", " ", "alr", "ead", "y", " ", "there", " ", "and", " ", "our", " ", "update", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schema_", "=_", "self_", "._", "get", "\\u", "schema_", "(_", "txn_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "data\\u", "manager_", "._", "table", "\\u", "merger", "_", "._", "merge", "\\u", "table_", "(_", "txn_", ",_", "table_", ",_", "schema_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "update", " ", "the", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Truncate", " ", "and", " ", "re", "-", "insert", " ", "if", " ", "this", " ", "is", " ", "static", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "do", "\\u", "update", " ", "if", " ", "this", " ", "is", " ", "an", " ", "update", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "we", " ", "insert", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "static_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txn_", "._", "execute_", "(_", "\"", "DELET", "E", " ", "FROM", " ", "'%", "s", "';", "\"_", "%_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rowcount_", "=_", "self_", "._", "do", "\\u", "insert", "\\u", "table_", "(_", "txn_", ",_", "table_", ")_", "\\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 ", " _", "if_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rowcount_", "=_", "self_", "._", "do", "\\u", "update", "\\u", "table_", "(_", "txn_", ",_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rowcount_", "=_", "self_", "._", "do", "\\u", "insert", "\\u", "table_", "(_", "txn_", ",_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "txn_", "._", "execute_", "(_", "\"", "COMMIT", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "aps", "w_", "._", "Busy", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "happ", "en", " ", "if", " ", "we", " ", "exceed", " ", "the", " ", "bus", "y", " ", "timeo", "ut", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "Warn", "ing", ":", " ", "Lock", " ", "content", "ion", " ", "for", " ", "addin", "g", " ", "table", " ", "'%", "s", "':", " ", "%", "s", " ", "for", " ", "%", "s", "\"_", ",_", "tablename_", ",_", "str_", "(_", "e_", ")_", ",_", "identity_", ")_", "\\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 ", " _", "txn_", "._", "execute_", "(_", "\"", "ROLL", "BACK", ";\"_", ")_", "\\u\\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_", "#", " ", "Sho", "ul", "d", " ", "we", " ", "try", " ", "again", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "table_", "._", "test\\u", "retry_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "ERROR", ":", " ", "Retri", "es", " ", "fail", "ed", " ", "for", " ", "table", " ", "'%", "s", "'\"_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Place", " ", "this", " ", "request", " ", "back", " ", "on", " ", "the", " ", "event", " ", "queue", " ", "for", " ", "a", " ", "retr", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "async", "\\u", "add", "\\u", "table", "\\u", "data_", "(_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Creat", "e", "Table", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Messag", "e", " ", "whe", "n", " ", "raised_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txn_", "._", "execute_", "(_", "\"", "ROLL", "BACK", ";\"_", ")_", "\\u\\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_", "#", " ", "Sho", "ul", "d", " ", "we", " ", "try", " ", "again", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "table_", "._", "test\\u", "retry_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "ERROR", ":", " ", "Retri", "es", " ", "fail", "ed", " ", "for", " ", "table", " ", "'%", "s", "'\"_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Place", " ", "this", " ", "request", " ", "back", " ", "on", " ", "the", " ", "event", " ", "queue", " ", "for", " ", "a", " ", "retr", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "async", "\\u", "add", "\\u", "table", "\\u", "data_", "(_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "ERROR", ":", " ", "Fail", "ed", " ", "to", " ", "add", " ", "table", " ", "'%", "s", "':", " ", "%", "s", "\"_", ",_", "tablename_", ",_", "e_", ")_", "\\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 ", " _", "txn_", "._", "execute_", "(_", "\"", "ROLL", "BACK", ";\"_", ")_", "\\u\\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_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nr", "\\u", "rows_", "=_", "table_", "._", "get", "\\u", "nr", "\\u", "rows_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proper", "ties", "\\u", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "static_", ":_", "proper", "ties", "\\u", "str_", "+=_", "'", " ", "static", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", ":_", "proper", "ties", "\\u", "str_", "+=_", "'", " ", "update", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "persist_", ":_", "proper", "ties", "\\u", "str_", "+=_", "'", " ", "persist", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "New", " ", "data", "%", "s", " ", "for", " ", "table", " ", "'%", "s", "'", " ", "%", "d", " ", "rows", " ", "from", " ", "'%", "s", "'", " ", "(%", ".02", "f", " ", "second", "s", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proper", "ties", "\\u", "str_", ",_", "tablename_", ",_", "rowcount_", ",_", "identity_", ",_", "now_", "-_", "start", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "some", " ", "informati", "onal", " ", "stats", " ", "used", " ", "for", " ", "mak", "ing", " ", "the", " ", "tables_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "connections", " ", "tables", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "table", "\\u", "stats_", "(_", "tablename_", ",_", "rowcount_", ",_", "identity_", "=_", "identity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sum_", "=_", "not_", "update_", "and_", "not_", "static_", ",_", "now_", "=_", "now_", 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 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 ]
Except block handles 'BaseException'
geopython/pycsw/pycsw/core/util.py
[ { "content": "def xmltag_split(tag):\n \"\"\"Return XML element bare tag name (without prefix)\"\"\"\n try:\n return tag.split('}')[1]\n except:\n return tag", "metadata": "root.xmltag_split", "header": "['module', '___EOS___']", "index": 109 }, { "content": "def xmltag_split2(tag, namespaces, colon=False):\n \"\"\"Return XML namespace prefix of element\"\"\"\n try:\n nsuri = tag.split('}')[0].split('{')[1]\n nsprefix = [key for key, value in namespaces.items()\n if value == nsuri]\n value = nsprefix[0]\n if colon:\n return '%s:' % nsprefix[0]\n else:\n return nsprefix[0]\n except:\n return ''", "metadata": "root.xmltag_split2", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def get_geometry_area(geometry):\n \"\"\"Derive area of a given geometry\"\"\"\n try:\n if geometry is not None:\n return str(loads(geometry).area)\n return '0'\n except:\n return '0'", "metadata": "root.get_geometry_area", "header": "['module', '___EOS___']", "index": 210 }, { "content": "def getqattr(obj, name):\n \"\"\"get value of an object, safely\"\"\"\n try:\n value = getattr(obj, name)\n if hasattr(value, '__call__'): # function generated value\n LOGGER.debug('attribute is a function')\n if name.find('link') != -1: # list of link tuple quadruplets\n LOGGER.debug('attribute is a link')\n return _linkify(value())\n return value()\n elif (isinstance(value, datetime.datetime)\n or isinstance(value, datetime.date)): # datetime object\n LOGGER.debug('attribute is a date')\n return datetime2iso8601(value)\n return value\n except:\n return None", "metadata": "root.getqattr", "header": "['module', '___EOS___']", "index": 330 } ]
[ { "span": "except:", "start_line": 113, "start_column": 4, "end_line": 113, "end_column": 11 }, { "span": "except:", "start_line": 128, "start_column": 4, "end_line": 128, "end_column": 11 }, { "span": "except:", "start_line": 216, "start_column": 4, "end_line": 216, "end_column": 11 }, { "span": "except:", "start_line": 345, "start_column": 4, "end_line": 345, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "xmlt", "ag", "\\u", "split_", "(_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "XML", " ", "element", " ", "bare", " ", "tag", " ", "name", " ", "(", "with", "out", " ", "prefix", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "tag_", "._", "split_", "(_", "'}'_", ")_", "[_", "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_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "xmlt", "ag", "\\u", "split", "2_", "(_", "tag_", ",_", "namespaces_", ",_", "colon", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "XML", " ", "namespace", " ", "prefix", " ", "of", " ", "element", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsu", "ri_", "=_", "tag_", "._", "split_", "(_", "'}'_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'{'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nsp", "refix", "_", "=_", "[_", "key_", "for_", "key_", ",_", "value_", "in_", "namespaces_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "==_", "nsu", "ri_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "nsp", "refix", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "colon", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", ":'_", "%_", "nsp", "refix", "_", "[_", "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_", "nsp", "refix", "_", "[_", "0_", "]_", "\\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]_", "module_", "\\u\\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", "geom", "etry", "\\u", "area_", "(_", "geometry_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Derive", " ", "area", " ", "of", " ", "a", " ", "give", "n", " ", "geom", "etry", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "geometry_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "loads_", "(_", "geometry_", ")_", "._", "area_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'", "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_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "qa", "ttr", "_", "(_", "obj_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", " ", "value", " ", "of", " ", "an", " ", "object", ",", " ", "safe", "ly", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "obj_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "value_", ",_", "'\\u", "\\u", "call", "\\u\\u'_", ")_", ":_", "#", " ", "function", " ", "generat", "ed", " ", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "attribute", " ", "is", " ", "a", " ", "function", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "._", "find_", "(_", "'", "link", "'_", ")_", "!=_", "-_", "1_", ":_", "#", " ", "list", " ", "of", " ", "link", " ", "tuple", " ", "quadr", "uple", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "attribute", " ", "is", " ", "a", " ", "link", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "link", "ify_", "(_", "value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "datetime_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "isinstance_", "(_", "value_", ",_", "datetime_", "._", "date_", ")_", ")_", ":_", "#", " ", "datetime", " ", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "debug_", "(_", "'", "attribute", " ", "is", " ", "a", " ", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime", "2i", "so", "860", "1_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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, 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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()\n\n link_title = 'Title'\n link_address = 'http://www.example.com'\n\n if not cursor.hasSelection():\n cursor.select(QtGui.QTextCursor.WordUnderCursor)\n text = cursor.selectedText()\n if text == '':\n text = 'example text'\n else:\n link_title = cursor.selectedText()\n\n if seq == 'ctrl_k':\n self._insert_hyperlink(title=link_title)\n elif seq == 'ctrl_shift_k':\n filepath, _ = QtGui.QFileDialog.getOpenFileName(self, \"Select File\", os.path.expanduser('~'))\n if filepath != '':\n self._insert_filelink(filepath)", "metadata": "root.MotomeTextBrowser.process_insertseq", "header": "['class', 'MotomeTextBrowser', '(', 'QtGui', '.', 'QTextBrowser', ')', ':', '___EOS___']", "index": 137 }, { "content": " def _insert_filelink(self, filepath):\n # create the media storage directory\n try:\n html_dir = os.path.join(self.notes_dir, MEDIA_FOLDER)\n os.makedirs(html_dir)\n except OSError:\n # already there\n pass\n except AttributeError:\n # notemodel is None\n return\n\n cursor = self.textCursor()\n current_pos = cursor.position()\n\n filename = safe_filename(os.path.basename(filepath))\n dst_path = os.path.join(self.notes_dir, MEDIA_FOLDER, filename)\n link_address = './{0}/{1}'.format(MEDIA_FOLDER, filename)\n\n if cursor.hasSelection():\n link_title = cursor.selectedText()\n else:\n link_title = filename\n\n try:\n is_image = 'image' in mimetypes.guess_type(filepath)[0]\n except TypeError:\n is_image = False\n\n if is_image:\n # user sent an image file\n try:\n shutil.copyfile(filepath, dst_path)\n except (IOError, shutil.Error):\n # file probably already there\n pass\n self.insertHtml('![{0}](<a href=\"{1}\">{1}</a>)'.format(link_title, link_address))\n else:\n try:\n shutil.copyfile(filepath, dst_path)\n except (IOError, shutil.Error):\n # file probably already there\n pass\n self.insertHtml('[{0}](<a href=\"{1}\">{1}</a>)'.format(link_title, link_address))", "metadata": "root.MotomeTextBrowser._insert_filelink", "header": "['class', 'MotomeTextBrowser', '(', 'QtGui', '.', 'QTextBrowser', ')', ':', '___EOS___']", "index": 320 } ]
[ { "span": "current_pos ", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 19 }, { "span": "link_address ", "start_line": 142, "start_column": 8, "end_line": 142, "end_column": 20 }, { "span": "text ", "start_line": 148, "start_column": 16, "end_line": 148, "end_column": 20 }, { "span": "current_pos ", "start_line": 333, "start_column": 8, "end_line": 333, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Moto", "me", "Text", "Browser_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Browser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "inserts", "eq_", "(_", "self_", ",_", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "text", "Cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "pos_", "=_", "cursor_", "._", "position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "link", "\\u", "title_", "=_", "'", "Tit", "le", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "address_", "=_", "'", "http", "://", "www", ".", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "cursor_", "._", "has", "Selection_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "._", "select_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Cursor_", "._", "Word", "Under", "Cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "cursor_", "._", "selecte", "d", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "'", "example", " ", "text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link", "\\u", "title_", "=_", "cursor_", "._", "selecte", "d", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "seq_", "==_", "'", "ctrl", "\\u", "k", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "insert", "\\u", "hyperlink", "_", "(_", "title_", "=_", "link", "\\u", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "seq_", "==_", "'", "ctrl", "\\u", "shift", "\\u", "k", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filepath_", ",_", "\\u_", "=_", "Qt", "Gui_", "._", "QF", "ile", "Dialog_", "._", "get", "Open", "File", "Name_", "(_", "self_", ",_", "\"", "Select", " ", "File", "\"_", ",_", "os_", "._", "path_", "._", "expanduser_", "(_", "'~'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filepath_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "insert", "\\u", "fileli", "nk_", "(_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moto", "me", "Text", "Browser_", "(_", "Qt", "Gui_", "._", "QT", "ext", "Browser_", ")_", ":_", "\\u\\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", "insert", "\\u", "fileli", "nk_", "(_", "self_", ",_", "filepath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "media", " ", "storage", " ", "directory_", "\\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 ", " _", "html", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "note", "s", "\\u", "dir_", ",_", "MEDIA", "\\u", "FOLDER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "html", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alr", "ead", "y", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", "model", " ", "is", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cursor_", "=_", "self_", "._", "text", "Cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "pos_", "=_", "cursor_", "._", "position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "safe", "\\u", "filename_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "filepath_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "note", "s", "\\u", "dir_", ",_", "MEDIA", "\\u", "FOLDER_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "address_", "=_", "'./", "{", "0", "}/", "{", "1", "}'_", "._", "format_", "(_", "MEDIA", "\\u", "FOLDER_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cursor_", "._", "has", "Selection_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link", "\\u", "title_", "=_", "cursor_", "._", "selecte", "d", "Text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link", "\\u", "title_", "=_", "filename_", "\\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 ", " _", "is", "\\u", "image_", "=_", "'", "image", "'_", "in_", "mimetypes_", "._", "guess", "\\u", "type_", "(_", "filepath_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "image_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "image_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "user", " ", "sent", " ", "an", " ", "image", " ", "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 ", " _", "shutil_", "._", "copyfile_", "(_", "filepath_", ",_", "dst", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "shutil_", "._", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "file", " ", "probab", "ly", " ", "alr", "ead", "y", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "insert", "Html_", "(_", "'!", "[{", "0", "}]", "(", "<", "a", " ", "href", "=\"", "{", "1", "}\">", "{", "1", "}", "</", "a", ">)", "'_", "._", "format_", "(_", "link", "\\u", "title_", ",_", "link", "\\u", "address_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copyfile_", "(_", "filepath_", ",_", "dst", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "shutil_", "._", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "file", " ", "probab", "ly", " ", "alr", "ead", "y", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "insert", "Html_", "(_", "'[{", "0", "}]", "(", "<", "a", " ", "href", "=\"", "{", "1", "}\">", "{", "1", "}", "</", "a", ">)", "'_", "._", "format_", "(_", "link", "\\u", "title_", ",_", "link", "\\u", "address_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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, 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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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 ]
Imprecise assert
django-bmf/django-bmf/djangobmf/utils/testcases.py
[ { "content": " def test_module_update(self):\n for model in self.models:\n ns = model._bmfmeta.namespace_api\n\n for obj in model.objects.all():\n url = reverse('%s:update' % ns, kwargs={\n 'pk': obj.pk,\n })\n response = self.client.get(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest')\n self.assertTrue(response.status_code in [200, 403])", "metadata": "root.ModuleTestFactory.test_module_update", "header": "['class', 'ModuleTestFactory', '(', 'SuperuserMixin', ',', 'BaseTestCase', ')', ':', '___EOS___']", "index": 142 }, { "content": " def test_module_delete(self):\n for model in self.models:\n ns = model._bmfmeta.namespace_api\n\n for obj in model.objects.all():\n url = reverse('%s:delete' % ns, kwargs={\n 'pk': obj.pk,\n })\n response = self.client.get(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest')\n self.assertTrue(response.status_code in [200, 403])", "metadata": "root.ModuleTestFactory.test_module_delete", "header": "['class', 'ModuleTestFactory', '(', 'SuperuserMixin', ',', 'BaseTestCase', ')', ':', '___EOS___']", "index": 153 }, { "content": " def test_module_api_detail(self):\n for model in self.models:\n\n for obj in model.objects.all():\n url = reverse('%s:api-detail' % settings.APP_LABEL, kwargs={\n 'app': obj._meta.app_label,\n 'model': obj._meta.model_name,\n 'pk': obj.pk,\n })\n response = self.client.get(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest')\n self.assertTrue(response.status_code in [200])", "metadata": "root.ModuleTestFactory.test_module_api_detail", "header": "['class', 'ModuleTestFactory', '(', 'SuperuserMixin', ',', 'BaseTestCase', ')', ':', '___EOS___']", "index": 174 }, { "content": " def test_module_api_related(self):\n self.appconf = [app for app in apps.get_app_configs() if isinstance(app, self.app)][0]\n\n for relation in self.appconf.bmf_config.bmf_relations:\n if relation._model not in self.models:\n continue\n\n for obj in relation._model.objects.all():\n url = reverse('%s:api-related' % settings.APP_LABEL, kwargs={\n 'app': obj._meta.app_label,\n 'model': obj._meta.model_name,\n 'pk': obj.pk,\n 'field': relation.slug,\n })\n response = self.client.get(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest')\n self.assertTrue(response.status_code in [200])", "metadata": "root.ModuleTestFactory.test_module_api_related", "header": "['class', 'ModuleTestFactory', '(', 'SuperuserMixin', ',', 'BaseTestCase', ')', ':', '___EOS___']", "index": 186 } ]
[ { "span": "self.assertTrue(response.status_code in [200, 403])", "start_line": 151, "start_column": 16, "end_line": 151, "end_column": 67 }, { "span": "self.assertTrue(response.status_code in [200, 403])", "start_line": 162, "start_column": 16, "end_line": 162, "end_column": 67 }, { "span": "self.assertTrue(response.status_code in [200])", "start_line": 184, "start_column": 16, "end_line": 184, "end_column": 62 }, { "span": "self.assertTrue(response.status_code in [200])", "start_line": 201, "start_column": 16, "end_line": 201, "end_column": 62 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Modul", "e", "Test", "Factory_", "(_", "Super", "user", "Mixin_", ",_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "module", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model_", "in_", "self_", "._", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ns_", "=_", "model_", "._", "\\u", "bm", "fm", "eta_", "._", "namespace", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "model_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'%", "s", ":", "update", "'_", "%_", "ns_", ",_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", "'_", ":_", "obj_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ",_", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "_", "=_", "'", "XML", "Http", "Request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "._", "status", "\\u", "code_", "in_", "[_", "200_", ",_", "403_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "e", "Test", "Factory_", "(_", "Super", "user", "Mixin_", ",_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "module", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model_", "in_", "self_", "._", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ns_", "=_", "model_", "._", "\\u", "bm", "fm", "eta_", "._", "namespace", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "model_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'%", "s", ":", "delete", "'_", "%_", "ns_", ",_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", "'_", ":_", "obj_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ",_", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "_", "=_", "'", "XML", "Http", "Request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "._", "status", "\\u", "code_", "in_", "[_", "200_", ",_", "403_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "e", "Test", "Factory_", "(_", "Super", "user", "Mixin_", ",_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "module", "\\u", "api", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model_", "in_", "self_", "._", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "model_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'%", "s", ":", "api", "-", "deta", "il", "'_", "%_", "settings_", "._", "APP", "\\u", "LABEL_", ",_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "'_", ":_", "obj_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "obj_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", "'_", ":_", "obj_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ",_", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "_", "=_", "'", "XML", "Http", "Request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "._", "status", "\\u", "code_", "in_", "[_", "200_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Modul", "e", "Test", "Factory_", "(_", "Super", "user", "Mixin_", ",_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "module", "\\u", "api", "\\u", "related_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "appc", "onf_", "=_", "[_", "app_", "for_", "app_", "in_", "apps_", "._", "get", "\\u", "app", "\\u", "configs_", "(_", ")_", "if_", "isinstance_", "(_", "app_", ",_", "self_", "._", "app_", ")_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "relation_", "in_", "self_", "._", "appc", "onf_", "._", "bm", "f", "\\u", "config_", "._", "bm", "f", "\\u", "relations_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "relation_", "._", "\\u", "model_", "not_", "in_", "self_", "._", "models_", ":_", "\\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_", "for_", "obj_", "in_", "relation_", "._", "\\u", "model_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "reverse_", "(_", "'%", "s", ":", "api", "-", "relate", "d", "'_", "%_", "settings_", "._", "APP", "\\u", "LABEL_", ",_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "'_", ":_", "obj_", "._", "\\u", "meta_", "._", "app", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "obj_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pk", "'_", ":_", "obj_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "'_", ":_", "relation_", "._", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ",_", "HTTP", "\\u", "X", "\\u", "REQUEST", "ED", "\\u", "WITH", "_", "=_", "'", "XML", "Http", "Request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "response_", "._", "status", "\\u", "code_", "in_", "[_", "200_", "]_", ")_", "\\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, 0, 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, 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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
ionelmc/django-monkey-team/tests/test_project/urls.py
[ { "content": "try:\n from django.conf.urls import patterns, handler404, handler500, include, url\nexcept ImportError:\n from django.conf.urls.defaults import patterns, handler404, handler500, include, url\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n url(r'^admin/', include(admin.site.urls)),\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from django.conf.urls import patterns, handler404, handler500, include, url", "start_line": 1, "start_column": 4, "end_line": 1, "end_column": 79 }, { "span": "from django.conf.urls.defaults import patterns, handler404, handler500, include, url", "start_line": 3, "start_column": 4, "end_line": 3, "end_column": 88 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "patterns_", ",_", "handler", "404_", ",_", "handler", "500_", ",_", "include_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "._", "urls_", "._", "defaults_", "import_", "patterns_", ",_", "handler", "404_", ",_", "handler", "500_", ",_", "include_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "autodiscover", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "patterns_", "(_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "admin", "/'_", ",_", "include_", "(_", "admin_", "._", "site_", "._", "urls_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
Unused local variable
facebook/sparts/demo/demo_tui.py
[ { "content": " def make_form(self):\n # These lines create the form and populate it with widgets.\n # A fairly complex screen in only 8 or so lines of code - a line for each control.\n F = npyscreen.Form(name = \"Welcome to Npyscreen\",)\n t = F.add(npyscreen.TitleText, name = \"Text:\",)\n fn = F.add(npyscreen.TitleFilename, name = \"Filename:\")\n fn2 = F.add(npyscreen.TitleFilenameCombo, name=\"Filename2:\")\n dt = F.add(npyscreen.TitleDateCombo, name = \"Date:\")\n s = F.add(npyscreen.TitleSlider, out_of=12, name = \"Slider\")\n ml = F.add(npyscreen.MultiLineEdit,\n value = \"\"\"try typing here!\\nMutiline text, press ^R to reformat.\\n\"\"\",\n max_height=5, rely=9)\n ms = F.add(npyscreen.TitleSelectOne, max_height=4, value = [1,], name=\"Pick One\",\n values = [\"Option1\",\"Option2\",\"Option3\"], scroll_exit=True)\n ms2= F.add(npyscreen.TitleMultiSelect, max_height =-2, value = [1,], name=\"Pick Several\",\n values = [\"Option1\",\"Option2\",\"Option3\"], scroll_exit=True)\n return F", "metadata": "root.MyUI.make_form", "header": "['class', 'MyUI', '(', 'UITask', ')', ':', '___EOS___']", "index": 17 } ]
[ { "span": "t ", "start_line": 21, "start_column": 8, "end_line": 21, "end_column": 9 }, { "span": "fn ", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 10 }, { "span": "fn2 ", "start_line": 23, "start_column": 8, "end_line": 23, "end_column": 11 }, { "span": "dt ", "start_line": 24, "start_column": 8, "end_line": 24, "end_column": 10 }, { "span": "s ", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 9 }, { "span": "ml ", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 10 }, { "span": "ms ", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 10 }, { "span": "ms2=", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "My", "UI_", "(_", "UI", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "form_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "lines", " ", "create", " ", "the", " ", "form", " ", "and", " ", "populate", " ", "it", " ", "with", " ", "widget", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "fair", "ly", " ", "complex", " ", "screen", " ", "in", " ", "only", " ", "8", " ", "or", " ", "so", " ", "lines", " ", "of", " ", "code", " ", "-", " ", "a", " ", "line", " ", "for", " ", "each", " ", "control", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "F_", "=_", "npy", "screen_", "._", "Form_", "(_", "name_", "=_", "\"", "Wel", "come", " ", "to", " ", "Np", "ysc", "reen", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Tit", "le", "Text_", ",_", "name_", "=_", "\"", "Text", ":\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Tit", "le", "Filename_", ",_", "name_", "=_", "\"", "File", "name", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn", "2_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Tit", "le", "File", "name", "Combo_", ",_", "name_", "=_", "\"", "File", "name2", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Tit", "le", "Date", "Combo_", ",_", "name_", "=_", "\"", "Date", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Tit", "le", "Slider_", ",_", "out", "\\u", "of_", "=_", "12_", ",_", "name_", "=_", "\"", "Slide", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ml_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Multi", "Line", "Edit_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "\"\"\"", "try", " ", "typ", "ing", " ", "here", "!\\\\", "n", "Mut", "ilin", "e", " ", "text", ",", " ", "press", " ", "^", "R", " ", "to", " ", "reformat", ".\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "height_", "=_", "5_", ",_", "rely", "_", "=_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Tit", "le", "Select", "One_", ",_", "max", "\\u", "height_", "=_", "4_", ",_", "value_", "=_", "[_", "1_", ",_", "]_", ",_", "name_", "=_", "\"", "Pick", " ", "One", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "[_", "\"", "Optio", "n1", "\"_", ",_", "\"", "Optio", "n2", "\"_", ",_", "\"", "Optio", "n", "3", "\"_", "]_", ",_", "scroll", "\\u", "exit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ms", "2_", "=_", "F_", "._", "add_", "(_", "npy", "screen_", "._", "Tit", "le", "Multi", "Select_", ",_", "max", "\\u", "height_", "=_", "-_", "2_", ",_", "value_", "=_", "[_", "1_", ",_", "]_", ",_", "name_", "=_", "\"", "Pick", " ", "Seve", "ral", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "[_", "\"", "Optio", "n1", "\"_", ",_", "\"", "Optio", "n2", "\"_", ",_", "\"", "Optio", "n", "3", "\"_", "]_", ",_", "scroll", "\\u", "exit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "F_", "\\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,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2, 2, 2, 2 ]
Unused import
karesansui/karesansui/bin/create_storage_pool.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui.\n#\n# Copyright (C) 2012 HDE, Inc.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport os\nimport sys\nimport re\nimport logging\nfrom optparse import OptionParser\n\nfrom ksscommand import KssCommand, KssCommandException, KssCommandOptException\n\nimport __cmd__\n\ntry:\n import karesansui\n from karesansui import __version__\n from karesansui.lib.virt.virt import KaresansuiVirtConnection\n from karesansui.lib.utils import load_locale, get_pwd_info, get_grp_info\n from karesansui.lib.const import STORAGE_POOL_TYPE\n\nexcept ImportError, e:\n print >>sys.stderr, \"[Error] some packages not found. - %s\" % e\n sys.exit(1)\n\n_ = load_locale()\n\nusage = '%prog [options]'\n\n\n\n\nif __name__ == \"__main__\":\n target = CreateStoragePool()\n sys.exit(target.run())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getopts():\n optp = OptionParser(usage=usage, version=__version__)\n optp.add_option('-n', '--name', dest='name', help=_('Name'), default=None)\n optp.add_option('-t', '--type', dest='type', help=_('Pool Type (dir or iscsi or fs)'), default=None)\n optp.add_option('-p', '--target_path', dest='target_path', help=_('Target path (dir, fs)'), default=None)\n #optp.add_option('-a', '--allocation', dest='allocation', help=_('Allocation'), default=0, type=\"int\")\n #optp.add_option('-v', '--available', dest='available', help=_('Available'), default=0, type=\"int\")\n #optp.add_option('-c', '--capacity', dest='capacity', help=_('Capacity'), default=0, type=\"int\")\n optp.add_option('-b', '--host_name', dest='host_name', help=_('Host name (iscsi)'), default=None)\n optp.add_option('-d', '--device_path', dest='device_path', help=_('Device path (iscsi, fs)'), default=None)\n optp.add_option('-g', '--group', dest='group', help=_('Permission group'), default=None)\n optp.add_option('-l', '--label', dest='label', help=_('Permission label'), default=None)\n optp.add_option('-m', '--mode', dest='mode', help=_('Permission mode'), default=None)\n optp.add_option('-o', '--owner', dest='owner', help=_('Permission owner'), default=None)\n return optp.parse_args()", "metadata": "root.getopts", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def chkopts(opts):\n reg = re.compile(\"[^a-zA-Z0-9\\./_:-]\")\n\n if opts.name:\n if reg.search(opts.name):\n raise KssCommandOptException('ERROR: Illigal option value. option=%s value=%s' % ('-n or --name', opts.name))\n else:\n raise KssCommandOptException('ERROR: %s option is required.' % '-n or --name')\n\n if opts.type:\n if opts.type not in STORAGE_POOL_TYPE.values():\n raise KssCommandOptException('ERROR: Type is not available. type=%s' % opts.type)\n else:\n raise KssCommandOptException('ERROR: %s option is required.' % '-t or --type')\n\n if opts.type == STORAGE_POOL_TYPE[\"TYPE_DIR\"]:\n # type:dir\n if not opts.target_path:\n raise KssCommandOptException('ERROR: %s option is required.' % '-p or --target_path')\n\n elif opts.type == STORAGE_POOL_TYPE[\"TYPE_ISCSI\"]:\n # type:iscsi\n if not opts.host_name:\n raise KssCommandOptException('ERROR: %s option is required.' % '-b or --host_name')\n if not opts.device_path:\n raise KssCommandOptException('ERROR: %s option is required.' % '-d or --device_path')\n\n elif opts.type == STORAGE_POOL_TYPE[\"TYPE_FS\"]:\n # type:fs\n if not opts.target_path:\n raise KssCommandOptException('ERROR: %s option is required.' % '-p or --target_path')\n if not opts.device_path:\n raise KssCommandOptException('ERROR: %s option is required.' % '-d or --device_path')\n\n else:\n raise KssCommandOptException('ERROR: The type that does not exist. type=%s' % opts.type)\n\n if opts.label:\n if reg.search(opts.label):\n raise KssCommandOptException('ERROR: Illigal option value. option=%s value=%s' % ('-l or --label', opts.label))\n\n reg = re.compile(\"[^0-9]\")\n if opts.owner:\n if reg.search(opts.owner):\n if opts.owner not in [user[0] for user in get_pwd_info()]:\n raise KssCommandOptException('ERROR: Permission user not found. owner=%s' % (opts.owner))\n else:\n if int(opts.owner) not in [user[2] for user in get_pwd_info()]:\n raise KssCommandOptException('ERROR: Permission user not found. owner=%s' % (opts.owner))\n\n if opts.group:\n if reg.search(opts.group):\n if opts.group not in [group[0] for group in get_grp_info()]:\n raise KssCommandOptException('ERROR: Permission user not found. group=%s' % (opts.group))\n else:\n if int(opts.group) not in [group[2] for group in get_grp_info()]:\n raise KssCommandOptException('ERROR: Permission user not found. group=%s' % (opts.group))\n\n reg = re.compile(\"^[0-9]{3,4}$\")\n if opts.mode:\n if not reg.match(opts.mode):\n raise KssCommandOptException('ERROR: Illigal permission mode. mode=%s' % (opts.mode))", "metadata": "root.chkopts", "header": "['module', '___EOS___']", "index": 67 }, { "content": "class CreateStoragePool(KssCommand):\n", "metadata": "root.CreateStoragePool", "header": "['module', '___EOS___']", "index": 130 }, { "content": " def process(self):\n (opts, args) = getopts()\n chkopts(opts)\n\n self.up_progress(10)\n conn = KaresansuiVirtConnection(readonly=False)\n try:\n inactive_storage_pools = conn.list_inactive_storage_pool()\n active_storage_pools = conn.list_active_storage_pool()\n\n self.up_progress(10)\n\n if opts.name in active_storage_pools or opts.name in inactive_storage_pools:\n raise KssCommandException('Storage pool already exists. - pool=%s' % opts.name)\n\n try:\n if opts.type == STORAGE_POOL_TYPE[\"TYPE_DIR\"]:\n if conn.create_storage_pool(opts.name, opts.type,\n opts.target_path,\n #allocation=opts.allocation, available=opts.available,\n #capacity=opts.capacity,\n target_p_group=opts.group, target_p_label=opts.label,\n target_p_mode=opts.mode, target_p_owner=opts.owner,\n ) is False:\n raise KssCommandException('Failed to create storage pools. - pool=%s' \\\n % opts.name)\n\n elif opts.type == STORAGE_POOL_TYPE[\"TYPE_ISCSI\"]:\n if conn.create_storage_pool(opts.name, opts.type,\n target_path=\"/dev/disk/by-path\",\n source_h_name=opts.host_name,\n source_dev_path=opts.device_path,\n #allocation=opts.allocation, available=opts.available,\n #capacity=opts.capacity,\n target_p_group=opts.group, target_p_label=opts.label,\n target_p_mode=opts.mode, target_p_owner=opts.owner,\n ) is False:\n raise KssCommandException('Failed to create storage pools. - pool=%s' \\\n % opts.name)\n\n elif opts.type == STORAGE_POOL_TYPE[\"TYPE_FS\"]:\n if conn.create_storage_pool(opts.name, opts.type,\n opts.target_path,\n source_dev_path=opts.device_path,\n #allocation=opts.allocation, available=opts.available,\n #capacity=opts.capacity,\n target_p_group=opts.group, target_p_label=opts.label,\n target_p_mode=opts.mode, target_p_owner=opts.owner,\n ) is False:\n raise KssCommandException('Failed to create storage pools. - pool=%s' \\\n % opts.name)\n\n else:\n raise KssCommandOptException('ERROR: The type that does not exist. type=%s' \\\n % opts.type)\n\n self.up_progress(20)\n # pool check\n inactive_storage_pools = conn.list_inactive_storage_pool()\n active_storage_pools = conn.list_active_storage_pool()\n\n if not (opts.name in active_storage_pools or opts.name in inactive_storage_pools):\n raise KssCommandException(\n 'Failed to create storage pools. (Unexplained) - pool=%s' \\\n % opts.name)\n\n self.up_progress(20)\n # pool autostart check\n flag = True # autostart on\n if conn.autostart_storage_pool(flag) is False:\n raise KssCommandException(\n 'Failed to autostart storage pool(libvirt). - pool=%s'\n % (opts.name))\n\n ret = conn.is_autostart_storage_pool()\n if not (ret is flag):\n raise KssCommandException(\n 'Auto-start failed to set the storage pool. - pool=%s, autostart=%s' \\\n % (opts.name, str(ret)))\n\n self.logger.info('Created storage pool. - pool=%s' % (opts.name))\n print >>sys.stdout, _('Created storage pool. - pool=%s') % (opts.name)\n return True\n except KssCommandException, e:\n raise e\n finally:\n conn.close()", "metadata": "root.CreateStoragePool.process", "header": "['class', 'CreateStoragePool', '(', 'KssCommand', ')', ':', '___EOS___']", "index": 132 } ]
[ { "span": "import os", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 9 }, { "span": "import logging", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 14 }, { "span": "import karesansui", "start_line": 37, "start_column": 4, "end_line": 37, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ks", "sco", "mmand", "_", "import_", "Ks", "s", "Command_", ",_", "Ks", "s", "Command", "Exception_", ",_", "Ks", "s", "Command", "Opt", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "\\u\\u", "cmd", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "kar", "esa", "nsu", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "virt_", "._", "virt_", "import_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "load", "\\u", "locale_", ",_", "get", "\\u", "pwd", "\\u", "info_", ",_", "get", "\\u", "grp", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "const_", "import_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"[", "Error", "]", " ", "some", " ", "package", "s", " ", "not", " ", "found", ".", " ", "-", " ", "%", "s", "\"_", "%_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u_", "=_", "load", "\\u", "locale_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "'%", "prog", " ", "[", "options", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "Creat", "e", "Stor", "age", "Pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "target_", "._", "run_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "getop", "ts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "p_", "=_", "Optio", "n", "Parser_", "(_", "usage_", "=_", "usage_", ",_", "version_", "=_", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "n", "'_", ",_", "'--", "name", "'_", ",_", "dest_", "=_", "'", "name", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Name", "'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "t", "'_", ",_", "'--", "type", "'_", ",_", "dest_", "=_", "'", "type", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Poo", "l", " ", "Type", " ", "(", "dir", " ", "or", " ", "iscsi", " ", "or", " ", "fs", ")'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "p", "'_", ",_", "'--", "target", "\\u", "path", "'_", ",_", "dest_", "=_", "'", "target", "\\u", "path", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Target", " ", "path", " ", "(", "dir", ",", " ", "fs", ")'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "opt", "p", ".", "add", "\\u", "option", "('", "-", "a", "',", " ", "'--", "allocat", "ion", "',", " ", " ", "dest", "='", "allocat", "ion", "',", " ", " ", "help", "=", "\\u(", "'", "Allocati", "on", "')", ",", " ", " ", " ", "default", "=", "0", ",", " ", "type", "=\"", "int", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "opt", "p", ".", "add", "\\u", "option", "('", "-", "v", "',", " ", "'--", "avail", "able", "',", " ", " ", " ", "dest", "='", "avail", "able", "',", " ", " ", " ", "help", "=", "\\u(", "'", "Avail", "able", "')", ",", " ", " ", " ", " ", "default", "=", "0", ",", " ", "type", "=\"", "int", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "opt", "p", ".", "add", "\\u", "option", "('", "-", "c", "',", " ", "'--", "capacit", "y", "',", " ", " ", " ", " ", "dest", "='", "capacit", "y", "',", " ", " ", " ", " ", "help", "=", "\\u(", "'", "Capacit", "y", "')", ",", " ", " ", " ", " ", " ", "default", "=", "0", ",", " ", "type", "=\"", "int", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "b", "'_", ",_", "'--", "host", "\\u", "name", "'_", ",_", "dest_", "=_", "'", "host", "\\u", "name", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Host", " ", "name", " ", "(", "iscsi", ")'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "d", "'_", ",_", "'--", "device", "\\u", "path", "'_", ",_", "dest_", "=_", "'", "device", "\\u", "path", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Dev", "ice", " ", "path", " ", "(", "iscsi", ",", " ", "fs", ")'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "g", "'_", ",_", "'--", "group", "'_", ",_", "dest_", "=_", "'", "group", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Permi", "ssion", " ", "group", "'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "l", "'_", ",_", "'--", "label", "'_", ",_", "dest_", "=_", "'", "label", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Permi", "ssion", " ", "label", "'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "m", "'_", ",_", "'--", "mode", "'_", ",_", "dest_", "=_", "'", "mode", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Permi", "ssion", " ", "mode", "'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "p_", "._", "add", "\\u", "option_", "(_", "'-", "o", "'_", ",_", "'--", "owner", "'_", ",_", "dest_", "=_", "'", "owner", "'_", ",_", "help_", "=_", "\\u_", "(_", "'", "Permi", "ssion", " ", "owner", "'_", ")_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "opt", "p_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "chk", "opts_", "(_", "opts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "=_", "re_", "._", "compile_", "(_", "\"[", "^", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\\\.", "/\\u", ":-", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opts_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reg_", "._", "search_", "(_", "opts_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Il", "lig", "al", " ", "option", " ", "value", ".", " ", "option", "=", "%", "s", " ", "value", "=", "%", "s", "'_", "%_", "(_", "'-", "n", " ", "or", " ", "--", "name", "'_", ",_", "opts_", "._", "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 ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "n", " ", "or", " ", "--", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opts_", "._", "type_", "not_", "in_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Type", " ", "is", " ", "not", " ", "avail", "able", ".", " ", "type", "=", "%", "s", "'_", "%_", "opts_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "t", " ", "or", " ", "--", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "type_", "==_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "[_", "\"", "TYPE", "\\u", "DIR", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "type", ":", "dir_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "opts_", "._", "target", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "p", " ", "or", " ", "--", "target", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opts_", "._", "type_", "==_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "[_", "\"", "TYPE", "\\u", "ISCSI", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "type", ":", "iscsi", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "opts_", "._", "host", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "b", " ", "or", " ", "--", "host", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "opts_", "._", "device", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "d", " ", "or", " ", "--", "device", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opts_", "._", "type_", "==_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "[_", "\"", "TYPE", "\\u", "FS", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "type", ":", "fs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "opts_", "._", "target", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "p", " ", "or", " ", "--", "target", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "opts_", "._", "device", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "%", "s", " ", "option", " ", "is", " ", "require", "d", ".'_", "%_", "'-", "d", " ", "or", " ", "--", "device", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "The", " ", "type", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "exist", ".", " ", "type", "=", "%", "s", "'_", "%_", "opts_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opts_", "._", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reg_", "._", "search_", "(_", "opts_", "._", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Il", "lig", "al", " ", "option", " ", "value", ".", " ", "option", "=", "%", "s", " ", "value", "=", "%", "s", "'_", "%_", "(_", "'-", "l", " ", "or", " ", "--", "label", "'_", ",_", "opts_", "._", "label_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reg_", "=_", "re_", "._", "compile_", "(_", "\"[", "^", "0", "-", "9", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reg_", "._", "search_", "(_", "opts_", "._", "owner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opts_", "._", "owner_", "not_", "in_", "[_", "user_", "[_", "0_", "]_", "for_", "user_", "in_", "get", "\\u", "pwd", "\\u", "info_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Permi", "ssion", " ", "user", " ", "not", " ", "found", ".", " ", "owner", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "owner_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "opts_", "._", "owner_", ")_", "not_", "in_", "[_", "user_", "[_", "2_", "]_", "for_", "user_", "in_", "get", "\\u", "pwd", "\\u", "info_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Permi", "ssion", " ", "user", " ", "not", " ", "found", ".", " ", "owner", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "owner_", ")_", ")_", "\\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_", "opts_", "._", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reg_", "._", "search_", "(_", "opts_", "._", "group_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opts_", "._", "group_", "not_", "in_", "[_", "group_", "[_", "0_", "]_", "for_", "group_", "in_", "get", "\\u", "grp", "\\u", "info_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Permi", "ssion", " ", "user", " ", "not", " ", "found", ".", " ", "group", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "group_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "opts_", "._", "group_", ")_", "not_", "in_", "[_", "group_", "[_", "2_", "]_", "for_", "group_", "in_", "get", "\\u", "grp", "\\u", "info_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Permi", "ssion", " ", "user", " ", "not", " ", "found", ".", " ", "group", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reg_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "[", "0", "-", "9", "]{", "3", ",", "4", "}$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "reg_", "._", "match_", "(_", "opts_", "._", "mode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "Il", "lig", "al", " ", "permissi", "on", " ", "mode", ".", " ", "mode", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Creat", "e", "Stor", "age", "Pool_", "(_", "Ks", "s", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Stor", "age", "Pool_", "(_", "Ks", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "opts_", ",_", "args_", ")_", "=_", "getop", "ts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chk", "opts_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", "readonly_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inact", "ive", "\\u", "storage", "\\u", "pools_", "=_", "conn_", "._", "list", "\\u", "inact", "ive", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "storage", "\\u", "pools_", "=_", "conn_", "._", "list", "\\u", "active", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opts_", "._", "name_", "in_", "active", "\\u", "storage", "\\u", "pools_", "or_", "opts_", "._", "name_", "in_", "inact", "ive", "\\u", "storage", "\\u", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "'", "Stor", "age", " ", "pool", " ", "alr", "ead", "y", " ", "exist", "s", ".", " ", "-", " ", "pool", "=", "%", "s", "'_", "%_", "opts_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opts_", "._", "type_", "==_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "[_", "\"", "TYPE", "\\u", "DIR", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "conn_", "._", "create", "\\u", "storage", "\\u", "pool_", "(_", "opts_", "._", "name_", ",_", "opts_", "._", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "._", "target", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "allocat", "ion", "=", "opts", ".", "allocat", "ion", ",", " ", "avail", "able", "=", "opts", ".", "avail", "able", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "capacit", "y", "=", "opts", ".", "capacit", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "p", "\\u", "group_", "=_", "opts_", "._", "group_", ",_", "target", "\\u", "p", "\\u", "label_", "=_", "opts_", "._", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "p", "\\u", "mode_", "=_", "opts_", "._", "mode_", ",_", "target", "\\u", "p", "\\u", "owner_", "=_", "opts_", "._", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "'", "Fail", "ed", " ", "to", " ", "create", " ", "storage", " ", "pools", ".", " ", "-", " ", "pool", "=", "%", "s", "'_", "%_", "opts_", "._", "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_", "elif_", "opts_", "._", "type_", "==_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "[_", "\"", "TYPE", "\\u", "ISCSI", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "conn_", "._", "create", "\\u", "storage", "\\u", "pool_", "(_", "opts_", "._", "name_", ",_", "opts_", "._", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "path_", "=_", "\"/", "dev", "/", "disk", "/", "by", "-", "path", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "h", "\\u", "name_", "=_", "opts_", "._", "host", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "dev", "\\u", "path_", "=_", "opts_", "._", "device", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "allocat", "ion", "=", "opts", ".", "allocat", "ion", ",", " ", "avail", "able", "=", "opts", ".", "avail", "able", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "capacit", "y", "=", "opts", ".", "capacit", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "p", "\\u", "group_", "=_", "opts_", "._", "group_", ",_", "target", "\\u", "p", "\\u", "label_", "=_", "opts_", "._", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "p", "\\u", "mode_", "=_", "opts_", "._", "mode_", ",_", "target", "\\u", "p", "\\u", "owner_", "=_", "opts_", "._", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "'", "Fail", "ed", " ", "to", " ", "create", " ", "storage", " ", "pools", ".", " ", "-", " ", "pool", "=", "%", "s", "'_", "%_", "opts_", "._", "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_", "elif_", "opts_", "._", "type_", "==_", "STOR", "AGE", "\\u", "POOL", "\\u", "TYPE_", "[_", "\"", "TYPE", "\\u", "FS", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "conn_", "._", "create", "\\u", "storage", "\\u", "pool_", "(_", "opts_", "._", "name_", ",_", "opts_", "._", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "._", "target", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "dev", "\\u", "path_", "=_", "opts_", "._", "device", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "allocat", "ion", "=", "opts", ".", "allocat", "ion", ",", " ", "avail", "able", "=", "opts", ".", "avail", "able", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "capacit", "y", "=", "opts", ".", "capacit", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "p", "\\u", "group_", "=_", "opts_", "._", "group_", ",_", "target", "\\u", "p", "\\u", "label_", "=_", "opts_", "._", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "p", "\\u", "mode_", "=_", "opts_", "._", "mode_", ",_", "target", "\\u", "p", "\\u", "owner_", "=_", "opts_", "._", "owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "'", "Fail", "ed", " ", "to", " ", "create", " ", "storage", " ", "pools", ".", " ", "-", " ", "pool", "=", "%", "s", "'_", "%_", "opts_", "._", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Ks", "s", "Command", "Opt", "Exception_", "(_", "'", "ERROR", ":", " ", "The", " ", "type", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "exist", ".", " ", "type", "=", "%", "s", "'_", "%_", "opts_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pool", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "inact", "ive", "\\u", "storage", "\\u", "pools_", "=_", "conn_", "._", "list", "\\u", "inact", "ive", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "storage", "\\u", "pools_", "=_", "conn_", "._", "list", "\\u", "active", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "opts_", "._", "name_", "in_", "active", "\\u", "storage", "\\u", "pools_", "or_", "opts_", "._", "name_", "in_", "inact", "ive", "\\u", "storage", "\\u", "pools_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Ks", "s", "Command", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "create", " ", "storage", " ", "pools", ".", " ", "(", "Une", "xpl", "aine", "d", ")", " ", "-", " ", "pool", "=", "%", "s", "'_", "%_", "opts_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pool", " ", "autostart", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "flag_", "=_", "True_", "#", " ", "autostart", " ", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "conn_", "._", "autostart", "\\u", "storage", "\\u", "pool_", "(_", "flag_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Ks", "s", "Command", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "autostart", " ", "storage", " ", "pool", "(", "libvi", "rt", ").", " ", "-", " ", "pool", "=", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "opts_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "=_", "conn_", "._", "is", "\\u", "autostart", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "ret_", "is_", "flag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Ks", "s", "Command", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Auto", "-", "start", " ", "fail", "ed", " ", "to", " ", "set", " ", "the", " ", "storage", " ", "pool", ".", " ", "-", " ", "pool", "=", "%", "s", ",", " ", "autostart", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "name_", ",_", "str_", "(_", "ret_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "'", "Creat", "ed", " ", "storage", " ", "pool", ".", " ", "-", " ", "pool", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stdout_", ",_", "\\u_", "(_", "'", "Creat", "ed", " ", "storage", " ", "pool", ".", " ", "-", " ", "pool", "=", "%", "s", "'_", ")_", "%_", "(_", "opts_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ks", "s", "Command", "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 ", " _", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
bslatkin/dpxdt/dpxdt/server/__init__.py
[ { "content": "#!/usr/bin/env python\n# Copyright 2013 Brett Slatkin\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\"\"\"Main module for the API server.\"\"\"\n\nimport datetime\nimport logging\nimport os\n\n# Local libraries\nfrom flask import Flask, url_for\nfrom flask.ext.cache import Cache\nfrom flask.ext.login import LoginManager\nfrom flask.ext.mail import Mail\nfrom flask.ext.sqlalchemy import SQLAlchemy\nimport jinja2\n\n# Local modules required for app setup\nimport config\n\n\napp = Flask(__name__)\napp.config.from_object(config)\nif 'YOURAPPLICATION_SETTINGS' in os.environ:\n app.config.from_envvar('YOURAPPLICATION_SETTINGS')\n\n\ndb = SQLAlchemy(\n app,\n # Don't expire model instances on commit. Let functions continue to\n # quickly read properties from their last known-good state.\n session_options=dict(expire_on_commit=False))\n\n\nlogin = LoginManager(app)\nlogin.login_view = 'login_view'\nlogin.refresh_view = 'login_view'\n\n\ncache = Cache(app)\n\n\nmail = Mail(app)\n\n\n# Modules with handlers to register with the app\nfrom dpxdt.server import api\nfrom dpxdt.server import auth\nfrom dpxdt.server import emails\nfrom dpxdt.server import frontend\nfrom dpxdt.server import work_queue\nfrom dpxdt.server import work_queue_handlers\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import datetime", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 15 }, { "span": "import logging", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 14 }, { "span": "from flask import Flask, url_for", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 32 }, { "span": "import jinja2", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 13 }, { "span": "from dpxdt.server import api", "start_line": 58, "start_column": 0, "end_line": 58, "end_column": 28 }, { "span": "from dpxdt.server import auth", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 29 }, { "span": "from dpxdt.server import emails", "start_line": 60, "start_column": 0, "end_line": 60, "end_column": 31 }, { "span": "from dpxdt.server import frontend", "start_line": 61, "start_column": 0, "end_line": 61, "end_column": 33 }, { "span": "from dpxdt.server import work_queue", "start_line": 62, "start_column": 0, "end_line": 62, "end_column": 35 }, { "span": "from dpxdt.server import work_queue_handlers", "start_line": 63, "start_column": 0, "end_line": 63, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "Bre", "tt", " ", "Sla", "tkin", "_", "\\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_", "\"\"\"", "Main", " ", "module", " ", "for", " ", "the", " ", "API", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "libraries_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "url", "\\u", "for_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "cache_", "import_", "Cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "login_", "import_", "Logi", "n", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "mail_", "import_", "Mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "sqlalchemy_", "import_", "SQL", "Alchemy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "jinja2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "module", "s", " ", "require", "d", " ", "for", " ", "app", " ", "setup_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "config_", "._", "from", "\\u", "object_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "YOU", "RA", "PP", "LIC", "ATION", "\\u", "SETTING", "S", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "config_", "._", "from", "\\u", "envvar", "_", "(_", "'", "YOU", "RA", "PP", "LIC", "ATION", "\\u", "SETTING", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "=_", "SQL", "Alchemy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "expir", "e", " ", "model", " ", "instance", "s", " ", "on", " ", "commit", ".", " ", "Let", " ", "function", "s", " ", "continue", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "quickl", "y", " ", "read", " ", "proper", "ties", " ", "from", " ", "thei", "r", " ", "last", " ", "know", "n", "-", "good", " ", "state", "._", "\\u\\u\\uNL\\u\\u\\u_", "session", "\\u", "options_", "=_", "dict_", "(_", "expir", "e\\u", "on", "\\u", "commit_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "login_", "=_", "Logi", "n", "Manager_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login_", "._", "login", "\\u", "view_", "=_", "'", "login", "\\u", "view", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login_", "._", "refre", "sh", "\\u", "view_", "=_", "'", "login", "\\u", "view", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "Cache_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mail_", "=_", "Mail_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modul", "es", " ", "with", " ", "handler", "s", " ", "to", " ", "register", " ", "with", " ", "the", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dp", "xd", "t_", "._", "server_", "import_", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dp", "xd", "t_", "._", "server_", "import_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dp", "xd", "t_", "._", "server_", "import_", "emails_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dp", "xd", "t_", "._", "server_", "import_", "frontend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dp", "xd", "t_", "._", "server_", "import_", "work", "\\u", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dp", "xd", "t_", "._", "server_", "import_", "work", "\\u", "queue", "\\u", "handlers_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused local variable
fchollet/keras/keras/backend/theano_backend.py
[ { "content": "def conv3d(x, kernel, strides=(1, 1, 1),\n border_mode='valid', dim_ordering='th',\n volume_shape=None, filter_shape=None):\n '''\n Run on cuDNN if available.\n border_mode: string, \"same\" or \"valid\".\n '''\n if dim_ordering not in {'th', 'tf'}:\n raise Exception('Unknown dim_ordering ' + str(dim_ordering))\n\n if border_mode not in {'same', 'valid'}:\n raise Exception('Invalid border mode: ' + str(border_mode))\n\n if dim_ordering == 'tf':\n # TF uses the last dimension as channel dimension,\n # instead of the 2nd one.\n # TH input shape: (samples, input_depth, conv_dim1, conv_dim2, conv_dim3)\n # TF input shape: (samples, conv_dim1, conv_dim2, conv_dim3, input_depth)\n # TH kernel shape: (out_depth, input_depth, kernel_dim1, kernel_dim2, kernel_dim3)\n # TF kernel shape: (kernel_dim1, kernel_dim2, kernel_dim3, input_depth, out_depth)\n x = x.dimshuffle((0, 4, 1, 2, 3))\n kernel = kernel.dimshuffle((4, 3, 0, 1, 2))\n if volume_shape:\n volume_shape = (volume_shape[0], volume_shape[4],\n volume_shape[1], volume_shape[2], volume_shape[3])\n if filter_shape:\n filter_shape = (filter_shape[4], filter_shape[3],\n filter_shape[0], filter_shape[1], filter_shape[2])\n\n if border_mode == 'same':\n assert(strides == (1, 1, 1))\n pad_dim1 = (kernel.shape[2] - 1)\n pad_dim2 = (kernel.shape[3] - 1)\n pad_dim3 = (kernel.shape[4] - 1)\n output_shape = (x.shape[0], x.shape[1],\n x.shape[2] + pad_dim1,\n x.shape[3] + pad_dim2,\n x.shape[4] + pad_dim3)\n output = T.zeros(output_shape)\n indices = (slice(None), slice(None),\n slice(pad_dim1 // 2, x.shape[2] + pad_dim1 // 2),\n slice(pad_dim2 // 2, x.shape[3] + pad_dim2 // 2),\n slice(pad_dim3 // 2, x.shape[4] + pad_dim3 // 2))\n x = T.set_subtensor(output[indices], x)\n border_mode = 'valid'\n\n border_mode_3d = (border_mode, border_mode, border_mode)\n conv_out = conv3d2d.conv3d(signals=x.dimshuffle(0, 2, 1, 3, 4),\n filters=kernel.dimshuffle(0, 2, 1, 3, 4),\n border_mode=border_mode_3d)\n conv_out = conv_out.dimshuffle(0, 2, 1, 3, 4)\n\n # support strides by manually slicing the output\n if strides != (1, 1, 1):\n conv_out = conv_out[:, :, ::strides[0], ::strides[1], ::strides[2]]\n\n if dim_ordering == 'tf':\n conv_out = conv_out.dimshuffle((0, 2, 3, 4, 1))\n\n return conv_out", "metadata": "root.conv3d", "header": "['module', '___EOS___']", "index": 846 } ]
[ { "span": "volume_shape ", "start_line": 869, "start_column": 12, "end_line": 869, "end_column": 24 }, { "span": "filter_shape ", "start_line": 872, "start_column": 12, "end_line": 872, "end_column": 24 } ]
[]
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_", "conv3", "d_", "(_", "x_", ",_", "kernel_", ",_", "strides_", "=_", "(_", "1_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "border", "\\u", "mode_", "=_", "'", "valid", "'_", ",_", "dim", "\\u", "ordering_", "=_", "'", "th", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "shape_", "=_", "None_", ",_", "filter", "\\u", "shape_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "on", " ", "cu", "DNN", " ", "if", " ", "avail", "able", ".", "\\", "10", ";", " ", " ", " ", " ", "border", "\\u", "mode", ":", " ", "string", ",", " ", "\"", "same", "\"", " ", "or", " ", "\"", "valid", "\".\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dim", "\\u", "ordering_", "not_", "in_", "{_", "'", "th", "'_", ",_", "'", "tf", "'_", "}_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Un", "know", "n", " ", "dim", "\\u", "orderi", "ng", " ", "'_", "+_", "str_", "(_", "dim", "\\u", "ordering_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "border", "\\u", "mode_", "not_", "in_", "{_", "'", "same", "'_", ",_", "'", "valid", "'_", "}_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "border", " ", "mode", ":", " ", "'_", "+_", "str_", "(_", "border", "\\u", "mode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dim", "\\u", "ordering_", "==_", "'", "tf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TF", " ", "use", "s", " ", "the", " ", "last", " ", "dimension", " ", "as", " ", "channel", " ", "dimension", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "of", " ", "the", " ", "2n", "d", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TH", " ", "input", " ", "shape", ":", " ", "(", "samples", ",", " ", "input", "\\u", "depth", ",", " ", "conv", "\\u", "dim", "1", ",", " ", "conv", "\\u", "dim", "2", ",", " ", "conv", "\\u", "dim", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TF", " ", "input", " ", "shape", ":", " ", "(", "samples", ",", " ", "conv", "\\u", "dim", "1", ",", " ", "conv", "\\u", "dim", "2", ",", " ", "conv", "\\u", "dim", "3", ",", " ", "input", "\\u", "depth", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TH", " ", "kernel", " ", "shape", ":", " ", "(", "out", "\\u", "depth", ",", " ", "input", "\\u", "depth", ",", " ", "kernel", "\\u", "dim", "1", ",", " ", "kernel", "\\u", "dim", "2", ",", " ", "kernel", "\\u", "dim", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TF", " ", "kernel", " ", "shape", ":", " ", "(", "kernel", "\\u", "dim", "1", ",", " ", "kernel", "\\u", "dim", "2", ",", " ", "kernel", "\\u", "dim", "3", ",", " ", "input", "\\u", "depth", ",", " ", "out", "\\u", "depth", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "x_", "._", "dims", "huff", "le_", "(_", "(_", "0_", ",_", "4_", ",_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernel_", "=_", "kernel_", "._", "dims", "huff", "le_", "(_", "(_", "4_", ",_", "3_", ",_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "volume", "\\u", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volume", "\\u", "shape_", "=_", "(_", "volume", "\\u", "shape_", "[_", "0_", "]_", ",_", "volume", "\\u", "shape_", "[_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "shape_", "[_", "1_", "]_", ",_", "volume", "\\u", "shape_", "[_", "2_", "]_", ",_", "volume", "\\u", "shape_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filter", "\\u", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "shape_", "=_", "(_", "filter", "\\u", "shape_", "[_", "4_", "]_", ",_", "filter", "\\u", "shape_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "shape_", "[_", "0_", "]_", ",_", "filter", "\\u", "shape_", "[_", "1_", "]_", ",_", "filter", "\\u", "shape_", "[_", "2_", "]_", ")_", "\\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_", "border", "\\u", "mode_", "==_", "'", "same", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "strides_", "==_", "(_", "1_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pad", "\\u", "dim", "1_", "=_", "(_", "kernel_", "._", "shape_", "[_", "2_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pad", "\\u", "dim", "2_", "=_", "(_", "kernel_", "._", "shape_", "[_", "3_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pad", "\\u", "dim", "3_", "=_", "(_", "kernel_", "._", "shape_", "[_", "4_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "shape_", "=_", "(_", "x_", "._", "shape_", "[_", "0_", "]_", ",_", "x_", "._", "shape_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "shape_", "[_", "2_", "]_", "+_", "pad", "\\u", "dim", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "shape_", "[_", "3_", "]_", "+_", "pad", "\\u", "dim", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "shape_", "[_", "4_", "]_", "+_", "pad", "\\u", "dim", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "T_", "._", "zeros_", "(_", "output", "\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indices_", "=_", "(_", "slice_", "(_", "None_", ")_", ",_", "slice_", "(_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice_", "(_", "pad", "\\u", "dim", "1_", "//_", "2_", ",_", "x_", "._", "shape_", "[_", "2_", "]_", "+_", "pad", "\\u", "dim", "1_", "//_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice_", "(_", "pad", "\\u", "dim", "2_", "//_", "2_", ",_", "x_", "._", "shape_", "[_", "3_", "]_", "+_", "pad", "\\u", "dim", "2_", "//_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slice_", "(_", "pad", "\\u", "dim", "3_", "//_", "2_", ",_", "x_", "._", "shape_", "[_", "4_", "]_", "+_", "pad", "\\u", "dim", "3_", "//_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "T_", "._", "set\\u", "subt", "ens", "or_", "(_", "output_", "[_", "indices_", "]_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "border", "\\u", "mode_", "=_", "'", "valid", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "border", "\\u", "mode", "\\u", "3d_", "=_", "(_", "border", "\\u", "mode_", ",_", "border", "\\u", "mode_", ",_", "border", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "\\u", "out_", "=_", "conv3", "d2", "d_", "._", "conv3", "d_", "(_", "signals_", "=_", "x_", "._", "dims", "huff", "le_", "(_", "0_", ",_", "2_", ",_", "1_", ",_", "3_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "kernel_", "._", "dims", "huff", "le_", "(_", "0_", ",_", "2_", ",_", "1_", ",_", "3_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "border", "\\u", "mode_", "=_", "border", "\\u", "mode", "\\u", "3d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "\\u", "out_", "=_", "conv", "\\u", "out_", "._", "dims", "huff", "le_", "(_", "0_", ",_", "2_", ",_", "1_", ",_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "support", " ", "stride", "s", " ", "by", " ", "manu", "ally", " ", "slicing", " ", "the", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "strides_", "!=_", "(_", "1_", ",_", "1_", ",_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conv", "\\u", "out_", "=_", "conv", "\\u", "out_", "[_", ":_", ",_", ":_", ",_", ":_", ":_", "strides_", "[_", "0_", "]_", ",_", ":_", ":_", "strides_", "[_", "1_", "]_", ",_", ":_", ":_", "strides_", "[_", "2_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dim", "\\u", "ordering_", "==_", "'", "tf", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conv", "\\u", "out_", "=_", "conv", "\\u", "out_", "._", "dims", "huff", "le_", "(_", "(_", "0_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "conv", "\\u", "out_", "\\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,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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 ]
Unreachable code
formencode/formencode/formencode/validators.py
[ { "content": " def _validate_python(self, value, state):\n if value == 0:\n # This isn't \"empty\" for this definition.\n return value\n if not value:\n raise Invalid(self.message('empty', state), value, state)", "metadata": "root.NotEmpty._validate_python", "header": "['class', 'NotEmpty', '(', 'FancyValidator', ')', ':', '___EOS___']", "index": 445 } ]
[ { "span": "raise Invalid(self.message('empty', state), value, state)", "start_line": 450, "start_column": 12, "end_line": 450, "end_column": 69 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Not", "Empty_", "(_", "Fan", "cy", "Validator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "validat", "e\\u", "python_", "(_", "self_", ",_", "value_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "isn", "'", "t", " ", "\"", "empty", "\"", " ", "for", " ", "this", " ", "definit", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "self_", "._", "message_", "(_", "'", "empty", "'_", ",_", "state_", ")_", ",_", "value_", ",_", "state_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Variable defined multiple times
aldebaran/qibuild/python/qibuild/cmake/__init__.py
[ { "content": "def check_root_cmake_list(cmake_list_file):\n \"\"\" Check that the root CMakeLists is correct.\n\n * It should contain a cmake_minimum_required() line\n * It should contain a call to project()\n * If find_package(qibuild) is called, it should be\n called after project()\n\n \"\"\"\n dirname = os.path.dirname(cmake_list_file)\n suggested_project_name = os.path.basename(dirname)\n message = \"\"\n lines = list()\n with open(cmake_list_file, \"r\") as fp:\n lines = fp.readlines()\n\n project_line_number = None\n find_qibuild_line_number = None\n minimum_required_found = False\n for (i, line) in enumerate(lines):\n if re.match(r'^\\s*project\\s*\\(', line, re.IGNORECASE):\n project_line_number = i\n if re.match(r'^\\s*find_package\\s*\\(.*qibuild\\.*\\)', line,\n re.IGNORECASE):\n find_qibuild_line_number = i\n if re.match(r'^\\s*cmake_minimum_required\\(', line,\n re.IGNORECASE):\n minimum_required_found = True\n\n if not minimum_required_found:\n message += \"\"\"\n* Missing call to cmake_minimum_required()\nAdd a line looking like:\n\ncmake_minimum_required(VERSION 2.8)\n\nAt the top of the CMakeLists.txt file\n\"\"\"\n\n if project_line_number is None:\n message += \"\"\"\n* Missing call to project().\nPlease fix this by editing the file so that it looks like\n\ncmake_minimum_required(VERSION 2.8)\nproject({project_name})\nfind_package(qibuild)\n\n\"\"\".format(\n project_name=suggested_project_name)\n\n if find_qibuild_line_number is not None and \\\n project_line_number is not None and \\\n project_line_number > find_qibuild_line_number:\n message += \"\"\"\n* The call to find_package(qibuild) should be AFTER the call to project()\n\"\"\"\n if message:\n raise IncorrectCMakeLists(cmake_list_file, message)", "metadata": "root.check_root_cmake_list", "header": "['module', '___EOS___']", "index": 297 } ]
[ { "span": "lines ", "start_line": 309, "start_column": 4, "end_line": 309, "end_column": 9 } ]
[ { "span": "lines ", "start_line": 311, "start_column": 8, "end_line": 311, "end_column": 13 } ]
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_", "check", "\\u", "root", "\\u", "cma", "ke", "\\u", "list_", "(_", "cma", "ke", "\\u", "list", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", " ", "tha", "t", " ", "the", " ", "root", " ", "CM", "ake", "List", "s", " ", "is", " ", "correct", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "It", " ", "shou", "ld", " ", "contain", " ", "a", " ", "cma", "ke", "\\u", "minim", "um", "\\u", "require", "d", "()", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "It", " ", "shou", "ld", " ", "contain", " ", "a", " ", "call", " ", "to", " ", "project", "()", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "If", " ", "find", "\\u", "package", "(", "qi", "build", ")", " ", "is", " ", "call", "ed", ",", " ", "it", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", "call", "ed", " ", "after", " ", "project", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirname_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "cma", "ke", "\\u", "list", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suggested", "\\u", "project", "\\u", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "dirname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "cma", "ke", "\\u", "list", "\\u", "file_", ",_", "\"", "r", "\"_", ")_", "as_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "fp_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "project", "\\u", "line", "\\u", "number_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "\\u", "qi", "build", "\\u", "line", "\\u", "number_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minim", "um", "\\u", "require", "d\\u", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "i_", ",_", "line_", ")_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "match_", "(_", "r", "'", "^", "\\\\", "s", "*", "project", "\\\\", "s", "*\\\\", "('_", ",_", "line_", ",_", "re_", "._", "IGNORECASE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "\\u", "line", "\\u", "number_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'", "^", "\\\\", "s", "*", "find", "\\u", "package", "\\\\", "s", "*\\\\", "(.", "*", "qi", "build", "\\\\.", "*\\\\", ")'_", ",_", "line_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "IGNORECASE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "find", "\\u", "qi", "build", "\\u", "line", "\\u", "number_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'", "^", "\\\\", "s", "*", "cma", "ke", "\\u", "minim", "um", "\\u", "require", "d", "\\\\(", "'_", ",_", "line_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "IGNORECASE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "minim", "um", "\\u", "require", "d\\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_", "if_", "not_", "minim", "um", "\\u", "require", "d\\u", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "+=_", "\"\"\"", "\\", "10", ";", "*", " ", "Missing", " ", "call", " ", "to", " ", "cma", "ke", "\\u", "minim", "um", "\\u", "require", "d", "()", "\\", "10", ";", "Add", " ", "a", " ", "line", " ", "look", "ing", " ", "like", ":", "\\", "10", ";", "\\", "10", ";", "cma", "ke", "\\u", "minim", "um", "\\u", "require", "d", "(", "VERSI", "ON", " ", "2.8", ")", "\\", "10", ";", "\\", "10", ";", "At", " ", "the", " ", "top", " ", "of", " ", "the", " ", "CM", "ake", "List", "s", ".", "txt", " ", "file", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "project", "\\u", "line", "\\u", "number_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "+=_", "\"\"\"", "\\", "10", ";", "*", " ", "Missing", " ", "call", " ", "to", " ", "project", "()", ".", "\\", "10", ";", "Ple", "ase", " ", "fix", " ", "this", " ", "by", " ", "editin", "g", " ", "the", " ", "file", " ", "so", " ", "tha", "t", " ", "it", " ", "look", "s", " ", "like", "\\", "10", ";", "\\", "10", ";", "cma", "ke", "\\u", "minim", "um", "\\u", "require", "d", "(", "VERSI", "ON", " ", "2.8", ")", "\\", "10", ";", "project", "({", "project", "\\u", "name", "})", "\\", "10", ";", "find", "\\u", "package", "(", "qi", "build", ")", "\\", "10", ";", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "name_", "=_", "suggested", "\\u", "project", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "find", "\\u", "qi", "build", "\\u", "line", "\\u", "number_", "is_", "not_", "None_", "and_", "project", "\\u", "line", "\\u", "number_", "is_", "not_", "None_", "and_", "project", "\\u", "line", "\\u", "number_", ">_", "find", "\\u", "qi", "build", "\\u", "line", "\\u", "number_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "+=_", "\"\"\"", "\\", "10", ";", "*", " ", "The", " ", "call", " ", "to", " ", "find", "\\u", "package", "(", "qi", "build", ")", " ", "shou", "ld", " ", "be", " ", "AFTER", " ", "the", " ", "call", " ", "to", " ", "project", "()", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inco", "rrect", "CM", "ake", "Lists_", "(_", "cma", "ke", "\\u", "list", "\\u", "file_", ",_", "message_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,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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 ]
Unused import
azoft-dev-team/imagrium/env/Lib/test/test_java_list_delegate.py
[ { "content": "from java.util import ArrayList, List, Vector\n\nfrom copy import copy\n\nimport unittest\nimport test.test_support\n\n\n\n\n\nif __name__ == \"__main__\":\n test_main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CollectionProxyTest(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n ", "metadata": "root.CollectionProxyTest", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def _perform_op(self, value, op_func):\n \"\"\"\n Perform an operation\n\n value - the value to operate on\n op_func - the function that applies the operation to value\n\n Returns:\n the result of calling op_func, OR the exception that was raised in op_func\n \"\"\"\n try:\n return op_func(value)\n except Exception, e:\n return type(e)", "metadata": "root.CollectionProxyTest._perform_op", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 8 }, { "content": " def _arraylist_of(self, xs):\n \"\"\"\n Converts a python list to a java.util.ArrayList\n \"\"\"\n a = ArrayList()\n a.addAll( xs )\n return a", "metadata": "root.CollectionProxyTest._arraylist_of", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def check_list(self, control, results, list_type_names, initial, test_name):\n for result, type_name in zip(results, list_type_names):\n try:\n len(result)\n except:\n print result\n self.assertEquals(len(control), len(result), \"%s: length for %s does not match that of list\" % (test_name, type_name))\n for control_value, result_value in zip(control, result):\n self.assertEquals(control_value, result_value, \"%s: values from %s do not match those from list\" % (test_name, type_name))", "metadata": "root.CollectionProxyTest.check_list", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def _list_op_test(self, initial_value, op_func, test_name):\n \"\"\"\n Tests a list operation\n\n Ensures that performing an operation on:\n - a python list\n - a java.util.List instance\n\n gives the same result in both cases\n \"\"\"\n lists = [list(initial_value), ArrayList(initial_value), Vector(initial_value)]\n list_type_names = ['list', 'ArrayList', 'Vector']\n\n results = [self._perform_op(l, op_func) for l in lists]\n self.check_list(lists[0], lists[1:], list_type_names[1:], initial_value, test_name)\n if not isinstance(results[0], list):\n for r,n in zip(results[1:], list_type_names[1:]):\n self.assertEquals(results[0], r, '%s: result for list does not match result for java type %s' % (test_name,n) )\n else:\n self.check_list(results[0], results[1:], list_type_names[1:], initial_value, test_name)", "metadata": "root.CollectionProxyTest._list_op_test", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test_get_integer(self):\n initial_value = range(0, 5)\n\n for i in xrange(-7, 7):\n self._list_op_test(initial_value, lambda xs: xs[i], 'get_integer [%d]' % (i,))", "metadata": "root.CollectionProxyTest.test_get_integer", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_get_slice(self):\n initial_value = range(0, 5)\n \n for i in [None] + range(-7, 7):\n for j in [None] + range(-7, 7):\n for k in [None] + range(-7, 7):\n self._list_op_test(initial_value, lambda xs: xs[i:j:k], 'get_slice [%s:%s:%s]' % (i,j,k))", "metadata": "root.CollectionProxyTest.test_get_slice", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_set_integer(self):\n initial_value = range(0, 5)\n\n def make_op_func(index):\n def _f(xs):\n xs[index] = 100\n return _f\n\n for i in xrange(-7, 7):\n self._list_op_test(initial_value, make_op_func(i), 'set_integer [%d]' % (i,))", "metadata": "root.CollectionProxyTest.test_set_integer", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_set_slice(self):\n initial_value = range(0, 5)\n\n def make_op_func(i, j, k, v):\n def _f(xs):\n xs[i:j:k] = v\n return _f\n \n for i in [None] + range(-7, 7):\n for j in [None] + range(-7, 7):\n for k in [None] + range(-7, 7):\n self._list_op_test(initial_value, make_op_func(i, j, k, []), 'set_slice [%s:%s:%s]=[]' % (i,j,k))\n self._list_op_test(initial_value, make_op_func(i, j, k, range(0,2)), 'set_slice [%s:%s:%s]=range(0,2)' % (i,j,k))\n self._list_op_test(initial_value, make_op_func(i, j, k, range(0,4)), 'set_slice [%s:%s:%s]=range(0,4)' % (i,j,k))\n self._list_op_test(initial_value, make_op_func(i, j, k, xrange(0,2)), 'set_slice [%s:%s:%s]=xrange(0,2)' % (i,j,k))\n self._list_op_test(initial_value, make_op_func(i, j, k, self._arraylist_of(range(0,2))), 'set_slice [%s:%s:%s]=ArrayList(range(0,2))' % (i,j,k))\n \n self._list_op_test([1,2,3,4,5], make_op_func(1, None, None, [1,2,3,4,5]), 'set_slice [1:]=[1,2,3,4,5]')", "metadata": "root.CollectionProxyTest.test_set_slice", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 87 }, { "content": " def test_del_integer(self):\n initial_value = range(0,5)\n\n def make_op_func(index):\n def _f(xs):\n del xs[index]\n return _f\n\n for i in xrange(-7, 7):\n self._list_op_test(initial_value, make_op_func(i), 'del_integer [%d]' % (i,))", "metadata": "root.CollectionProxyTest.test_del_integer", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_del_slice(self):\n initial_value = range(0,5)\n\n def make_op_func(i, j, k):\n def _f(xs):\n del xs[i:j:k]\n return _f\n\n for i in [None] + range(-7, 7):\n for j in [None] + range(-7, 7):\n for k in [None] + range(-7, 7):\n self._list_op_test(initial_value, make_op_func(i, j, k), 'del_slice [%s:%s:%s]' % (i,j,k))", "metadata": "root.CollectionProxyTest.test_del_slice", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 117 }, { "content": " def test_len(self):\n jlist = ArrayList()\n jlist.addAll(range(0, 10))\n\n self.assert_(len(jlist) == 10)", "metadata": "root.CollectionProxyTest.test_len", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 130 }, { "content": " def test_iter(self):\n jlist = ArrayList()\n jlist.addAll(range(0, 10))\n\n i = iter(jlist)\n\n x = list(i)\n\n self.assert_(x == range(0, 10))", "metadata": "root.CollectionProxyTest.test_iter", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 136 }, { "content": " def test_override_len(self):\n class MyList (ArrayList):\n def __len__(self):\n return self.size() + 1;\n\n m = MyList()\n m.addAll(range(0,10))\n\n self.assert_(len(m) == 11)", "metadata": "root.CollectionProxyTest.test_override_len", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 146 }, { "content": " def test_override_iter(self):\n class MyList (ArrayList):\n def __iter__(self):\n return iter(self.subList(0, self.size() - 1));\n\n\n m = MyList()\n m.addAll(range(0,10))\n i = iter(m)\n x = list(i)\n\n self.assert_(x == range(0, 9))", "metadata": "root.CollectionProxyTest.test_override_iter", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def test_override_getsetdelitem(self):\n # Create an ArrayList subclass that provides some silly overrides for get/set/del item\n class MyList (ArrayList):\n def __getitem__(self, key):\n return self.get(key) * 2;\n\n def __setitem__(self, key, value):\n return self.set(key, value * 2);\n\n def __delitem__(self, key):\n self.add(84)\n\n\n m = MyList()\n m.addAll(range(0,10))\n\n self.assert_(m[1] == 2)\n self.assert_(m.get(1) == 1)\n\n m[0] = 3\n self.assert_(m.get(0) == 6)\n self.assert_(m[0] == 12)\n\n del m[0]\n self.assert_(m.size() == 11)\n self.assert_(m.get(10) == 84)", "metadata": "root.CollectionProxyTest.test_override_getsetdelitem", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 169 }, { "content": " def test_set_slice_from_input_types(self):\n \"\"\"\n Tests the slice setting functionality of Python lists\n Ensures that the results are all the same, whether the source list is a Python list, a java.util.List or an iterator\n \"\"\"\n initial_value = range(0, 5)\n \n def make_op_func(i, j, k, v):\n def _f(xs):\n xs[i:j:k] = v\n return _f\n \n for i in [None] + range(-7, 7):\n for j in [None] + range(-7, 7):\n for k in [None] + range(-7, 7):\n destPy = copy(initial_value)\n destJUL = copy(initial_value)\n destIter = copy(initial_value)\n \n sourcePy = range(0, 2)\n sourceJUL = self._arraylist_of(range(0, 2))\n sourceIter = xrange(0, 2)\n \n resultPy = self._perform_op(destPy, make_op_func(i, j, k, sourcePy))\n resultJUL = self._perform_op(destJUL, make_op_func(i, j, k, sourceJUL))\n resultIter = self._perform_op(destIter, make_op_func(i, j, k, sourceIter))\n \n self.assertEquals(resultPy, resultJUL)\n self.assertEquals(resultPy, resultIter)\n\n self.assertEquals(destPy, destJUL)\n self.assertEquals(destPy, destIter)", "metadata": "root.CollectionProxyTest.test_set_slice_from_input_types", "header": "['class', 'CollectionProxyTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 198 }, { "content": "def test_main():\n test.test_support.run_unittest(CollectionProxyTest)", "metadata": "root.test_main", "header": "['module', '___EOS___']", "index": 233 } ]
[ { "span": "from java.util import ArrayList, List, Vector", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "java_", "._", "util_", "import_", "Array", "List_", ",_", "List_", ",_", "Vector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "copy_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "test_", "._", "test\\u", "support_", "\\u\\u\\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\\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 ", " _", "test\\u", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Collecti", "on", "Pro", "xy", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "perform", "\\u", "op_", "(_", "self_", ",_", "value_", ",_", "op", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "an", " ", "operati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "-", " ", "the", " ", "value", " ", "to", " ", "operate", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "op", "\\u", "func", " ", "-", " ", "the", " ", "function", " ", "tha", "t", " ", "appli", "es", " ", "the", " ", "operati", "on", " ", "to", " ", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "result", " ", "of", " ", "calling", " ", "op", "\\u", "func", ",", " ", "OR", " ", "the", " ", "exception", " ", "tha", "t", " ", "was", " ", "raise", "d", " ", "in", " ", "op", "\\u", "func", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "op", "\\u", "func_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "\\u", "array", "list", "\\u", "of_", "(_", "self_", ",_", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "python", " ", "list", " ", "to", " ", "a", " ", "java", ".", "util", ".", "Array", "List", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "Array", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "add", "All_", "(_", "xs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "list_", "(_", "self_", ",_", "control_", ",_", "results_", ",_", "list", "\\u", "type", "\\u", "names_", ",_", "initial_", ",_", "test\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "result_", ",_", "type", "\\u", "name_", "in_", "zip_", "(_", "results_", ",_", "list", "\\u", "type", "\\u", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "len_", "(_", "result_", ")_", "\\u\\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_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "control_", ")_", ",_", "len_", "(_", "result_", ")_", ",_", "\"%", "s", ":", " ", "length", " ", "for", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "match", " ", "tha", "t", " ", "of", " ", "list", "\"_", "%_", "(_", "test\\u", "name_", ",_", "type", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "control", "\\u", "value_", ",_", "result", "\\u", "value_", "in_", "zip_", "(_", "control_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "control", "\\u", "value_", ",_", "result", "\\u", "value_", ",_", "\"%", "s", ":", " ", "values", " ", "from", " ", "%", "s", " ", "do", " ", "not", " ", "match", " ", "tho", "se", " ", "from", " ", "list", "\"_", "%_", "(_", "test\\u", "name_", ",_", "type", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "self_", ",_", "initial", "\\u", "value_", ",_", "op", "\\u", "func_", ",_", "test\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "a", " ", "list", " ", "operati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "perform", "ing", " ", "an", " ", "operati", "on", " ", "on", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "a", " ", "python", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "a", " ", "java", ".", "util", ".", "List", " ", "instance", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "give", "s", " ", "the", " ", "same", " ", "result", " ", "in", " ", "bot", "h", " ", "case", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lists_", "=_", "[_", "list_", "(_", "initial", "\\u", "value_", ")_", ",_", "Array", "List_", "(_", "initial", "\\u", "value_", ")_", ",_", "Vector_", "(_", "initial", "\\u", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "type", "\\u", "names_", "=_", "[_", "'", "list", "'_", ",_", "'", "Array", "List", "'_", ",_", "'", "Vector", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "self_", "._", "\\u", "perform", "\\u", "op_", "(_", "l_", ",_", "op", "\\u", "func_", ")_", "for_", "l_", "in_", "lists_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "list_", "(_", "lists_", "[_", "0_", "]_", ",_", "lists_", "[_", "1_", ":_", "]_", ",_", "list", "\\u", "type", "\\u", "names_", "[_", "1_", ":_", "]_", ",_", "initial", "\\u", "value_", ",_", "test\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "results_", "[_", "0_", "]_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "r_", ",_", "n_", "in_", "zip_", "(_", "results_", "[_", "1_", ":_", "]_", ",_", "list", "\\u", "type", "\\u", "names_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "results_", "[_", "0_", "]_", ",_", "r_", ",_", "'%", "s", ":", " ", "result", " ", "for", " ", "list", " ", "doe", "s", " ", "not", " ", "match", " ", "result", " ", "for", " ", "java", " ", "type", " ", "%", "s", "'_", "%_", "(_", "test\\u", "name_", ",_", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "list_", "(_", "results_", "[_", "0_", "]_", ",_", "results_", "[_", "1_", ":_", "]_", ",_", "list", "\\u", "type", "\\u", "names_", "[_", "1_", ":_", "]_", ",_", "initial", "\\u", "value_", ",_", "test\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "test\\u", "get", "\\u", "integer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "range_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "lambda_", "xs_", ":_", "xs_", "[_", "i_", "]_", ",_", "'", "get", "\\u", "integ", "er", " ", "[", "%", "d", "]'_", "%_", "(_", "i_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "test\\u", "get", "\\u", "slice_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "range_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "lambda_", "xs_", ":_", "xs_", "[_", "i_", ":_", "j_", ":_", "k_", "]_", ",_", "'", "get", "\\u", "slice", " ", "[", "%", "s", ":", "%", "s", ":", "%", "s", "]'_", "%_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "test\\u", "set\\u", "integer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "range_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "op", "\\u", "func_", "(_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "f_", "(_", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xs_", "[_", "index_", "]_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ")_", ",_", "'", "set\\u", "integ", "er", " ", "[", "%", "d", "]'_", "%_", "(_", "i_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "test\\u", "set\\u", "slice_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "range_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "f_", "(_", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xs_", "[_", "i_", ":_", "j_", ":_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "[_", "]_", ")_", ",_", "'", "set\\u", "slice", " ", "[", "%", "s", ":", "%", "s", ":", "%", "s", "]=", "[]'_", "%_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "range_", "(_", "0_", ",_", "2_", ")_", ")_", ",_", "'", "set\\u", "slice", " ", "[", "%", "s", ":", "%", "s", ":", "%", "s", "]=", "range", "(", "0", ",", "2", ")'_", "%_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "range_", "(_", "0_", ",_", "4_", ")_", ")_", ",_", "'", "set\\u", "slice", " ", "[", "%", "s", ":", "%", "s", ":", "%", "s", "]=", "range", "(", "0", ",", "4", ")'_", "%_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "xrange_", "(_", "0_", ",_", "2_", ")_", ")_", ",_", "'", "set\\u", "slice", " ", "[", "%", "s", ":", "%", "s", ":", "%", "s", "]=", "xran", "ge", "(", "0", ",", "2", ")'_", "%_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "self_", "._", "\\u", "array", "list", "\\u", "of_", "(_", "range_", "(_", "0_", ",_", "2_", ")_", ")_", ")_", ",_", "'", "set\\u", "slice", " ", "[", "%", "s", ":", "%", "s", ":", "%", "s", "]=", "Array", "List", "(", "range", "(", "0", ",", "2", "))'_", "%_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "1_", ",_", "None_", ",_", "None_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ")_", ",_", "'", "set\\u", "slice", " ", "[", "1", ":]", "=[", "1", ",", "2", ",", "3", ",", "4", ",", "5", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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", "del", "\\u", "integer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "range_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "op", "\\u", "func_", "(_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "f_", "(_", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "xs_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ")_", ",_", "'", "del", "\\u", "integ", "er", " ", "[", "%", "d", "]'_", "%_", "(_", "i_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "test\\u", "del", "\\u", "slice_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "value_", "=_", "range_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "f_", "(_", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "xs_", "[_", "i_", ":_", "j_", ":_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "list", "\\u", "op", "\\u", "test_", "(_", "initial", "\\u", "value_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ",_", "'", "del", "\\u", "slice", " ", "[", "%", "s", ":", "%", "s", ":", "%", "s", "]'_", "%_", "(_", "i_", ",_", "j_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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_", "def_", "test\\u", "len_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jl", "ist_", "=_", "Array", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jl", "ist_", "._", "add", "All_", "(_", "range_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "len_", "(_", "jl", "ist_", ")_", "==_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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", "iter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jl", "ist_", "=_", "Array", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jl", "ist_", "._", "add", "All_", "(_", "range_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "iter_", "(_", "jl", "ist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "list_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "x_", "==_", "range_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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", "override", "\\u", "len_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "My", "List_", "(_", "Array", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "size_", "(_", ")_", "+_", "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_", "m_", "=_", "My", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "All_", "(_", "range_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "len_", "(_", "m_", ")_", "==_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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", "override", "\\u", "iter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "My", "List_", "(_", "Array", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "sub", "List_", "(_", "0_", ",_", "self_", "._", "size_", "(_", ")_", "-_", "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_", "m_", "=_", "My", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "All_", "(_", "range_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "iter_", "(_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "list_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "x_", "==_", "range_", "(_", "0_", ",_", "9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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", "override", "\\u", "gets", "et", "deli", "tem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "Array", "List", " ", "subclass", " ", "tha", "t", " ", "provide", "s", " ", "some", " ", "sil", "ly", " ", "override", "s", " ", "for", " ", "get", "/", "set", "/", "del", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "My", "List_", "(_", "Array", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get_", "(_", "key_", ")_", "*_", "2_", ";_", "\\u\\u\\uNEWLINE\\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 ", " _", "return_", "self_", "._", "set_", "(_", "key_", ",_", "value_", "*_", "2_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add_", "(_", "84_", ")_", "\\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_", "m_", "=_", "My", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "All_", "(_", "range_", "(_", "0_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "m_", "[_", "1_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "m_", "._", "get_", "(_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "[_", "0_", "]_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "m_", "._", "get_", "(_", "0_", ")_", "==_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "m_", "[_", "0_", "]_", "==_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "m_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "m_", "._", "size_", "(_", ")_", "==_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "m_", "._", "get_", "(_", "10_", ")_", "==_", "84_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Collecti", "on", "Pro", "xy", "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", "set\\u", "slice", "\\u", "from", "\\u", "input", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "the", " ", "slice", " ", "setti", "ng", " ", "functional", "it", "y", " ", "of", " ", "Pyth", "on", " ", "lists", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "the", " ", "results", " ", "are", " ", "all", " ", "the", " ", "same", ",", " ", "whe", "ther", " ", "the", " ", "source", " ", "list", " ", "is", " ", "a", " ", "Pyth", "on", " ", "list", ",", " ", "a", " ", "java", ".", "util", ".", "List", " ", "or", " ", "an", " ", "iter", "ator", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial", "\\u", "value_", "=_", "range_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "f_", "(_", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xs_", "[_", "i_", ":_", "j_", ":_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "[_", "None_", "]_", "+_", "range_", "(_", "-_", "7_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dest", "Py_", "=_", "copy_", "(_", "initial", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "JU", "L_", "=_", "copy_", "(_", "initial", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "Iter_", "=_", "copy_", "(_", "initial", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Py_", "=_", "range_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "JU", "L_", "=_", "self_", "._", "\\u", "array", "list", "\\u", "of_", "(_", "range_", "(_", "0_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "Iter_", "=_", "xrange_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result", "Py_", "=_", "self_", "._", "\\u", "perform", "\\u", "op_", "(_", "dest", "Py_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "source", "Py_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "JU", "L_", "=_", "self_", "._", "\\u", "perform", "\\u", "op_", "(_", "dest", "JU", "L_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "source", "JU", "L_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "Iter_", "=_", "self_", "._", "\\u", "perform", "\\u", "op_", "(_", "dest", "Iter_", ",_", "make", "\\u", "op", "\\u", "func_", "(_", "i_", ",_", "j_", ",_", "k_", ",_", "source", "Iter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "result", "Py_", ",_", "result", "JU", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "result", "Py_", ",_", "result", "Iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dest", "Py_", ",_", "dest", "JU", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dest", "Py_", ",_", "dest", "Iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "._", "test\\u", "support_", "._", "run", "\\u", "unittest_", "(_", "Collecti", "on", "Pro", "xy", "Test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
Arelle/Arelle/arelle/CntlrWebMain.py
[ { "content": "def validation(file=None):\n \"\"\"REST request to validate, by *get* or *post*, to URL patterns including */rest/xbrl/<file:path>/{open|close|validation|DTS...}*,\n and */rest/xbrl/{view|open|close}*.\n Sets up CntrlCmdLine options for request, performed by runOptionsAndGetResult using CntlrCmdLine.run with get or post arguments.\n \n :returns: html, xhtml, xml, json, text -- Return per media type argument and request arguments\n \"\"\"\n errors = []\n flavor = request.query.flavor or 'standard'\n media = request.query.media or 'html'\n requestPathParts = request.urlparts[2].split('/')\n isValidation = 'validation' == requestPathParts[-1] or 'validation' == requestPathParts[-2]\n view = request.query.view\n viewArcrole = request.query.viewArcrole\n if request.method == 'POST':\n mimeType = request.get_header(\"Content-Type\")\n if mimeType.startswith(\"multipart/form-data\"):\n _upload = request.files.get(\"upload\")\n if not _upload or not _upload.filename.endswith(\".zip\"):\n errors.append(_(\"POST file upload must be a zip file\"))\n sourceZipStream = None\n else:\n sourceZipStream = _upload.file\n elif mimeType not in ('application/zip', 'application/x-zip', 'application/x-zip-compressed', 'multipart/x-zip'):\n errors.append(_(\"POST must provide a zip file, Content-Type '{0}' not recognized as a zip file.\").format(mimeType))\n sourceZipStream = request.body\n else:\n sourceZipStream = None\n if not view and not viewArcrole:\n if requestPathParts[-1] in supportedViews:\n view = requestPathParts[-1]\n if isValidation:\n if view or viewArcrole:\n errors.append(_(\"Only validation or one view can be specified in one requested.\"))\n if media not in ('xml', 'xhtml', 'html', 'json', 'text') and not (sourceZipStream and media == 'zip'):\n errors.append(_(\"Media '{0}' is not supported for validation (please select xhtml, html, xml, json or text)\").format(media))\n elif view or viewArcrole:\n if media not in ('xml', 'xhtml', 'html', 'csv', 'json'):\n errors.append(_(\"Media '{0}' is not supported for view (please select xhtml, html, xml, csv, or json)\").format(media))\n elif requestPathParts[-1] not in (\"open\", \"close\"): \n errors.append(_(\"Neither validation nor view requested, nothing to do.\"))\n if (flavor not in ('standard', 'standard-except-formula', 'formula-compile-only', 'formula-compile-and-run')\n and not flavor.startswith('edgar') and not flavor.startswith('sec')):\n errors.append(_(\"Flavor '{0}' is not supported\").format(flavor)) \n if view and view not in supportedViews:\n errors.append(_(\"View '{0}' is not supported\").format(view))\n if errors:\n errors.insert(0, _(\"URL: \") + (file or request.query.file or '(no file)'))\n return errorReport(errors, media)\n options = Options() # need named parameters to simulate options\n isFormulaOnly = False\n for key, value in request.query.items():\n if key == \"file\":\n setattr(options, \"entrypointFile\", value)\n elif key == \"flavor\":\n if value.startswith(\"sec\") or value.startswith(\"edgar\"):\n setattr(options, \"validateEFM\", True)\n elif value == \"formula-compile-only\":\n isFormulaOnly = True\n setattr(options, \"formulaAction\", \"validate\")\n elif value == \"formula-compile-and-run\":\n isFormulaOnly = True\n setattr(options, \"formulaAction\", \"run\")\n elif value == \"standard-except-formula\":\n setattr(options, \"formulaAction\", \"none\")\n elif key in(\"media\", \"view\", \"viewArcrole\"):\n pass\n elif key in validationOptions:\n optionKey, optionValue = validationOptions[key]\n setattr(options, optionKey, optionValue if optionValue is not None else value)\n elif key in validationKeyVarName:\n setattr(options, validationKeyVarName[key], value or True)\n elif not value: # convert plain str parameter present to True parameter\n setattr(options, key, True)\n else:\n setattr(options, key, value)\n if file:\n setattr(options, \"entrypointFile\", file.replace(';','/'))\n requestPathParts = set(request.urlparts[2].split('/'))\n viewFile = None\n if isValidation:\n if not isFormulaOnly:\n setattr(options, \"validate\", True)\n elif view:\n viewFile = FileNamedStringIO(media)\n setattr(options, view + \"File\", viewFile)\n elif viewArcrole:\n viewFile = FileNamedStringIO(media)\n setattr(options, \"viewArcrole\", viewArcrole)\n setattr(options, \"viewFile\", viewFile)\n return runOptionsAndGetResult(options, media, viewFile, sourceZipStream)", "metadata": "root.validation", "header": "['module', '___EOS___']", "index": 196 }, { "content": "def quickbooksGLresponse():\n \"\"\"Poll for QuickBooks protocol responses for *get* requests to */rest/quickbooks/response*.\n \n :returns: html, xml, csv, text -- Return per media type argument and request arguments, if response is ready, otherwise javascript to requery this *get* request periodicially.\n \"\"\"\n from arelle import CntlrQuickBooks\n ticket = request.query.ticket\n media = request.query.media\n viewRequested = request.query.view\n status = CntlrQuickBooks.qbRequestStatus.get(ticket)\n if not status:\n return htmlBody(tableRows([_(\"QuickBooks ticket not found, request canceled.\")], header=_(\"Quickbooks Request\")))\n if status.startswith(\"ConnectionErrorMessage: \"):\n CntlrQuickBooks.qbRequestStatus.pop(ticket, None)\n return errorReport([status[24:]], media)\n if status != \"Done\" or ticket not in CntlrQuickBooks.xbrlInstances:\n return htmlBody(tableRows([_(\"{0}, Waiting 20 seconds...\").format(status)], \n header=_(\"Quickbooks Request\")), \n script='''\n<script type=\"text/javascript\">\n<!-- \nvar timer = setInterval(\"autoRefresh()\", 1000 * 20);\nfunction autoRefresh(){{clearInterval(timer);self.location.reload(true);}}\n//--> \n</script>\n''')\n CntlrQuickBooks.qbRequestStatus.pop(ticket)\n \n instanceUuid = CntlrQuickBooks.xbrlInstances[ticket]\n CntlrQuickBooks.xbrlInstances.pop(ticket)\n options = Options()\n setattr(options, \"entrypointFile\", instanceUuid)\n viewFile = FileNamedStringIO(media)\n setattr(options, \"factsFile\", viewFile)\n return runOptionsAndGetResult(options, media, viewFile)", "metadata": "root.quickbooksGLresponse", "header": "['module', '___EOS___']", "index": 436 } ]
[ { "span": "requestPathParts ", "start_line": 274, "start_column": 4, "end_line": 274, "end_column": 20 }, { "span": "viewRequested ", "start_line": 444, "start_column": 4, "end_line": 444, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validation_", "(_", "file_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "REST", " ", "request", " ", "to", " ", "validat", "e", ",", " ", "by", " ", "*", "get", "*", " ", "or", " ", "*", "post", "*", ",", " ", "to", " ", "URL", " ", "pattern", "s", " ", "inclu", "ding", " ", "*/", "rest", "/", "xbr", "l", "/", "<", "file", ":", "path", ">/", "{", "open", "|", "close", "|", "validation", "|", "DT", "S", "...", "}*", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "*/", "rest", "/", "xbr", "l", "/{", "view", "|", "open", "|", "close", "}*", ".", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "up", " ", "Cnt", "rl", "Cmd", "Line", " ", "options", " ", "for", " ", "request", ",", " ", "perform", "ed", " ", "by", " ", "run", "Optio", "ns", "And", "Get", "Result", " ", "usi", "ng", " ", "Cnt", "lr", "Cmd", "Line", ".", "run", " ", "with", " ", "get", " ", "or", " ", "post", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "html", ",", " ", "xh", "tml", ",", " ", "xml", ",", " ", "json", ",", " ", "text", " ", "--", " ", "Return", " ", "per", " ", "media", " ", "type", " ", "argu", "ment", " ", "and", " ", "request", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "request_", "._", "query_", "._", "flavor_", "or_", "'", "standard", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media_", "=_", "request_", "._", "query_", "._", "media_", "or_", "'", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "Path", "Parts_", "=_", "request_", "._", "urlpa", "rts_", "[_", "2_", "]_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Validation_", "=_", "'", "validation", "'_", "==_", "request", "Path", "Parts_", "[_", "-_", "1_", "]_", "or_", "'", "validation", "'_", "==_", "request", "Path", "Parts_", "[_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "request_", "._", "query_", "._", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Arc", "role_", "=_", "request_", "._", "query_", "._", "view", "Arc", "role_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mime", "Type_", "=_", "request_", "._", "get", "\\u", "header_", "(_", "\"", "Conten", "t", "-", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mime", "Type_", "._", "startswith_", "(_", "\"", "multip", "art", "/", "form", "-", "data", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "upload_", "=_", "request_", "._", "files_", "._", "get_", "(_", "\"", "upload", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "upload_", "or_", "not_", "\\u", "upload_", "._", "filename_", "._", "endswith_", "(_", "\".", "zip", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "POST", " ", "file", " ", "upload", " ", "must", " ", "be", " ", "a", " ", "zip", " ", "file", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "Zip", "Stream_", "=_", "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 ", " _", "source", "Zip", "Stream_", "=_", "\\u", "upload_", "._", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mime", "Type_", "not_", "in_", "(_", "'", "applica", "tion", "/", "zip", "'_", ",_", "'", "applica", "tion", "/", "x", "-", "zip", "'_", ",_", "'", "applica", "tion", "/", "x", "-", "zip", "-", "compress", "ed", "'_", ",_", "'", "multip", "art", "/", "x", "-", "zip", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "POST", " ", "must", " ", "provide", " ", "a", " ", "zip", " ", "file", ",", " ", "Conten", "t", "-", "Type", " ", "'{", "0", "}'", " ", "not", " ", "recognize", "d", " ", "as", " ", "a", " ", "zip", " ", "file", ".\"_", ")_", "._", "format_", "(_", "mime", "Type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "Zip", "Stream_", "=_", "request_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "Zip", "Stream_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "view_", "and_", "not_", "view", "Arc", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request", "Path", "Parts_", "[_", "-_", "1_", "]_", "in_", "support", "ed", "Views_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "request", "Path", "Parts_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "Validation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "view_", "or_", "view", "Arc", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "On", "ly", " ", "validation", " ", "or", " ", "one", " ", "view", " ", "can", " ", "be", " ", "specified", " ", "in", " ", "one", " ", "request", "ed", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "media_", "not_", "in_", "(_", "'", "xml", "'_", ",_", "'", "xh", "tml", "'_", ",_", "'", "html", "'_", ",_", "'", "json", "'_", ",_", "'", "text", "'_", ")_", "and_", "not_", "(_", "source", "Zip", "Stream_", "and_", "media_", "==_", "'", "zip", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "Media", " ", "'{", "0", "}'", " ", "is", " ", "not", " ", "support", "ed", " ", "for", " ", "validation", " ", "(", "plea", "se", " ", "select", " ", "xh", "tml", ",", " ", "html", ",", " ", "xml", ",", " ", "json", " ", "or", " ", "text", ")\"_", ")_", "._", "format_", "(_", "media_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "view_", "or_", "view", "Arc", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "media_", "not_", "in_", "(_", "'", "xml", "'_", ",_", "'", "xh", "tml", "'_", ",_", "'", "html", "'_", ",_", "'", "csv", "'_", ",_", "'", "json", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "Media", " ", "'{", "0", "}'", " ", "is", " ", "not", " ", "support", "ed", " ", "for", " ", "view", " ", "(", "plea", "se", " ", "select", " ", "xh", "tml", ",", " ", "html", ",", " ", "xml", ",", " ", "csv", ",", " ", "or", " ", "json", ")\"_", ")_", "._", "format_", "(_", "media_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request", "Path", "Parts_", "[_", "-_", "1_", "]_", "not_", "in_", "(_", "\"", "open", "\"_", ",_", "\"", "close", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "Nei", "ther", " ", "validation", " ", "nor", " ", "view", " ", "request", "ed", ",", " ", "not", "hing", " ", "to", " ", "do", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "flavor_", "not_", "in_", "(_", "'", "standard", "'_", ",_", "'", "standard", "-", "except", "-", "formula", "'_", ",_", "'", "formula", "-", "compile", "-", "only", "'_", ",_", "'", "formula", "-", "compile", "-", "and", "-", "run", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "flavor_", "._", "startswith_", "(_", "'", "edg", "ar", "'_", ")_", "and_", "not_", "flavor_", "._", "startswith_", "(_", "'", "sec", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "Fla", "vor", " ", "'{", "0", "}'", " ", "is", " ", "not", " ", "support", "ed", "\"_", ")_", "._", "format_", "(_", "flavor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "view_", "and_", "view_", "not_", "in_", "support", "ed", "Views_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\\u_", "(_", "\"", "View", " ", "'{", "0", "}'", " ", "is", " ", "not", " ", "support", "ed", "\"_", ")_", "._", "format_", "(_", "view_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "insert_", "(_", "0_", ",_", "\\u_", "(_", "\"", "URL", ":", " ", "\"_", ")_", "+_", "(_", "file_", "or_", "request_", "._", "query_", "._", "file_", "or_", "'(", "no", " ", "file", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "error", "Report_", "(_", "errors_", ",_", "media_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "options_", "=_", "Options_", "(_", ")_", "#", " ", "need", " ", "named", " ", "parameter", "s", " ", "to", " ", "simulat", "e", " ", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Form", "ula", "Only_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "request_", "._", "query_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "==_", "\"", "file", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "options_", ",_", "\"", "entrypoint", "File", "\"_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "\"", "flavor", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "startswith_", "(_", "\"", "sec", "\"_", ")_", "or_", "value_", "._", "startswith_", "(_", "\"", "edg", "ar", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "options_", ",_", "\"", "validat", "e", "EF", "M", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "==_", "\"", "formula", "-", "compile", "-", "only", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Form", "ula", "Only_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "\"", "formula", "Action", "\"_", ",_", "\"", "validat", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "==_", "\"", "formula", "-", "compile", "-", "and", "-", "run", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Form", "ula", "Only_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "\"", "formula", "Action", "\"_", ",_", "\"", "run", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "==_", "\"", "standard", "-", "except", "-", "formula", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "options_", ",_", "\"", "formula", "Action", "\"_", ",_", "\"", "none", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "in_", "(_", "\"", "media", "\"_", ",_", "\"", "view", "\"_", ",_", "\"", "view", "Arc", "role", "\"_", ")_", ":_", "\\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_", "key_", "in_", "validation", "Options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "Key_", ",_", "option", "Value_", "=_", "validation", "Options_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "option", "Key_", ",_", "option", "Value_", "if_", "option", "Value_", "is_", "not_", "None_", "else_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "in_", "validation", "Key", "Var", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "options_", ",_", "validation", "Key", "Var", "Name_", "[_", "key_", "]_", ",_", "value_", "or_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "value_", ":_", "#", " ", "convert", " ", "plain", " ", "str", " ", "parameter", " ", "presen", "t", " ", "to", " ", "Tru", "e", " ", "parameter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "options_", ",_", "key_", ",_", "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 ", " _", "setattr_", "(_", "options_", ",_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "options_", ",_", "\"", "entrypoint", "File", "\"_", ",_", "file_", "._", "replace_", "(_", "';'_", ",_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request", "Path", "Parts_", "=_", "set_", "(_", "request_", "._", "urlpa", "rts_", "[_", "2_", "]_", "._", "split_", "(_", "'/'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "File_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Validation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "Form", "ula", "Only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "options_", ",_", "\"", "validat", "e", "\"_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "view_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "File_", "=_", "File", "Name", "d", "String", "IO_", "(_", "media_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "view_", "+_", "\"", "File", "\"_", ",_", "view", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "view", "Arc", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "File_", "=_", "File", "Name", "d", "String", "IO_", "(_", "media_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "\"", "view", "Arc", "role", "\"_", ",_", "view", "Arc", "role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "\"", "view", "File", "\"_", ",_", "view", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "run", "Optio", "ns", "And", "Get", "Result_", "(_", "options_", ",_", "media_", ",_", "view", "File_", ",_", "source", "Zip", "Stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "quick", "books", "GL", "response_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Poll", " ", "for", " ", "Qui", "ck", "Books", " ", "protoc", "ol", " ", "response", "s", " ", "for", " ", "*", "get", "*", " ", "request", "s", " ", "to", " ", "*/", "rest", "/", "quick", "books", "/", "response", "*.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "html", ",", " ", "xml", ",", " ", "csv", ",", " ", "text", " ", "--", " ", "Return", " ", "per", " ", "media", " ", "type", " ", "argu", "ment", " ", "and", " ", "request", " ", "argu", "ment", "s", ",", " ", "if", " ", "response", " ", "is", " ", "read", "y", ",", " ", "other", "wis", "e", " ", "javascript", " ", "to", " ", "reque", "ry", " ", "this", " ", "*", "get", "*", " ", "request", " ", "periodic", "ial", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "import_", "Cnt", "lr", "Qui", "ck", "Books", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ticket_", "=_", "request_", "._", "query_", "._", "ticket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media_", "=_", "request_", "._", "query_", "._", "media_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "Requeste", "d_", "=_", "request_", "._", "query_", "._", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "Cnt", "lr", "Qui", "ck", "Books", "_", "._", "qb", "Request", "Status_", "._", "get_", "(_", "ticket_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "html", "Body_", "(_", "table", "Rows_", "(_", "[_", "\\u_", "(_", "\"", "Qui", "ck", "Books", " ", "tick", "et", " ", "not", " ", "found", ",", " ", "request", " ", "cancel", "ed", ".\"_", ")_", "]_", ",_", "header_", "=_", "\\u_", "(_", "\"", "Qui", "ck", "books", " ", "Request", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status_", "._", "startswith_", "(_", "\"", "Connect", "ion", "Error", "Messag", "e", ":", " ", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cnt", "lr", "Qui", "ck", "Books", "_", "._", "qb", "Request", "Status_", "._", "pop_", "(_", "ticket_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "error", "Report_", "(_", "[_", "status_", "[_", "24_", ":_", "]_", "]_", ",_", "media_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status_", "!=_", "\"", "Don", "e", "\"_", "or_", "ticket_", "not_", "in_", "Cnt", "lr", "Qui", "ck", "Books", "_", "._", "xbr", "l", "Instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "html", "Body_", "(_", "table", "Rows_", "(_", "[_", "\\u_", "(_", "\"{", "0", "},", " ", "Wait", "ing", " ", "20", " ", "second", "s", "...\"_", ")_", "._", "format_", "(_", "status_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "=_", "\\u_", "(_", "\"", "Qui", "ck", "books", " ", "Request", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "script_", "=_", "'''", "\\", "10", ";<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">", "\\", "10", ";<", "!-", "-", " ", "\\", "10", ";", "var", " ", "timer", " ", "=", " ", "set", "Interv", "al", "(\"", "auto", "Refr", "esh", "()\"", ",", " ", "1000", " ", "*", " ", "20", ");", "\\", "10", ";", "function", " ", "auto", "Refr", "esh", "()", "{{", "clear", "Interv", "al", "(", "timer", ");", "self", ".", "location", ".", "relo", "ad", "(", "true", ");", "}}\\", "10", ";", "//", "-->", " ", "\\", "10", ";<", "/", "script", ">", "\\", "10", ";'", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cnt", "lr", "Qui", "ck", "Books", "_", "._", "qb", "Request", "Status_", "._", "pop_", "(_", "ticket_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "Uuid_", "=_", "Cnt", "lr", "Qui", "ck", "Books", "_", "._", "xbr", "l", "Instances_", "[_", "ticket_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cnt", "lr", "Qui", "ck", "Books", "_", "._", "xbr", "l", "Instances_", "._", "pop_", "(_", "ticket_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "\"", "entrypoint", "File", "\"_", ",_", "instance", "Uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "File_", "=_", "File", "Name", "d", "String", "IO_", "(_", "media_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "options_", ",_", "\"", "fact", "s", "File", "\"_", ",_", "view", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "run", "Optio", "ns", "And", "Get", "Result_", "(_", "options_", ",_", "media_", ",_", "view", "File_", ")_", "\\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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
danirus/django-wysihtml5/wysihtml5/tests/widgets.py
[ { "content": "#-*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom bs4 import BeautifulSoup, NavigableString\n\nfrom django.forms.models import modelform_factory\nfrom django.test import TestCase as DjangoTestCase\nfrom django.utils.html import conditional_escape\n\nfrom wysihtml5.tests.models import ModelTest\nfrom wysihtml5.widgets import (Wysihtml5TextareaWidget,\n render_cmd_icon, render_cmd_dialog)\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Wysihtml5ToolbarTestCase(DjangoTestCase):\n\n", "metadata": "root.Wysihtml5ToolbarTestCase", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def setUp(self):\n ModelForm = modelform_factory(ModelTest)\n # self.soup = BeautifulSoup(unicode(ModelForm()))\n self.soup = BeautifulSoup(ModelForm().__str__())", "metadata": "root.Wysihtml5ToolbarTestCase.setUp", "header": "['class', 'Wysihtml5ToolbarTestCase', '(', 'DjangoTestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_command_disabled_in_settings(self): \n # check an active command and the disabled one\n cmd_format_block = self.soup.find('span', attrs={\n 'data-wysihtml5-command-group': 'formatBlock'})\n cmd_fore_color = self.soup.find('span', attrs={\n 'data-wysihtml5-command-group': 'foreColor'})\n self.assert_(cmd_format_block != None)\n self.assert_(cmd_fore_color == None) # tests.settings disabled", "metadata": "root.Wysihtml5ToolbarTestCase.test_command_disabled_in_settings", "header": "['class', 'Wysihtml5ToolbarTestCase', '(', 'DjangoTestCase', ')', ':', '___EOS___']", "index": 20 }, { "content": " def test_dialog_disabled_in_settings(self): \n # check the active dialog and the disabled one\n dialog_insert_image = self.soup.find('div', attrs={\n 'data-wysihtml5-dialog': 'insertImage'})\n dialog_create_link = self.soup.find('span', attrs={\n 'data-wysihtml5-dialog': 'createLink'})\n self.assert_(dialog_insert_image != None)\n self.assert_(dialog_create_link == None) # tests.settings disabled", "metadata": "root.Wysihtml5ToolbarTestCase.test_dialog_disabled_in_settings", "header": "['class', 'Wysihtml5ToolbarTestCase', '(', 'DjangoTestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": "class Wysihtml5TextareaWidgetTestCase(DjangoTestCase):", "metadata": "root.Wysihtml5TextareaWidgetTestCase", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def test_render_wysihtml5admintextarea_widget(self):\n neilmsg = ModelTest.objects.create(\n first_text=\"One small step for man\", \n second_text=\"One giant leap for mankind\")\n w = Wysihtml5TextareaWidget()\n rendered = conditional_escape(w.render(\"test\", neilmsg.second_text))\n expected = '\\\n<div style=\"display:inline-block\"><div id=\"unknown-toolbar\" class=\"wysihtml5-editor-toolbar\">\\\n <div class=\"commands\">\\\n <span data-wysihtml5-command-group=\"formatBlock\" title=\"Format text header\" class=\"heading-selector\">\\\n <div>\\\n <span data-wysihtml5-command=\"formatBlock\" data-wysihtml5-command-value=\"h1\">H1</span>\\\n <span data-wysihtml5-command=\"formatBlock\" data-wysihtml5-command-value=\"h2\">H2</span>\\\n <span data-wysihtml5-command=\"formatBlock\" data-wysihtml5-command-value=\"h3\">H3</span>\\\n <span data-wysihtml5-command=\"formatBlock\" data-wysihtml5-command-value=\"h4\">H4</span>\\\n <span data-wysihtml5-command=\"formatBlock\" data-wysihtml5-command-value=\"h5\">H5</span>\\\n <span data-wysihtml5-command=\"formatBlock\" data-wysihtml5-command-value=\"h6\">H6</span>\\\n </div>\\\n </span>\\\n <span data-wysihtml5-command=\"formatBlock\" title=\"Make a paragraph block\" data-wysihtml5-command-value=\"p\" class=\"command format-block-p\"></span>\\\n <span data-wysihtml5-command=\"bold\" title=\"Make text bold (CTRL + B)\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"italic\" title=\"Make text italic (CTRL + I)\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"underline\" title=\"Underline text (CTRL + U)\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"justifyLeft\" title=\"Paragraph left justified\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"justifyCenter\" title=\"Paragraph center justified\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"justifyRight\" title=\"Paragraph right justified\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"insertOrderedList\" title=\"Insert an ordered list\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"insertUnorderedList\" title=\"Insert an unordered list\" class=\"command\"></span>\\\n <span data-wysihtml5-command=\"insertImage\" title=\"Insert an image\" class=\"command insert-image\"></span>\\\n <span data-wysihtml5-command=\"insertHTML\" title=\"Insert a quote\" class=\"command\" data-wysihtml5-command-value=\"<blockquote>quote</blockquote>\"></span>\\\n <span data-wysihtml5-action=\"change_view\" title=\"Show HTML\" class=\"action\" unselectable=\"on\"></span>\\\n </div>\\\n <div class=\"wysihtml5-dialogs\">\\\n <div data-wysihtml5-dialog=\"insertImage\" style=\"display:none\"> <label>Image:</label>&nbsp; <input data-wysihtml5-dialog-field=\"src\" value=\"http://\"> <a data-wysihtml5-dialog-action=\"save\" class=\"button\">Ok</a>&nbsp; <a data-wysihtml5-dialog-action=\"cancel\" class=\"button\">Cancel</a></div> </div></div><textarea rows=\"25\" cols=\"40\" name=\"test\" class=\"vLargeTextField\">One giant leap for mankind</textarea></div>\\\n<script>\\\nnew wysihtml5.Editor(\"unknown\",{ name: null, style: true, toolbar: \"unknown-toolbar\", autoLink: true, parserRules: wysihtml5ParserRules, parser: wysihtml5.dom.parse || Prototype.K, composerClassName: \"wysihtml5-editor\", bodyClassName: \"wysihtml5-supported\", useLineBreaks: true, stylesheets: [\"/static/wysihtml5/css/stylesheet.css\"], placeholderText: null, allowObjectResizing: true, supportTouchDevices: true });\\\n</script>'\n self.maxDiff = None\n self.assertHTMLEqual(expected, rendered)", "metadata": "root.Wysihtml5TextareaWidgetTestCase.test_render_wysihtml5admintextarea_widget", "header": "['class', 'Wysihtml5TextareaWidgetTestCase', '(', 'DjangoTestCase', ')', ':', '___EOS___']", "index": 40 } ]
[ { "span": "from bs4 import BeautifulSoup, NavigableString", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 46 }, { "span": "from wysihtml5.widgets import (Wysihtml5TextareaWidget,\n render_cmd_icon, render_cmd_dialog)", "start_line": 10, "start_column": 0, "end_line": 11, "end_column": 66 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bs4_", "import_", "Bea", "uti", "ful", "Soup_", ",_", "Nav", "iga", "ble", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "models_", "import_", "modelf", "orm", "\\u", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "as_", "Dj", "ang", "o", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "html_", "import_", "conditional", "\\u", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wy", "si", "html", "5_", "._", "tests_", "._", "models_", "import_", "Model", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wy", "si", "html", "5_", "._", "widgets_", "import_", "(_", "Wy", "si", "html", "5", "Text", "area", "Widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "render", "\\u", "cmd", "\\u", "icon_", ",_", "render", "\\u", "cmd", "\\u", "dialog_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Wy", "si", "html", "5", "Toolb", "ar", "Test", "Case_", "(_", "Dj", "ang", "o", "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_", "[SEP]_", "class_", "Wy", "si", "html", "5", "Toolb", "ar", "Test", "Case_", "(_", "Dj", "ang", "o", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Model", "Form_", "=_", "modelf", "orm", "\\u", "factory_", "(_", "Model", "Test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "soup", " ", "=", " ", "Bea", "uti", "ful", "Sou", "p", "(", "unicode", "(", "Model", "Form", "())", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "soup_", "=_", "Bea", "uti", "ful", "Soup_", "(_", "Model", "Form_", "(_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wy", "si", "html", "5", "Toolb", "ar", "Test", "Case_", "(_", "Dj", "ang", "o", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "command", "\\u", "disable", "d\\u", "in", "\\u", "settings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "an", " ", "active", " ", "command", " ", "and", " ", "the", " ", "disable", "d", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "format\\u", "block_", "=_", "self_", "._", "soup_", "._", "find_", "(_", "'", "span", "'_", ",_", "attrs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "group", "'_", ":_", "'", "format", "Block", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "fore", "\\u", "color_", "=_", "self_", "._", "soup_", "._", "find_", "(_", "'", "span", "'_", ",_", "attrs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "group", "'_", ":_", "'", "fore", "Color", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "cmd", "\\u", "format\\u", "block_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "cmd", "\\u", "fore", "\\u", "color_", "==_", "None_", ")_", "#", " ", "tests", ".", "settings", " ", "disabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wy", "si", "html", "5", "Toolb", "ar", "Test", "Case_", "(_", "Dj", "ang", "o", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dialog", "\\u", "disable", "d\\u", "in", "\\u", "settings_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "the", " ", "active", " ", "dialog", " ", "and", " ", "the", " ", "disable", "d", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dialog", "\\u", "insert", "\\u", "image_", "=_", "self_", "._", "soup_", "._", "find_", "(_", "'", "div", "'_", ",_", "attrs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "-", "wy", "si", "html", "5", "-", "dialog", "'_", ":_", "'", "insert", "Image", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dialog", "\\u", "create", "\\u", "link_", "=_", "self_", "._", "soup_", "._", "find_", "(_", "'", "span", "'_", ",_", "attrs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "-", "wy", "si", "html", "5", "-", "dialog", "'_", ":_", "'", "create", "Link", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "dialog", "\\u", "insert", "\\u", "image_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "dialog", "\\u", "create", "\\u", "link_", "==_", "None_", ")_", "#", " ", "tests", ".", "settings", " ", "disabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Wy", "si", "html", "5", "Text", "area", "Wid", "get", "Test", "Case_", "(_", "Dj", "ang", "o", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wy", "si", "html", "5", "Text", "area", "Wid", "get", "Test", "Case_", "(_", "Dj", "ang", "o", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "render", "\\u", "wy", "si", "html", "5a", "dmin", "text", "area", "\\u", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nei", "lm", "sg_", "=_", "Model", "Test_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "first", "\\u", "text_", "=_", "\"", "One", " ", "small", " ", "step", " ", "for", " ", "man", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "second", "\\u", "text_", "=_", "\"", "One", " ", "gian", "t", " ", "leap", " ", "for", " ", "man", "kind", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "Wy", "si", "html", "5", "Text", "area", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rendered_", "=_", "conditional", "\\u", "escape_", "(_", "w_", "._", "render_", "(_", "\"", "test", "\"_", ",_", "nei", "lm", "sg_", "._", "second", "\\u", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "'\\\\", "\\", "10", ";<", "div", " ", "style", "=\"", "display", ":", "inline", "-", "block", "\">", "<", "div", " ", "id", "=\"", "unknown", "-", "toolb", "ar", "\"", " ", "class", "=\"", "wy", "si", "html", "5", "-", "editor", "-", "toolb", "ar", "\">", "\\\\", "\\", "10", ";", " ", " ", "<", "div", " ", "class", "=\"", "command", "s", "\">", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "group", "=\"", "format", "Block", "\"", " ", "title", "=\"", "Format", " ", "text", " ", "header", "\"", " ", "class", "=\"", "heading", "-", "select", "or", "\">", "\\\\", "\\", "10", ";", " ", " ", "<", "div", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "format", "Block", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "h1", "\">", "H1", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "format", "Block", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "h2", "\">", "H2", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "format", "Block", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "h", "3", "\">", "H", "3", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "format", "Block", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "h", "4", "\">", "H", "4", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "format", "Block", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "h5", "\">", "H", "5", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "format", "Block", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "h", "6", "\">", "H", "6", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", "</", "div", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "format", "Block", "\"", " ", "title", "=\"", "Make", " ", "a", " ", "paragraph", " ", "block", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "p", "\"", " ", "class", "=\"", "command", " ", "format", "-", "block", "-", "p", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "bold", "\"", " ", "title", "=\"", "Make", " ", "text", " ", "bold", " ", "(", "CTR", "L", " ", "+", " ", "B", ")\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "italic", "\"", " ", "title", "=\"", "Make", " ", "text", " ", "italic", " ", "(", "CTR", "L", " ", "+", " ", "I", ")\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "underl", "ine", "\"", " ", "title", "=\"", "Underl", "ine", " ", "text", " ", "(", "CTR", "L", " ", "+", " ", "U", ")\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "justif", "y", "Le", "ft", "\"", " ", "title", "=\"", "Para", "graph", " ", "left", " ", "justif", "ied", "\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "justif", "y", "Center", "\"", " ", "title", "=\"", "Para", "graph", " ", "center", " ", "justif", "ied", "\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "justif", "y", "Rig", "ht", "\"", " ", "title", "=\"", "Para", "graph", " ", "right", " ", "justif", "ied", "\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "insert", "Order", "ed", "List", "\"", " ", "title", "=\"", "Insert", " ", "an", " ", "order", "ed", " ", "list", "\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "insert", "Uno", "rder", "ed", "List", "\"", " ", "title", "=\"", "Insert", " ", "an", " ", "unordered", " ", "list", "\"", " ", "class", "=\"", "command", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "insert", "Image", "\"", " ", "title", "=\"", "Insert", " ", "an", " ", "image", "\"", " ", "class", "=\"", "command", " ", "insert", "-", "image", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "=\"", "insert", "HTM", "L", "\"", " ", "title", "=\"", "Insert", " ", "a", " ", "quote", "\"", " ", "class", "=\"", "command", "\"", " ", "data", "-", "wy", "si", "html", "5", "-", "command", "-", "value", "=\"", "<", "block", "quote", ">", "quote", "</", "block", "quote", ">\"", "><", "/", "span", ">\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "data", "-", "wy", "si", "html", "5", "-", "action", "=\"", "change", "\\u", "view", "\"", " ", "title", "=\"", "Show", " ", "HTM", "L", "\"", " ", "class", "=\"", "action", "\"", " ", "unselect", "able", "=\"", "on", "\">", "</", "span", ">\\\\", "\\", "10", ";", " ", " ", "</", "div", ">\\\\", "\\", "10", ";", " ", " ", "<", "div", " ", "class", "=\"", "wy", "si", "html", "5", "-", "dialog", "s", "\">", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "<", "div", " ", "data", "-", "wy", "si", "html", "5", "-", "dialog", "=\"", "insert", "Image", "\"", " ", "style", "=\"", "display", ":", "none", "\">", " ", " ", "<", "label", ">", "Image", ":", "</", "label", ">", "&", "nb", "sp", ";", " ", " ", "<", "input", " ", "data", "-", "wy", "si", "html", "5", "-", "dialog", "-", "field", "=\"", "src", "\"", " ", "value", "=\"", "http", "://", "\">", " ", " ", "<", "a", " ", "data", "-", "wy", "si", "html", "5", "-", "dialog", "-", "action", "=\"", "save", "\"", " ", "class", "=\"", "button", "\">", "Ok", "</", "a", ">", "&", "nb", "sp", ";", " ", " ", "<", "a", " ", "data", "-", "wy", "si", "html", "5", "-", "dialog", "-", "action", "=\"", "cancel", "\"", " ", "class", "=\"", "button", "\">", "Cancel", "</", "a", "><", "/", "div", ">", " ", " ", "</", "div", "><", "/", "div", "><", "text", "area", " ", "rows", "=\"", "25", "\"", " ", "cols", "=\"", "40", "\"", " ", "name", "=\"", "test", "\"", " ", "class", "=\"", "v", "Large", "Text", "Field", "\">", "One", " ", "gian", "t", " ", "leap", " ", "for", " ", "man", "kind", "</", "text", "area", "><", "/", "div", ">\\\\", "\\", "10", ";<", "script", ">\\\\", "\\", "10", ";", "new", " ", "wy", "si", "html", "5", ".", "Edit", "or", "(\"", "unknown", "\",", "{", " ", "name", ":", " ", "null", ",", " ", "style", ":", " ", "true", ",", " ", "toolb", "ar", ":", " ", "\"", "unknown", "-", "toolb", "ar", "\",", " ", "auto", "Link", ":", " ", "true", ",", " ", "parser", "Rule", "s", ":", " ", "wy", "si", "html", "5", "Parser", "Rule", "s", ",", " ", "parser", ":", " ", "wy", "si", "html", "5", ".", "dom", ".", "parse", " ", "||", " ", "Prototype", ".", "K", ",", " ", "composer", "Class", "Name", ":", " ", "\"", "wy", "si", "html", "5", "-", "editor", "\",", " ", "body", "Class", "Name", ":", " ", "\"", "wy", "si", "html", "5", "-", "support", "ed", "\",", " ", "use", "Line", "Break", "s", ":", " ", "true", ",", " ", "stylesheet", "s", ":", " ", "[\"", "/", "static", "/", "wy", "si", "html", "5", "/", "css", "/", "stylesheet", ".", "css", "\"]", ",", " ", "placehold", "er", "Text", ":", " ", "null", ",", " ", "allow", "Object", "Res", "izi", "ng", ":", " ", "true", ",", " ", "support", "Tou", "ch", "Dev", "ices", ":", " ", "true", " ", "})", ";\\\\", "\\", "10", ";<", "/", "script", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "HTM", "LE", "qual_", "(_", "expected_", ",_", "rendered_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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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 ]
Comparison of constants
skyostil/tracy/src/generator/Cheetah/ImportManager.py
[ { "content": "#!/usr/bin/env python\n# $Id: ImportManager.py,v 1.1 2006-09-06 09:50:08 skyostil Exp $\n\n\"\"\"Provides an emulator/replacement for Python's standard import system.\n\n@@TR: Be warned that Import Hooks are in the deepest, darkest corner of Python's\njungle. If you need to start hacking with this, be prepared to get lost for a\nwhile. Also note, this module predates the newstyle import hooks in Python 2.3\nhttp://www.python.org/peps/pep-0302.html. \n\n\nThis is a hacked/documented version of Gordon McMillan's iu.py. I have:\n\n - made it a little less terse\n\n - added docstrings and explanatations\n\n - standardized the variable naming scheme\n\n - reorganized the code layout to enhance readability\n\nMeta-Data\n================================================================================\nAuthor: Tavis Rudd <[email protected]> based on Gordon McMillan's iu.py\nLicense: This software is released for unlimited distribution under the\n terms of the MIT license. See the LICENSE file.\nVersion: $Revision: 1.1 $\nStart Date: 2001/03/30\nLast Revision Date: $Date: 2006-09-06 09:50:08 $\n\"\"\" \n__author__ = \"Tavis Rudd <[email protected]>\"\n__revision__ = \"$Revision: 1.1 $\"[11:-2]\n\n##################################################\n## DEPENDENCIES\n\nimport sys\nimport imp\nimport marshal\n\n##################################################\n## CONSTANTS & GLOBALS\n\ntry:\n True,False\nexcept NameError:\n True, False = (1==1),(1==0)\n\n_installed = False\n\nSTRINGTYPE = type('')\n\n# _globalOwnerTypes is defined at the bottom of this file\n\n_os_stat = _os_path_join = _os_getcwd = _os_path_dirname = None\n\n##################################################\n## FUNCTIONS\n\n \n_os_bootstrap()\n\n\n\n\n\n\n##################################################\n## CLASSES\n\n \n\n\n\n\n\n\n \n\n#=================ImportManager============================#\n# The one-and-only ImportManager\n# ie, the builtin import\n\nUNTRIED = -1\n\n## print \"_release releasing lock!\"\n\n\n##################################################\n## MORE CONSTANTS & GLOBALS\n\n_globalOwnerTypes = [\n DirOwner,\n Owner,\n]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "1==1)", "start_line": 46, "start_column": 19, "end_line": 46, "end_column": 23 }, { "span": "1==0)", "start_line": 46, "start_column": 26, "end_line": 46, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "Id", ":", " ", "Import", "Manager", ".", "py", ",", "v", " ", "1.1", " ", "2006", "-0", "9", "-0", "6", " ", "09", ":", "50", ":", "0", "8", " ", "sky", "ost", "il", " ", "Exp", " ", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Prov", "ides", " ", "an", " ", "emulator", "/", "replace", "ment", " ", "for", " ", "Pyth", "on", "'", "s", " ", "standard", " ", "import", " ", "system", ".", "\\", "10", ";", "\\", "10", ";", "@@", "TR", ":", " ", "Be", " ", "warn", "ed", " ", "tha", "t", " ", "Import", " ", "Hook", "s", " ", "are", " ", "in", " ", "the", " ", "deep", "est", ",", " ", "dark", "est", " ", "corn", "er", " ", "of", " ", "Pyth", "on", "'", "s", "\\", "10", ";", "jun", "gle", ".", " ", " ", "If", " ", "you", " ", "need", " ", "to", " ", "start", " ", "hack", "ing", " ", "with", " ", "this", ",", " ", "be", " ", "prepared", " ", "to", " ", "get", " ", "lost", " ", "for", " ", "a", "\\", "10", ";", "whi", "le", ".", " ", "Al", "so", " ", "note", ",", " ", "this", " ", "module", " ", "pred", "ates", " ", "the", " ", "newst", "yle", " ", "import", " ", "hook", "s", " ", "in", " ", "Pyth", "on", " ", "2.3", "\\", "10", ";", "http", "://", "www", ".", "python", ".", "org", "/", "pep", "s", "/", "pep", "-0", "302", ".", "html", ".", " ", " ", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "is", " ", "a", " ", "hacke", "d", "/", "documente", "d", " ", "version", " ", "of", " ", "Go", "rdo", "n", " ", "Mc", "Mill", "an", "'", "s", " ", "iu", ".", "py", ".", " ", "I", " ", "have", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", "made", " ", "it", " ", "a", " ", "litt", "le", " ", "less", " ", "ters", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", "adde", "d", " ", "docstrings", " ", "and", " ", "expl", "anat", "ation", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", "standardize", "d", " ", "the", " ", "variab", "le", " ", "nami", "ng", " ", "sche", "me", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", "reo", "rga", "niz", "ed", " ", "the", " ", "code", " ", "layout", " ", "to", " ", "enhance", " ", "reada", "bilit", "y", "\\", "10", ";", "\\", "10", ";", "Meta", "-", "Data", "\\", "10", ";", "==============", "==============", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", "Author", ":", " ", "Ta", "vis", " ", "Ru", "dd", " ", "<", "tav", "is", "@", "dam", "nsi", "mple", ".", "com", ">", " ", " ", "based", " ", "on", " ", "Go", "rdo", "n", " ", "Mc", "Mill", "an", "'", "s", " ", "iu", ".", "py", "\\", "10", ";", "License", ":", " ", "Thi", "s", " ", "software", " ", "is", " ", "released", " ", "for", " ", "unlimited", " ", "distribu", "tion", " ", "under", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "term", "s", " ", "of", " ", "the", " ", "MIT", " ", "license", ".", " ", " ", "See", " ", "the", " ", "LICENSE", " ", "file", ".", "\\", "10", ";", "Version", ":", " ", "$", "Revi", "sion", ":", " ", "1.1", " ", "$", "\\", "10", ";", "Start", " ", "Date", ":", " ", "200", "1", "/", "03", "/", "30", "\\", "10", ";", "Las", "t", " ", "Revi", "sion", " ", "Date", ":", " ", "$", "Date", ":", " ", "2006", "-0", "9", "-0", "6", " ", "09", ":", "50", ":", "0", "8", " ", "$", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Ta", "vis", " ", "Ru", "dd", " ", "<", "tav", "is", "@", "dam", "nsi", "mple", ".", "com", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "revision\\u\\u_", "=_", "\"$", "Revi", "sion", ":", " ", "1.1", " ", "$\"_", "[_", "11_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "DEPENDEN", "CIE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "marshal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "CONSTANT", "S", " ", "&", " ", "GLOB", "ALS", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "True_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "True_", ",_", "False_", "=_", "(_", "1_", "==_", "1_", ")_", ",_", "(_", "1_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "installed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STRING", "TYPE_", "=_", "type_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "global", "Owne", "r", "Type", "s", " ", "is", " ", "defin", "ed", " ", "at", " ", "the", " ", "bottom", " ", "of", " ", "this", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "os", "\\u", "stat_", "=_", "\\u", "os", "\\u", "path", "\\u", "join_", "=_", "\\u", "os", "\\u", "getcwd_", "=_", "\\u", "os", "\\u", "path", "\\u", "dirname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "FUNCTIONS", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "os", "\\u", "bootstrap_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "##", " ", "CLASSES_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "==============", "===", "Import", "Manager", "==============", "==============", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "one", "-", "and", "-", "only", " ", "Import", "Manager_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ie", ",", " ", "the", " ", "bui", "lti", "n", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "UNT", "RIE", "D_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "print", " ", "\"\\u", "release", " ", "rele", "asin", "g", " ", "lock", "!\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "MOR", "E", " ", "CONSTANT", "S", " ", "&", " ", "GLOB", "ALS", "_", "\\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", "global", "Owne", "r", "Types_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Dir", "Owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Owner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Imprecise assert
marionmari/pyGPs/pyGPs/Testing/unit_test_model.py
[ { "content": " def checkRegressionOutput(self, model):\n nn,D = self.zr.shape\n self.assertTrue(model.ym.shape == (nn,1))\n self.assertTrue(model.ys2.shape == (nn,1))\n self.assertTrue(model.fm.shape == (nn,1))\n self.assertTrue(model.fs2.shape == (nn,1))", "metadata": "root.ModelTests.checkRegressionOutput", "header": "['class', 'ModelTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# note!!', '___NL___', '# due to completely random data(which may not make sense for gp in some cases),', '___NL___', '# it will rasis error sometimes(failed too much times in multiple-start optimizations)', '___NL___', '# therefore we construct toy data reasonably as memtioned in GPML book', '___NL___', '___EOS___']", "index": 42 }, { "content": " def checkClassificationOutput(self, model):\n nn,D = self.zc.shape\n self.assertTrue(model.ym.shape == (nn,1))\n self.assertTrue(model.ys2.shape == (nn,1))\n self.assertTrue(model.fm.shape == (nn,1))\n self.assertTrue(model.fs2.shape == (nn,1))", "metadata": "root.ModelTests.checkClassificationOutput", "header": "['class', 'ModelTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# note!!', '___NL___', '# due to completely random data(which may not make sense for gp in some cases),', '___NL___', '# it will rasis error sometimes(failed too much times in multiple-start optimizations)', '___NL___', '# therefore we construct toy data reasonably as memtioned in GPML book', '___NL___', '___EOS___']", "index": 50 } ]
[ { "span": "self.assertTrue(model.ym.shape == (nn,1))", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 49 }, { "span": "self.assertTrue(model.ys2.shape == (nn,1))", "start_line": 45, "start_column": 8, "end_line": 45, "end_column": 50 }, { "span": "self.assertTrue(model.fm.shape == (nn,1))", "start_line": 46, "start_column": 8, "end_line": 46, "end_column": 49 }, { "span": "self.assertTrue(model.fs2.shape == (nn,1))", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 50 }, { "span": "self.assertTrue(model.ym.shape == (nn,1))", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 49 }, { "span": "self.assertTrue(model.ys2.shape == (nn,1))", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 50 }, { "span": "self.assertTrue(model.fm.shape == (nn,1))", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 49 }, { "span": "self.assertTrue(model.fs2.shape == (nn,1))", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 50 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Model", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", "!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "due", " ", "to", " ", "complete", "ly", " ", "random", " ", "data", "(", "whi", "ch", " ", "may", " ", "not", " ", "make", " ", "sense", " ", "for", " ", "gp", " ", "in", " ", "some", " ", "case", "s", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "will", " ", "ras", "is", " ", "error", " ", "somet", "imes", "(", "fail", "ed", " ", "too", " ", "muc", "h", " ", "times", " ", "in", " ", "multiple", "-", "start", " ", "optimization", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", "fore", " ", "we", " ", "construct", " ", "toy", " ", "data", " ", "reason", "abl", "y", " ", "as", " ", "mem", "tion", "ed", " ", "in", " ", "GP", "ML", " ", "book_", "\\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_", "check", "Regr", "ession", "Output_", "(_", "self_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nn_", ",_", "D_", "=_", "self_", "._", "zr", "_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "ym_", "._", "shape_", "==_", "(_", "nn_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "ys", "2_", "._", "shape_", "==_", "(_", "nn_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "fm_", "._", "shape_", "==_", "(_", "nn_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "fs", "2_", "._", "shape_", "==_", "(_", "nn_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "note", "!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "due", " ", "to", " ", "complete", "ly", " ", "random", " ", "data", "(", "whi", "ch", " ", "may", " ", "not", " ", "make", " ", "sense", " ", "for", " ", "gp", " ", "in", " ", "some", " ", "case", "s", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "will", " ", "ras", "is", " ", "error", " ", "somet", "imes", "(", "fail", "ed", " ", "too", " ", "muc", "h", " ", "times", " ", "in", " ", "multiple", "-", "start", " ", "optimization", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", "fore", " ", "we", " ", "construct", " ", "toy", " ", "data", " ", "reason", "abl", "y", " ", "as", " ", "mem", "tion", "ed", " ", "in", " ", "GP", "ML", " ", "book_", "\\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_", "check", "Classificat", "ion", "Output_", "(_", "self_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nn_", ",_", "D_", "=_", "self_", "._", "zc", "_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "ym_", "._", "shape_", "==_", "(_", "nn_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "ys", "2_", "._", "shape_", "==_", "(_", "nn_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "fm_", "._", "shape_", "==_", "(_", "nn_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "model_", "._", "fs", "2_", "._", "shape_", "==_", "(_", "nn_", ",_", "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, 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, 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